+
得分:
{{ currentAnswerRecord.totalScore }}
@@ -985,7 +998,7 @@
type="primary"
class="selected-option"
>
- {{ option.optionValue }}. {{ option.optionText }}
+ {{ option.optionValue }}({{ option.optionScore }}分)
@@ -1966,7 +1979,8 @@ const loadSurveyResultData = async (surveyId: string | number) => {
// 从API获取真实数据
const [statisticsRes, recordsRes] = await Promise.all([
getSurveyStatistics(surveyId),
- getSurveyAnswerRecords(surveyId, { status: '1', pageNum: 1, pageSize: 10 })
+ // getSurveyAnswerRecords(surveyId, { status: '1', pageNum: 1, pageSize: 10 })
+ getSurveyAnswerRecords(surveyId, { pageNum: 1, pageSize: 10 })
]);
console.log('统计数据:', statisticsRes.data);
@@ -2008,20 +2022,23 @@ const calculateSatisfactionData = () => {
if (!surveyStatistics.value) return;
const stats = surveyStatistics.value;
+ // 获取总分,优先用currentResultSurvey.value.score,否则用stats.maxScore
+ const totalScore = currentResultSurvey.value?.score || stats.maxScore || 0;
- // 计算满意度等级
- const getSatisfactionLevel = (score: number) => {
- if (score >= 90) return '非常满意';
- if (score >= 80) return '满意';
- if (score >= 70) return '一般';
- if (score >= 60) return '不满意';
- return '非常不满意';
+ // 计算满意度等级(按平均分占总分比例)
+ const getSatisfactionLevel = (score: number, total: number) => {
+ if (!total || total === 0) return '无数据';
+ const percent = (score / total) * 100;
+ if (percent > 80) return '非常满意';
+ if (percent > 70) return '满意';
+ if (percent > 60) return '一般';
+ return '不满意';
};
// 从真实数据中计算满意度分布
satisfactionData.value = {
overallScore: stats.avgScore,
- satisfactionLevel: getSatisfactionLevel(stats.avgScore),
+ satisfactionLevel: getSatisfactionLevel(stats.avgScore, totalScore),
distribution: stats.satisfactionDistribution || {
excellent: 0,
good: 0,
@@ -2794,7 +2811,7 @@ onMounted(() => {
.overview-content {
.stat-cards {
display: grid;
- grid-template-columns: repeat(4, 1fr);
+ grid-template-columns: repeat(3, 1fr);
gap: 20px;
margin-bottom: 24px;
@@ -3540,4 +3557,77 @@ onMounted(() => {
margin: 5px 0;
}
}
+
+.satisfaction-rule-card {
+ background: #f8f9fa;
+ border: 1px solid #e4e7ed;
+ border-radius: 8px;
+ padding: 12px 20px;
+ margin-top: 8px;
+ font-size: 14px;
+ color: #606266;
+}
+.satisfaction-rule-card .rule-title {
+ font-weight: bold;
+ margin-bottom: 6px;
+}
+.satisfaction-rule-card ol {
+ margin: 0;
+ padding-left: 20px;
+}
+.satisfaction-rule-card li {
+ margin-bottom: 4px;
+}
+
+/* 满意度展示区样式 */
+.satisfaction-display {
+ display: flex;
+ justify-content: space-between;
+ align-items: flex-start;
+ gap: 20px;
+
+ .satisfaction-score {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+
+ .score-number {
+ font-size: 36px;
+ font-weight: bold;
+ color: #409eff;
+ }
+
+ .score-level {
+ font-size: 18px;
+ color: #303133;
+ margin-top: 5px;
+ }
+ }
+
+ .satisfaction-rule-card {
+ flex: 1;
+ background-color: #f8f9fa;
+ border-radius: 6px;
+ padding: 12px;
+ border: 1px solid #e4e7ed;
+
+ .rule-title {
+ font-size: 14px;
+ font-weight: 500;
+ color: #606266;
+ margin-bottom: 10px;
+ }
+
+ ol {
+ padding-left: 20px;
+ margin: 0;
+
+ li {
+ font-size: 13px;
+ line-height: 1.6;
+ color: #606266;
+ }
+ }
+ }
+}