|
@@ -1,87 +1,83 @@
|
|
<template>
|
|
<template>
|
|
- <div class="divBox">
|
|
|
|
- <el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }">
|
|
|
|
|
|
+ <div class="divBox relative">
|
|
|
|
+ <el-card
|
|
|
|
+ v-hasPermi="['platform:product:whattodayeatTag:list']"
|
|
|
|
+ :bordered="false"
|
|
|
|
+ shadow="never"
|
|
|
|
+ class="ivu-mt"
|
|
|
|
+ :body-style="{ padding: 0 }"
|
|
|
|
+ >
|
|
<div class="padding-add">
|
|
<div class="padding-add">
|
|
- <el-form inline label-position="right" @submit.native.prevent>
|
|
|
|
|
|
+ <el-form :inline="true" @submit.native.prevent>
|
|
<el-form-item label="标签名称:">
|
|
<el-form-item label="标签名称:">
|
|
<el-input
|
|
<el-input
|
|
v-model.trim="keywords"
|
|
v-model.trim="keywords"
|
|
- @keyup.enter.native="handleSearch"
|
|
|
|
|
|
+ @keyup.enter.native="getList(1)"
|
|
|
|
+ placeholder="请输入标签名称"
|
|
|
|
+ class="selWidth"
|
|
size="small"
|
|
size="small"
|
|
clearable
|
|
clearable
|
|
- class="selWidth"
|
|
|
|
- placeholder="请输入标签名称"
|
|
|
|
- ></el-input>
|
|
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="显示状态:">
|
|
|
|
+ <el-select v-model="tableFrom.isShow" placeholder="请选择显示状态" size="small" class="selWidth" clearable>
|
|
|
|
+ <el-option label="显示" value="1"></el-option>
|
|
|
|
+ <el-option label="隐藏" value="0"></el-option>
|
|
|
|
+ </el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button size="small" type="primary" @click="handleSearch">搜索</el-button>
|
|
|
|
|
|
+ <el-button type="primary" size="small" @click="getList(1)">查询</el-button>
|
|
|
|
+ <el-button size="small" @click="reset()">重置</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</el-card>
|
|
- <el-card class="box-card mt14" shadow="never" :bordered="false">
|
|
|
|
- <div class="container">
|
|
|
|
- <router-link
|
|
|
|
- :to="{ path: '/product/whattodayeatTag/creatTag' }"
|
|
|
|
|
|
+ <el-card class="box-card mt14" :body-style="{ padding: '20px' }" :bordered="false" shadow="never">
|
|
|
|
+ <div class="acea-row">
|
|
|
|
+ <el-button
|
|
|
|
+ type="primary"
|
|
|
|
+ size="small"
|
|
|
|
+ v-hasPermi="['platform:product:whattodayeatTag:save']"
|
|
|
|
+ @click="handlerOpenEdit(0)"
|
|
|
|
+ >添加标签</el-button
|
|
>
|
|
>
|
|
- <el-button size="small" type="primary" class="mr10">添加标签</el-button>
|
|
|
|
- </router-link>
|
|
|
|
</div>
|
|
</div>
|
|
- <el-table
|
|
|
|
- v-loading="tableConfig.listLoading"
|
|
|
|
- :data="tableData.data"
|
|
|
|
- size="small"
|
|
|
|
- row-key="tag_id"
|
|
|
|
- :default-expand-all="false"
|
|
|
|
- :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
|
- class="mt20"
|
|
|
|
- >
|
|
|
|
- <el-table-column prop="id" label="ID" min-width="60" />
|
|
|
|
- <el-table-column
|
|
|
|
- label="标签名称"
|
|
|
|
- prop="tagName"
|
|
|
|
- min-width="140"
|
|
|
|
- :show-overflow-tooltip="true"
|
|
|
|
- />
|
|
|
|
- <el-table-column
|
|
|
|
- label="标签图片"
|
|
|
|
- prop="icon"
|
|
|
|
- :show-overflow-tooltip="true"
|
|
|
|
- >
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
|
|
+ <el-table v-loading="listLoading" :data="tableData.data" size="small" :highlight-current-row="true" class="mt20">
|
|
|
|
+ <el-table-column prop="id" label="ID" min-width="50" />
|
|
|
|
+ <el-table-column label="标签名称" prop="tagName" min-width="100" :show-overflow-tooltip="true"> </el-table-column>
|
|
|
|
+ <el-table-column label="标签图标" min-width="120">
|
|
|
|
+ <template slot-scope="scope">
|
|
<div class="demo-image__preview line-heightOne">
|
|
<div class="demo-image__preview line-heightOne">
|
|
<el-image :src="scope.row.icon" :preview-src-list="[scope.row.icon]" v-if="scope.row.icon" />
|
|
<el-image :src="scope.row.icon" :preview-src-list="[scope.row.icon]" v-if="scope.row.icon" />
|
|
<img v-else :src="defaultImg" alt="" />
|
|
<img v-else :src="defaultImg" alt="" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="sort" label="排序" min-width="100" />
|
|
|
|
+ <el-table-column label="添加时间" min-width="120">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span>{{ scope.row.createTime }}</span>
|
|
|
|
+ </template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column prop="status" label="是否显示" min-width="100" fixed="right">
|
|
|
|
|
|
+ <el-table-column label="是否开启" fixed="right" min-width="90">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-switch
|
|
|
|
|
|
+ <el-switch
|
|
|
|
+ v-if="checkPermi(['platform:product:whattodayeatTag:status'])"
|
|
v-model="scope.row.status"
|
|
v-model="scope.row.status"
|
|
:active-value="1"
|
|
:active-value="1"
|
|
:inactive-value="0"
|
|
:inactive-value="0"
|
|
- active-text="显示"
|
|
|
|
- inactive-text="隐藏"
|
|
|
|
- @change="onchangeIsShow(scope.row)"
|
|
|
|
|
|
+ active-text="开启"
|
|
|
|
+ inactive-text="关闭"
|
|
|
|
+ @click.native="onchangeIsShow(scope.row)"
|
|
/>
|
|
/>
|
|
- <!-- <div >{{ scope.row.status ? "显示" : "隐藏" }}</div> -->
|
|
|
|
|
|
+ <div v-else>{{ scope.row.isShow ? '开启' : '关闭' }}</div>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column prop="createTime" label="创建时间" min-width="150" />
|
|
|
|
- <el-table-column prop="sort" label="排序" min-width="80" />
|
|
|
|
<el-table-column label="操作" width="100" fixed="right">
|
|
<el-table-column label="操作" width="100" fixed="right">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <router-link
|
|
|
|
- :to="{ path: '/product/whattodayeatTag/creatTag/' + scope.row.id }"
|
|
|
|
- >
|
|
|
|
- <a>编辑</a>
|
|
|
|
- </router-link>
|
|
|
|
- <template
|
|
|
|
- >
|
|
|
|
- <el-divider direction="vertical"></el-divider>
|
|
|
|
- <a @click="handleDelete(scope.row.id, scope.$index)">删除</a>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <a @click="handlerOpenEdit(1, scope.row)" v-hasPermi="['platform:product:whattodayeatTag:update']">编辑</a>
|
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
|
+ <a @click="handlerOpenDel(scope.row)" v-hasPermi="['platform:product:whattodayeatTag:delete']">删除</a>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -100,125 +96,154 @@
|
|
</el-card>
|
|
</el-card>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
-
|
|
|
|
<script>
|
|
<script>
|
|
-// +----------------------------------------------------------------------
|
|
|
|
|
|
+// +---------------------------------------------------------------------
|
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
-// +----------------------------------------------------------------------
|
|
|
|
|
|
+// +---------------------------------------------------------------------
|
|
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
|
// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
|
|
-// +----------------------------------------------------------------------
|
|
|
|
|
|
+// +---------------------------------------------------------------------
|
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
-// +----------------------------------------------------------------------
|
|
|
|
|
|
+// +---------------------------------------------------------------------
|
|
// | Author: CRMEB Team <admin@crmeb.com>
|
|
// | Author: CRMEB Team <admin@crmeb.com>
|
|
-// +----------------------------------------------------------------------
|
|
|
|
|
|
+// +---------------------------------------------------------------------
|
|
import * as storeApi from "@/api/product.js";
|
|
import * as storeApi from "@/api/product.js";
|
|
-import { checkPermi } from "@/utils/permission";
|
|
|
|
|
|
+import { checkPermi } from '@/utils/permission'; // 权限判断函数
|
|
export default {
|
|
export default {
|
|
- name: "whattodayeatTag",
|
|
|
|
- components: {
|
|
|
|
- },
|
|
|
|
- computed: {},
|
|
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- defaultImg: require('@/assets/imgs/moren.jpg'),
|
|
|
|
- tableConfig: {
|
|
|
|
- listLoading: false,
|
|
|
|
- },
|
|
|
|
- tableData: {
|
|
|
|
- data: [],
|
|
|
|
- total: 0,
|
|
|
|
- },
|
|
|
|
tableFrom: {
|
|
tableFrom: {
|
|
page: 1,
|
|
page: 1,
|
|
limit: 20,
|
|
limit: 20,
|
|
keywords: "", // 搜索关键字
|
|
keywords: "", // 搜索关键字
|
|
|
|
+ isShow: '',
|
|
},
|
|
},
|
|
keywords: "",
|
|
keywords: "",
|
|
- editData: {},
|
|
|
|
- editDataDialogConfig: {
|
|
|
|
- visible: false,
|
|
|
|
|
|
+ tableData: {
|
|
|
|
+ data: [],
|
|
|
|
+ total: 0,
|
|
},
|
|
},
|
|
|
|
+ listLoading: false,
|
|
|
|
+ keyNum: 0,
|
|
|
|
+ id: 0,
|
|
|
|
+ defaultImg: require('@/assets/imgs/moren.jpg'),
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- if (checkPermi(["platform:product:tag:list"])) this.getList(1);
|
|
|
|
|
|
+ if (checkPermi(['platform:product:whattodayeatTag:list'])) this.getList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
checkPermi,
|
|
checkPermi,
|
|
- handleSearch() {
|
|
|
|
- this.getList(1);
|
|
|
|
- },
|
|
|
|
|
|
+ onchangeIsShow(row) {
|
|
|
|
+ storeApi
|
|
|
|
+ .whattodayeatTagStatusApi(row.id, row.status)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message.success("操作成功");
|
|
|
|
+ this.getList();
|
|
|
|
+ })
|
|
|
|
+ .catch((e) => {
|
|
|
|
+ return (row.status = !row.status);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
// 列表
|
|
// 列表
|
|
getList(num) {
|
|
getList(num) {
|
|
- this.tableFrom.keywords = this.keywords;
|
|
|
|
this.tableFrom.page = num ? num : this.tableFrom.page;
|
|
this.tableFrom.page = num ? num : this.tableFrom.page;
|
|
- this.tableConfig.listLoading = true;
|
|
|
|
|
|
+ this.tableFrom.keywords = encodeURIComponent(this.keywords);
|
|
|
|
+ this.listLoading = true;
|
|
storeApi
|
|
storeApi
|
|
.whattodayeatTagList(this.tableFrom)
|
|
.whattodayeatTagList(this.tableFrom)
|
|
.then((res) => {
|
|
.then((res) => {
|
|
this.tableData.data = res.list;
|
|
this.tableData.data = res.list;
|
|
this.tableData.total = res.total;
|
|
this.tableData.total = res.total;
|
|
- this.tableConfig.listLoading = false;
|
|
|
|
|
|
+ this.listLoading = false;
|
|
})
|
|
})
|
|
.catch((res) => {
|
|
.catch((res) => {
|
|
- this.tableConfig.listLoading = false;
|
|
|
|
- this.$message.error(res.message);
|
|
|
|
|
|
+ this.listLoading = false;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ reset() {
|
|
|
|
+ this.tableFrom.keywords = '';
|
|
|
|
+ this.tableFrom.isShow = '';
|
|
|
|
+ this.keywords = '';
|
|
|
|
+ this.getList(1);
|
|
|
|
+ },
|
|
pageChange(page) {
|
|
pageChange(page) {
|
|
this.tableFrom.page = page;
|
|
this.tableFrom.page = page;
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
handleSizeChange(val) {
|
|
handleSizeChange(val) {
|
|
this.tableFrom.limit = val;
|
|
this.tableFrom.limit = val;
|
|
- this.getList();
|
|
|
|
- },
|
|
|
|
- // 添加
|
|
|
|
- onAdd() {
|
|
|
|
- this.editData = {};
|
|
|
|
- this.editDataDialogConfig.visible = true;
|
|
|
|
|
|
+ this.getList(1);
|
|
},
|
|
},
|
|
- // 编辑
|
|
|
|
- onEdit(row) {
|
|
|
|
- this.editData = row;
|
|
|
|
- this.editDataDialogConfig.visible = true;
|
|
|
|
|
|
+ handlerOpenEdit(isCreate, editDate) {
|
|
|
|
+ console.log(editDate)
|
|
|
|
+ const _this = this;
|
|
|
|
+ this.id = editDate ? editDate.id : 0;
|
|
|
|
+ this.$modalParserFrom(
|
|
|
|
+ isCreate === 0 ? '新建标签' : '编辑标签',
|
|
|
|
+ 'whattodayeatTag',
|
|
|
|
+ isCreate,
|
|
|
|
+ isCreate === 0
|
|
|
|
+ ? {
|
|
|
|
+ id: 0,
|
|
|
|
+ tagName: '',
|
|
|
|
+ icon: '',
|
|
|
|
+ status: 0
|
|
|
|
+ }
|
|
|
|
+ : Object.assign({}, editDate),
|
|
|
|
+ function (formValue) {
|
|
|
|
+ _this.submit(formValue);
|
|
|
|
+ _this.resetForm(formValue);
|
|
|
|
+ },
|
|
|
|
+ (this.keyNum += 1),
|
|
|
|
+ );
|
|
},
|
|
},
|
|
- // 删除
|
|
|
|
- handleDelete(id, idx) {
|
|
|
|
- this.$modalSure("删除当前标签吗?").then(async () => {
|
|
|
|
- await storeApi.whattodayeatTagDelete(id);
|
|
|
|
- this.$message.success("删除成功");
|
|
|
|
- await this.getList();
|
|
|
|
- });
|
|
|
|
|
|
+ submit(formValue) {
|
|
|
|
+ const data = {
|
|
|
|
+ id: this.id,
|
|
|
|
+ tagName: formValue.tagName,
|
|
|
|
+ status: formValue.status,
|
|
|
|
+ sort: formValue.sort,
|
|
|
|
+ icon: formValue.icon,
|
|
|
|
+ };
|
|
|
|
+ this.id>0
|
|
|
|
+ ? storeApi
|
|
|
|
+ .whattodayeatTagUpdateApi(data)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message.success('操作成功');
|
|
|
|
+ this.$msgbox.close();
|
|
|
|
+ this.getList();
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ })
|
|
|
|
+ : storeApi
|
|
|
|
+ .whattodayeatTagAddApi(data)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ this.$message.success('操作成功');
|
|
|
|
+ this.$msgbox.close();
|
|
|
|
+ this.getList();
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- onchangeIsShow(row) {
|
|
|
|
- storeApi
|
|
|
|
- .whattodayeatTagStatusApi(row.id, row.status)
|
|
|
|
- .then((res) => {
|
|
|
|
- this.$message.success("操作成功");
|
|
|
|
|
|
+ handlerOpenDel(rowData) {
|
|
|
|
+ this.$modalSure(
|
|
|
|
+ '删除当前标签吗?删除之后,移动端页面分类筛选不展示此标签',
|
|
|
|
+ ).then(() => {
|
|
|
|
+ storeApi.whattodayeatTagDelete(rowData.id).then((data) => {
|
|
|
|
+ this.$message.success('删除分类成功');
|
|
|
|
+ if (this.tableData.data.length === 1 && this.tableFrom.page > 1)
|
|
|
|
+ this.tableFrom.page = this.tableFrom.page - 1;
|
|
this.getList();
|
|
this.getList();
|
|
- })
|
|
|
|
- .catch((e) => {
|
|
|
|
- return (row.status = !row.status);
|
|
|
|
});
|
|
});
|
|
- },
|
|
|
|
- handleOnEditDiaClosed() {
|
|
|
|
- this.editDataDialogConfig.visible = false;
|
|
|
|
- this.getList();
|
|
|
|
|
|
+ });
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
-
|
|
|
|
-<style scoped lang="scss">
|
|
|
|
-.infoBox {
|
|
|
|
- ::v-deep.el-drawer__header {
|
|
|
|
- margin-bottom: 0;
|
|
|
|
- font-size: 20px;
|
|
|
|
- }
|
|
|
|
- ::v-deep.el-icon-arrow-down,
|
|
|
|
- ::v-deep .el-icon-arrow-up {
|
|
|
|
- display: none;
|
|
|
|
- }
|
|
|
|
|
|
+<style>
|
|
|
|
+.alert_title {
|
|
|
|
+ margin-right: 10px;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|