Browse Source

设备点检优化——选报修时,同时新增维修工单

wyh 1 year ago
parent
commit
d73b3b2540
1 changed files with 34 additions and 0 deletions
  1. 34 0
      src/views/module_cmms/spotcheck/modules/SpotcheckForm.vue

+ 34 - 0
src/views/module_cmms/spotcheck/modules/SpotcheckForm.vue

@@ -147,6 +147,8 @@
         model:{
           cmmsSpotcheckTitemList: []
         },
+        modelWX:{
+        },
         // 单个禁填
         disableds: false,
         // 点检结果(-1为报修,1为其他结果)
@@ -209,6 +211,9 @@
           result: [
             { required: true, message: '请输入点检结果!'},
           ],
+          description: [
+            { required: true, message: '请输入点检描述/故障描述!'},
+          ],
           spotcheckdate: [
             { required: true, message: '请选择点检时间!'},
           ],
@@ -221,6 +226,7 @@
         },
         url: {
           add: "/cmmsSpotcheck/cmmsSpotcheck/add",
+          add2: "/cmmsRepair/cmmsRepair/add",
           edit: "/cmmsSpotcheck/cmmsSpotcheck/edit",
           queryById: "/cmmsSpotcheck/cmmsSpotcheck/queryById"
         }
@@ -270,10 +276,38 @@
           if (valid) {
             that.confirmLoading = true;
             let httpurl = '';
+            let httpurl2 = '';
             let method = '';
             if(!this.model.id){
               httpurl+=this.url.add;
               method = 'post';
+              // 判断点检结果是否为报修
+              if (this.resultStatus == -1) {
+                console.log(99,this.model)
+                this.modelWX.equipmentid = this.model.equipmentid
+                // 下面两句:将带有时分秒的去掉,只传年月日
+                // const time = this.model.spotcheckdate
+                // this.modelWX.faultdate=time.replace(/ \d+(:\d+){2}/,'');
+                this.modelWX.faultdate = this.model.spotcheckdate
+                this.modelWX.faultdesc = this.model.description
+                this.modelWX.repairname = this.model.repairname
+                this.modelWX.priority = this.model.priority
+                const c  = this.model.files.split(',')
+                this.modelWX.files = c.map((res) => {
+                  return {
+                    url: res
+                  }
+                })
+                console.log("00",this.modelWX)
+                httpurl2+=this.url.add2;
+                httpAction(httpurl2,this.modelWX,method).then((res)=>{
+                  if(res.success){
+                    that.$message.success("维修工单新增成功!");
+                  }else{
+                    that.$message.warning(res.message);
+                  }
+                })
+              }
             }else{
               httpurl+=this.url.edit;
                method = 'put';