From bc9538a9e071259ca8bbb6de52c60c9d7a55a03b Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 23 九月 2026 14:02:44 +0800
Subject: [PATCH] 测试完成
---
src/views/Satisfaction/sfstatistics/components/DataOverview.vue | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/views/Satisfaction/sfstatistics/components/DataOverview.vue b/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
index 2cfa325..d221e0f 100644
--- a/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
+++ b/src/views/Satisfaction/sfstatistics/components/DataOverview.vue
@@ -445,8 +445,13 @@
const details = pickDetails(item);
let node = map.get(title);
if (!node) {
- node = { title, type: "", options: new Map() };
+ node = { title, type: "", options: new Map(), avgScore: null };
map.set(title, node);
+ }
+ // 缁煎悎寰楀垎锛氬悗绔繑鍥炵殑棰樼洰绾� avgScore锛堜笌棰樼洰鍚岀骇锛�
+ if (node.avgScore == null) {
+ const rawAvg = Number(item && item.avgScore);
+ node.avgScore = isNaN(rawAvg) ? null : rawAvg;
}
details.forEach((d) => {
@@ -480,7 +485,7 @@
return Array.from(map.values()).map((n) => {
const options = Array.from(n.options.values());
- const item = { title: n.title, type: n.type, options };
+ const item = { title: n.title, type: n.type, options, avgScore: n.avgScore };
// 澶氶�夐锛氱敤鍚勯�夐」鏁伴噺涔嬪拰浣滀负濉姤鎬婚噺锛堟帴鍙f湭鍗曠嫭鎻愪緵浜烘锛�
if (n.type === "multiple")
item.total = options.reduce((s, o) => s + o.count, 0);
@@ -595,7 +600,8 @@
veryBadRate: this.rateOf(veryBad.count, total),
naCount: na.count,
naRate: this.rateOf(na.count, total),
- score: this.scoreOfItems(items),
+ total,
+ score: this.formatScore(q.avgScore),
};
});
@@ -609,6 +615,17 @@
});
});
const total = sum.reduce((s, it) => s + it.count, 0);
+ // 鎬昏缁煎悎寰楀垎锛氭寜鍚勯濉姤閲忓姞鏉冨钩鍧囧悇棰� avgScore
+ let totalScoreNum = 0;
+ let totalScoreDen = 0;
+ this.satisfactionQuestions.forEach((q, i) => {
+ const avg = Number(q.avgScore);
+ const qTotal = rows[i] ? rows[i].total : 0;
+ if (!isNaN(avg) && qTotal) {
+ totalScoreNum += avg * qTotal;
+ totalScoreDen += qTotal;
+ }
+ });
rows.push({
category: "鎬昏",
veryGoodCount: sum[0].count,
@@ -623,7 +640,7 @@
veryBadRate: this.rateOf(sum[4].count, total),
naCount: sum[5].count,
naRate: this.rateOf(sum[5].count, total),
- score: this.scoreOfItems(sum),
+ score: totalScoreDen ? (totalScoreNum / totalScoreDen).toFixed(2) : "0.00",
});
return rows;
},
@@ -772,6 +789,11 @@
if (!denominator) return "0.00";
return (numerator / denominator).toFixed(2);
},
+ // 缁煎悎寰楀垎灞曠ず锛氱洿鎺ヤ娇鐢ㄥ悗绔� avgScore锛屾牸寮忓寲涓轰袱浣嶅皬鏁�
+ formatScore(val) {
+ const n = Number(val);
+ return isNaN(n) ? "0.00" : n.toFixed(2);
+ },
defaultRange() {
const end = new Date();
const start = new Date();
--
Gitblit v1.9.3