Bläddra i källkod

feat: 优化成品放行审批单的审核明细展示,支持分组和结论显示

xieyong 1 vecka sedan
förälder
incheckning
7d3b71717a
1 ändrade filer med 144 tillägg och 17 borttagningar
  1. 144 17
      src/views/batchRecord/print/electrodeBatchRecord/productReleaseApproval.vue

+ 144 - 17
src/views/batchRecord/print/electrodeBatchRecord/productReleaseApproval.vue

@@ -50,23 +50,58 @@
             </tr>
           </thead>
           <tbody v-if="Array.isArray(form.checklistDetailRows)">
-            <tr v-for="detail in form.checklistDetailRows" :key="detail.rowKey">
-              <td
-                v-if="detail.checkTypeRowSpan"
-                :rowspan="detail.checkTypeRowSpan"
-                class="check-type-cell"
-              >
-                {{ detail.checkTypeName }}
-              </td>
-              <td class="audit-item-cell">
-                {{ displayValue(detail.auditItem) }}
-              </td>
-              <td class="standard-cell">
-                {{ displayValue(detail.standard) }}
-              </td>
-              <td class="result-cell">
-                {{ displayValue(detail.result) }}
-              </td>
+            <tr v-for="row in flattenedChecklistRows" :key="row.rowKey">
+              <template v-if="row.type === 'detail'">
+                <td
+                  v-if="row.isFirstInGroup"
+                  :rowspan="row.groupSize"
+                  class="check-type-cell"
+                >
+                  {{ row.checkTypeName }}
+                </td>
+                <td class="audit-item-cell">
+                  {{ displayValue(row.detail.auditItem) }}
+                </td>
+                <td class="standard-cell">
+                  {{ displayValue(row.detail.standard) }}
+                </td>
+                <td class="result-cell">
+                  {{ displayValue(row.detail.result) }}
+                </td>
+              </template>
+              <template v-else-if="row.type === 'conclusion'">
+                <td class="checked-cell">结论</td>
+                <td colspan="2"
+                  >符合规定<span
+                    :class="[
+                      'check-box',
+                      getConclusionByCheckType(row.checkTypeName) ===
+                      '符合规定'
+                        ? 'checked'
+                        : ''
+                    ]"
+                  ></span
+                  > &nbsp; &nbsp; &nbsp; &nbsp; 不符合规定<span
+                    :class="[
+                      'check-box',
+                      getConclusionByCheckType(row.checkTypeName) ===
+                      '不符合规定'
+                        ? 'checked'
+                        : ''
+                    ]"
+                  ></span
+                ></td>
+              </template>
+              <template v-else>
+                <td class="reviewer-cell"
+                  >审核人</td
+                >
+                <td colspan="2"
+                  >{{
+                    getReviewerByCheckType(row.checkTypeName) || ''
+                  }}</td
+                >
+              </template>
             </tr>
             <tr v-if="!form.checklistDetailRows.length">
               <td colspan="4" class="empty-cell">暂无审核明细</td>
@@ -243,6 +278,55 @@
         formList: []
       };
     },
+    computed: {
+      groupedChecklistDetails() {
+        const rows = this.form && this.form.checklistDetailRows;
+        if (!Array.isArray(rows) || !rows.length) return [];
+        const groups = [];
+        let current = null;
+        for (const detail of rows) {
+          if (detail && detail.checkTypeRowSpan) {
+            if (current) groups.push(current);
+            current = {
+              checkTypeName: detail.checkTypeName,
+              items: []
+            };
+          }
+          if (current) current.items.push(detail);
+        }
+        if (current) groups.push(current);
+        return groups;
+      },
+      flattenedChecklistRows() {
+        const groups = this.groupedChecklistDetails;
+        const result = [];
+        for (let gIndex = 0; gIndex < groups.length; gIndex++) {
+          const group = groups[gIndex];
+          for (let i = 0; i < group.items.length; i++) {
+            const detail = group.items[i];
+            result.push({
+              rowKey: detail.rowKey || `detail-${result.length}`,
+              type: 'detail',
+              detail,
+              isFirstInGroup: i === 0,
+              groupSize: group.items.length + 2,
+              checkTypeName: group.checkTypeName
+            });
+          }
+          result.push({
+            rowKey: `conclusion-${gIndex}`,
+            type: 'conclusion',
+            checkTypeName: group.checkTypeName
+          });
+          result.push({
+            rowKey: `reviewer-${gIndex}`,
+            type: 'reviewer',
+            checkTypeName: group.checkTypeName
+          });
+        }
+        return result;
+      }
+    },
     methods: {
       open(data) {
         this.formList = Array.isArray(data) ? data : [data || {}];
@@ -254,6 +338,22 @@
           ? '-'
           : value;
       },
+      getReviewerByCheckType(checkTypeName) {
+        const form = this.form || {};
+        const map = {
+          生产放行: form.workCheckUserName,
+          质检放行: form.qualityCheckUserName,
+        };
+        return map[checkTypeName] || '';
+      },
+      getConclusionByCheckType(checkTypeName) {
+        const form = this.form || {};
+        const map = {
+          生产放行: form.workConclution,
+          质检放行: form.qualityConclution,
+        };
+        return map[checkTypeName] || '';
+      },
       print() {
         const el = document.getElementById(
           'printSection_productReleaseApproval'
@@ -312,6 +412,12 @@
           '.result-cell{text-align:center;white-space:nowrap;}'
         );
         win.document.write('.empty-cell{text-align:center;padding:20px;}');
+        win.document.write(
+          '.check-box{display:inline-block;width:14px;height:14px;border:1px solid #000;vertical-align:middle;margin:0 2px;}'
+        );
+        win.document.write(
+          '.check-box.checked::after{content:"√";font-weight:bold;display:block;text-align:center;line-height:12px;font-size:14px;}'
+        );
         win.document.write('</style>');
         win.document.write('</head><body>');
         win.document.write(el.innerHTML);
@@ -420,8 +526,29 @@
     text-align: center;
     white-space: nowrap;
   }
+
+  .reviewer-cell,.checked-cell{
+    font-weight: bold;
+  }
+
   .empty-cell {
     text-align: center;
     padding: 20px;
   }
+  .check-box {
+    display: inline-block;
+    width: 14px;
+    height: 14px;
+    border: 1px solid #000;
+    vertical-align: middle;
+    margin: 0 2px;
+  }
+  .check-box.checked::after {
+    content: '√';
+    font-weight: bold;
+    display: block;
+    text-align: center;
+    line-height: 12px;
+    font-size: 14px;
+  }
 </style>