shish 2 лет назад
Родитель
Сommit
d5457d30c0
3 измененных файлов с 40 добавлено и 8 удалено
  1. 2 0
      pt/src/cool/request/index.js
  2. 23 0
      pt/src/service/pt-cp-item/index.js
  3. 15 8
      pt/src/views/item/list.vue

+ 2 - 0
pt/src/cool/request/index.js

@@ -43,12 +43,14 @@ import ptAsset from '@/service/ptAsset/index';
 import shopYeChange from '@/service/shop-ye-change/index';
 import ptCp from '@/service/pt-cp/index';
 import ptCpClass from '@/service/pt-cp-class/index';
+import ptCpItem from '@/service/pt-cp-item/index';
 
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const ignore = ['./request.js'];
 
 	let modules = {
+		ptCpItem,
 		ptCp,
 		ptCpClass,
 		common,

+ 23 - 0
pt/src/service/pt-cp-item/index.js

@@ -0,0 +1,23 @@
+import { BaseService, Service } from '@/cool';
+
+@Service('pt-cp-item')
+export class PtCpItemService extends BaseService {
+
+	setCpRelate(data) {
+		return this.request({
+			url: '/set-cp',
+			method: 'POST',
+			data: data
+		});
+	}
+
+	delCpRelate(data) {
+		return this.request({
+			url: '/del-cp',
+			method: 'POST',
+			data: data
+		});
+	}
+
+}
+export default new PtCpItemService();

+ 15 - 8
pt/src/views/item/list.vue

@@ -256,7 +256,7 @@ export default {
 			currentItemClassName:'',
 			cpClassData:[],
 			cpClassStyle:"-1",
-			selects:{ids:[]}
+			selectedIds:[]
 		};
 	},
 	computed: {},
@@ -277,26 +277,33 @@ export default {
 			}
 		},
 		installCp(){
-			if (this.$util.isEmpty(this.selects.ids)) {
-				this.$message.error('请选花材')
+			if (this.$util.isEmpty(this.selectedIds)) {
+				this.$message.error('请选花材')
 				return false
 			}
 			if(this.selectCpId == 0){
-				this.$message.error('请选产品')
+				this.$message.error('请选产品')
 				return false
 			}
+			this.$service.ptCpItem.setCpRelate({ids:JSON.stringify(this.selectedIds),cpId:this.selectCpId}).then((res) => {
+
+			})
 		},
 		doMore(cmd){
-			if (this.$util.isEmpty(this.selects.ids)) {
-				this.$message.error('请选择花材')
+			let that = this
+			if (this.$util.isEmpty(this.selectedIds)) {
+				this.$message.error('请选花材')
 				return false
 			}
 			//删除产品关系
 			if(cmd == 'delCpRelate'){
 				if(this.selectCpId == 0){
-					this.$message.error('请选产品')
+					this.$message.error('请选产品')
 					return false
 				}
+				this.$service.ptCpItem.delCpRelate({ids:JSON.stringify(this.selectedIds),cpId:this.selectCpId}).then((res) => {
+
+				})
 			}
 			//申请认证
 			if(cmd == 'toAuth'){
@@ -519,7 +526,7 @@ export default {
 					],
 					on: {
 						'selection-change': selection => {
-							this.selects.ids = selection.map(e => e.id)
+							this.selectedIds = selection.map(e => e.id)
 						}
 					},
 					op: {