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 |   77 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/src/views/outsideChainnew.vue b/src/views/outsideChainnew.vue
index 1e83bb8..3feadf1 100644
--- a/src/views/outsideChainnew.vue
+++ b/src/views/outsideChainnew.vue
@@ -22,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
               >
@@ -54,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
               >
@@ -88,9 +100,11 @@
             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
               >
@@ -331,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;
@@ -356,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;
@@ -421,6 +435,10 @@
     // 缂撳瓨
     cache(subm) {
       console.log("杩涘叆缂撳瓨");
+      // 鎻愪氦鍦烘櫙锛氬厛鍋氬繀濉」鏍¢獙
+      if (subm === true && !this.validateRequired()) {
+        return;
+      }
       let form = {
         param1: this.taskid,
         param2: this.patid,
@@ -459,6 +477,45 @@
           }
         }
       });
+    },
+    // 鏄惁蹇呭~锛�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) {
@@ -610,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