| | |
| | | <text class="item-detail-label">单位:</text> |
| | | <text class="item-detail-value">{{ item.unit || '-' }}</text> |
| | | </view> |
| | | <!-- 数字型按上下限判定,把上下限摆出来才看得懂判定依据 --> |
| | | <view v-if="isNumeric(item)" |
| | | class="item-detail-row"> |
| | | <text class="item-detail-label">上下限:</text> |
| | | <text class="item-detail-value">{{ item.minValue }} ~ {{ item.maxValue }}</text> |
| | | </view> |
| | | <view class="item-detail-row"> |
| | | <text class="item-detail-label">标准值:</text> |
| | | <text class="item-detail-value">{{ item.standardValue || '-' }}</text> |
| | |
| | | </view> |
| | | <view class="item-detail-row"> |
| | | <text class="item-detail-label">检验值:</text> |
| | | <text class="item-detail-value">{{ item.testValue || '-' }}</text> |
| | | </view> |
| | | <view class="item-detail-row"> |
| | | <text class="item-detail-label">判定:</text> |
| | | <text class="item-detail-value result" |
| | | :class="getResultClass(item.testValue, item.standardValue)"> |
| | | {{ item.testValue || '-' }} |
| | | :class="judgeClass(item)"> |
| | | {{ judgeText(item) }} |
| | | </text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 操作按钮 --> |
| | | <!-- <view class="action-buttons"> |
| | | <!-- 需求九.4:下载 PDF 合格证 --> |
| | | <view class="action-buttons"> |
| | | <u-button type="primary" |
| | | class="action-btn" |
| | | :loading="downloading" |
| | | @click="downloadReport"> |
| | | 下载报告 |
| | | 下载合格证PDF |
| | | </u-button> |
| | | </view> --> |
| | | </view> |
| | | </view> |
| | | <view v-else |
| | | class="no-data"> |
| | |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import dayjs from "dayjs"; |
| | | import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js"; |
| | | import { downloadQualityInspectPdf } from "@/api/qualityManagement/qualityInspectFile.js"; |
| | | import { NUMERIC_TYPE, isItemPass } from "./_utils/inspection"; |
| | | |
| | | // 显示提示信息 |
| | | const showToast = message => { |
| | |
| | | const detailData = ref(null); |
| | | // 检验项目 |
| | | const inspectionItems = ref([]); |
| | | // 合格证PDF 下载中 |
| | | const downloading = ref(false); |
| | | |
| | | // 返回上一页 |
| | | const goBack = () => { |
| | |
| | | return state ? "success" : "warning"; |
| | | }; |
| | | |
| | | // 获取结果样式 |
| | | const getResultClass = (testValue, standardValue) => { |
| | | // 简单的结果判断逻辑,实际项目中可能需要更复杂的判断 |
| | | if (testValue === "合格") { |
| | | return "result-passed"; |
| | | } else if (testValue === "不合格") { |
| | | return "result-rejected"; |
| | | } |
| | | return ""; |
| | | // 数字型才有上下限 |
| | | const isNumeric = item => item?.parameterType === NUMERIC_TYPE; |
| | | |
| | | const judgeText = item => { |
| | | const val = item?.testValue; |
| | | if (val === null || val === undefined || val === "") return "-"; |
| | | return isItemPass(item) ? "合格" : "不合格"; |
| | | }; |
| | | |
| | | // 下载报告 |
| | | const downloadReport = () => { |
| | | uni.showToast({ |
| | | title: "报告下载中...", |
| | | icon: "loading", |
| | | }); |
| | | const judgeClass = item => { |
| | | const val = item?.testValue; |
| | | if (val === null || val === undefined || val === "") return ""; |
| | | return isItemPass(item) ? "result-passed" : "result-rejected"; |
| | | }; |
| | | |
| | | // 模拟下载 |
| | | setTimeout(() => { |
| | | uni.showToast({ |
| | | title: "报告下载成功", |
| | | icon: "success", |
| | | // 下载 PDF 合格证 |
| | | const downloadReport = () => { |
| | | if (!optionsId.value) { |
| | | showToast("参数错误"); |
| | | return; |
| | | } |
| | | downloading.value = true; |
| | | // downloadFileByPost 内部已 toast,这里只负责收尾 loading |
| | | downloadQualityInspectPdf(optionsId.value) |
| | | .catch(() => {}) |
| | | .finally(() => { |
| | | downloading.value = false; |
| | | }); |
| | | }, 1500); |
| | | }; |
| | | |
| | | // 获取详情数据 |
| | |
| | | color: #f56c6c; |
| | | } |
| | | |
| | | .action-buttons { |
| | | padding: 4px 0 8px; |
| | | } |
| | | |
| | | .action-btn { |
| | | width: 100%; |
| | | } |
| | | |
| | | // 空状态 |
| | | .no-data { |
| | | padding: 60px 20px; |