shish há 2 anos atrás
pai
commit
1d2279c21c
2 ficheiros alterados com 26 adições e 3 exclusões
  1. 7 0
      pt/src/service/pt-cp/index.js
  2. 19 3
      pt/src/views/item/list.vue

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

@@ -2,6 +2,13 @@ import { BaseService, Service } from '@/cool';
 @Service('pt-cp')
 export class CpService extends BaseService {
 
+	copyCreateCp(data) {
+		return this.request({
+			url: '/copy-create-cp',
+			params: data
+		});
+	}
+
 	batchModifyClass(data) {
 		return this.request({
 			url: '/batch-modify-class',

+ 19 - 3
pt/src/views/item/list.vue

@@ -54,8 +54,10 @@
 				</div>
 			</template>
 
-			<template #slot-modify="{ scope }">
+			<template #slot-handle="{ scope }">
 				<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id)" >修改</el-button >
+				<el-button type="text" @click.native.stop="copyCreateCp(scope.row,0)" >建产品</el-button >
+				<el-button type="text" @click.native.stop="copyCreateCp(scope.row,1)" >建产品等级</el-button >
 			</template>
 
 			<template #slot-item-class="{scope}">
@@ -480,6 +482,20 @@ export default {
 		uploadSuccess() {
 			this.$refs['replaceForm'].validateField('cover');
 		},
+		copyCreateCp(info,needLevelItem){
+			if(needLevelItem == 1){
+				if(this.selectCpId == 0){
+					this.$message.error('请选产品')
+					return false					
+				}
+			}
+			this.$confirm('确认复制新建?', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
+				this.$service.ptCp.copyCreateCp({id:info.id,needLevelItem:needLevelItem,cpId:this.selectCpId}).then(res=>{
+					this.$message.success('操作成功');
+					this.app.refresh({ type: 0 })
+				})
+			})
+		},
 		replaceBtnFn(id) {
 			this.getAllClass()
 			this.getAllUnit()
@@ -665,12 +681,12 @@ export default {
 					op: {
 						visible: true,
 						props: {
-							width: 200,
+							width: 290,
 							align: 'center',
 							fixed: 'right',
 							label: '操作',
 						},
-						layout: ['slot-modify'],
+						layout: ['slot-handle'],
 					},
 				})
 				.set('dict', {