浏览代码

称重打印表单数据初始化

lph 1 年之前
父节点
当前提交
07989c57f0
共有 1 个文件被更改,包括 54 次插入2 次删除
  1. 54 2
      zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

+ 54 - 2
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -491,6 +491,7 @@ import {
 import codeListPrint from "@/utils/print/codeListPrint";
 import { getServerPrintData } from "@/utils/print/printUtils";
 import { v4 as uuidv4 } from "uuid";
+import moment from "moment";
 
 export default {
   name: "ProductCodeList",
@@ -690,9 +691,26 @@ export default {
       deep: true,
       immediate: true,
     },
+    "dict.type.packaging_type": {
+      handler(newValue, oldValue) {
+        if (newValue?.length > 0 && this.excuteType == 1) {
+          this.form.packaging = newValue[0].value;
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
+    "dict.type.coding_list_format": {
+      handler(newValue, oldValue) {
+        if (newValue?.length > 0 && this.excuteType == 1) {
+          this.form.printFormat = newValue[0].value;
+        }
+      },
+      deep: true,
+      immediate: true,
+    },
   },
   mounted() {
-    // console.log(this.dict.type.packaging_type);
     console.log("mounted");
     let { excuteType, qrCode } = this.$route.query;
     if (excuteType == 2) {
@@ -1116,6 +1134,9 @@ export default {
         let res = await getLineOptionLsit(payLoad);
         if (res.code == 200) {
           this.lineOptions = res.rows;
+          if (this.lineOptions.length > 0) {
+            this.form.machineTool = this.lineOptions[0].id;
+          }
           console.log(this.lineOptions);
         } else {
           console.log(res);
@@ -1459,7 +1480,36 @@ export default {
       try {
         let res = await getOptionLsit();
         if (res.code == 200) {
-          this.dropDownData = res.data;
+          this.dropDownData = res.data || {};
+          // 初始化默认值
+          if (
+            this.dropDownData.work_shifts?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.workShifts = this.dropDownData.work_shifts[0].codeName;
+          }
+          if (this.dropDownData.level?.length > 0 && this.excuteType == 1) {
+            this.form.levels = this.dropDownData.level[0].codeName;
+          }
+          if (
+            this.dropDownData.drum_weight?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.canisterWeight =
+              this.dropDownData.drum_weight[0].codeName;
+          }
+          if (
+            this.dropDownData.box_weight?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.boxWeight = this.dropDownData.box_weight[0].codeName;
+          }
+          if (
+            this.dropDownData.tube_color?.length > 0 &&
+            this.excuteType == 1
+          ) {
+            this.form.tubeColor = this.dropDownData.tube_color[0].codeName;
+          }
         } else {
           this.$message.error("网络异常!");
         }
@@ -1548,6 +1598,8 @@ export default {
       this.excuteType = 1;
       this.reset();
 
+      this.form.productionDate = new Date();
+
       await this.getAllBatchData(); //获取所有产品数据
       await this.getLineOptionLsit(); //获取机台选项数据
       await this.getSelectOptions();