695593266@qq.com vor 4 Tagen
Ursprung
Commit
aad2cbc52f

+ 1 - 37
src/views/batchRecord/components/editModal.vue

@@ -378,12 +378,6 @@
           <el-col :span="8">
             <el-form-item
               label="产品编码"
-              :required="form.recordTemplateStyle != '3' && form.reportWorkType != 4"
-              :prop="
-                form.recordTemplateStyle != '3' && form.reportWorkType != 4
-                  ? 'productCode'
-                  : ''
-              "
             >
               <el-input
                 v-model="form.productCode"
@@ -400,12 +394,6 @@
           <el-col :span="8">
             <el-form-item
               label="产品名称"
-              :required="form.recordTemplateStyle != '3' && form.reportWorkType != 4"
-              :prop="
-                form.recordTemplateStyle != '3' && form.reportWorkType != 4
-                  ? 'productName'
-                  : ''
-              "
             >
               <el-input
                 v-model="form.productName"
@@ -929,30 +917,6 @@
             { required: true, message: '请选择规则', trigger: 'blur' },
             { required: true, message: '请选择规则', trigger: 'change' }
           ],
-          productCode: [
-            {
-              required: true,
-              message: '请输入产品编码',
-              trigger: 'blur'
-            },
-            {
-              required: true,
-              message: '请输入产品编码',
-              trigger: 'change'
-            }
-          ],
-          productName: [
-            {
-              required: true,
-              message: '请输入产品名称',
-              trigger: 'blur'
-            },
-            {
-              required: true,
-              message: '请输入产品编码',
-              trigger: 'change'
-            }
-          ],
           formingNum: [
             {
               required: true,
@@ -961,7 +925,7 @@
             },
             {
               required: true,
-              message: '请输入产品编码',
+              message: '请输入要求生产数量',
               trigger: 'change'
             }
           ],

+ 31 - 5
src/views/produce/components/prenatalExamination/PlanRulesDialog.vue

@@ -127,12 +127,38 @@
       },
       // 报工成功后刷新当前项状态
       setPlanStatus(status) {
-        this.rulesInfo.planOrders[this.activeIndex].planStatus = status;
+        this.$set(
+          this.rulesInfo.planOrders[this.activeIndex],
+          'planStatus',
+          status
+        );
       },
-      setWorkOrderIdAndStatus(workOrderId) {
-        console.log('workOrderId', workOrderId);
-        this.rulesInfo.planOrders[this.activeIndex].eamWorkOrderId =
-          workOrderId;
+      getDispatchWorkOrderId(data) {
+        if (!data || typeof data !== 'object') {
+          return data;
+        }
+        return (
+          data.eamWorkOrderId ||
+          data.workOrderId ||
+          data.workOrderMaintenanceId ||
+          data.eamWorkorderId ||
+          data.id ||
+          ''
+        );
+      },
+      setWorkOrderIdAndStatus(data) {
+        console.log('dispatchResult', data);
+        const current = this.rulesInfo.planOrders[this.activeIndex];
+        if (data && typeof data === 'object') {
+          Object.keys(data).forEach((key) => {
+            this.$set(current, key, data[key]);
+          });
+        }
+
+        const workOrderId = this.getDispatchWorkOrderId(data);
+        if (workOrderId) {
+          this.$set(current, 'eamWorkOrderId', workOrderId);
+        }
         this.setPlanStatus(1);
       }
     }

+ 64 - 24
src/views/produce/components/prenatalExamination/components/workOrder/signingUpWork.vue

@@ -190,7 +190,7 @@
             value: 1
           },
           {
-            label: '缺陷',
+            label: '异常',
             value: -1
           }
         ],
@@ -209,46 +209,86 @@
         console.log(this.time);
         if (this.time.length > 0) {
           this.butLoading = true;
-          this.infoData.acceptTime = this.time[0];
-          this.infoData.finishTime = this.time[1];
-          this.infoData.deviceList = this.infoData.planDeviceList;
-          console.log(this.infoData);
-          let deviceList = this.infoData.deviceList
+          try {
+            await this.getInfo();
+          } catch (err) {
+            this.butLoading = false;
+            return;
+          }
+          const body = {
+            ...this.infoData,
+            acceptTime: this.time[0],
+            finishTime: this.time[1],
+            workOrderId: this.getReportWorkOrderId(),
+            deviceList: this.infoData.planDeviceList || []
+          };
+          if (!body.workOrderId) {
+            this.butLoading = false;
+            return this.$message.error('未获取到工单信息,请刷新后再试');
+          }
+          console.log(body);
+          let deviceList = body.deviceList
             .map((item) => {
               return item.workItems;
             })
             .flat();
           let boolen = deviceList.every((item) => item.status > -1);
-          this.infoData.isAbnormal = boolen ? 1 : 0;
-          report(this.infoData).then((res) => {
-            if (res.code == 0) {
-              this.$message.success('报工成功');
-              this.visible = false;
-              this.$emit('refresh');
-            }
-            this.butLoading = false;
-          }).catch((err) => {
-            this.butLoading = false;
-          });
+          body.isAbnormal = boolen ? 1 : 0;
+          report(body)
+            .then((res) => {
+              if (res.code == 0) {
+                this.$message.success('报工成功');
+                this.visible = false;
+                this.$emit('refresh');
+              }
+              this.butLoading = false;
+            })
+            .catch((err) => {
+              this.butLoading = false;
+            });
         } else {
           this.$message.error('请选择实际起始时间');
         }
       },
       // 表格数据
+      getReportWorkOrderId() {
+        const infoWorkOrderId =
+          this.infoData.eamWorkOrderId ||
+          this.infoData.workOrderId ||
+          this.infoData.workOrderMaintenanceId ||
+          this.infoData.eamWorkorderId ||
+          '';
+        if (infoWorkOrderId) {
+          return infoWorkOrderId;
+        }
+
+        if (this.workOrderId && typeof this.workOrderId === 'object') {
+          return (
+            this.workOrderId.eamWorkOrderId ||
+            this.workOrderId.workOrderId ||
+            this.workOrderId.workOrderMaintenanceId ||
+            this.workOrderId.eamWorkorderId ||
+            this.workOrderId.id ||
+            ''
+          );
+        }
+        return this.workOrderId || '';
+      },
       async getInfo() {
         this.loading = true;
-        let res = await getById(this.planId);
-        console.log(res);
-        this.infoData = res.data;
-        this.infoData.workOrderId = this.workOrderId;
-        this.loading = false;
+        try {
+          let res = await getById(this.planId);
+          console.log(res);
+          this.infoData = res.data;
+          this.infoData.workOrderId = this.getReportWorkOrderId();
+        } finally {
+          this.loading = false;
+        }
       }
     }
   };
 </script>
 <style lang="scss" scoped>
-  .page {
-  }
   .page-title {
     background: #fff;
     font-size: 18px;