From 805b087e4d036c51e0b377b7264a99d37fb15ff0 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期六, 16 五月 2026 10:58:28 +0800
Subject: [PATCH] 更新质量管理模块,新增合格数量和不合格数量字段,修改数量标签为总数量,计算合格率展示
---
src/pages/qualityManagement/processInspection/index.vue | 48 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/src/pages/qualityManagement/processInspection/index.vue b/src/pages/qualityManagement/processInspection/index.vue
index e6a7281..816143d 100644
--- a/src/pages/qualityManagement/processInspection/index.vue
+++ b/src/pages/qualityManagement/processInspection/index.vue
@@ -75,11 +75,11 @@
</view>
</view>
<view class="status-tags">
- <u-tag :type="getTagType(item.checkResult)"
- v-if="item.checkResult!=null"
+ <u-tag :type="getPassRateTagType(item.passRate)"
+ v-if="item.passRate != null && item.passRate !== ''"
size="mini"
class="status-tag">
- {{ item.checkResult }}
+ {{ formatPassRate(item.passRate) }}
</u-tag>
<u-tag :type="getStateTagType(item.inspectState)"
size="mini"
@@ -107,8 +107,16 @@
<text class="detail-value">{{ item.checkName || '-' }}</text>
</view>
<view class="detail-row">
- <text class="detail-label">鏁伴噺</text>
+ <text class="detail-label">鎬绘暟閲�</text>
<text class="detail-value">{{ item.quantity || 0 }} {{ item.unit || '' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍚堟牸鏁伴噺</text>
+ <text class="detail-value">{{ item.qualifiedQuantity ?? '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">涓嶅悎鏍兼暟閲�</text>
+ <text class="detail-value">{{ item.unqualifiedQuantity ?? '-' }}</text>
</view>
<view class="detail-row">
<text class="detail-label">妫�娴嬪崟浣�</text>
@@ -315,11 +323,31 @@
return inspectState ? "checkmark-circle" : "time";
};
- // 鑾峰彇鏍囩绫诲瀷
- const getTagType = checkResult => {
- if (checkResult === "鍚堟牸") return "success";
- if (checkResult === "涓嶅悎鏍�") return "error";
- return "default";
+ const formatPassRate = val => {
+ if (val === null || val === undefined || val === "") return "-";
+ const n = Number(val);
+ if (Number.isNaN(n)) return String(val);
+ if (n > 0 && n <= 1) return `${(n * 100).toFixed(1)}%`;
+ return `${Number.isInteger(n) ? n : Number(n.toFixed(1))}%`;
+ };
+
+ const getPassRateTagType = val => {
+ if (val === null || val === undefined || val === "") return "default";
+ let n = Number(val);
+ if (Number.isNaN(n)) return "default";
+ if (n > 0 && n <= 1) n *= 100;
+ if (n >= 100) return "success";
+ if (n >= 60) return "warning";
+ return "error";
+ };
+
+ const isFullPassByPassRate = item => {
+ const v = item.passRate;
+ if (v === null || v === undefined || v === "") return false;
+ const n = Number(v);
+ if (Number.isNaN(n)) return false;
+ if (n > 0 && n <= 1) return n >= 1;
+ return n >= 100;
};
// 鑾峰彇鐘舵�佹爣绛剧被鍨�
@@ -383,7 +411,7 @@
item => !item.inspectState
).length;
qualifiedCount.value = inspectionList.value.filter(
- item => item.checkResult === "鍚堟牸"
+ isFullPassByPassRate
).length;
})
.catch(err => {
--
Gitblit v1.9.3