ysy 2 жил өмнө
parent
commit
69e56df2a7

+ 11 - 1
src/api/technology/productParam/index.js

@@ -46,6 +46,16 @@ export default {
     if (res.data.code == 0) {
       return res.data.message;
     }
-  }
+  },
+
+    //详情
+    getCategoryParam: async (categoryId) => {
+      const res = await request.get(
+        `/main/category/getCategoryParam/${categoryId}`
+      );
+      if (res.data.code == 0) {
+        return res.data.data;
+      }
+    },
 };
 

+ 6 - 6
src/views/material/product/components/index-data.vue

@@ -26,7 +26,7 @@
         </el-popconfirm>
 
 
-        <el-link v-if="row.isProduct == 1" type="primary" :underline="false" @click="openParam(row)">
+        <el-link type="primary" :underline="false" @click="openParam(row)">
           工艺参数
         </el-link>
 
@@ -45,7 +45,7 @@
     <MaterialModal :visible.sync="materialEdit" :data="current" ref="materialRefs"></MaterialModal>
 
     <!-- 工艺参数 -->
-    <ParamEdit  :visible.sync="paramEdit"   :paramData="current" ref="paramRefs"></ParamEdit>
+    <ParamEdit :visible.sync="paramEditShow"  :paramData="current" ref="paramRefs"></ParamEdit>
   </div>
 </template>
 
@@ -168,7 +168,7 @@ export default {
       id: null,
 
       materialEdit: false,
-      paramEdit: false,
+      paramEditShow: false,
       current: null,
 
     };
@@ -228,11 +228,11 @@ export default {
 
 
     openParam(row) {
+      this.paramEditShow = true;
       this.current = row;
-      this.paramEdit = true;
       this.$refs.paramRefs.$refs.form &&
-        this.$refs.paramRefs.$refs.form.clearValidate();
-      
+       this.$refs.paramRefs.$refs.form.clearValidate();
+
     },
 
 

+ 36 - 12
src/views/technology/productParam/components/user-edit.vue

@@ -326,7 +326,8 @@ export default {
           showOverflowTooltip: true
         }
       ],
-      isProduct: false
+      isProduct: false, // 判断是否是产品
+      isProductUpdate:null,  // 1 新增, 2编辑
 
     };
   },
@@ -404,20 +405,25 @@ export default {
           return false;
         }
         this.loading = true;
-        if (!this.isUpdate) {
+        if (!this.isUpdate && this.isProductUpdate == null) {
           delete this.form.id;
         }
-        const saveOrUpdate = this.isUpdate
+        let saveOrUpdate = this.isUpdate 
           ? parameter.update
           : parameter.save;
 
+          if(this.isProductUpdate != null) {
+            saveOrUpdate = this.isProductUpdate == 2
+          ? parameter.update
+          : parameter.save;
+          }
+
 
         saveOrUpdate(this.form)
           .then((msg) => {
             this.loading = false;
             this.form = {};
-            const info = this.isUpdate ? '修改成功' : '新增成功'
-            this.$message.success(info);
+            this.$message.success(msg);
             this.updateVisible(false);
             this.$emit('done');
           })
@@ -474,20 +480,38 @@ export default {
           this.taskParam = res.taskParam
           this.isUpdate = true;
         } else if (this.paramData) {
-         this.isProduct = true
+          this.isProduct = true
+
           let param = {
             categoryId: this.paramData.id,
-            categoryName:this.paramData.name,
+            categoryName: this.paramData.name,
             categoryCode: this.paramData.code,
-            categoryModelType:this.paramData.modelType,
+            categoryModelType: this.paramData.modelType,
             categoryBrandNum: this.paramData.brandNum,
             categorySpecification: this.paramData.specification,
-           
+
+          }
+
+
+          const res = await parameter.getCategoryParam(this.paramData.id);
+       
+          if (res) {
+            this.isProductUpdate = 2
+            this.$util.assignObject(this.form, {
+              ...res
+            });
+
+            this.$refs.table.setData(res.produceParam)
+          this.taskParam = res.taskParam
+
+          } else {
+      
+            this.$util.assignObject(this.form, {
+              ...param
+            });
+            this.isProductUpdate = 1
           }
 
-          this.$util.assignObject(this.form, {
-            ...param
-          });
         }
 
         else {