Răsfoiți Sursa

设置产品

shish 2 ani în urmă
părinte
comite
cd3b1f55cc
1 a modificat fișierele cu 51 adăugiri și 10 ștergeri
  1. 51 10
      pt/src/views/item/list.vue

+ 51 - 10
pt/src/views/item/list.vue

@@ -64,14 +64,21 @@
 			</template>
 			</template>
 
 
 			<template #slot-more-do-btn>
 			<template #slot-more-do-btn>
-				<el-dropdown size="medium" split-button type="primary" @click="setCp" @command="doMore">
-				产品归类
+				<el-dropdown size="medium" split-button type="primary" @click="installCp" @command="doMore">
+				设置产品
 				<el-dropdown-menu slot="dropdown">
 				<el-dropdown-menu slot="dropdown">
-					<el-dropdown-item command="delItem">全部删除</el-dropdown-item>
+					<el-dropdown-item command="toAuth">全部认证</el-dropdown-item>
+					<el-dropdown-item command="delCpRelate">删除产品</el-dropdown-item>
 				</el-dropdown-menu>
 				</el-dropdown-menu>
 				</el-dropdown>
 				</el-dropdown>
 			</template>
 			</template>
 
 
+			<template #slot-select-cp="{scope}">
+				<el-select @change="searchSelectCp" v-model="selectCpName" filterable remote reserve-keyword placeholder="请搜索产品" :remote-method="searchCpInfo" :loading="loading" style="width:200px;margin-left:20px;" size="medium">
+    				<el-option v-for="item in cpInfoList" :key="item.id" :label="`${item.id} ${item.name}(${item.auth == 1 ?'认证':'未认证'})`" :value="item.id"> </el-option>
+  				</el-select>
+			</template>
+
 		</x-crud>
 		</x-crud>
 
 
 		<el-dialog :title="`${currentItemId == 0 ? '添加' : '修改'}花材`" :visible.sync="addDialog" :close-on-click-modal="false" width="600px" >
 		<el-dialog :title="`${currentItemId == 0 ? '添加' : '修改'}花材`" :visible.sync="addDialog" :close-on-click-modal="false" width="600px" >
@@ -171,6 +178,11 @@ export default {
 	components: {},
 	components: {},
 	data() {
 	data() {
 		return {
 		return {
+			selectCpId:0,
+			selectCpName:'',
+			cpInfoList: [],
+			list: [],
+			loading: false,
 			app: null,
 			app: null,
 			sortLink: '',
 			sortLink: '',
 			operateData: {},
 			operateData: {},
@@ -248,18 +260,47 @@ export default {
 	},
 	},
 	computed: {},
 	computed: {},
 	methods: {
 	methods: {
-		setCp(){
+		searchSelectCp(e){
+			this.selectCpId = e
+		},
+		searchCpInfo(query) {
+			let that = this
+			if (query !== '') {
+				this.loading = true;
+				this.$service.ptCp.list({search:query}).then(res=>{
+					that.loading = false
+					that.cpInfoList = res.list	
+				})
+			} else {
+				this.cpInfoList = []
+			}
+		},
+		installCp(){
 			if (this.$util.isEmpty(this.selects.ids)) {
 			if (this.$util.isEmpty(this.selects.ids)) {
 				this.$message.error('请选择花材')
 				this.$message.error('请选择花材')
 				return false
 				return false
 			}
 			}
+			if(this.selectCpId == 0){
+				this.$message.error('请选择产品')
+				return false
+			}
 		},
 		},
-		doMore(c){
+		doMore(cmd){
 			if (this.$util.isEmpty(this.selects.ids)) {
 			if (this.$util.isEmpty(this.selects.ids)) {
 				this.$message.error('请选择花材')
 				this.$message.error('请选择花材')
 				return false
 				return false
 			}
 			}
-			this.$message.success(c)
+			//删除产品关系
+			if(cmd == 'delCpRelate'){
+				if(this.selectCpId == 0){
+					this.$message.error('请选择产品')
+					return false
+				}
+			}
+			//全部认证
+			if(cmd == 'toAuth'){
+
+			}
 		},
 		},
     	changeCpClassStyle(e){
     	changeCpClassStyle(e){
 			this.cpClassStyle = e
 			this.cpClassStyle = e
@@ -438,13 +479,13 @@ export default {
 							prop: 'className',
 							prop: 'className',
 							label: '分类',
 							label: '分类',
 							align: 'center',
 							align: 'center',
-							'min-width': 100,
+							'min-width':90,
 						},
 						},
 						{
 						{
 							prop: 'stockWarning',
 							prop: 'stockWarning',
-							label: '库存预警',
+							label: '预警',
 							align: 'center',
 							align: 'center',
-							'min-width': 100,
+							'min-width': 80,
 						},
 						},
 						{
 						{
 							prop: 'weight',
 							prop: 'weight',
@@ -504,7 +545,7 @@ export default {
 					['slot-tabs'],
 					['slot-tabs'],
 					['slot-cpClassStyle','slot-cp-class','slot-item-class','search-key','flex1','slot-add-item-btn', 'refresh-btn'],
 					['slot-cpClassStyle','slot-cp-class','slot-item-class','search-key','flex1','slot-add-item-btn', 'refresh-btn'],
 					['data-table'],
 					['data-table'],
-					['slot-more-do-btn','flex1', 'pagination'],
+					['slot-more-do-btn','slot-select-cp','flex1', 'pagination'],
 				])
 				])
 				.done();
 				.done();
 			app.refresh({ classId: this.classId,cpId:this.cpId,cpClassStyle:this.cpClassStyle })
 			app.refresh({ classId: this.classId,cpId:this.cpId,cpClassStyle:this.cpClassStyle })