From e9f35f9782f3d99d742c294fe503fc1294f203c4 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期一, 14 九月 2026 11:10:31 +0800
Subject: [PATCH] 测试完成
---
src/views/outsideChainnew.vue | 292 +++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 195 insertions(+), 97 deletions(-)
diff --git a/src/views/outsideChainnew.vue b/src/views/outsideChainnew.vue
index 4c9d925..3feadf1 100644
--- a/src/views/outsideChainnew.vue
+++ b/src/views/outsideChainnew.vue
@@ -8,7 +8,9 @@
{{
kcb
? kcb
- : "浜茬埍鐨勬偅鑰�-瀹跺睘锛屾偍濂斤紒鎴戜滑鏄禉涓尰澶т簩闄㈢殑鍖绘姢浜哄憳锛屼负浜嗘洿濂藉湴浜嗚В鎮ㄧ殑搴峰鎯呭喌锛岃鎮ㄦ娊涓�鐐瑰疂璐垫椂闂达紝瀹屾垚杩欎唤闅忚闂嵎銆�"
+ : "浜茬埍鐨勬偅鑰�-瀹跺睘锛屾垜浠槸" +
+ localStorage.getItem("orgname") +
+ "鐨勫尰鎶や汉鍛橈紝涓轰簡鏇村ソ鍦颁簡瑙f偍鐨勫悍澶嶆儏鍐碉紝璇锋偍鎶戒竴鐐瑰疂璐垫椂闂达紝瀹屾垚杩欎唤闅忚闂嵎銆�"
}}
<!-- 浜茬埍鐨勬偅鑰�/瀹跺睘鎮ㄥソ锛屼负浜嗘洿濂界殑浜嗚В鎮ㄥ嚭闄㈠悗鐨勫悍澶嶆儏鍐碉紝缁欐偍閫傚綋鍙婃椂鐨勫仴搴锋寚瀵硷紝璇锋偍鎶戒竴鐐瑰疂璐垫椂闂达紝瀹屾垚杩欎唤鍑洪櫌闅忚闂嵎璋冩煡銆� -->
</div>
@@ -20,9 +22,15 @@
v-for="(item, index) in questionList"
:key="item.aaa"
>
- <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 1">
+ <div
+ class="scriptTopic-dev"
+ :key="index"
+ v-if="item.scriptType == 1"
+ :class="{ 'required-error': item.requiredError }"
+ >
<div class="dev-text">
{{ index + 1 }}銆�<span style="line-height: 1.5"
+ ><span v-if="isRequired(item)" class="required-star">*</span
>{{ item.scriptContent }}
<span style="color: #3ba2f7">[鍗曢�塢</span></span
>
@@ -30,20 +38,20 @@
<div class="dev-xx">
<el-radio-group
class="custom-radio"
- v-model="item.scriptResult"
+ v-model="item.questionResult"
@change="handleOptionChange($event, index, item)"
>
<el-radio
border
- v-for="(items, index) in item.svyLibTemplateTargetoptions"
+ v-for="(items, index) in item.ivrTaskScriptTargetoptionList"
:class="
- items.isabnormal && item.scriptResult == items.optioncontent
+ items.isabnormal && item.questionResult == items.targetvalue
? 'red-star'
: ''
"
:key="index"
- :label="items.optioncontent"
- >{{ items.optioncontent }}</el-radio
+ :label="items.targetvalue"
+ >{{ items.targetvalue }}</el-radio
>
</el-radio-group>
</div>
@@ -52,9 +60,15 @@
</div>
</div>
<!-- 澶氶�� -->
- <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 2">
+ <div
+ class="scriptTopic-dev"
+ :key="index"
+ v-if="item.scriptType == 2"
+ :class="{ 'required-error': item.requiredError }"
+ >
<div class="dev-text">
{{ index + 1 }}銆�<span style="line-height: 1.5"
+ ><span v-if="isRequired(item)" class="required-star">*</span
>{{ item.scriptContent }}
<span style="color: #3ba2f7">[澶氶�塢</span></span
>
@@ -62,29 +76,35 @@
<div class="dev-xx">
<el-checkbox-group
class="custom-radio"
- v-model="item.scriptResult"
+ v-model="item.questionResult"
@change="updateScore($event, index, item)"
>
<el-checkbox
border
@change="$forceUpdate()"
- v-for="(items, indexs) in item.svyLibTemplateTargetoptions"
+ v-for="(items, indexs) in item.ivrTaskScriptTargetoptionList"
:key="indexs"
- :label="items.optioncontent"
+ :label="items.targetvalue"
>
- {{ items.optioncontent }}
+ {{ items.targetvalue }}
</el-checkbox>
</el-checkbox-group>
</div>
<!-- :class="items.isabnormal ? 'red-star' : ''" -->
- <div v-show="item.prompt && item.scriptResult[0]">
+ <div v-show="item.prompt && item.questionResult[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="scriptTopic-dev"
+ :key="index"
+ v-if="item.scriptType == 4 || item.scriptType == 3"
+ :class="{ 'required-error': item.requiredError }"
+ >
<div class="dev-text">
{{ index + 1 }}銆�<span style="line-height: 1.5"
+ ><span v-if="isRequired(item)" class="required-star">*</span
>{{ item.scriptContent
}}<span style="color: #3ba2f7">[闂瓟]</span></span
>
@@ -94,7 +114,7 @@
type="textarea"
:rows="3"
placeholder="璇疯緭鍏ョ瓟妗�"
- v-model="item.scriptResult"
+ v-model="item.questionResult"
clearable
>
</el-input>
@@ -153,6 +173,7 @@
Submitaquestionnaire,
geturlinfo,
} from "@/api/AiCentre/index";
+import { type } from "jquery";
import JSEncrypt from "jsencrypt";
export default {
data() {
@@ -161,91 +182,93 @@
patid: 265823,
kcb: "",
excep: "",
+ taskname: "",
+ param6: null,
questionList: [
// {
// scriptType: 1,
// scriptContent: "鎮ㄧ殑骞撮緞鑼冨洿鏄紵",
- // scriptResult: null,
- // svyLibTemplateTargetoptions: [
- // { optioncontent: "18-25", value: "18-25", isabnormal: true },
- // { optioncontent: "26-35", value: "26-35" },
- // { optioncontent: "36-45", value: "36-45" },
- // { optioncontent: "46-55", value: "46-55" },
- // { optioncontent: "56+", value: "56+" },
+ // questionResult: null,
+ // ivrTaskScriptTargetoptionList: [
+ // { targetvalue: "18-25", value: "18-25", isabnormal: true },
+ // { targetvalue: "26-35", value: "26-35" },
+ // { targetvalue: "36-45", value: "36-45" },
+ // { targetvalue: "46-55", value: "46-55" },
+ // { targetvalue: "56+", value: "56+" },
// ],
// required: true,
// },
// {
// scriptType: 1,
// scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
- // scriptResult: null,
- // svyLibTemplateTargetoptions: [
- // { optioncontent: "瀛︾敓", value: "student" },
- // { optioncontent: "鏁欏笀", value: "teacher" },
- // { optioncontent: "宸ョ▼甯�", value: "engineer" },
- // { optioncontent: "鍖荤敓", value: "doctor" },
- // { optioncontent: "鍏朵粬", value: "other" },
+ // questionResult: null,
+ // ivrTaskScriptTargetoptionList: [
+ // { targetvalue: "瀛︾敓", value: "student" },
+ // { targetvalue: "鏁欏笀", value: "teacher" },
+ // { targetvalue: "宸ョ▼甯�", value: "engineer" },
+ // { targetvalue: "鍖荤敓", value: "doctor" },
+ // { targetvalue: "鍏朵粬", value: "other" },
// ],
// required: false,
// },
// {
// scriptType: 2,
// scriptContent: "鎮ㄦ劅鍏磋叮鐨勬椿鍔ㄦ湁鍝簺锛�",
- // scriptResult: [],
- // svyLibTemplateTargetoptions: [
- // { optioncontent: "鏃呮父", value: "travel", isabnormal: true },
- // { optioncontent: "闃呰", value: "reading", isabnormal: true },
- // { optioncontent: "杩愬姩", value: "sports", isabnormal: true },
- // { optioncontent: "闊充箰", value: "music" },
- // { optioncontent: "鐢靛奖", value: "movies" },
+ // questionResult: [],
+ // ivrTaskScriptTargetoptionList: [
+ // { targetvalue: "鏃呮父", value: "travel", isabnormal: true },
+ // { targetvalue: "闃呰", value: "reading", isabnormal: true },
+ // { targetvalue: "杩愬姩", value: "sports", isabnormal: true },
+ // { targetvalue: "闊充箰", value: "music" },
+ // { targetvalue: "鐢靛奖", value: "movies" },
// ],
// required: false,
// },
// {
// scriptType: 1,
// scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
- // scriptResult: null,
- // svyLibTemplateTargetoptions: [
- // { optioncontent: "瀛︾敓", value: "student" },
- // { optioncontent: "鏁欏笀", value: "teacher" },
- // { optioncontent: "宸ョ▼甯�", value: "engineer" },
- // { optioncontent: "鍖荤敓", value: "doctor" },
- // { optioncontent: "鍏朵粬", value: "other" },
+ // questionResult: null,
+ // ivrTaskScriptTargetoptionList: [
+ // { targetvalue: "瀛︾敓", value: "student" },
+ // { targetvalue: "鏁欏笀", value: "teacher" },
+ // { targetvalue: "宸ョ▼甯�", value: "engineer" },
+ // { targetvalue: "鍖荤敓", value: "doctor" },
+ // { targetvalue: "鍏朵粬", value: "other" },
// ],
// required: false,
// },
// {
// scriptType: 1,
// scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
- // scriptResult: null,
- // svyLibTemplateTargetoptions: [
- // { optioncontent: "瀛︾敓", value: "student" },
- // { optioncontent: "鏁欏笀", value: "teacher" },
- // { optioncontent: "宸ョ▼甯�", value: "engineer", isabnormal: true },
- // { optioncontent: "鍖荤敓", value: "doctor" },
- // { optioncontent: "鍏朵粬", value: "other" },
+ // questionResult: null,
+ // ivrTaskScriptTargetoptionList: [
+ // { targetvalue: "瀛︾敓", value: "student" },
+ // { targetvalue: "鏁欏笀", value: "teacher" },
+ // { targetvalue: "宸ョ▼甯�", value: "engineer", isabnormal: true },
+ // { targetvalue: "鍖荤敓", value: "doctor" },
+ // { targetvalue: "鍏朵粬", value: "other" },
// ],
// required: false,
// },
// {
// scriptType: 1,
// scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
- // scriptResult: null,
- // svyLibTemplateTargetoptions: [
- // { optioncontent: "瀛︾敓", value: "student" },
- // { optioncontent: "鏁欏笀", value: "teacher" },
- // { optioncontent: "宸ョ▼甯�", value: "engineer" },
- // { optioncontent: "鍖荤敓", value: "doctor" },
- // { optioncontent: "鍏朵粬", value: "other" },
+ // questionResult: null,
+ // ivrTaskScriptTargetoptionList: [
+ // { targetvalue: "瀛︾敓", value: "student" },
+ // { targetvalue: "鏁欏笀", value: "teacher" },
+ // { targetvalue: "宸ョ▼甯�", value: "engineer" },
+ // { targetvalue: "鍖荤敓", value: "doctor" },
+ // { targetvalue: "鍏朵粬", value: "other" },
// ],
// required: false,
// },
// {
// scriptType: 4,
// scriptContent: "鎮ㄧ殑濮撳悕鏄粈涔堬紵",
- // scriptResult: "name",
+ // questionResult: "name",
// required: true,
- // scriptResult: null,
+ // questionResult: null,
// },
],
jsy: null,
@@ -279,31 +302,40 @@
geturlinfo() {
// let url = window.location.href;
let url = this.$route.query.p;
+ console.log(445);
+
// let url = 'http://218.108.11.22:8093/sf/003';
// let urlid = this.extractLastSegmentFromUrl(url);
- geturlinfo( url ).then((res) => {
- if (res.code==200) {
- this.getQuestionnaire(res.data.param1,res.data.param2,res.data.param3,res.data.param5,)
- }
+ geturlinfo(url).then((res) => {
+ if (res.code == 200) {
+
+ this.getQuestionnaire(
+ res.data.param1,
+ res.data.param2,
+ res.data.param3,
+ res.data.param5
+ );
+ this.param6 = res.data.param6;
+ }
});
},
-// extractLastSegmentFromUrl(url) {
-// // 鎵惧埌鏈�鍚庝竴涓�'/'鐨勪綅缃�
-// const lastSlashIndex = url.lastIndexOf('/');
-// // 濡傛灉鎵惧埌浜�'/'锛屾埅鍙栧叾鍚庣殑鎵�鏈夊瓧绗�
-// if (lastSlashIndex !== -1) {
-// return url.substring(lastSlashIndex + 1);
-// }
-// // 濡傛灉娌℃湁鎵惧埌'/'锛岃繑鍥炵┖瀛楃涓�
-// return '';
-// },
+ // extractLastSegmentFromUrl(url) {
+ // // 鎵惧埌鏈�鍚庝竴涓�'/'鐨勪綅缃�
+ // const lastSlashIndex = url.lastIndexOf('/');
+ // // 濡傛灉鎵惧埌浜�'/'锛屾埅鍙栧叾鍚庣殑鎵�鏈夊瓧绗�
+ // if (lastSlashIndex !== -1) {
+ // return url.substring(lastSlashIndex + 1);
+ // }
+ // // 濡傛灉娌℃湁鎵惧埌'/'锛岃繑鍥炵┖瀛楃涓�
+ // return '';
+ // },
// 鑾峰彇鏁版嵁
- getQuestionnaire(param1,param2,param3) {
+ getQuestionnaire(param1, param2, param3) {
this.taskid = decodeURIComponent(param1);
this.patid = decodeURIComponent(param2);
- this.taskname = param3;
+ // this.taskname = param3;
// let taskid =
// "OFp7tn/B6x7IzKJetvGWHdSWBj7msRlnlj6am9dyuHTH6sEt4uBbVCUXs5kcF/e4O2W6vqHf2Bz9K3/evbYDmw==";
// let patid =
@@ -313,17 +345,17 @@
// let taskids = this.encrypt(this.taskid);
// let patids = this.encrypt(this.patid);
// 鍏堝彇缂撳瓨
- getCachequestionnaire({ param1: this.taskid, param2: this.patid }).then(
+ getCachequestionnaire({ param1: this.taskid, param2: this.patid,param6:this.param6 }).then(
(res) => {
if (res.code == 200) {
this.questionList = res.data;
this.accomplish = res.data.submit;
if (this.questionList[0]) {
this.questionList.forEach((item) => {
- if (item.scriptResult && item.scriptType != 2) {
- item.scriptResult = JSON.parse(item.scriptResult);
- } else if (item.scriptResult && item.scriptType == 2) {
- item.scriptResult = item.scriptResult.split("&");
+ if (item.questionResult && item.scriptType != 2) {
+ item.questionResult = JSON.parse(item.questionResult);
+ } else if (item.questionResult && item.scriptType == 2) {
+ item.questionResult = item.questionResult.split("&");
}
});
return;
@@ -338,17 +370,20 @@
},
// 鑾峰彇鏁版嵁
getExternalfollowup() {
- getExternalfollowup({ param1: this.taskid, param2: this.patid }).then(
+ getExternalfollowup({ param1: this.taskid, param2: this.patid,param6:this.param6 }).then(
(res) => {
if (res.code == 200) {
this.questionList = res.data.script;
this.jsy = res.data.jsy;
this.kcb = res.data.kcb;
+ this.taskname = res.data.taskName;
+ this.type = res.data.type;
+
// 澶勭悊棰樼洰鏀堕泦缁撴灉鏍煎紡
this.questionList.forEach((item) => {
item.nextScriptno = Number(item.nextScriptno);
if (item.scriptType == 2) {
- item.scriptResult = [];
+ item.questionResult = [];
}
});
}
@@ -373,14 +408,17 @@
let form = {
param1: this.taskid,
param2: this.patid,
+ param6: this.param6,
excep: this.excep,
+ type: this.type,
serviceSubtaskDetailList: [],
};
+
const arr = structuredClone(this.questionList);
// arr.forEach((item) => {
- // item.asrtext = JSON.stringify(item.scriptResult);
- // if (item.scriptType == 2 && item.scriptResult[0]) {
- // item.scriptResult = item.scriptResult.join("&");
+ // item.asrtext = JSON.stringify(item.questionResult);
+ // if (item.scriptType == 2 && item.questionResult[0]) {
+ // item.questionResult = item.questionResult.join("&");
// }
// });
form.serviceSubtaskDetailList = arr;
@@ -397,17 +435,26 @@
// 缂撳瓨
cache(subm) {
console.log("杩涘叆缂撳瓨");
+ // 鎻愪氦鍦烘櫙锛氬厛鍋氬繀濉」鏍¢獙
+ if (subm === true && !this.validateRequired()) {
+ return;
+ }
let form = {
param1: this.taskid,
param2: this.patid,
- svyLibTemplateScriptVOS: [],
+ param6: this.param6,
+ type: this.type,
+ ivrTaskTemplateScriptVOList: [],
};
const arr = structuredClone(this.questionList);
console.log(arr, "srr");
arr.forEach((item, index) => {
- var obj = item.svyLibTemplateTargetoptions.find(
- (items) => items.optioncontent == item.scriptResult
+ if (item.scriptType == 3 || item.scriptType == 4) return;
+ var obj = item.ivrTaskScriptTargetoptionList.find(
+ (items) => items.targetvalue == item.questionResult
);
+ console.log(obj, "isabnormal");
+
if (obj.isabnormal) {
console.log(obj.isabnormal);
form.excep = 1;
@@ -416,13 +463,13 @@
});
arr.forEach((item) => {
- if (item.scriptType == 2 && item.scriptResult[0]) {
- item.scriptResult = item.scriptResult.join("&");
- } else if (item.scriptType != 2 && item.scriptResult) {
- item.scriptResult = JSON.stringify(item.scriptResult);
+ if (item.scriptType == 2 && item.questionResult[0]) {
+ item.questionResult = item.questionResult.join("&");
+ } else if (item.scriptType != 2 && item.questionResult) {
+ item.questionResult = JSON.stringify(item.questionResult);
}
});
- form.svyLibTemplateScriptVOS = arr;
+ form.ivrTaskTemplateScriptVOList = arr;
Cachequestionnaire(form).then((res) => {
if (res.code == 200) {
if (subm) {
@@ -431,11 +478,50 @@
}
});
},
+ // 鏄惁蹇呭~锛�1蹇呭~ 2涓嶅繀濉級
+ isRequired(item) {
+ return item.ismandatory == 1 || item.ismandatory == "1";
+ },
+ // 鍒ゆ柇棰樼洰鏄惁鏈~鍐�
+ isQuestionEmpty(item) {
+ const val = item.questionResult;
+ if (item.scriptType == 2) {
+ return !val || (Array.isArray(val) && val.length === 0);
+ }
+ return val === undefined || val === null || val === "";
+ },
+ // 淇濆瓨鍓嶅繀濉」鏍¢獙
+ validateRequired() {
+ const list = this.questionList || [];
+ list.forEach((item) => {
+ if (item.requiredError) this.$set(item, "requiredError", false);
+ });
+ const unfilled = [];
+ list.forEach((item) => {
+ if (!this.isRequired(item)) return;
+ if (this.isQuestionEmpty(item)) unfilled.push(item);
+ });
+ if (unfilled.length > 0) {
+ unfilled.forEach((item) => this.$set(item, "requiredError", true));
+ this.$modal.msgWarning(
+ `杩樻湁 ${unfilled.length} 閬撳繀濉鏈~鍐欙紝璇疯ˉ鍏呭悗鍐嶆彁浜
+ );
+ this.$nextTick(() => {
+ const idx = this.questionList.indexOf(unfilled[0]);
+ const els = this.$el.querySelectorAll(".scriptTopic-dev");
+ if (els[idx]) {
+ els[idx].scrollIntoView({ behavior: "smooth", block: "center" });
+ }
+ });
+ return false;
+ }
+ return true;
+ },
// 澶勭悊鍗曢�夐�夐」
handleOptionChange(selectedvalue, index, arr) {
// 鏌ユ壘閫変腑鐨勯�夐」瀵硅薄
- const selectedOption = arr.svyLibTemplateTargetoptions.find(
- (option) => option.optioncontent == selectedvalue
+ const selectedOption = arr.ivrTaskScriptTargetoptionList.find(
+ (option) => option.targetvalue == selectedvalue
);
if (selectedOption) {
// 灏嗛�変腑鐨勯�夐」瀵硅薄鐨� id 璧嬪�肩粰 obj.sonId
@@ -449,8 +535,8 @@
// 锟斤拷鍔犲垎鏁�
let score = 0;
selectedvalues.forEach((value) => {
- const selectedOption = arr.svyLibTemplateTargetoptions.find(
- (option) => option.optioncontent == value
+ const selectedOption = arr.ivrTaskScriptTargetoptionList.find(
+ (option) => option.targetvalue == value
);
if (selectedOption) {
score += Number(selectedOption.score);
@@ -581,6 +667,18 @@
}
.toptitle {
}
+.required-star {
+ color: #f56c6c;
+ margin-right: 2px;
+ font-weight: 600;
+}
+.scriptTopic-dev.required-error {
+ border: 1px solid #f56c6c;
+ border-left: 4px solid #f56c6c;
+ background: #fef0f0;
+ border-radius: 4px;
+ padding: 8px;
+}
.bottom-fixed {
position: fixed;
bottom: 0;
--
Gitblit v1.9.3