Преглед изворни кода

feat(工单): 添加工单信息传递功能

liujt пре 6 месеци
родитељ
комит
389ddf1df0

+ 15 - 9
src/views/produce/components/prenatalExamination/PlanRulesEventDialog.vue

@@ -19,6 +19,7 @@
         "
         :planId="currentPlans.id"
         :info="currentPlans"
+        :workOrderInfo="workOrderInfo"
         @done="setWorkOrderIdAndStatus"
       />
       <!-- 1 报工 -->
@@ -31,9 +32,10 @@
       <!-- 2 执行中 3 完成展示详情-->
       <workOrderDetails
         v-if="
-          currentPlans.status == 3 || currentPlans.status == 2
+          (currentPlans.status == 3 || currentPlans.status == 2)
         "
-        :workOrderId="currentPlanRecords.id"
+        :workOrderId="currentPlans.matchedRecords[0].id"
+        :workOrderInfo="workOrderInfo"
       ></workOrderDetails>
     </div>
 
@@ -83,6 +85,12 @@
 
   export default {
     mixins: [dictMixins],
+    props: {
+      workOrderInfo: {
+        type: Object,
+        default: () => {}
+      }
+    },
     components: {
       signingUpWork,
       workOrderDetails,
@@ -110,13 +118,9 @@
       // 当前计划工单信息
       currentPlanRecords() {
         if (this.currentPlans && this.currentPlans.matchedRecords) {
-          console.log('this.currentPlans.matchedRecords', this.currentPlans.matchedRecords[this.activeIndex]);
           return this.currentPlans.matchedRecords?.[0] || {};
         }
         return {};
-      },
-      orderLength() {
-        return this.currentPlans.status == 0 || this.currentPlans.status == 4 ? this.rulesInfo.plans.length : this.currentPlans.matchedRecords.length;
       }
     },
     created() {
@@ -146,9 +150,11 @@
         this.rulesInfo.plans[this.activeIndex].status = status;
       },
       setWorkOrderIdAndStatus(workOrderId) {
-        // console.log('workOrderId', workOrderId);
-        this.rulesInfo.plans[this.activeIndex].matchedRecords[0].id =
-          workOrderId;
+        const currentPlan = this.rulesInfo.plans[this.activeIndex];
+        
+        this.$set(currentPlan.matchedRecords, 0, {
+          id: workOrderId,
+        });
         this.setStatus(2);
       }
     }

+ 13 - 7
src/views/produce/components/prenatalExamination/components/workOrder/programRulesEventDialog.vue

@@ -572,6 +572,11 @@
       info: {
         type: Object,
         required: true
+      },
+      // 工单信息
+      workOrderInfo: {
+        type: Object,
+        default: () => {}
       }
     },
     components: {
@@ -909,10 +914,10 @@
       // 关闭时清理表单
       handleClose() {
         this.addForm = JSON.parse(JSON.stringify(this.formBaseData));
-        this.$nextTick(() => {
-          this.$refs.formRef.clearValidate();
-          this.visible = false;
-        });
+        // this.$nextTick(() => {
+        //   this.$refs.formRef.clearValidate();
+        //   this.visible = false;
+        // });
       },
       // 构建数据
       formMateBody() {
@@ -939,17 +944,18 @@
               const body = this.formMateBody();
 
               console.log('body', body);
-              const workOrderId = ''
+              let workOrderId = ''
               if (this.type == 'dispatch') {
                 const res = await recordrulesplanManualDispatchOrder(body);
-                workOrderId = res.data || '';
+                console.log('res~~~~~~~~~~~~~~~~', res);
+                workOrderId = res || '';
                 this.$message.success('派单成功');
               } else {
                 await recordrulesplanSaveOrUpdate(body);
                 this.$message.success('保存成功');
               }
               this.butLoading = false;
-
+              console.log('workOrderId~~~~~~', workOrderId);
               this.$emit('done', workOrderId);
 
               this.handleClose();

+ 19 - 1
src/views/produce/components/prenatalExamination/components/workOrder/workOrderEvent.vue

@@ -333,7 +333,12 @@
       workOrderId: {
         type: [Number, String],
         required: true
-      }
+      },
+      // 工单信息
+      workOrderInfo: {
+        type: Object,
+        default: () => {}
+      },
     },
     components: {
       toolModal,
@@ -767,6 +772,19 @@
             body.duration = Number(body.duration);
             body.duration = body.duration * 60 * 60 * 1000;
 
+            // 带工单信息
+            body.workOrderId = this.workOrderInfo.id;
+            body.workOrderCode = this.workOrderInfo.code;
+            body.produceRoutingId = this.workOrderInfo.produceRoutingId;
+            body.produceRoutingName = this.workOrderInfo.produceRoutingName;
+            body.productCode = this.workOrderInfo.productCode;
+            body.productName = this.workOrderInfo.productName;
+            body.batchNo = this.workOrderInfo.batchNo;
+            body.brandNo = this.workOrderInfo.brandNo;
+            body.specification = this.workOrderInfo.specification;
+            body.productModel = this.workOrderInfo.model;
+            body.formingNum = this.workOrderInfo.formingNum;
+
             this.butLoading = true;
 
             try {

+ 1 - 0
src/views/produce/components/prenatalExamination/index.vue

@@ -72,6 +72,7 @@
     <!-- 事件驱动-->
     <PlanRulesEventDialog
       ref="planRulesEventDialogRef"
+      :workOrderInfo="workOrderInfo"
       @reload="getData"
     ></PlanRulesEventDialog>
   </el-dialog>