From 95630f1507b3383d7e969abe7760bd768940e72f Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Fri, 23 Oct 2026 12:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../survey/components/SurveyResultsDialog.vue | 23 +++++++++----- .../survey/components/SurveyStatsField.vue | 6 +++- tests/unit/components/Survey.spec.js | 1 + .../unit/components/SurveySupplement.spec.js | 30 +++++++++++++++++++ 4 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 tests/unit/components/SurveySupplement.spec.js diff --git a/src/views/survey/components/SurveyResultsDialog.vue b/src/views/survey/components/SurveyResultsDialog.vue index 0fd4c93..4b92b6c 100644 --- a/src/views/survey/components/SurveyResultsDialog.vue +++ b/src/views/survey/components/SurveyResultsDialog.vue @@ -70,7 +70,7 @@ @@ -163,6 +163,7 @@ >
+
{{ (item.respondent && item.respondent.name) || '未填写姓名' }} · {{ item.respondent.company_name }}
{{ item.created_at }} String(o.key) === String(this.textOptionKey)) + const suffix = this.textKind === 'option' ? ' · ' + (option ? option.value : '选项') + ' · 补充内容' : this.textKind === 'other' ? ' · 补充内容' : ' · 回答' + return this.textQuestion.name + suffix } }, watch: { @@ -345,9 +347,11 @@ export default { this.replyVisible = true } }, - openTexts(q, kind) { + openTexts(q, kind, optionKey = '') { this.textQuestion = q this.textKind = kind + this.textOptionKey = optionKey + this.textTotal = 0 this.textPage = 1 this.texts = [] this.textsVisible = true @@ -356,16 +360,19 @@ export default { async loadTexts() { const epoch = this.epoch const questionId = this.textQuestion.id + const kind = this.textKind + const optionKey = this.textOptionKey this.textsLoading = true try { const res = await textAnswers({ course_content_evaluation_id: this.surveyData.id, question_id: questionId, - kind: this.textKind, + kind, + option_key: optionKey, page: this.textPage, page_size: 20 }) - if (epoch === this.epoch && questionId === this.textQuestion.id) { + if (epoch === this.epoch && this.textQuestion && questionId === this.textQuestion.id && kind === this.textKind && optionKey === this.textOptionKey) { this.texts = res.data || [] this.textTotal = Number(res.total || 0) } diff --git a/src/views/survey/components/SurveyStatsField.vue b/src/views/survey/components/SurveyStatsField.vue index a34eed9..6eee786 100644 --- a/src/views/survey/components/SurveyStatsField.vue +++ b/src/views/survey/components/SurveyStatsField.vue @@ -25,7 +25,11 @@ width="170" > + >{{ scope.row.percentage }}% + + + +