quwangxin il y a 2 ans
Parent
commit
7bd335eb73
1 fichiers modifiés avec 75 ajouts et 76 suppressions
  1. 75 76
      src/components/print/OrderPrint.vue

+ 75 - 76
src/components/print/OrderPrint.vue

@@ -51,7 +51,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -77,7 +77,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -103,7 +103,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -128,7 +128,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -153,7 +153,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -178,7 +178,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -203,7 +203,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -228,7 +228,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
             <el-col
@@ -266,7 +266,7 @@
           v-else-if="item.taskTypeName.includes('库')"
         >
           <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 预缴库</div></el-col
+            ><div class="title">{{ index + 1 }}0 库</div></el-col
           >
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
@@ -277,7 +277,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -305,7 +305,7 @@
               :key="i + '-' + idx"
             >
               {{ t.label }}:{{
-                (item.formatter && item.formatter(itm)) || itm[t.key]
+                (t.formatter && t.formatter(itm)) || itm[t.key]
               }}
             </el-col>
           </template>
@@ -346,7 +346,7 @@
         default: ''
       }
     },
-    data() {
+    data () {
       return {
         visible: false,
         typeList: {
@@ -367,7 +367,7 @@
             key: 'brandNo',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.workReportCategoryList[0]?.brandNum;
             }
           },
@@ -376,7 +376,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.workReportCategoryList[0]?.batchNo;
             }
           },
@@ -385,7 +385,7 @@
             key: 'feedingWeight',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.workReportCategoryList[0]?.number;
             }
           },
@@ -394,7 +394,7 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.standardNum;
             }
           },
@@ -403,7 +403,7 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.noStandardNum;
             }
           },
@@ -413,8 +413,8 @@
             key: 'deviceCode',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
               return obj?.code;
@@ -425,11 +425,11 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 5
               );
-              return obj?.code + '/' + obj?.model;
+              return obj && obj.code + '/' + obj.model;
             }
           },
           {
@@ -437,8 +437,8 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
               return obj?.name;
@@ -449,8 +449,8 @@
             key: 'boatNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
               return obj?.extraField?.boatNum;
@@ -462,8 +462,8 @@
             key: 'stampingTimes',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 5
               );
               return obj?.extraField?.stampingTimes;
@@ -500,7 +500,7 @@
             key: 'dryingDuration',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.workReportArea?.extraField?.dryTime;
             }
           },
@@ -509,7 +509,7 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.standardNum;
             }
           },
@@ -518,7 +518,7 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.noStandardNum;
             }
           },
@@ -527,7 +527,7 @@
             key: 'areaCode',
             span: 8,
             class: 'border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.workReportArea?.code;
             }
           },
@@ -537,8 +537,8 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right ',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
               return obj?.code;
@@ -570,8 +570,8 @@
             key: 'temperatureRamp',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
               return obj?.extraField?.temperatureRamp;
@@ -588,7 +588,7 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.standardNum;
             }
           },
@@ -597,7 +597,7 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.noStandardNum;
             }
           },
@@ -606,8 +606,8 @@
             key: 'deviceCode',
             span: 4,
             class: ' border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
               return obj?.code;
@@ -619,8 +619,8 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
               return obj?.code;
@@ -658,7 +658,7 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.standardNum;
             }
           },
@@ -667,7 +667,7 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.noStandardNum;
             }
           },
@@ -676,8 +676,8 @@
             key: 'deviceCode',
             span: 8,
             class: ' border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
               return obj?.code;
@@ -689,8 +689,8 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
               return obj?.name;
@@ -701,8 +701,8 @@
             key: 'boatNum',
             span: 4,
             class: 'border-dashed-right',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
               return obj?.extraField?.boatNum;
@@ -734,7 +734,7 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right',
-            formatter(itm) {
+            formatter (itm) {
               const obj = itm.workReportCategoryList.find(
                 (i) => i.rootCategoryLevelId == 9
               );
@@ -746,8 +746,8 @@
             key: 'deviceCode',
             span: 4,
             class: 'border-dashed-right',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
               return obj?.code;
@@ -785,7 +785,7 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.standardNum;
             }
           },
@@ -794,7 +794,7 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom border-dashed-right',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.noStandardNum;
             }
           },
@@ -803,8 +803,8 @@
             key: 'deviceCode',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
               return obj?.code;
@@ -977,7 +977,7 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.standardNum;
             }
           },
@@ -986,7 +986,7 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm.productInfo?.noStandardNum;
             }
           },
@@ -995,8 +995,8 @@
             key: 'deviceCode',
             span: 4,
             class: 'border-dashed-right',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
               return obj?.code;
@@ -1028,7 +1028,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm?.packInfo?.packDemand;
             }
           },
@@ -1037,7 +1037,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm?.packInfo?.packUnit;
             }
           },
@@ -1046,7 +1046,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm?.packInfo?.packNum;
             }
           },
@@ -1055,7 +1055,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return `PCS/${itm.packInfo.packUnit}`;
             }
           },
@@ -1064,7 +1064,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm?.packInfo?.netWeight;
             }
           },
@@ -1073,7 +1073,7 @@
             key: 'xxx',
             span: 4,
             class: ' border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm?.packInfo?.roughWeight;
             }
           },
@@ -1082,7 +1082,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
+            formatter (itm) {
               return itm?.packInfo?.surplusNum;
             }
           },
@@ -1112,8 +1112,8 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter(itm) {
-              const obj = itm.workReportDeviceList.find(
+            formatter (itm) {
+              const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 9
               );
               return obj?.number;
@@ -1142,30 +1142,29 @@
     },
 
     methods: {
-      open() {
+      open () {
         this.visible = true;
         this.init();
       },
-      init() {
+      init () {
         for (const p of this.processList) {
           this.$set(p, 'list', []);
         }
         printWorkOrderInfo(this.workOrderId).then((res) => {
           for (const t of res.taskInfo) {
             for (const p of this.processList) {
-              if (t.taskName === p.taskTypeName) {
-                console.log(t.taskName, p.taskTypeName);
+              if (t.taskName === p.taskTypeName && t.taskCode === p.taskCode) {
                 p.list.push(t);
               }
             }
           }
         });
       },
-      cancel() {
+      cancel () {
         this.visible = false;
       },
       //打印
-      handlePrint() {
+      handlePrint () {
         this.PrintLoading = true;
         const page = this.$refs.pagesRef;
         const pHeight = page.offsetHeight;