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/ChartsPanel.vue | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue b/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
index cc1be67..93f0164 100644
--- a/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
+++ b/src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
@@ -371,6 +371,11 @@
if (!den) return '0.00';
return (num / den).toFixed(2);
},
+ // 缁煎悎寰楀垎灞曠ず锛氱洿鎺ヤ娇鐢ㄥ悗绔� avgScore锛屾牸寮忓寲涓轰袱浣嶅皬鏁�
+ formatScore(val) {
+ const n = Number(val);
+ return isNaN(n) ? '0.00' : n.toFixed(2);
+ },
// 瑙f瀽姣斾緥瀛楃涓诧細"14.29%"銆�"0"銆�"0.5" 鈫� 鏁板�硷紙鐧惧垎姣旓級锛涙棤鏁堣繑鍥� null
parsePercent(value) {
if (value == null || value === '') return null;
@@ -382,7 +387,13 @@
const arr = Array.isArray(list) ? list : (list && (list.list || list.rows)) || [];
const options = [];
let total = 0;
+ let avgScore = null;
arr.forEach((item) => {
+ // 缁煎悎寰楀垎锛氬悗绔繑鍥炵殑棰樼洰绾� avgScore锛堜笌棰樼洰鍚岀骇锛�
+ if (avgScore == null) {
+ const rawAvg = Number(item && item.avgScore);
+ if (!isNaN(rawAvg)) avgScore = rawAvg;
+ }
const details = Array.isArray(item && item.subtaskDetailRatioExportList)
? item.subtaskDetailRatioExportList
: [];
@@ -395,7 +406,7 @@
total += count;
});
});
- return { options, total };
+ return { options, total, avgScore };
},
// 鍗曢閫夐」缁熻锛堢湡瀹炴帴鍙� /smartor/serviceSubtaskDetail/sltdMydTotalByScore锛�
async fetchSingleQuestion() {
@@ -425,7 +436,7 @@
const res = await sltdMydTotalByScore(payload);
console.log('[sltdMydTotalByScore 鍗曢] code=', res && res.code, 'data=', JSON.stringify(res && res.data).slice(0, 1500));
const list = res && res.code === 200 ? res.data : [];
- const { options, total } = this.normalizeSingleQuestion(list);
+ const { options, total, avgScore } = this.normalizeSingleQuestion(list);
this.singleQuestionData = options.map((o) => ({
option: o.option,
count: o.count,
@@ -435,7 +446,7 @@
}));
this.singleQuestionMeta = {
total: total.toLocaleString(),
- score: this.scoreOfOptions(options),
+ score: this.formatScore(avgScore),
};
if (!options.length) this.notify('褰撳墠鏉′欢涓嬫殏鏃犺棰樼殑閫夐」缁熻鏁版嵁', 'warning');
} catch (e) {
--
Gitblit v1.9.3