Browse Source

Fix: 工艺编辑问题

chris 2 years ago
parent
commit
fe9841b4e4
1 changed files with 14 additions and 9 deletions
  1. 14 9
      src/views/modules/tech/ctafts-add-or-detail.vue

+ 14 - 9
src/views/modules/tech/ctafts-add-or-detail.vue

@@ -7,7 +7,7 @@
       :visible.sync="visible"
       @close="handleClose"
     > -->
-      <div class="my-title">{{ display ? '工艺详情' : '新建工艺' }}</div>
+      <div class="my-title">{{ !id ? '新增': display ? '详情' : '修改' }}</div>
       <el-form
         :model="dataForm"
         :rules="dataRule"
@@ -91,7 +91,7 @@
 </template>
 
 <script>
-import { getInfo, getProduct, getWorkType } from '@/api/crafts'
+import { getInfo, getProduct } from '@/api/crafts'
 import UploadComponent from '../common/upload-component'
 import WorkFlow from '@/components/work-flow/home'
 // import data from "@/components/work-flow/config/data.json";
@@ -173,6 +173,7 @@ export default {
       }
     },
     async init (id, display) {
+      this.fileList = []
       this.dataForm = {
         techName: '',
         techVersion: '',
@@ -190,6 +191,17 @@ export default {
       await getInfo(id).then(async ({ data }) => {
         if (data && data.code === '200') {
           this.dataForm = data.data
+          // 附件
+          if (data.data.attachList) {
+            data.data.attachList.forEach(item => {
+              this.fileList.push({
+                name: item.fileName,
+                url: item.url,
+                id: item.url
+              })
+            })
+          }
+          // 工艺流程
           this.workFlowData = {
             nodeList: data.data.nodeList,
             lineList: data.data.lineList
@@ -197,13 +209,6 @@ export default {
         }
       })
     },
-    getWorkType () {
-      getWorkType().then(({ data }) => {
-        if (data && data.code === '200') {
-          this.workTypeOptions = data.data
-        }
-      })
-    },
     handleRemove (file, fileList) {
       this.fileList = fileList
     },