From 051b4cb8c19b786ba4a2b0d9a030a9bdd1e75e48 Mon Sep 17 00:00:00 2001
From: jjLv <1981429112@qq.com>
Date: Sat, 23 Nov 2024 11:11:53 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 .../repair/repairManage/component/edit.vue    | 80 ++++++++++++-------
 1 file changed, 53 insertions(+), 27 deletions(-)
diff --git a/src/views/material/repair/repairManage/component/edit.vue b/src/views/material/repair/repairManage/component/edit.vue
index 647ec372..647314ba 100644
--- a/src/views/material/repair/repairManage/component/edit.vue
+++ b/src/views/material/repair/repairManage/component/edit.vue
@@ -253,7 +253,7 @@
         保存
-        取消
       
@@ -653,6 +653,7 @@
                     placeholder="请输入内部维修数量"
                     maxlength="20"
                     type="number"
+                    min="0"
                     style="width: 265px"
                     @input="waitRepairCount"
                   />
@@ -753,6 +754,7 @@
                     placeholder="请输入返厂维修数量"
                     maxlength="20"
                     type="number"
+                    min="0"
                     style="width: 265px"
                     @input="waitRepairCount"
                   />
@@ -885,6 +887,7 @@
                   maxlength="20"
                   type="number"
                   style="width: 250px"
+                  min="0"
                   @input="waitRepairCount"
                 />
               
@@ -1115,9 +1118,13 @@ export default {
         repairNum:0
       },
       formMiddle: {
+        supplierId:undefined,
         repairNum:0
       },
       formRight:{
+        scrapNum:0,
+        scrapType:undefined,
+        scrapReason:undefined,
         scrapNum:0
       },
 
@@ -1139,13 +1146,13 @@ export default {
           },
         ],
 
-        supplierId: [
-          {
-            required: true,
-            message: "请选择厂家",
-            trigger: "change",
-          },
-        ],
+        // supplierId: [
+        //   {
+        //     required: true,
+        //     message: "请选择厂家",
+        //     trigger: "change",
+        //   },
+        // ],
 
         partPrice: [
           {
@@ -1214,14 +1221,10 @@ export default {
       //待维修数量
       disrepairNumTemp: undefined,
       //数量维修是否能保存
-      flagSave: false, 
+      flagSave: true, 
       //合格勾选对象数组
       idsList:[],
-      //
-      supplierId:undefined,
-      //
-      remark:undefined,
-      //
+      //一级页面传来的id
       taskIdTemp:undefined,
     };
   },
@@ -1365,6 +1368,10 @@ export default {
           this.resetForm("formLeft");
           this.resetForm("formMiddle")
           this.resetForm("formRight")
+          this.partItems =  [{ partType: "", partNum: "", isCharge: "" }],
+          this.partItemsMiddle= [
+            { partName: "", partNum: "", partPrice: "0", isCharge: "" },
+          ],
           this.openNum = true;
         });
       }
@@ -1406,6 +1413,21 @@ export default {
       this.openCode = false;
       // console.log(this.equipmentList)
     },
+
+    // 编码维修弹窗取消
+   async cancelCodeDialog(){
+      let param = {
+        taskId: this.repairRow.taskId,
+        keyword: "",
+      };
+      this.taskIdTemp = this.repairRow.taskId;
+      const res = await getAppRepairMaTypeList(param);
+      this.equipmentList = res.data;
+      this.equipmentList.forEach((e) => {
+        e.disrepairNum = Number(e.repairNum) - Number(e.repairedNum);
+      }); 
+      this.openCode = false;
+    },
     //编码维修弹窗文件上传前
     beforeFileUpload(row) {
       this.fileData = row;
@@ -1484,6 +1506,7 @@ export default {
     // 待报废保存按钮
    async saveSubmit() {
       this.uploadKey = Date.now();
+
       if(this.fileList.length!=0){
         await  this.getImaUpload(),
         await this.addWaitRepairPic(this.scrapForm);
@@ -1494,8 +1517,9 @@ export default {
       this.scrapRowData.codeScrapRepairPartList.push(this.scrapForm)
 
       this.openScrap = false;
-      this.reset();
+      // this.reset();
     },
+    
     //上传文件库
     async getImaUpload(){
         this.fileListTemp = [];
@@ -1673,6 +1697,7 @@ export default {
       console.log('row',row)
       this.backRowData = row;
       this.backTableList = [];
+      this.resetForm("backForm")
       if(row.backTableList){
       this.backForm = {
         //返场厂家
@@ -1680,14 +1705,7 @@ export default {
         //备注
         remark: row.backTableList[0].remark,
       };
-      }else{
-        this.backForm = {
-        //返场厂家
-        supplierId: null,
-        //备注
-        remark: '',
-      }; 
-      }
+       }
       if (
         this.backRowData.backTableList &&
         this.backRowData.backTableList.length > 0
@@ -1776,6 +1794,7 @@ export default {
 
     // 待报废-打开
     openScrapDialog(row) {
+      console.log('row11',row)
       this.scrapRowData = row;
       this.scrapForm = {};
       this.openScrap = true;
@@ -1926,22 +1945,29 @@ export default {
     saveCancelAll(){
       this.fileList=[];
       this.fileListTemp=[];
+      this.resetForm("formLeft");
+      this.resetForm("formMiddle")
+      this.resetForm("formRight")
+      this.partItems =  [{ partType: "", partNum: "", isCharge: "" }],
+      this.partItemsMiddle = [
+        { partName: "", partNum: "", partPrice: "0", isCharge: "" },
+      ],
       this.openNum=false;
     },
 
     //待维修数量限制统计
     waitRepairCount(){
-      console.log('this.formLeft.repairNum',this.formLeft.repairNum)
-      console.log('this.formMiddle.repairNum',this.formMiddle.repairNum)
-      console.log('this.formRight.scrapNum',this.formRight.scrapNum)
-      console.log('this.disrepairNumTemp',this.disrepairNumTemp)
       if((Number(this.formLeft.repairNum) + Number(this.formMiddle.repairNum)+ Number(this.formRight.scrapNum)) >this.disrepairNumTemp){
         this.flagSave = true;
         this.$message.error("输入的数字之和大于"+this.disrepairNumTemp);
+      }else if((Number(this.formLeft.repairNum) + Number(this.formMiddle.repairNum)+ Number(this.formRight.scrapNum))==0){
+        this.flagSave = true;
+        this.$message.error("输入的数字之和不能为0");
       }else{
          this.flagSave = false;
       }
     },
+
   },
 };