shish 2 лет назад
Родитель
Сommit
e2ff2a67b4
2 измененных файлов с 24 добавлено и 11 удалено
  1. 7 0
      pt/src/service/cp-class/index.js
  2. 17 11
      pt/src/views/cp/list.vue

+ 7 - 0
pt/src/service/cp-class/index.js

@@ -2,5 +2,12 @@ import { BaseService, Service } from '@/cool';
 @Service('cp-class')
 export class CpService extends BaseService {
 
+	getMenu(data) {
+		return this.request({
+			url: '/get-menu',
+			params: data
+		});
+	}
+
 }
 export default new CpService();

+ 17 - 11
pt/src/views/cp/list.vue

@@ -43,8 +43,8 @@
 			</template>
 
 			<template #slot-cp-class="{scope}">
-				<el-select size="mini" v-model="getCpClass" placeholder="请选分类" style="width:150px;margin-right:10px;">
-					<el-option v-for="item in cpClassData" :key="item.value" :label="item.label" :value="item.value"> </el-option>
+				<el-select size="mini" v-model="currentCpClassId" placeholder="请选分类" style="width:150px;margin-right:10px;" @change="getCpClass">
+					<el-option v-for="item in cpClassData" :key="item.value" :label="item.name" :value="item.id"> </el-option>
 				</el-select>				
 			</template>
 
@@ -87,7 +87,7 @@ export default {
 				value: '选项5',
 				label: '北京烤鸭'
 			}],
-			getCpClass: '',
+			currentCpClassId:'',
 			app: null,
 			sortLink: '',
 			operateData: {},
@@ -112,9 +112,13 @@ export default {
 	},
 	computed: {},
 	methods: {
+		getCpClass(e){
+			this.currentCpClassId = e
+			this.app.refresh({classStyle:this.classStyle,classId:this.currentCpClassId})
+		},
     	changeClassify(e){
 			this.classStyle = e
-			this.app.refresh({ classStyle:this.classStyle })
+			this.app.refresh({ classStyle:this.classStyle,classId:this.currentCpClassId })
 		},
 		cancelDel(id) {
 			this.$refs[`popover-` + id].doClose();
@@ -123,7 +127,7 @@ export default {
 			this.$service.itemCatRelate.delRelate({ itemId: item.id }).then(res => {
 				this.$message.success('删除成功');
 				this.$refs[`popover-` + item.id].doClose();
-				this.app.refresh({ classStyle:this.classStyle })
+				this.app.refresh({ classStyle:this.classStyle,classId:this.currentCpClassId })
 			});
 		},
 		onLoad({ ctx, app }) {
@@ -202,7 +206,7 @@ export default {
 				})
 				.set('dict', {
 					search: {
-					keyWord: 'name'
+					keyWord: 'search'
 					}
 				})
 				.set('search', {
@@ -215,10 +219,12 @@ export default {
 					['flex1', 'pagination'],
 				])
 				.done();
-				app.refresh({ classStyle:this.classStyle })
-		},
-		exeRefresh(params) {
-			this.app.refresh(params);
+				app.refresh({ classStyle:this.classStyle,classId:this.currentCpClassId })
+
+				this.$service.cpClass.getMenu().then(res=>{
+					this.cpClassData = res.list ? res.list : []
+				})
+
 		},
 		showSort(e) {
 			this.sort.status = true;
@@ -231,7 +237,7 @@ export default {
 			this.$service.goods .sort({ inTurn: d.inTurn, id: d.id, })
 				.then(() => {
 					this.$message.success('修改成功')
-					this.exeRefresh({classStyle:this.classStyle})
+					this.app.refresh({classStyle:this.classStyle,classId:this.currentCpClassId})
 				})
 				.catch((err) => {
 					this.$message.error(err)