From c8e7f0a424f2ffee9281ae5072aff2f96641538e Mon Sep 17 00:00:00 2001 From: zpc Date: Mon, 23 Feb 2026 22:27:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=BB=E6=AD=A6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/assessment/record/index.vue | 61 ++++++++++++++++++- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/assessment/record/index.vue b/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/assessment/record/index.vue index e4dfa31..328b6c4 100644 --- a/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/assessment/record/index.vue +++ b/server/MiAssessment/src/MiAssessment.Admin/admin-web/src/views/business/assessment/record/index.vue @@ -175,9 +175,9 @@ - + @@ -282,6 +282,7 @@ import { type AssessmentReport, type AssessmentRecordQuery } from '@/api/business/assessmentRecord' +import { getScoreOptionList, type ScoreOptionItem } from '@/api/business/assessment' // ============ Constants ============ @@ -329,6 +330,7 @@ interface RecordPageState { reportLoading: boolean report: AssessmentReport | null exportLoading: boolean + scoreOptionMap: Map } // ============ Refs ============ @@ -356,7 +358,8 @@ const state = reactive({ reportVisible: false, reportLoading: false, report: null, - exportLoading: false + exportLoading: false, + scoreOptionMap: new Map() }) // ============ Helper Functions ============ @@ -375,6 +378,33 @@ function getStatusTagType(status: number): 'info' | 'primary' | 'warning' | 'suc } } +/** + * 根据答案值获取对应的评分标签 + */ +function getScoreLabel(answerValue: number): string { + const option = state.scoreOptionMap.get(answerValue) + return option ? option.label : String(answerValue) +} + +/** + * 根据答案值获取对应的评分描述 + */ +function getScoreDescription(answerValue: number): string { + const option = state.scoreOptionMap.get(answerValue) + return option ? option.description : '' +} + +/** + * 根据答案值获取标签颜色 + */ +function getScoreTagType(answerValue: number): 'danger' | 'warning' | 'info' | 'primary' | 'success' { + if (answerValue <= 2) return 'danger' + if (answerValue <= 4) return 'warning' + if (answerValue <= 6) return 'info' + if (answerValue <= 8) return 'primary' + return 'success' +} + // ============ API Functions ============ /** 加载测评记录列表 */ @@ -420,6 +450,10 @@ async function loadRecordDetail(id: number) { const res = await getRecordDetail(id) if (res.code === 0) { state.detail = res.data + // 加载评分标准映射(如果还没加载过) + if (state.scoreOptionMap.size === 0 && res.data?.assessmentTypeId) { + await loadScoreOptions(res.data.assessmentTypeId) + } } else { throw new Error(res.message || '获取测评记录详情失败') } @@ -431,6 +465,20 @@ async function loadRecordDetail(id: number) { } } +/** 加载评分标准 */ +async function loadScoreOptions(assessmentTypeId: number) { + try { + const res = await getScoreOptionList({ page: 1, pageSize: 100, assessmentTypeId }) + if (res.code === 0 && res.data?.list) { + state.scoreOptionMap = new Map( + res.data.list.map(item => [item.score, item]) + ) + } + } catch { + // 评分标准加载失败不影响主流程 + } +} + /** 加载测评报告 */ async function loadRecordReport(id: number) { state.reportLoading = true @@ -598,6 +646,13 @@ onMounted(() => { color: var(--text-secondary, #909399); } +.score-desc { + display: block; + font-size: 12px; + color: var(--text-secondary, #909399); + margin-top: 4px; +} + .pagination-wrapper { display: flex; justify-content: flex-end;