Bläddra i källkod

修改打印bug

695593266@qq.com 7 timmar sedan
förälder
incheckning
1e0ce411d1

+ 74 - 56
src/views/batchRecord/components/tables/batchRecordTable.vue

@@ -311,7 +311,7 @@
                 return this.buildPrintData(key, res, row);
               })
             )
-          ).filter(Boolean);
+          ).reduce((result, items) => result.concat(items), []);
           if (!data.length) {
             this.$message.warning('未查询到可打印的生产记录数据');
             return;
@@ -327,28 +327,27 @@
         const list = this.getPrintList(key, res);
         const first = list[0];
         if (!first) {
-          return null;
+          return [];
         }
         const today = this.formatPrintDate(new Date());
-        const base = this.buildBasePrintData(first, fallback, today);
 
         if (key == 'cleaningRecord') {
-          return {
-            ...base,
-            area: first.workshopArea || fallback.workshopArea || '',
-            processName: first.processName || fallback.ruleName || '',
-            productModel: first.productModel || fallback.productModel || '',
+          return list.map((item) => ({
+            ...this.buildBasePrintData(item, fallback, today),
+            area: item.workshopArea || fallback.workshopArea || '',
+            processName: item.processName || fallback.ruleName || '',
+            productModel: item.productModel || fallback.productModel || '',
             completionTime:
-              first.cleaningFinishTime ||
+              item.cleaningFinishTime ||
               fallback.createTime ||
               '',
-            checkItems: this.buildCleaningDetails(first.cleaningDetails)
-          };
+            checkItems: this.buildCleaningDetails(item.cleaningDetails)
+          }));
         }
 
         if (key == 'labelPrintRecord') {
-          return {
-            ...base,
+          return [{
+            ...this.buildBasePrintData(first, fallback, today),
             productionDate: this.formatPrintDate(first.productionDate),
             expiryDate: this.formatPrintDate(first.expiryDate),
             printTargets: this.uniqueList(list.map((item) => item.printTarget)),
@@ -358,34 +357,25 @@
               productModel: item.productModel || '',
               printQuantity: this.valueOrEmpty(item.printQuantity)
             }))
-          };
+          }];
         }
 
         if (key == 'productLabelRecord') {
-          const operateDate = this.formatPrintDate(
-            first.operateTime ||
-              first.createTime ||
-              ''
-          );
-          return {
-            ...base,
-            specification: first.specModel || first.specification || '',
-            productQuantity: this.valueOrEmpty(first.productQuantity),
-            equipmentCode: first.deviceCode || fallback.equipmentCode || '',
-            equipmentName: first.deviceName || fallback.equipmentName || '',
-            operateYear: operateDate.slice(0, 4),
-            operateMonth: operateDate.slice(5, 7),
-            operateDay: operateDate.slice(8, 10),
-            startHour: this.getTimePart(first.startTime, 0),
-            startMinute: this.getTimePart(first.startTime, 1),
-            endHour: this.getTimePart(first.endTime, 0),
-            endMinute: this.getTimePart(first.endTime, 1),
-            records: list
-          };
+          return list.map((item) => ({
+            ...this.buildBasePrintData(item, fallback, today),
+            specification: item.specModel || item.specification || '',
+            productQuantity: this.valueOrEmpty(item.productQuantity),
+            equipmentCode: item.deviceCode || fallback.equipmentCode || '',
+            equipmentName: item.deviceName || fallback.equipmentName || '',
+            cleaningItems: this.buildCleaningInspectionDetails(
+              item.cleaningInspectionDetails
+            )
+          }));
         }
 
         if (key == 'packagingRecord') {
-          return {
+          const base = this.buildBasePrintData(first, fallback, today);
+          return [{
             ...base,
             batchNo: first.produceBatch || base.batchNo,
             specification: first.specModel || first.specification || '',
@@ -393,7 +383,7 @@
             startTime: first.startTime || '',
             endTime: first.endTime || '',
             operationRecords: this.buildPackagingRecords(list),
-            cleaningItems: this.buildCleaningDetails(
+            cleaningItems: this.buildCleaningInspectionDetails(
               list.reduce((result, item) => {
                 const details = Array.isArray(item.cleaningInspectionDetails)
                   ? item.cleaningInspectionDetails
@@ -401,31 +391,36 @@
                 return result.concat(details);
               }, [])
             )
-          };
+          }];
         }
 
         if (key == 'processInspectionRecord') {
-          return {
-            ...base,
-            batchNo: first.produceBatch || base.batchNo,
-            productName: first.productName || base.productName,
-            productionDate: this.formatPrintDate(first.productionDate),
-            specification: this.buildSpecificationModel(
-              first.modelSpec ||
-                first.specModel ||
-                first.specification ||
-                base.specification,
-              first.productModel ||
-                first.modelType ||
-                first.model ||
-                fallback.productModel ||
-                fallback.modelType ||
-                fallback.model
-            )
-          };
+          return list.map((item) => {
+            const base = this.buildBasePrintData(item, fallback, today);
+            return {
+              ...base,
+              batchNo: item.produceBatch || base.batchNo,
+              productName: item.productName || base.productName,
+              productionDate: this.formatPrintDate(item.productionDate),
+              details: this.buildInspectionDetails(item.details),
+              conclusion: item.conclusion || '',
+              specification: this.buildSpecificationModel(
+                item.modelSpec ||
+                  item.specModel ||
+                  item.specification ||
+                  base.specification,
+                item.productModel ||
+                  item.modelType ||
+                  item.model ||
+                  fallback.productModel ||
+                  fallback.modelType ||
+                  fallback.model
+              )
+            };
+          });
         }
 
-        return base;
+        return [];
       },
       getPrintList(key, res) {
         const listMap = {
@@ -489,6 +484,29 @@
           checkResult: item.checkResult || ''
         }));
       },
+      buildCleaningInspectionDetails(details) {
+        const list = Array.isArray(details) ? details : [];
+        return list.map((item) => ({
+          ...item,
+          name: item.cleaningItem || '',
+          operationRecord: item.operationRecord || '',
+          checkRecord: item.checkRecord || ''
+        }));
+      },
+      buildInspectionDetails(details) {
+        const list = Array.isArray(details) ? details : [];
+        return list.map((item) => ({
+          processName: item.processName || '',
+          inspectionItem: item.inspectionItem || '',
+          inspectionMethod: item.inspectionMethod || '',
+          qualityStandard: item.qualityStandard || '',
+          inspectionTiming: item.inspectionTiming || '',
+          inspectionTime: item.inspectionTime || '',
+          inspectionQuantity: this.valueOrEmpty(item.inspectionQuantity),
+          inspectionResult: item.inspectionResult || '',
+          batchJudgment: item.batchJudgment || ''
+        }));
+      },
       buildPackagingRecords(list) {
         return (list || []).map((item) => ({
           operationProcess: item.operationProcess || '',

+ 2 - 2
src/views/batchRecord/print/electrodeBatchRecord/packagingRecord.vue

@@ -88,10 +88,10 @@
           <tr v-for="(item, index) in getCleaningItems(form)" :key="index">
             <td style="border: 1px solid #000; padding: 6px 10px;">{{ item.name }}</td>
             <td style="border: 1px solid #000; padding: 6px 10px; text-align: center;">
-              {{ item.cleaningStatus }}<span v-if="item.cleaner"> / {{ item.cleaner }}</span>
+              {{ item.operationRecord }}
             </td>
             <td style="border: 1px solid #000; padding: 6px 10px; text-align: center;">
-              {{ item.checkResult }}<span v-if="item.abnormalDesc"> / {{ item.abnormalDesc }}</span>
+              {{ item.checkRecord }}
             </td>
           </tr>
           <tr v-if="!getCleaningItems(form).length">

+ 20 - 1
src/views/batchRecord/print/electrodeBatchRecord/processInspectionRecord.vue

@@ -71,6 +71,20 @@
             </tr>
           </thead>
           <tbody>
+            <template v-if="getDetails(form).length">
+              <tr v-for="(item, index) in getDetails(form)" :key="index">
+                <td>{{ item.processName }}</td>
+                <td>{{ item.inspectionItem }}</td>
+                <td>{{ item.inspectionMethod }}</td>
+                <td>{{ item.qualityStandard }}</td>
+                <td>{{ item.inspectionTiming }}</td>
+                <td>{{ item.inspectionTime }}</td>
+                <td>{{ item.inspectionQuantity }}</td>
+                <td>{{ item.inspectionResult }}</td>
+                <td>{{ item.batchJudgment }}</td>
+              </tr>
+            </template>
+            <template v-else>
             <!-- 领料 -->
             <tr>
               <td>领料</td>
@@ -201,11 +215,13 @@
               <td></td>
               <td>□符合 □不符合</td>
             </tr>
+            </template>
             <!-- 综合判定 -->
             <tr class="judgement-row">
               <td>综合判定</td>
               <td colspan="8">
-                <div class="judgement-options">
+                <div v-if="form.conclusion" class="judgement-value">{{ form.conclusion }}</div>
+                <div v-else class="judgement-options">
                   <span>□合格</span>
                   <span>□返工</span>
                   <span>□报废</span>
@@ -242,6 +258,9 @@
         this.form = this.formList[0] || {};
         this.visible = true;
       },
+      getDetails(form) {
+        return Array.isArray(form.details) ? form.details : [];
+      },
       print() {
         const el = document.getElementById(
           'printSection_processInspectionRecord'

+ 9 - 7
src/views/batchRecord/print/electrodeBatchRecord/productLabelRecord.vue

@@ -107,14 +107,13 @@
             </tr>
           </thead>
           <tbody>
-            <tr>
-              <td style="border: 1px solid #000; padding: 6px 10px;">1. 剩余物料及废弃物已清理完成。</td>
-              <td style="border: 1px solid #000; padding: 6px; text-align: center;">□完成 &nbsp;□未完成</td>
-              <td style="border: 1px solid #000; padding: 6px; text-align: center;" rowspan="2">□合格 &nbsp;&nbsp;&nbsp;□不合格</td>
+            <tr v-for="(item, idx) in getCleaningItems(form)" :key="idx">
+              <td style="border: 1px solid #000; padding: 6px 10px;">{{ item.name }}</td>
+              <td style="border: 1px solid #000; padding: 6px; text-align: center;">{{ item.operationRecord }}</td>
+              <td style="border: 1px solid #000; padding: 6px; text-align: center;">{{ item.checkRecord }}</td>
             </tr>
-            <tr>
-              <td style="border: 1px solid #000; padding: 6px 10px;">2. 整理完成记录,交生产负责人审核。</td>
-              <td style="border: 1px solid #000; padding: 6px; text-align: center;">□完成 &nbsp;□未完成</td>
+            <tr v-if="!getCleaningItems(form).length">
+              <td colspan="3" style="border: 1px solid #000; padding: 12px; text-align: center;">暂无清场检查记录</td>
             </tr>
           </tbody>
         </table>
@@ -171,6 +170,9 @@
           ? form.materialRows
           : this.defaultMaterialRows;
       },
+      getCleaningItems(form) {
+        return Array.isArray(form.cleaningItems) ? form.cleaningItems : [];
+      },
       print() {
         const el = document.getElementById('printSection_productLabelRecord');
         const win = window.open('', '_blank');