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 |  123 ++++++++++++++++++++++++++++++++++------
 1 files changed, 103 insertions(+), 20 deletions(-)

diff --git a/src/views/outsideChainnew.vue b/src/views/outsideChainnew.vue
index f8738ed..3feadf1 100644
--- a/src/views/outsideChainnew.vue
+++ b/src/views/outsideChainnew.vue
@@ -8,7 +8,9 @@
             {{
               kcb
                 ? kcb
-                : "浜茬埍鐨勬偅鑰�-瀹跺睘锛屾垜浠槸"+localStorage.getItem("orgname")+"鐨勫尰鎶や汉鍛橈紝涓轰簡鏇村ソ鍦颁簡瑙f偍鐨勫悍澶嶆儏鍐碉紝璇锋偍鎶戒竴鐐瑰疂璐垫椂闂达紝瀹屾垚杩欎唤闅忚闂嵎銆�"
+                : "浜茬埍鐨勬偅鑰�-瀹跺睘锛屾垜浠槸" +
+                  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
               >
@@ -35,7 +43,7 @@
               >
                 <el-radio
                   border
-                  v-for="(items, index) in item.ivrLibaScriptTargetoptionList"
+                  v-for="(items, index) in item.ivrTaskScriptTargetoptionList"
                   :class="
                     items.isabnormal && item.questionResult == items.targetvalue
                       ? 'red-star'
@@ -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
               >
@@ -68,7 +82,7 @@
                 <el-checkbox
                   border
                   @change="$forceUpdate()"
-                  v-for="(items, indexs) in item.ivrLibaScriptTargetoptionList"
+                  v-for="(items, indexs) in item.ivrTaskScriptTargetoptionList"
                   :key="indexs"
                   :label="items.targetvalue"
                 >
@@ -82,9 +96,15 @@
             </div>
           </div>
           <!-- 濉┖ -->
-          <div class="scriptTopic-dev" :key="index" v-if="item.scriptType == 4||item.scriptType == 3">
+          <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
               >
@@ -163,12 +183,13 @@
       kcb: "",
       excep: "",
       taskname: "",
+      param6: null,
       questionList: [
         // {
         //   scriptType: 1,
         //   scriptContent: "鎮ㄧ殑骞撮緞鑼冨洿鏄紵",
         //   questionResult: null,
-        //   ivrLibaScriptTargetoptionList: [
+        //   ivrTaskScriptTargetoptionList: [
         //     { targetvalue: "18-25", value: "18-25", isabnormal: true },
         //     { targetvalue: "26-35", value: "26-35" },
         //     { targetvalue: "36-45", value: "36-45" },
@@ -181,7 +202,7 @@
         //   scriptType: 1,
         //   scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
         //   questionResult: null,
-        //   ivrLibaScriptTargetoptionList: [
+        //   ivrTaskScriptTargetoptionList: [
         //     { targetvalue: "瀛︾敓", value: "student" },
         //     { targetvalue: "鏁欏笀", value: "teacher" },
         //     { targetvalue: "宸ョ▼甯�", value: "engineer" },
@@ -194,7 +215,7 @@
         //   scriptType: 2,
         //   scriptContent: "鎮ㄦ劅鍏磋叮鐨勬椿鍔ㄦ湁鍝簺锛�",
         //   questionResult: [],
-        //   ivrLibaScriptTargetoptionList: [
+        //   ivrTaskScriptTargetoptionList: [
         //     { targetvalue: "鏃呮父", value: "travel", isabnormal: true },
         //     { targetvalue: "闃呰", value: "reading", isabnormal: true },
         //     { targetvalue: "杩愬姩", value: "sports", isabnormal: true },
@@ -207,7 +228,7 @@
         //   scriptType: 1,
         //   scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
         //   questionResult: null,
-        //   ivrLibaScriptTargetoptionList: [
+        //   ivrTaskScriptTargetoptionList: [
         //     { targetvalue: "瀛︾敓", value: "student" },
         //     { targetvalue: "鏁欏笀", value: "teacher" },
         //     { targetvalue: "宸ョ▼甯�", value: "engineer" },
@@ -220,7 +241,7 @@
         //   scriptType: 1,
         //   scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
         //   questionResult: null,
-        //   ivrLibaScriptTargetoptionList: [
+        //   ivrTaskScriptTargetoptionList: [
         //     { targetvalue: "瀛︾敓", value: "student" },
         //     { targetvalue: "鏁欏笀", value: "teacher" },
         //     { targetvalue: "宸ョ▼甯�", value: "engineer", isabnormal: true },
@@ -233,7 +254,7 @@
         //   scriptType: 1,
         //   scriptContent: "鎮ㄧ殑鑱屼笟鏄粈涔堬紵",
         //   questionResult: null,
-        //   ivrLibaScriptTargetoptionList: [
+        //   ivrTaskScriptTargetoptionList: [
         //     { targetvalue: "瀛︾敓", value: "student" },
         //     { targetvalue: "鏁欏笀", value: "teacher" },
         //     { targetvalue: "宸ョ▼甯�", value: "engineer" },
@@ -281,17 +302,21 @@
     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
           );
+          this.param6 = res.data.param6;
         }
       });
     },
@@ -320,7 +345,7 @@
       // 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;
@@ -345,7 +370,7 @@
     },
     // 鑾峰彇鏁版嵁
     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;
@@ -383,10 +408,12 @@
       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.questionResult);
@@ -408,17 +435,22 @@
     // 缂撳瓨
     cache(subm) {
       console.log("杩涘叆缂撳瓨");
+      // 鎻愪氦鍦烘櫙锛氬厛鍋氬繀濉」鏍¢獙
+      if (subm === true && !this.validateRequired()) {
+        return;
+      }
       let form = {
         param1: this.taskid,
         param2: this.patid,
+        param6: this.param6,
         type: this.type,
-        ivrLibaTemplateScriptVOList: [],
+        ivrTaskTemplateScriptVOList: [],
       };
       const arr = structuredClone(this.questionList);
       console.log(arr, "srr");
       arr.forEach((item, index) => {
-        if (item.scriptType == 3||item.scriptType == 4) return;
-        var obj = item.ivrLibaScriptTargetoptionList.find(
+        if (item.scriptType == 3 || item.scriptType == 4) return;
+        var obj = item.ivrTaskScriptTargetoptionList.find(
           (items) => items.targetvalue == item.questionResult
         );
         console.log(obj, "isabnormal");
@@ -437,7 +469,7 @@
           item.questionResult = JSON.stringify(item.questionResult);
         }
       });
-      form.ivrLibaTemplateScriptVOList = arr;
+      form.ivrTaskTemplateScriptVOList = arr;
       Cachequestionnaire(form).then((res) => {
         if (res.code == 200) {
           if (subm) {
@@ -446,10 +478,49 @@
         }
       });
     },
+    // 鏄惁蹇呭~锛�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.ivrLibaScriptTargetoptionList.find(
+      const selectedOption = arr.ivrTaskScriptTargetoptionList.find(
         (option) => option.targetvalue == selectedvalue
       );
       if (selectedOption) {
@@ -464,7 +535,7 @@
       // 锟斤拷鍔犲垎鏁�
       let score = 0;
       selectedvalues.forEach((value) => {
-        const selectedOption = arr.ivrLibaScriptTargetoptionList.find(
+        const selectedOption = arr.ivrTaskScriptTargetoptionList.find(
           (option) => option.targetvalue == value
         );
         if (selectedOption) {
@@ -596,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