From 6d1c826ab6bb3f2cc7cd598a8317b40e403d898f Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 27 八月 2025 09:23:24 +0800
Subject: [PATCH] 测试完成
---
src/api/AiCentre/index.js | 2
src/views/followvisit/tasklist/index.vue | 2
src/permission.js | 80 ++--
src/views/satisfaction.vue | 875 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/views/knowledge/questionbank/particulars/index.vue | 4
src/views/knowledge/questionnaire/compilequer/index.vue | 7
src/router/index.js | 5
src/api/AiCentre/satisfaction.js | 23 +
8 files changed, 959 insertions(+), 39 deletions(-)
diff --git a/src/api/AiCentre/index.js b/src/api/AiCentre/index.js
index a124c74..60f658f 100644
--- a/src/api/AiCentre/index.js
+++ b/src/api/AiCentre/index.js
@@ -10,3 +10,5 @@
export * from './patientexternal'
export * from './EChartsdata'
export * from './satisfactionse'
+export * from './satisfaction'
+
diff --git a/src/api/AiCentre/satisfaction.js b/src/api/AiCentre/satisfaction.js
new file mode 100644
index 0000000..e7f6e43
--- /dev/null
+++ b/src/api/AiCentre/satisfaction.js
@@ -0,0 +1,23 @@
+import request from "@/utils/request";
+
+// 澶栭摼鑾峰彇闅忚
+export function getScriptByCondition(data) {
+ return request({
+ url: "/smartor/servicetask/getScriptByCondition",
+ method: "post",
+ data: data
+ });
+}
+
+
+
+// 缂撳瓨闂嵎
+export function saveMYDQuestionAnswer(data) {
+ return request({
+ url: "/smartor/subtaskAnswer/saveMYDQuestionAnswer",
+ method: "post",
+ data: data
+ });
+}
+
+
diff --git a/src/permission.js b/src/permission.js
index c36698f..91b16b0 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -1,55 +1,67 @@
-import router from './router'
-import store from './store'
-import { Message } from 'element-ui'
-import NProgress from 'nprogress'
-import 'nprogress/nprogress.css'
-import { getToken } from '@/utils/auth'
-import { isRelogin } from '@/utils/request'
+import router from "./router";
+import store from "./store";
+import { Message } from "element-ui";
+import NProgress from "nprogress";
+import "nprogress/nprogress.css";
+import { getToken } from "@/utils/auth";
+import { isRelogin } from "@/utils/request";
-NProgress.configure({ showSpinner: false })
+NProgress.configure({ showSpinner: false });
-const whiteList = ['/login', '/auth-redirect', '/bind', '/register','/wt','/xj','/sf', '/outsideChain','/outsideChainwt','/outsideChainxj']
+const whiteList = [
+ "/login",
+ "/auth-redirect",
+ "/bind",
+ "/register",
+ "/wt",
+ "/xj",
+ "/sf",
+ "/satisfaction",
+];
router.beforeEach((to, from, next) => {
- NProgress.start()
+ NProgress.start();
if (getToken()) {
- to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
+ to.meta.title && store.dispatch("settings/setTitle", to.meta.title);
/* has token*/
- if (to.path === '/login') {
- next({ path: '/' })
- NProgress.done()
+ if (to.path === "/login") {
+ next({ path: "/" });
+ NProgress.done();
} else {
if (store.getters.roles.length === 0) {
- isRelogin.show = true
+ isRelogin.show = true;
// 鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁宸叉媺鍙栧畬user_info淇℃伅
- store.dispatch('GetInfo').then(() => {
- isRelogin.show = false
- store.dispatch('GenerateRoutes').then(accessRoutes => {
- // 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛�
- router.addRoutes(accessRoutes) // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛�
- next({ ...to, replace: true }) // hack鏂规硶 纭繚addRoutes宸插畬鎴�
+ store
+ .dispatch("GetInfo")
+ .then(() => {
+ isRelogin.show = false;
+ store.dispatch("GenerateRoutes").then((accessRoutes) => {
+ // 鏍规嵁roles鏉冮檺鐢熸垚鍙闂殑璺敱琛�
+ router.addRoutes(accessRoutes); // 鍔ㄦ�佹坊鍔犲彲璁块棶璺敱琛�
+ next({ ...to, replace: true }); // hack鏂规硶 纭繚addRoutes宸插畬鎴�
+ });
})
- }).catch(err => {
- store.dispatch('LogOut').then(() => {
- Message.error(err)
- next({ path: '/' })
- })
- })
+ .catch((err) => {
+ store.dispatch("LogOut").then(() => {
+ Message.error(err);
+ next({ path: "/" });
+ });
+ });
} else {
- next()
+ next();
}
}
} else {
// 娌℃湁token
if (whiteList.indexOf(to.path) !== -1) {
// 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
- next()
+ next();
} else {
- next(`/login?redirect=${to.fullPath}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
- NProgress.done()
+ next(`/login?redirect=${to.fullPath}`); // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�
+ NProgress.done();
}
}
-})
+});
router.afterEach(() => {
- NProgress.done()
-})
+ NProgress.done();
+});
diff --git a/src/router/index.js b/src/router/index.js
index 84042a6..6a10307 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -62,6 +62,11 @@
hidden: true
},
{
+ path: '/satisfaction',
+ component: () => import('@/views/satisfaction'),
+ hidden: true
+ },
+ {
path: '/outsideChain',
component: () => import('@/views/outsideChain'),
hidden: true
diff --git a/src/views/followvisit/tasklist/index.vue b/src/views/followvisit/tasklist/index.vue
index 1db5fbb..9f51be9 100644
--- a/src/views/followvisit/tasklist/index.vue
+++ b/src/views/followvisit/tasklist/index.vue
@@ -475,7 +475,7 @@
},
],
taskoptions: store.getters.tasktypes,
- tasktopic: "2", //鏂板绫诲瀷
+ tasktopic: 2, //鏂板绫诲瀷
activname: "",
value: [],
list: [],
diff --git a/src/views/knowledge/questionbank/particulars/index.vue b/src/views/knowledge/questionbank/particulars/index.vue
index f13501d..b009153 100644
--- a/src/views/knowledge/questionbank/particulars/index.vue
+++ b/src/views/knowledge/questionbank/particulars/index.vue
@@ -1092,10 +1092,10 @@
)
.then(() => {
console.log(row);
- this.topicobj.scriptTopic = row.targetname;
+ // this.topicobj.scriptTopic = row.targetname;
this.topicobj.valueType = row.valueType;
this.topicobj.scriptType = row.scriptType;
- this.topicobj.scriptContent = row.targetdesc;
+ // this.topicobj.scriptContent = row.targetdesc;
this.topicobj.targetid = row.id;
this.topicobj.targetname = row.targetname;
this.topicobj.svyLibScriptOptions = [];
diff --git a/src/views/knowledge/questionnaire/compilequer/index.vue b/src/views/knowledge/questionnaire/compilequer/index.vue
index 074bb70..bc81908 100644
--- a/src/views/knowledge/questionnaire/compilequer/index.vue
+++ b/src/views/knowledge/questionnaire/compilequer/index.vue
@@ -2388,7 +2388,10 @@
display: flex;
.presentation-left {
width: 45%;
- // height: 500px;
+ max-height: 80vh;
+ padding: 0 20px;
+ font-size: 18px;
+ overflow: auto;
.button-textxg {
color: #024df0;
}
@@ -2408,7 +2411,7 @@
}
.presentation-right {
width: 55%;
- max-height: 688px;
+ max-height: 80vh;
padding: 0 20px;
font-size: 18px;
overflow: auto;
diff --git a/src/views/satisfaction.vue b/src/views/satisfaction.vue
new file mode 100644
index 0000000..cedc116
--- /dev/null
+++ b/src/views/satisfaction.vue
@@ -0,0 +1,875 @@
+<template>
+ <div class="questionnaire" :class="'survey-type-' + surveyType">
+ <div class="CONTENT" v-if="!accomplish">
+ <div class="preview-left">
+ <div class="toptitle">
+ <div class="title">{{ surveyTitle }}</div>
+ <div style="font-size: 22px; margin-bottom: 20px; line-height: 1.5">
+ {{ surveyDescription }}
+ </div>
+ </div>
+ <el-divider></el-divider>
+
+ <!-- 鍗曢�夐 -->
+ <div
+ class="topic-dev"
+ v-for="(item, index) in questionList"
+ :key="item.scriptId"
+ >
+ <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 1">
+ <div class="dev-text">
+ {{ index + 1 }}銆�<span style="line-height: 1.5"
+ >{{ item.scriptContent }}
+ <span style="color: #3ba2f7">[鍗曢�塢</span></span
+ >
+ </div>
+ <div class="dev-xx">
+ <el-radio-group
+ class="custom-radio"
+ v-model="item.scriptResult"
+ @change="handleOptionChange($event, index, item)"
+ >
+ <el-radio
+ border
+ v-for="(option, optIndex) in item.svyLibTemplateTargetoptions"
+ :class="
+ option.isabnormal &&
+ item.scriptResult == option.optioncontent
+ ? 'red-star'
+ : ''
+ "
+ :key="optIndex"
+ :label="option.optioncontent"
+ >{{ option.optioncontent }}</el-radio
+ >
+ </el-radio-group>
+ </div>
+ <div v-show="item.prompt">
+ <el-alert :title="item.prompt" type="warning"> </el-alert>
+ </div>
+ </div>
+
+ <!-- 澶氶�夐 -->
+ <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 2">
+ <div class="dev-text">
+ {{ index + 1 }}銆�<span style="line-height: 1.5"
+ >{{ item.scriptContent }}
+ <span style="color: #3ba2f7">[澶氶�塢</span></span
+ >
+ </div>
+ <div class="dev-xx">
+ <el-checkbox-group
+ class="custom-radio"
+ v-model="item.scriptResult"
+ >
+ <el-checkbox
+ border
+ @change="$forceUpdate()"
+ v-for="(option, optIndex) in item.svyLibTemplateTargetoptions"
+ :key="optIndex"
+ :label="option.optioncontent"
+ >
+ {{ option.optioncontent }}
+ </el-checkbox>
+ </el-checkbox-group>
+ </div>
+ <div v-show="item.prompt && item.scriptResult[0]">
+ <el-alert :title="item.prompt" type="warning"> </el-alert>
+ </div>
+ </div>
+
+ <!-- 濉┖棰� -->
+ <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 4">
+ <div class="dev-text">
+ {{ index + 1 }}銆�<span style="line-height: 1.5"
+ >{{ item.scriptContent
+ }}<span style="color: #3ba2f7">[闂瓟]</span></span
+ >
+ </div>
+ <div class="dev-xx">
+ <el-input
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ユ偍鐨勬剰瑙佹垨寤鸿"
+ v-model="item.scriptResult"
+ clearable
+ >
+ </el-input>
+ </div>
+ </div>
+ </div>
+
+ <div class="bottom-fixed">
+ <el-button
+ type="primary"
+ style="width: 80%; font-size: 20px"
+ @click="submitSurvey"
+ >鎻愪氦闂嵎</el-button
+ >
+ </div>
+ </div>
+ </div>
+
+ <div class="CONTENT" v-else>
+ <div class="preview-lefts">
+ <div class="completion-message">
+ <div class="thank-you">{{ this.accomplish||'鎰熻阿鎮ㄧ殑閰嶅悎!' }}</div>
+ <div class="feedback-message">{{ completionMessage }}</div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script>
+import {
+ getScriptByCondition,
+ saveMYDQuestionAnswer,
+} from "@/api/AiCentre/index";
+
+export default {
+ data() {
+ return {
+ surveyType: null, // 'outpatient', 'inpatient'
+ surveyTitle: "",
+ surveyDescription: "",
+ questionList: [],
+ completionMessage: "",
+ accomplish: false,
+
+ // 鍔犲瘑鍚庣殑鍙傛暟
+ encryptedParams: {
+ param1: "",
+ param2: "",
+ param3: "",
+ param4: "",
+ },
+
+ // 娴嬭瘯鏁版嵁
+ testData: {
+ 1: {
+ title: "闂ㄨ瘖婊℃剰搴﹁皟鏌�",
+ description:
+ "浜茬埍鐨勬偅鑰咃紝鎰熻阿鎮ㄩ�夋嫨鎴戜滑鐨勫尰鐤楁湇鍔°�備负浜嗕笉鏂彁鍗囨湇鍔¤川閲忥紝璇锋偍鑺卞嚑鍒嗛挓鏃堕棿濉啓姝ら棶鍗枫��",
+ questions: [
+ {
+ scriptId: 1,
+ scriptType: 1,
+ scriptContent: "鎮ㄥ闂ㄨ瘖鍖荤敓鐨勮瘖鐤楁按骞虫槸鍚︽弧鎰忥紵",
+ scriptResult: null,
+ svyLibTemplateTargetoptions: [
+ { optioncontent: "闈炲父婊℃剰", value: "5", isabnormal: false },
+ { optioncontent: "婊℃剰", value: "4", isabnormal: false },
+ { optioncontent: "涓�鑸�", value: "3", isabnormal: true },
+ { optioncontent: "涓嶆弧鎰�", value: "2", isabnormal: true },
+ { optioncontent: "闈炲父涓嶆弧鎰�", value: "1", isabnormal: true },
+ ],
+ },
+ {
+ scriptId: 2,
+ scriptType: 1,
+ scriptContent: "鎮ㄥ闂ㄨ瘖鎶ゅ+鐨勬湇鍔℃�佸害鏄惁婊℃剰锛�",
+ scriptResult: null,
+ svyLibTemplateTargetoptions: [
+ { optioncontent: "闈炲父婊℃剰", value: "5", isabnormal: false },
+ { optioncontent: "婊℃剰", value: "4", isabnormal: false },
+ { optioncontent: "涓�鑸�", value: "3", isabnormal: true },
+ { optioncontent: "涓嶆弧鎰�", value: "2", isabnormal: true },
+ { optioncontent: "闈炲父涓嶆弧鎰�", value: "1", isabnormal: true },
+ ],
+ },
+ {
+ scriptId: 3,
+ scriptType: 2,
+ scriptContent: "鎮ㄨ涓洪棬璇婂摢浜涙柟闈㈤渶瑕佹敼杩涳紵锛堝彲澶氶�夛級",
+ scriptResult: [],
+ svyLibTemplateTargetoptions: [
+ {
+ optioncontent: "鎺掗槦绛夊�欐椂闂�",
+ value: "waiting_time",
+ isabnormal: false,
+ },
+ {
+ optioncontent: "鍖荤敓娌熼�氭柟寮�",
+ value: "communication",
+ isabnormal: false,
+ },
+ {
+ optioncontent: "灏辫瘖鐜",
+ value: "environment",
+ isabnormal: false,
+ },
+ {
+ optioncontent: "鍖荤枟璁惧",
+ value: "equipment",
+ isabnormal: false,
+ },
+ { optioncontent: "鍏朵粬", value: "other", isabnormal: false },
+ ],
+ },
+ {
+ scriptId: 4,
+ scriptType: 4,
+ scriptContent: "鎮ㄥ闂ㄨ瘖鏈嶅姟杩樻湁浠�涔堝叾浠栧缓璁紵",
+ scriptResult: null,
+ },
+ ],
+ completionMessage:
+ "鎰熻阿鎮ㄥ疂璐电殑鎰忚锛佹垜浠皢涓嶆柇鏀硅繘闂ㄨ瘖鏈嶅姟璐ㄩ噺锛屼负鎮ㄦ彁渚涙洿濂界殑鍖荤枟鏈嶅姟浣撻獙銆�",
+ },
+ 2: {
+ title: "浣忛櫌婊℃剰搴﹁皟鏌�",
+ description:
+ "浜茬埍鐨勬偅鑰呭強瀹跺睘锛屾劅璋㈡偍閫夋嫨鍦ㄦ垜闄綇闄㈡不鐤椼�備负浜嗘彁鍗囦綇闄㈡湇鍔¤川閲忥紝璇锋偍濉啓姝ら棶鍗枫��",
+ questions: [
+ {
+ scriptId: 1,
+ scriptType: 1,
+ scriptContent: "鎮ㄥ浣忛櫌鏈熼棿鍖荤敓鐨勮瘖鐤楁按骞虫槸鍚︽弧鎰忥紵",
+ scriptResult: null,
+ svyLibTemplateTargetoptions: [
+ { optioncontent: "闈炲父婊℃剰", value: "5", isabnormal: false },
+ { optioncontent: "婊℃剰", value: "4", isabnormal: false },
+ { optioncontent: "涓�鑸�", value: "3", isabnormal: true },
+ { optioncontent: "涓嶆弧鎰�", value: "2", isabnormal: true },
+ { optioncontent: "闈炲父涓嶆弧鎰�", value: "1", isabnormal: true },
+ ],
+ },
+ {
+ scriptId: 2,
+ scriptType: 1,
+ scriptContent: "鎮ㄥ浣忛櫌鏈熼棿鎶ゅ+鐨勬姢鐞嗘湇鍔℃槸鍚︽弧鎰忥紵",
+ scriptResult: null,
+ svyLibTemplateTargetoptions: [
+ { optioncontent: "闈炲父婊℃剰", value: "5", isabnormal: false },
+ { optioncontent: "婊℃剰", value: "4", isabnormal: false },
+ { optioncontent: "涓�鑸�", value: "3", isabnormal: true },
+ { optioncontent: "涓嶆弧鎰�", value: "2", isabnormal: true },
+ { optioncontent: "闈炲父涓嶆弧鎰�", value: "1", isabnormal: true },
+ ],
+ },
+ {
+ scriptId: 3,
+ scriptType: 1,
+ scriptContent: "鎮ㄥ浣忛櫌鐥呮埧鐨勭幆澧冨拰鍗敓鏄惁婊℃剰锛�",
+ scriptResult: null,
+ svyLibTemplateTargetoptions: [
+ { optioncontent: "闈炲父婊℃剰", value: "5", isabnormal: false },
+ { optioncontent: "婊℃剰", value: "4", isabnormal: false },
+ { optioncontent: "涓�鑸�", value: "3", isabnormal: true },
+ { optioncontent: "涓嶆弧鎰�", value: "2", isabnormal: true },
+ { optioncontent: "闈炲父涓嶆弧鎰�", value: "1", isabnormal: true },
+ ],
+ },
+ {
+ scriptId: 4,
+ scriptType: 4,
+ scriptContent: "鎮ㄥ浣忛櫌鏈嶅姟杩樻湁浠�涔堝叾浠栧缓璁紵",
+ scriptResult: null,
+ },
+ ],
+ completionMessage:
+ "鎰熻阿鎮ㄥ鎴戜滑宸ヤ綔鐨勬敮鎸侊紒鎴戜滑灏嗘牴鎹偍鐨勫弽棣堟寔缁敼杩涗綇闄㈡湇鍔¤川閲忥紝绁濇偍鏃╂棩搴峰锛�",
+ },
+ },
+ };
+ },
+ created() {
+ this.initSurveyData();
+ },
+ methods: {
+ // 鍒濆鍖栬皟鏌ユ暟鎹�
+ initSurveyData() {
+ // 浠庤矾鐢卞弬鏁拌幏鍙栧姞瀵嗗悗鐨勫弬鏁�
+ this.encryptedParams.param1 =
+ this.$route.query.param1 ||
+ "DBohZ1ARKfFmCdKrBKQ6JW3ddPTtDpgSaRZaKtxBMTJ4FngT06Vy-VskiwDYJJRwfvkHrPIZlkafgZybobGtKQ==";
+ this.encryptedParams.param2 =
+ this.$route.query.param2 ||
+ "WQXniB7BIlizOwOQ4KZqITNrqWpLU3SD5vXdHLeYaviA-1T5Dtk70IJWAHbtcDUuYz-2ObYuMj4YKHfWhlCLzw==";
+ this.encryptedParams.param3 = this.$route.query.param3 || null;
+ this.encryptedParams.param4 = this.$route.query.param4 || "1"; // 榛樿涓洪棬璇�
+
+ this.surveyType = parseInt(this.encryptedParams.param4) || 1;
+
+ // 鍔犺浇闂嵎鏁版嵁
+ this.loadSurveyData();
+ },
+
+ // 鍔犺浇璋冩煡鏁版嵁
+ // 鍔犺浇璋冩煡鏁版嵁
+ loadSurveyData() {
+ // 璋冪敤鎺ュ彛鑾峰彇闂嵎鏁版嵁
+ getScriptByCondition(this.encryptedParams)
+ .then((res) => {
+ if (res.code === 200) {
+ if (res.data.result) {
+ this.accomplish = res.data.result;
+ return
+ }
+ // 澶勭悊鎺ュ彛杩斿洖鐨勬暟鎹�
+ this.questionList = res.data.svyLibTemplateScriptVOS.map((item) => {
+ return {
+ ...item,
+ scriptResult: item.scriptType === 2 ? [] : null,
+ };
+ });
+
+ // 鏍规嵁surveyType璁剧疆鏍囬鍜屾弿杩�
+ switch (this.surveyType) {
+ case 1: // 闂ㄨ瘖
+ this.surveyTitle = "闂ㄨ瘖婊℃剰搴﹁皟鏌�";
+ this.surveyDescription =
+ "浜茬埍鐨勬偅鑰咃紝鎰熻阿鎮ㄩ�夋嫨鎴戜滑鐨勫尰鐤楁湇鍔°�備负浜嗕笉鏂彁鍗囨湇鍔¤川閲忥紝璇锋偍鑺卞嚑鍒嗛挓鏃堕棿濉啓姝ら棶鍗枫��";
+ this.completionMessage =
+ "鎰熻阿鎮ㄥ疂璐电殑鎰忚锛佹垜浠皢涓嶆柇鏀硅繘闂ㄨ瘖鏈嶅姟璐ㄩ噺锛屼负鎮ㄦ彁渚涙洿濂界殑鍖荤枟鏈嶅姟浣撻獙銆�";
+ break;
+ case 2: // 浣忛櫌
+ this.surveyTitle = "浣忛櫌婊℃剰搴﹁皟鏌�";
+ this.surveyDescription =
+ "浜茬埍鐨勬偅鑰呭強瀹跺睘锛屾劅璋㈡偍閫夋嫨鍦ㄦ垜闄綇闄㈡不鐤椼�備负浜嗘彁鍗囦綇闄㈡湇鍔¤川閲忥紝璇锋偍濉啓姝ら棶鍗枫��";
+ this.completionMessage =
+ "鎰熻阿鎮ㄥ鎴戜滑宸ヤ綔鐨勬敮鎸侊紒鎴戜滑灏嗘牴鎹偍鐨勫弽棣堟寔缁敼杩涗綇闄㈡湇鍔¤川閲忥紝绁濇偍鏃╂棩搴峰锛�";
+ break;
+ case 3: // 鎶曡瘔寤鸿
+ this.surveyTitle = "鎶曡瘔寤鸿鍙嶉";
+ this.surveyDescription =
+ "灏婃暚鐨勫鎴凤紝鎰熻阿鎮ㄦ娊鍑哄疂璐垫椂闂存彁渚涘弽棣堛�傛偍鐨勬剰瑙佸鎴戜滑鏀硅繘鏈嶅姟闈炲父閲嶈銆�";
+ this.completionMessage =
+ "鎰熻阿鎮ㄧ殑鍙嶉锛佹垜浠凡鏀跺埌鎮ㄧ殑鎶曡瘔/寤鸿锛屽皢灏藉揩澶勭悊骞朵笌鎮ㄨ仈绯汇��";
+ break;
+ default:
+ this.useTestData(1); // 榛樿浣跨敤闂ㄨ瘖鏁版嵁
+ }
+ } else {
+ // 鎺ュ彛鏃犳暟鎹垨澶辫触锛屼娇鐢ㄦ祴璇曟暟鎹�
+ this.useTestData(this.surveyType);
+ }
+ })
+ .catch(() => {
+ // 鎺ュ彛璋冪敤澶辫触锛屼娇鐢ㄦ祴璇曟暟鎹�
+ this.useTestData(this.surveyType);
+ });
+ },
+
+ // 浣跨敤娴嬭瘯鏁版嵁
+ useTestData(surveyType) {
+ const type = [1, 2, 3].includes(surveyType) ? surveyType : 1;
+ const testData = this.testData[type];
+
+ this.surveyTitle = testData.title;
+ this.surveyDescription = testData.description;
+ this.questionList = testData.questions;
+ this.completionMessage = testData.completionMessage;
+ },
+
+ // 鎻愪氦璋冩煡闂嵎锛堢洿鎺ユ彁浜わ紝涓嶇粡杩囩紦瀛橈級
+ async submitSurvey() {
+ // 楠岃瘉蹇呭~椤�
+ if (this.hasUnansweredRequiredQuestions()) {
+ this.$message.error("璇峰畬鎴愭墍鏈夊繀濉棶棰樺悗鍐嶆彁浜�");
+ return;
+ }
+
+ try {
+ const submitData = this.prepareSubmitData();
+ const res = await saveMYDQuestionAnswer(submitData);
+
+ if (res.code === 200) {
+ this.accomplish = false;
+ this.$message.success("鎻愪氦鎴愬姛锛佹劅璋㈡偍鐨勫弽棣堛��");
+ } else {
+ this.$message.error(res.msg || "鎻愪氦澶辫触锛岃绋嶅悗鍐嶈瘯");
+ }
+ } catch (error) {
+ this.$message.error("缃戠粶閿欒锛屾彁浜ゅけ璐�");
+ console.error("鎻愪氦澶辫触:", error);
+ }
+ },
+
+ // 妫�鏌ユ槸鍚︽湁鏈洖绛旂殑蹇呭~闂
+ hasUnansweredRequiredQuestions() {
+ return this.questionList.some((question) => {
+ return (
+ question.required &&
+ (question.scriptResult === null ||
+ question.scriptResult === "" ||
+ (Array.isArray(question.scriptResult) &&
+ question.scriptResult.length === 0))
+ );
+ });
+ },
+
+ // 鍑嗗鎻愪氦鏁版嵁
+ // 鍑嗗鎻愪氦鏁版嵁
+ prepareSubmitData() {
+ return {
+ taskId: this.encryptedParams.param1,
+ serialnum: this.encryptedParams.param2 || this.encryptedParams.param3,
+ mzzy: this.surveyType, // 1=闂ㄨ瘖, 2=浣忛櫌, 3=鎶曡瘔寤鸿
+ svyLibTemplateScriptVOS: this.questionList.map((item) => {
+ return {
+ scriptId: item.scriptId,
+ scriptType: item.scriptType,
+ scriptResult:
+ item.scriptType === 2
+ ? (item.scriptResult || []).join("&")
+ : item.scriptResult || "",
+ nextScriptno: item.nextScriptno,
+ score: item.score,
+ prompt: item.prompt,
+ ...item,
+ };
+ }),
+ excep: this.checkAbnormalOptions() ? 1 : 0,
+ };
+ },
+
+ // 妫�鏌ュ紓甯搁�夐」
+ checkAbnormalOptions() {
+ return this.questionList.some((question) => {
+ if (!question.scriptResult) return false;
+
+ if (question.scriptType === 1) {
+ // 鍗曢�夐寮傚父妫�鏌�
+ const selectedOption = question.svyLibTemplateTargetoptions.find(
+ (opt) => opt.optioncontent === question.scriptResult
+ );
+ return selectedOption?.isabnormal;
+ } else if (question.scriptType === 2) {
+ // 澶氶�夐寮傚父妫�鏌�
+ return question.scriptResult.some((answer) => {
+ const option = question.svyLibTemplateTargetoptions.find(
+ (opt) => opt.optioncontent === answer
+ );
+ return option?.isabnormal;
+ });
+ }
+ return false;
+ });
+ },
+
+ // 澶勭悊鍗曢�夐�夐」鍙樺寲
+ handleOptionChange(selectedValue, index, question) {
+ const selectedOption = question.svyLibTemplateTargetoptions.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;
+ }
+ },
+ },
+};
+</script>
+
+<style lang="scss" scoped>
+/* 鍩虹鏍峰紡鍙橀噺 */
+:root {
+ --primary-color: #1a73e8; /* 榛樿钃濊壊 */
+ --secondary-color: #34d399; /* 榛樿缁胯壊 */
+ --alert-color: #ed8936; /* 榛樿姗欒壊 */
+}
+
+/* 闂ㄨ瘖鏍峰紡鍙橀噺 */
+.survey-type-1 {
+ --primary-color: #1a73e8; /* 鍖荤枟钃� */
+ --secondary-color: #34d399; /* 鍋ュ悍缁� */
+ --alert-color: #ed8936; /* 璀︾ず姗� */
+}
+
+/* 浣忛櫌鏍峰紡鍙橀噺 */
+.survey-type-2 {
+ --primary-color: #5a67d8; /* 娣辫摑绱� */
+ --secondary-color: #667eea; /* 娴呰摑绱� */
+ --alert-color: #f56565; /* 璀︾ず绾� */
+}
+
+/* 鎶曡瘔寤鸿鏍峰紡鍙橀噺 */
+.survey-type-3 {
+ --primary-color: #e53e3e; /* 绱ф�ョ孩 */
+ --secondary-color: #f6ad55; /* 璀︾ず榛� */
+ --alert-color: #f56565; /* 璀︾ず绾� */
+}
+
+.questionnaire {
+ font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;
+ min-height: 100vh;
+ margin: 0;
+ padding: 0;
+ color: #333;
+ transition: all 0.3s ease;
+
+ /* 鏍规嵁surveyType搴旂敤涓嶅悓鐨勪富棰� */
+ &.survey-type-1 {
+ background-color: #f5f9fc;
+ --theme-gradient: linear-gradient(135deg, #1a73e8, #34d399);
+ }
+
+ &.survey-type-2 {
+ background-color: #f8f9ff;
+ --theme-gradient: linear-gradient(135deg, #5a67d8, #667eea);
+ }
+
+ &.survey-type-3 {
+ background-color: #fff5f5;
+ --theme-gradient: linear-gradient(135deg, #e53e3e, #f6ad55);
+ }
+}
+
+.CONTENT {
+ max-width: 900px;
+ margin: 0 auto;
+ padding: 20px;
+
+ .title {
+ color: var(--primary-color);
+ font-size: 28px;
+ font-weight: 600;
+ margin-bottom: 15px;
+ text-align: center;
+ letter-spacing: 0.5px;
+ position: relative;
+
+ &::after {
+ content: "";
+ position: absolute;
+ bottom: -8px;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 60px;
+ height: 3px;
+ background: var(--theme-gradient);
+ border-radius: 3px;
+ }
+ }
+}
+
+.preview-left {
+ margin: 20px 0;
+ margin-bottom: 100px;
+ background-color: #fff;
+ border-radius: 12px;
+ padding: 30px;
+ border: none;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
+ transition: all 0.3s ease;
+
+ &:hover {
+ box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
+ }
+
+ .toptitle {
+ margin-bottom: 25px;
+
+ div {
+ color: #4a5568;
+ font-size: 18px;
+ line-height: 1.6;
+ text-align: center;
+ }
+ }
+
+ .el-divider {
+ background-color: #e2e8f0;
+ margin: 25px 0;
+ }
+
+ .topic-dev {
+ margin-bottom: 30px;
+ font-size: 17px;
+ background-color: #f8fafc;
+ border-radius: 10px;
+ padding: 20px;
+ transition: all 0.3s ease;
+ position: relative;
+ overflow: hidden;
+
+ &:hover {
+ background-color: #f1f5f9;
+ }
+
+ /* 娣诲姞绫诲瀷鏍囪瘑灏忔爣绛� */
+ &::before {
+ content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 4px;
+ height: 100%;
+ background: var(--primary-color);
+ }
+
+ .dev-text {
+ margin-bottom: 18px;
+ font-weight: 500;
+ color: #2d3748;
+ font-size: 18px;
+ line-height: 1.6;
+
+ span[style*="color: #3ba2f7"] {
+ font-size: 14px;
+ margin-left: 8px;
+ color: var(--primary-color) !important;
+ }
+ }
+ }
+}
+
+.preview-lefts {
+ margin: 20px 0;
+ background-color: #fff;
+ border-radius: 12px;
+ padding: 40px;
+ min-height: 400px;
+ border: none;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+
+ .completion-message {
+ padding: 40px;
+ max-width: 600px;
+
+ .thank-you {
+ font-size: 32px;
+ color: var(--primary-color);
+ font-weight: 600;
+ margin-bottom: 25px;
+ position: relative;
+ display: inline-block;
+
+ &::after {
+ content: "";
+ position: absolute;
+ bottom: -10px;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 80px;
+ height: 3px;
+ background: var(--theme-gradient);
+ border-radius: 3px;
+ }
+ }
+
+ .feedback-message {
+ font-size: 20px;
+ line-height: 1.7;
+ color: #4a5568;
+ margin: 0 auto;
+ }
+ }
+}
+
+.red-star {
+ ::v-deep .el-radio__label,
+ ::v-deep .el-checkbox__label {
+ position: relative;
+ padding-right: 20px;
+
+ &::after {
+ content: "*";
+ color: #ef4444;
+ position: absolute;
+ right: 0;
+ top: 0;
+ font-size: 16px;
+ }
+ }
+}
+
+::v-deep {
+ .el-checkbox-group {
+ display: flex;
+ flex-direction: column;
+ margin: 15px 0;
+ gap: 12px;
+ }
+
+ .el-radio-group {
+ display: flex;
+ flex-direction: column;
+ margin: 15px 0;
+ gap: 12px;
+ }
+
+ .el-radio.is-bordered,
+ .el-checkbox.is-bordered {
+ width: 100%;
+ margin-right: 0;
+ margin-bottom: 10px;
+ max-width: 400px;
+ padding: 14px 20px 14px 15px;
+ border-radius: 8px;
+ height: auto;
+ min-height: 50px;
+ border: 1px solid #e2e8f0;
+ transition: all 0.3s ease;
+ margin-left: 0 !important;
+ margin-top: 0 !important;
+ .el-radio-group,
+ .el-checkbox-group {
+ align-items: center;
+ }
+ &:hover {
+ border-color: var(--primary-color);
+ box-shadow: 0 2px 8px rgba(var(--primary-color), 0.15);
+ }
+
+ &.is-checked {
+ border-color: var(--primary-color);
+ background-color: rgba(var(--primary-color), 0.05);
+ }
+ }
+
+ .el-radio__label,
+ .el-checkbox__label {
+ font-size: 16px;
+ color: #2d3748;
+ }
+
+ .el-alert--warning.is-light {
+ background-color: #fff8f0;
+ color: var(--alert-color);
+ margin-top: 15px;
+ border-radius: 8px;
+ border-left: 4px solid var(--alert-color);
+
+ .el-alert__title {
+ font-size: 15px;
+ line-height: 1.6;
+ color: var(--alert-color);
+ }
+
+ .el-alert__closebtn {
+ color: var(--alert-color);
+ }
+ }
+
+ .el-textarea__inner {
+ font-size: 16px;
+ border-radius: 8px;
+ border: 1px solid #e2e8f0;
+ padding: 12px 15px;
+ transition: all 0.3s ease;
+ min-height: 100px;
+
+ &:focus {
+ border-color: var(--primary-color);
+ box-shadow: 0 0 0 2px rgba(var(--primary-color), 0.2);
+ }
+
+ &::placeholder {
+ color: #a0aec0;
+ }
+ }
+
+ .el-radio__input.is-checked .el-radio__inner {
+ background-color: var(--primary-color);
+ border-color: var(--primary-color);
+ }
+
+ .el-checkbox__input.is-checked .el-checkbox__inner {
+ background-color: var(--primary-color);
+ border-color: var(--primary-color);
+ }
+
+ .el-radio__inner,
+ .el-checkbox__inner {
+ width: 18px;
+ height: 18px;
+ }
+}
+
+.bottom-fixed {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ text-align: center;
+ padding: 10px 0;
+ background: var(--theme-gradient);
+ box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
+ z-index: 1000;
+ transition: all 0.3s ease;
+
+ .el-button {
+ height: 56px;
+ font-size: 18px;
+ font-weight: 500;
+ letter-spacing: 0.5px;
+ border-radius: 8px;
+ background-color: #fff;
+ color: var(--primary-color);
+ border: none;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
+ transition: all 0.3s ease;
+ width: 80%;
+ max-width: 400px;
+ position: relative;
+ overflow: hidden;
+
+ &::before {
+ content: "";
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(
+ 90deg,
+ transparent,
+ rgba(255, 255, 255, 0.4),
+ transparent
+ );
+ transition: all 0.5s ease;
+ }
+
+ &:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
+
+ &::before {
+ left: 100%;
+ }
+ }
+
+ &:active {
+ transform: translateY(0);
+ }
+ }
+}
+
+/* 鍝嶅簲寮忚璁� */
+@media (max-width: 768px) {
+ .questionnaire {
+ .CONTENT {
+ padding: 15px;
+ }
+
+ .preview-left,
+ .preview-lefts {
+ padding: 20px;
+ margin-bottom: 80px;
+ }
+
+ .title {
+ font-size: 24px !important;
+ }
+
+ .dev-text {
+ font-size: 16px !important;
+ }
+
+ .bottom-fixed .el-button {
+ height: 50px;
+ font-size: 16px;
+ width: 90%;
+ }
+ }
+}
+</style>
--
Gitblit v1.9.3