瀏覽代碼

工艺复制

damon227 1 年之前
父節點
當前提交
a08ff97666
共有 2 個文件被更改,包括 23 次插入5 次删除
  1. 3 2
      src/views/modules/tech/crafts-management.vue
  2. 20 3
      src/views/modules/tech/ctafts-add-or-detail.vue

+ 3 - 2
src/views/modules/tech/crafts-management.vue

@@ -143,6 +143,7 @@
           <template slot-scope="scope">
             <el-button v-if="isAuth('pro:technology:revoke') && scope.row.state === '1'" type="text" size="small" @click="revokeHandle(scope.row.techId)">撤销</el-button>
             <el-button v-if="isAuth('pro:technology:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.techId)">编辑</el-button>
+            <el-button v-if="isAuth('pro:technology:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.techId, true)">复制</el-button>
             <el-button v-if="isAuth('pro:technology:update') && scope.row.techState === '-1' && scope.row.state === '3'" type="text" size="small" @click="changeStateHandle(scope.row.techId, 0)">启用</el-button>
             <el-button v-if="isAuth('pro:technology:update') && scope.row.techState === '0'" type="text" size="small" @click="changeStateHandle(scope.row.techId, -1)">停用</el-button>
             <el-button v-if="isAuth('pro:technology:info')" type="text" size="small" @click="detailHandle(scope.row.techId, scope.row.productName)">查看</el-button>
@@ -261,10 +262,10 @@
         this.dataListSelections = val
       },
       // 新增 / 修改
-      addOrUpdateHandle (id) {
+      addOrUpdateHandle (id, isCopy) {
         this.addOrUpdateVisible = true
         this.$nextTick(() => {
-          this.$refs.addOrUpdate.init(id, false, Number(id) !== 0)
+          this.$refs.addOrUpdate.init(id, false, Number(id) !== 0, isCopy)
         })
       },
       // 撤销

+ 20 - 3
src/views/modules/tech/ctafts-add-or-detail.vue

@@ -118,6 +118,7 @@ export default {
       visible: false,
       display: false,
       isEdit: false, // 是否是编辑页面
+      isCopy: false,
       fileList: [],
       dataList: [],
       id: 0,
@@ -183,7 +184,7 @@ export default {
         lineList: []
       }
     },
-    async init (id, display, isEdit) {
+    async init (id, display, isEdit, isCopy) {
       this.fileList = []
       this.dataForm = {
         techName: '',
@@ -193,7 +194,8 @@ export default {
       }
       this.visible = true
       this.display = display
-      this.isEdit = isEdit
+      this.isEdit = isEdit && !isCopy
+      this.isCopy = isCopy
 
       await getProduct({ current: 1, size: 20000 }).then(({ data }) => {
         if (data && data.code === '200') {
@@ -266,10 +268,25 @@ export default {
           }
 
           let url = `/biz-service/technology/submit`
-          if (this.isEdit) {
+          if (this.isEdit && !this.isCopy) {
             url = `/biz-service/technology/update`
           }
 
+          if (this.isCopy) {
+            this.dataForm.id = 0
+            this.dataForm.techId = null
+            if (flowData.lineList != null && flowData.lineList.length > 0) {
+              for (let index = 0; index < flowData.lineList.length; index++) {
+                flowData.lineList[index].techId = null
+              }
+            }
+            if (flowData.nodeList != null && flowData.nodeList.length > 0) {
+              for (let index = 0; index < flowData.nodeList.length; index++) {
+                flowData.nodeList[index].techId = null
+              }
+            }
+          }
+
           this.$http({
             url: this.$http.adornUrl(url),
             method: 'post',