云
2026-09-22 ddc35c1d91e28509ceb86a50d8b10874936976aa
src/views/mes/qc/components/qc-report-print.vue
@@ -3,7 +3,7 @@
import { computed, nextTick, ref } from 'vue';
import { DICT_TYPE } from '@vben/constants';
import { DICT_TYPE, MesQcTypeEnum } from '@vben/constants';
import { getDictLabel } from '@vben/hooks';
import { useUserStore } from '@vben/stores';
import { formatDateTime } from '@vben/utils';
@@ -11,7 +11,8 @@
import { getQcReport } from '#/api/mes/qc/indicatorresult';
/**
 * MES 检验报告单打印组件(化工检验记录版式:表头 + 检验项矩阵 + 平行测量列 + 签字区)
 * MES 检验报告单打印组件(化工检验记录版式:表头 + 检验项矩阵 + 平行测量列 +
 * 判定结论/质检专用章 + 备注 + 签字区)
 *
 * 打印样式参考 erp/sale/order/modules/print.vue(Teleport + body class + @media print)。
 */
@@ -91,15 +92,25 @@
  return rows;
});
/** 检测结果文案(字典 mes_qc_check_result) */
/** 检测结果文案:优先用后端按质检类型解析的文案,缺失时按质检类型选字典兜底 */
const checkResultText = computed(() => {
  if (report.value.checkResultText) {
    return report.value.checkResultText;
  }
  if (report.value.checkResult == null) {
    return '-';
  }
  return (
    getDictLabel(DICT_TYPE.MES_QC_CHECK_RESULT, report.value.checkResult) || '-'
  );
  const dictType =
    report.value.qcType === MesQcTypeEnum.OQC
      ? DICT_TYPE.MES_OQC_CHECK_RESULT
      : DICT_TYPE.MES_QC_CHECK_RESULT;
  return getDictLabel(dictType, report.value.checkResult) || '-';
});
/** 测量列头:无平行测量时叫「测量值」,多批次时按「测量1」「测量2」区分 */
function measureHeader(no: number) {
  return measureNos.value.length > 1 ? `测量${no}` : '测量值';
}
function waitForPaint() {
  return new Promise<void>((resolve) => {
@@ -155,7 +166,6 @@
        <div>
          采样/检验时间:{{ formatDateTime(report.samplingTime) || '-' }}
        </div>
        <div>检测结论:{{ checkResultText }}</div>
        <div>打印时间:{{ printTime || '-' }}</div>
      </div>
@@ -168,7 +178,7 @@
            <th class="cell bg">方法/公式</th>
            <th class="cell w-24 bg">标准值</th>
            <th v-for="no in measureNos" :key="`h-${no}`" class="cell w-20 bg">
              测量{{ no }}
              {{ measureHeader(no) }}
            </th>
            <th class="cell bg">备注</th>
          </tr>
@@ -213,6 +223,12 @@
        </tbody>
      </table>
      <!-- 判定结论 + 质检专用章(判定结论带出检验结果,盖章区留空打印后人工盖章) -->
      <div class="mt-3 grid grid-cols-2 text-sm leading-[1.6]">
        <div class="cell min-h-[90px]">判定结论:{{ checkResultText }}</div>
        <div class="cell min-h-[90px]">质检专用章:</div>
      </div>
      <!-- 备注 + 签字区 -->
      <div class="mt-3 border border-solid border-[#dcdfe6] p-3 text-sm leading-[1.6]">
        备注:{{ report.remark || '-' }}