From feb5a669dced68415bc7e32f237f77bf9842fe8b Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 03 六月 2026 17:42:18 +0800
Subject: [PATCH] 测试完成
---
src/views/outsideChainwtnew.vue | 370 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 330 insertions(+), 40 deletions(-)
diff --git a/src/views/outsideChainwtnew.vue b/src/views/outsideChainwtnew.vue
index e435d5c..3882e7f 100644
--- a/src/views/outsideChainwtnew.vue
+++ b/src/views/outsideChainwtnew.vue
@@ -1,6 +1,6 @@
<template>
<div class="questionnaire-optimized">
- <div v-if="loading" class="loading-container">
+ <div v-if="loading && !accomplish" class="loading-container">
<div class="loading-content">
<i class="el-icon-loading loading-icon"></i>
<div class="loading-text">闂嵎鍔犺浇涓紝璇风◢鍊�...</div>
@@ -27,8 +27,146 @@
<el-divider class="custom-divider"></el-divider>
- <!-- 闂嵎棰樼洰鍖哄煙 -->
- <div class="questions-section">
+ <!-- 鎸夌淮搴﹀垎缁勭殑棰樼洰鍖哄煙 -->
+ <div class="dimension-section" v-if="hasDimension">
+ <!-- 閬嶅巻缁村害鍒嗙粍 -->
+ <div
+ class="dimension-group"
+ v-for="(group, dimensionKey) in dimensionGroups"
+ :key="dimensionKey"
+ >
+ <!-- 缁村害鏍囬 - 鍙樉绀烘湁缁村害鏍囩鐨� -->
+ <div class="dimension-title" v-if="group.dimensionLabel">
+ <h3>{{ group.dimensionLabel }}</h3>
+ </div>
+
+ <!-- 璇ョ淮搴︿笅鐨勯鐩� -->
+ <div class="questions-section">
+ <div
+ class="question-item"
+ v-for="(item, index) in group.questions"
+ :key="item.id"
+ :class="{
+ 'has-warning':
+ item.prompt &&
+ item.scriptResult &&
+ (item.scriptType !== 2 || item.scriptResult.length > 0),
+ }"
+ >
+ <!-- 棰樼洰棰樺共 -->
+ <div class="question-stem">
+ <span class="question-number"
+ >{{ getQuestionNumber(group, index) }}.</span
+ >
+ <span class="question-text">{{ item.scriptContent }}</span>
+ <span class="question-type-tag">
+ {{
+ item.scriptType == 1
+ ? "[鍗曢�塢"
+ : item.scriptType == 2
+ ? "[澶氶�塢"
+ : "[闂瓟]"
+ }}
+ </span>
+ </div>
+
+ <!-- 鍗曢�夐鐩� -->
+ <div
+ class="question-options"
+ v-if="item.scriptType == 1 && !item.ishide"
+ >
+ <el-radio-group
+ class="options-group"
+ v-model="item.scriptResult"
+ >
+ <el-radio
+ v-for="(
+ option, optionIndex
+ ) in item.svyTaskTemplateTargetoptions"
+ :key="optionIndex"
+ :label="option.optioncontent"
+ :class="{
+ 'abnormal-option':
+ option.isabnormal &&
+ item.scriptResult == option.optioncontent,
+ }"
+ @click.native.prevent="
+ handleRadioToggle(
+ item,
+ getGlobalIndex(dimension, group, index),
+ item.svyTaskTemplateTargetoptions,
+ option.optioncontent
+ )
+ "
+ class="option-radio"
+ >
+ <span class="option-text">{{
+ option.optioncontent
+ }}</span>
+ </el-radio>
+ </el-radio-group>
+ </div>
+
+ <!-- 澶氶�夐鐩� -->
+ <div class="question-options" v-if="item.scriptType == 2">
+ <el-checkbox-group
+ class="options-group"
+ v-model="item.scriptResult"
+ >
+ <el-checkbox
+ v-for="(
+ option, optionIndex
+ ) in item.svyTaskTemplateTargetoptions"
+ :key="optionIndex"
+ :label="option.optioncontent"
+ :class="{
+ 'abnormal-option': option.isabnormal,
+ }"
+ @change="$forceUpdate()"
+ class="option-checkbox"
+ >
+ <span class="option-text">{{
+ option.optioncontent
+ }}</span>
+ </el-checkbox>
+ </el-checkbox-group>
+ </div>
+
+ <!-- 濉┖棰樼洰 -->
+ <div class="question-input" v-if="item.scriptType == 4">
+ <el-input
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ユ偍鐨勫洖绛�"
+ v-model="item.scriptResult"
+ clearable
+ class="answer-textarea"
+ ></el-input>
+ </div>
+
+ <!-- 鎻愮ず淇℃伅 -->
+ <div
+ class="question-warning"
+ v-show="
+ item.prompt &&
+ item.scriptResult &&
+ (item.scriptType !== 2 || item.scriptResult.length > 0)
+ "
+ >
+ <el-alert
+ :title="item.prompt"
+ type="warning"
+ :closable="false"
+ class="warning-alert"
+ ></el-alert>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- 鏃犵淮搴︽椂鐨勯鐩尯鍩燂紙淇濇寔鍘熸牱锛� -->
+ <div class="questions-section" v-else>
<div
class="question-item"
v-for="(item, index) in visibleQuestions"
@@ -48,9 +186,9 @@
<span class="question-text">{{ item.scriptContent }}</span>
<span class="question-type-tag">
{{
- item.scriptType === 1
+ item.scriptType == 1
? "[鍗曢�塢"
- : item.scriptType === 2
+ : item.scriptType == 2
? "[澶氶�塢"
: "[闂瓟]"
}}
@@ -182,6 +320,7 @@
getExternalfollowup,
getCachequestionnaire,
Cachequestionnaire,
+ gettypeout,
Submitaquestionnaire,
geturlinfo,
} from "@/api/AiCentre/index";
@@ -202,6 +341,23 @@
dialogVisible: false,
Endornot: true,
accomplish: false,
+ dimensionTypes: [
+ {
+ value: 1,
+ label: "缁村害1",
+ listClass: "primary",
+ },
+ {
+ value: 2,
+ label: "缁村害浜�",
+ listClass: "primary",
+ },
+ {
+ value: 3,
+ label: "缁村害涓�",
+ listClass: "primary",
+ },
+ ],
// 鍓嶇鍏挜
publicKey:
"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKR0yHv0rbJWQE+Sc7/FwpW66qMd9qX2k6z+SDgkSdxWh/1GbBoAP7bDQQRF6vXmoKsD2ya42H6XRLSDXAoayuMCAwEAAQ== ",
@@ -222,6 +378,7 @@
// window.removeEventListener("beforeunload", this.cache);
},
created() {
+ this.gettypeout();
this.geturlinfo();
},
computed: {
@@ -231,6 +388,79 @@
return [];
}
return this.questionList.filter((question) => !question.ishide);
+ },
+
+ // 璁$畻灞炴�э細妫�鏌ユ槸鍚︽湁缁村害瀛楁
+ hasDimension() {
+ if (!this.questionList || this.questionList.length == 0) {
+ return false;
+ }
+ // 妫�鏌ヤ换鎰忎竴涓鐩槸鍚︽湁dimension瀛楁
+ return this.questionList.some(
+ (question) =>
+ question.dimension && this.getDimensionLabel(question.dimension)
+ );
+ },
+
+ // 璁$畻灞炴�э細鎸夌淮搴︽暣鐞嗛鐩�
+ dimensionGroups() {
+ if (!this.questionList || this.questionList.length == 0) {
+ return {};
+ }
+
+ const groups = {};
+ let currentGroupKey = null;
+ let groupStartIndex = 0; // 璁板綍褰撳墠缁村害缁勭殑寮�濮嬬储寮�
+
+ this.visibleQuestions.forEach((question, index) => {
+ const dimensionValue = question.dimension;
+ const dimensionLabel = this.getDimensionLabel(dimensionValue);
+
+ // 鐢熸垚缁刱ey锛氭湁缁村害鐢ㄧ淮搴﹀�硷紝鏃犵淮搴︾敤鐗规畩鏍囪+璧峰绱㈠紩
+ let groupKey;
+ if (dimensionValue && dimensionLabel) {
+ groupKey = `dimension-${dimensionValue}`;
+ } else {
+ // 鏃犵淮搴︽垨缁村害鏄犲皠涓嶅瓨鍦ㄧ殑棰樼洰鍗曠嫭鍒嗙粍
+ groupKey = `no-dimension-${groupStartIndex}`;
+ }
+
+ // 鍒涘缓鎴栬幏鍙栫淮搴︾粍
+ if (!groups[groupKey]) {
+ groups[groupKey] = {
+ questions: [],
+ startIndex: groupStartIndex,
+ dimensionValue: dimensionValue, // 淇濆瓨缁村害鍊肩敤浜庡悗缁鐞�
+ dimensionLabel: dimensionLabel, // 淇濆瓨缁村害鏍囩
+ isNoDimension: !dimensionValue || !dimensionLabel,
+ };
+ currentGroupKey = groupKey;
+ }
+
+ // 灏嗛鐩坊鍔犲埌瀵瑰簲鐨勭淮搴︾粍
+ groups[groupKey].questions.push(question);
+
+ // 濡傛灉涓嬩竴涓鐩淮搴︿笉鍚岋紝閲嶆柊寮�濮嬭鏁�
+ const nextQuestion = this.visibleQuestions[index + 1];
+ if (nextQuestion) {
+ const nextDimensionValue = nextQuestion.dimension;
+ const nextDimensionLabel = this.getDimensionLabel(nextDimensionValue);
+ const currentDimensionLabel = this.getDimensionLabel(dimensionValue);
+
+ // 鍒ゆ柇缁村害鏄惁鐩稿悓
+ if (
+ dimensionValue !== nextDimensionValue ||
+ (dimensionValue &&
+ nextDimensionValue &&
+ ((!dimensionValue && nextDimensionValue) ||
+ (dimensionValue && !nextDimensionValue)))
+ ) {
+ groupStartIndex = index + 1;
+ }
+ }
+ });
+
+ return groups;
},
},
methods: {
@@ -253,6 +483,23 @@
this.param6 = res.data.param6;
}
});
+ },
+ // 鑾峰彇瀛楀吀
+ gettypeout() {
+ gettypeout("dimensionality_type").then((res) => {
+ if (res.code == 200) {
+ this.dimensionTypes = res.data;
+ }
+ });
+ },
+ // 鏍规嵁缁村害鍊艰幏鍙栫淮搴︽爣绛�
+ getDimensionLabel(dimensionValue) {
+ if (!dimensionValue) return "";
+
+ const dimensionType = this.dimensionTypes.find(
+ (item) => item.dictValue == Number(dimensionValue)
+ );
+ return dimensionType ? dimensionType.dictLabel : "";
},
// extractLastSegmentFromUrl(url) {
// // 鎵惧埌鏈�鍚庝竴涓�'/'鐨勪綅缃�
@@ -431,19 +678,42 @@
getVisibleQuestionIndex(index) {
return index + 1;
},
+
+ // 鑾峰彇缁村害鍐呴鐩殑搴忓彿
+ getQuestionNumber(group, index) {
+ return group.startIndex + index + 1;
+ },
+
+ // 鑾峰彇棰樼洰鍦ㄥ叏閲忔暟缁勪腑鐨勭储寮�
+ getGlobalIndex(dimension, group, localIndex) {
+ return group.startIndex + localIndex;
+ },
+ // 鍦ㄦā鏉夸腑浣跨敤
+ getDimensionLabelForDisplay(dimensionKey) {
+ if (dimensionKey.startsWith("no-dimension-")) {
+ return "";
+ }
+ const dimensionValue = dimensionKey.replace("dimension-", "");
+ return this.getDimensionLabel(dimensionValue);
+ },
// 鏂板鐨勫垏鎹㈤�変腑/鍙栨秷閫変腑鏂规硶
- handleRadioToggle(questionItem, index, options, optionValue) {
+ handleRadioToggle(questionItem, globalIndex, options, optionValue) {
// 淇濆瓨褰撳墠鐘舵�佷互渚垮悗缁瘮杈�
const previousState = JSON.parse(JSON.stringify(this.questionList));
// 鍘熸湁鐨勫鐞嗛�昏緫
- if (questionItem.scriptResult === optionValue) {
+ if (questionItem.scriptResult == optionValue) {
questionItem.scriptResult = "";
questionItem.isabnormal = 0;
questionItem.showAppendInput = false;
} else {
questionItem.scriptResult = optionValue;
- this.handleOptionChange(optionValue, index, options, questionItem);
+ this.handleOptionChange(
+ optionValue,
+ globalIndex,
+ options,
+ questionItem
+ );
}
// 澶勭悊瀹屾垚鍚庯紝纭繚閲嶆柊璁$畻鍙棰樼洰鐨勫簭鍙�
@@ -517,12 +787,12 @@
}
// 褰撳墠棰樼洰鎬绘槸鍙
- if (index === questionIndex) {
+ if (index == questionIndex) {
return { ...item, ishide: 0, hiddenByEnd: false };
}
// 鏄剧ず鐩爣涓嬩竴棰�
- if (index === nextQuestionIndex) {
+ if (index == nextQuestionIndex) {
return { ...item, ishide: 0, hiddenByEnd: false };
}
@@ -544,8 +814,8 @@
// 濡傛灉娌℃湁璺宠浆锛屽彧闇�纭繚涓嬩竴棰樺彲瑙�
this.questionList = this.questionList.map((item, index) => ({
...item,
- ishide: index === questionIndex + 1 ? 0 : item.ishide,
- hiddenByEnd: index === questionIndex + 1 ? false : item.hiddenByEnd,
+ ishide: index == questionIndex + 1 ? 0 : item.ishide,
+ hiddenByEnd: index == questionIndex + 1 ? false : item.hiddenByEnd,
}));
}
@@ -554,32 +824,6 @@
this.$forceUpdate();
});
},
- // 澶勭悊鍗曢�夐�夐」
- // handleOptionChange(selectedvalue, index, arr) {
- // // 鏌ユ壘閫変腑鐨勯�夐」瀵硅薄
- // const selectedOption = arr.svyTaskTemplateTargetoptions.find(
- // (option) => option.optioncontent == selectedvalue
- // );
- // if (selectedOption) {
- // this.questionList[index].nextScriptno = selectedOption.nextQuestion;
- // this.questionList[index].score = selectedOption.score;
- // this.questionList[index].prompt = selectedOption.prompt;
- // }
- // },
- // 澶勭悊澶氶�夐�夐」
- // updateScore(selectedvalues, index, arr) {
- // // 锟斤拷鍔犲垎鏁�
- // let score = 0;
- // selectedvalues.forEach((value) => {
- // const selectedOption = arr.svyTaskTemplateTargetoptions.find(
- // (option) => option.optioncontent == value
- // );
- // if (selectedOption) {
- // score += Number(selectedOption.score);
- // }
- // });
- // this.questionList[index].score = score;
- // },
},
};
</script>
@@ -632,12 +876,40 @@
background-color: #eaeef2;
}
+/* 缁村害鍒嗙粍鏍峰紡 */
+.dimension-section {
+ margin-bottom: 20px;
+}
+
+.dimension-group {
+ margin-bottom: 30px;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+}
+
+.dimension-title {
+ background: linear-gradient(135deg, #e8f4ff 0%, #d1e7ff 100%);
+ padding: 12px 20px;
+ border-radius: 8px;
+ margin-bottom: 20px;
+ border-left: 4px solid #175997;
+
+ h3 {
+ color: #175997;
+ font-size: 20px;
+ font-weight: 600;
+ margin: 0;
+ }
+}
+
.questions-section {
- margin-bottom: 40px;
+ margin-bottom: 10px;
}
.question-item {
- margin-bottom: 35px;
+ margin-bottom: 25px;
padding: 20px;
border-radius: 8px;
border: 1px solid #eaeef2;
@@ -650,6 +922,10 @@
&.has-warning {
border-left: 4px solid #e6a23c;
+ }
+
+ &:last-child {
+ margin-bottom: 0;
}
}
@@ -756,6 +1032,8 @@
.submit-section {
text-align: center;
padding: 20px 0 10px;
+ border-top: 1px solid #eaeef2;
+ margin-top: 20px;
}
.submit-button {
@@ -849,6 +1127,14 @@
padding: 15px;
}
+ .dimension-title {
+ padding: 10px 15px;
+
+ h3 {
+ font-size: 18px;
+ }
+ }
+
.completion-content {
padding: 30px 20px;
}
@@ -874,6 +1160,10 @@
.completion-icon {
font-size: 60px;
}
+
+ .dimension-title h3 {
+ font-size: 16px;
+ }
}
.loading-container {
display: flex;
--
Gitblit v1.9.3