From 574b449a39019a59dc90ecc19dda9f63d3aa9636 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期三, 18 十一月 2026 15:35:47 +0800
Subject: [PATCH] 测试完成

---
 src/views/followvisit/record/detailpage/index.vue |  294 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 277 insertions(+), 17 deletions(-)

diff --git a/src/views/followvisit/record/detailpage/index.vue b/src/views/followvisit/record/detailpage/index.vue
index 99123e5..0340bf4 100644
--- a/src/views/followvisit/record/detailpage/index.vue
+++ b/src/views/followvisit/record/detailpage/index.vue
@@ -636,10 +636,16 @@
                   <el-button
                     v-if="showQuestionnaireForm"
                     type="primary"
+                    :disabled="!canSaveQuestionnaire"
+                    :loading="savingQuestion"
                     @click="getdetail"
                     >淇濆瓨闂嵎璇︽儏</el-button
                   >
-                  <el-button v-else type="primary" @click="yuyingetdetail"
+                  <el-button
+                    v-else
+                    type="primary"
+                    :loading="savingQuestion"
+                    @click="yuyingetdetail"
                     >淇濆瓨闂嵎璇︽儏</el-button
                   >
                 </div>
@@ -697,10 +703,15 @@
                   <el-button
                     v-if="Voicetype"
                     type="primary"
+                    :loading="savingVoice"
                     @click="yuyingetdetail"
                     >淇濆瓨闅忚璇︽儏</el-button
                   >
-                  <el-button v-else type="primary" @click="getdetail"
+                  <el-button
+                    v-else
+                    type="primary"
+                    :loading="savingQuestion"
+                    @click="getdetail"
                     >淇濆瓨闅忚璇︽儏</el-button
                   >
                 </div>
@@ -709,6 +720,38 @@
           </div>
         </div>
       </div>
+
+      <!-- 鏈�夐�夐」鎻愮ず锛氬ぇ瀛楅啋鐩彁閱掞紝鍏佽鐢ㄦ埛鍧氭寔淇濆瓨 -->
+      <el-dialog
+        :visible.sync="confirmSaveVisible"
+        width="640px"
+        append-to-body
+        :close-on-click-modal="false"
+        custom-class="unanswered-dialog"
+      >
+        <div slot="title" class="unanswered-title">
+          <i class="el-icon-warning"></i> 娉ㄦ剰锛氭湁棰樼洰娌℃湁閫夋嫨閫夐」
+        </div>
+        <div class="unanswered-warn">
+          褰撳墠闂嵎杩樻湁
+          <span class="unanswered-count">{{ unansweredQuestions.length }}</span>
+          閬撻<strong>娌℃湁閫夋嫨浠讳綍閫夐」</strong>锛岀户缁繚瀛樺皢鎸夆�滄湭浣滅瓟鈥濊褰曪細
+        </div>
+        <div class="unanswered-list">
+          <div v-for="q in unansweredQuestions" :key="q.index">
+            绗� {{ q.index }} 棰橈細{{ q.title }}
+          </div>
+        </div>
+        <div class="unanswered-tip">纭畾杩樿淇濆瓨鍚楋紵</div>
+        <span slot="footer">
+          <el-button size="medium" @click="confirmSaveVisible = false"
+            >杩斿洖琛ュ~</el-button
+          >
+          <el-button type="danger" size="medium" @click="confirmForceSave"
+            >浠嶈淇濆瓨</el-button
+          >
+        </span>
+      </el-dialog>
       <!-- 浜哄伐澶勭悊 -->
       <div class="manual-action">
         <div class="Followuserinfos">
@@ -1170,7 +1213,7 @@
           <!-- 娉ㄦ剰杩欓噷鍙兘浣跨敤 userform.telcode -->
         </el-form-item>
         <el-form-item label="绉戝">
-          <el-input style="width: 400px" v-model="form.deptname"></el-input>
+          <el-input style="width: 400px" v-model="form.leaveldeptname"></el-input>
         </el-form-item>
         <el-form-item label="鐥呭尯">
           <el-input
@@ -1224,7 +1267,7 @@
               <el-input
                 style="width: 100%"
                 disabled
-                v-model="form.deptname"
+                v-model="form.leaveldeptname"
               ></el-input>
             </el-form-item>
             <el-form-item label="鐥呭尯">
@@ -1422,6 +1465,7 @@
 import {
   messagelistpatient,
   alterpatient,
+  particularpatient,
   listcontactinformation,
 } from "@/api/patient/homepage";
 import CallButton from "@/components/CallButton";
@@ -1615,6 +1659,12 @@
         "棰勭害涓嬫澶嶈瘖",
       ],
       tableDatatop: [], //棰樼洰琛�
+      // 淇濆瓨闂嵎锛氭湭绛旈鎻愮ず寮圭獥 / 鐢ㄦ埛鍧氭寔淇濆瓨鏍囪
+      confirmSaveVisible: false,
+      forceSave: false,
+      // 闃查噸澶嶆彁浜わ細淇濆瓨涓鐢ㄦ寜閽�
+      savingQuestion: false,
+      savingVoice: false,
       voiceDatatop: [], //棰樼洰琛�
       dynamicTags: [],
       isMergeMode: false,
@@ -1779,6 +1829,27 @@
     }
   },
   computed: {
+    // 鏄惁鏈変换鎰忎竴閬撻銆岄�変簡閫夐」銆嶆垨銆屽~浜嗗娉ㄣ��
+    hasAnyAnswer() {
+      return (this.tableDatatop || []).some((item) => this.isQuestionAnswered(item));
+    },
+    // 鍙充晶澶勭悊鎰忚/澶囨敞妗嗘槸鍚︽湁鍐呭
+    hasRemarkText() {
+      const remark = this.form && this.form.remark;
+      return remark !== null && remark !== undefined && String(remark).trim() !== "";
+    },
+    // 淇濆瓨闂嵎璇︽儏鐨勫彲鐐规潯浠讹細闂嵎鏈変綔绛� 鎴� 鍙宠竟澶囨敞妗嗘湁鍐呭锛堟湁鍏朵竴鍗冲彲锛�
+    canSaveQuestionnaire() {
+      return this.hasAnyAnswer || this.hasRemarkText;
+    },
+    // 娌℃湁閫夋嫨閫夐」鐨勯鐩紙淇濆瓨鍓嶇敤澶у瓧閱掔洰鎻愮ず锛屼笉鍖哄垎鏈夋病鏈夊~澶囨敞锛�
+    // index 鐢ㄩ鐩湪闂嵎閲岀殑鍘熷搴忓彿锛屾柟渚垮拰宸﹁竟闂嵎瀵圭収
+    unansweredQuestions() {
+      return (this.tableDatatop || [])
+        .map((item, i) => ({ index: i + 1, title: item.scriptContent || "鏈懡鍚嶉鐩�", raw: item }))
+        // astrict=1 琛ㄧず璇ラ鍥犻�夐」璺宠浆琚烦杩囷紙宸查殣钘忥級锛岃烦杩囬涓嶇畻鈥滄湭浣滅瓟鈥�
+        .filter((q) => !q.raw.astrict && !this.hasOptionValue(q.raw));
+    },
     callStatusText() {
       if (this.customCallStatus) {
         return this.customCallStatus;
@@ -1831,13 +1902,7 @@
     this.orgname = localStorage.getItem("orgname");
     console.log(localStorage.getItem("orgname"));
 
-    if (
-      this.orgname == "鐪佺珛鍚屽痉缈犺嫅闄㈠尯" ||
-      this.orgname == "鐪佺珛鍚屽痉涔嬫睙闄㈠尯" ||
-      this.orgname == "鐪佺珛鍚屽痉闂叉灄闄㈠尯" ||
-      this.orgname == "鐪佺珛鍚屽痉闈掑北婀栭櫌鍖�" ||
-      this.orgname == "鐪佺珛鍚屽痉澶╃洰灞辫矾闄㈠尯"
-    ) {
+    if (this.isTongdeCampus) {
       this.showContinuationCareBtn = true;
     }
 
@@ -1980,6 +2045,35 @@
         const newPos = start + text.length;
         target.setSelectionRange(newPos, newPos);
       });
+
+      // 蹇嵎璇寘鍚�滄浜♀�濇椂锛岃繃婊ゆ帓闄よ鎮h��
+      if (text && text.includes("姝讳骸")) {
+        this.filterDeathPatient(text);
+      }
+    },
+    // 蹇嵎璇寘鍚�滄浜♀�濇椂杩囨护鎺掗櫎鎮h�咃紙鍙傝�� discharge 椤垫偅鑰呰繃婊わ級
+    filterDeathPatient(text) {
+      this.$modal
+        .confirm(
+          "璇ュ揩鎹疯鍖呭惈鈥滄浜♀�濓紝纭灏嗚鎮h�呰繃婊ゆ帓闄ゅ悧锛熻繃婊ゅ悗璇ユ偅鑰呮墍鏈夎繘琛屼腑浠诲姟灏嗗叏閮ㄥ仠姝紝涓旀棤娉曞尮閰嶆柊鐨勯殢璁夸换鍔★紝璇疯皑鎱庢搷浣滐紒"
+        )
+        .then(() => {
+          particularpatient(this.patid).then((response) => {
+            const patient = response.data;
+            patient.isoperation = 2;
+            patient.notrequiredFlag = 1;
+            patient.notrequiredreason = text;
+            patient.filterDrname = store.getters.nickName;
+            alterpatient(patient).then((res) => {
+              if (res.code == 200) {
+                this.$modal.msgSuccess("鎮h�呰繃婊ゆ垚鍔�");
+              } else {
+                this.$modal.msgError("鎮h�呰繃婊ゅけ璐�");
+              }
+            });
+          });
+        })
+        .catch(() => {});
     },
     // 鑾峰彇闂嵎鏁版嵁
     getsearchrResults(id) {
@@ -2019,6 +2113,8 @@
           });
           this.taskname = res.data.taskName;
           this.overdata();
+          // 鏍规嵁宸蹭繚瀛樼瓟妗堝洖鏀鹃�夐」璺宠浆閫昏緫锛屾仮澶嶈璺宠繃棰樼洰鐨勯殣钘忕姸鎬�
+          this.restoreJumpState();
         }
       });
     },
@@ -2194,8 +2290,52 @@
         }
       });
     },
+    // 棰樼洰鏄惁閫変簡閫夐」锛堝崟閫夊瓧绗︿覆 / 澶氶�夋暟缁勶級
+    hasOptionValue(item) {
+      if (!item) {
+        return false;
+      }
+      const val = item.scriptResult;
+      if (Array.isArray(val)) {
+        return val.some(
+          (v) => v !== null && v !== undefined && String(v).trim() !== ""
+        );
+      }
+      return val !== null && val !== undefined && String(val).trim() !== "";
+    },
+    // 棰樼洰鏄惁濉簡澶囨敞
+    hasRemarkValue(item) {
+      if (!item) {
+        return false;
+      }
+      const remark = item.answerps;
+      return (
+        remark !== null && remark !== undefined && String(remark).trim() !== ""
+      );
+    },
+    // 棰樼洰鏄惁宸蹭綔绛旓細閫変簡閫夐」 鎴� 濉簡澶囨敞锛堜袱鑰呮湁鍏朵竴鍗崇畻宸茬瓟锛�
+    isQuestionAnswered(item) {
+      return this.hasOptionValue(item) || this.hasRemarkValue(item);
+    },
+    // 鏈瓟棰樻彁绀洪噷鐐广�屼粛瑕佷繚瀛樸��
+    confirmForceSave() {
+      this.forceSave = true;
+      this.confirmSaveVisible = false;
+      this.getdetail();
+    },
     // 鍖绘姢浜哄憳瀛樺偍鏁版嵁
     getdetail() {
+      // 闂嵎娌′綔绛斻�佸彸杈瑰娉ㄦ涔熺┖ 鈫� 涓嶅厑璁镐繚瀛�
+      if (!this.canSaveQuestionnaire) {
+        this.$message.warning("璇峰厛鍦ㄩ棶鍗蜂腑浣滅瓟锛屾垨鍦ㄥ彸渚у~鍐欏鐞嗘剰瑙�/澶囨敞");
+        return;
+      }
+      // 杩樻湁棰樼洰娌′綔绛旓細澶у瓧鎻愮ず锛岀敤鎴峰潥鎸佹墠缁х画
+      if (this.unansweredQuestions.length > 0 && !this.forceSave) {
+        this.confirmSaveVisible = true;
+        return;
+      }
+      this.forceSave = false;
       console.log(1);
       let excep = "";
 
@@ -2250,6 +2390,11 @@
         param6: this.id,
         type: 2,
       };
+      // 闃查噸澶嶆彁浜わ細淇濆瓨涓啀娆$偣鍑荤洿鎺ュ拷鐣�
+      if (this.savingQuestion) {
+        return;
+      }
+      this.savingQuestion = true;
       savequestiondetail(obj).then((res) => {
         if (res.code == 200) {
           this.$modal.msgSuccess("鏈嶅姟淇濆瓨鎴愬姛");
@@ -2292,6 +2437,8 @@
               });
           }
         }
+      }).finally(() => {
+        this.savingQuestion = false;
       });
     },
     Torouter() {
@@ -2615,6 +2762,11 @@
         type: 1,
       };
       console.log("c", 4);
+      // 闃查噸澶嶆彁浜わ細淇濆瓨涓啀娆$偣鍑荤洿鎺ュ拷鐣�
+      if (this.savingVoice) {
+        return;
+      }
+      this.savingVoice = true;
       const orgName = localStorage.getItem("orgname");
       console.log(orgName, "orgName");
 
@@ -2657,6 +2809,8 @@
               this.Torouter();
             });
         }
+      }).finally(() => {
+        this.savingVoice = false;
       });
     },
     // 鍐嶆闅忚鏁版嵁鏇存浛
@@ -2731,7 +2885,7 @@
         name: this.form.sendname,
         age: this.form.age,
         phone: this.userform.telcode,
-        deptName: this.form.deptname,
+        deptName: this.form.leaveldeptname,
         wardName: this.form.leavehospitaldistrictname,
         smsTemplate: `灏婃暚鐨�${this.form.sendname}锛屾偍濂斤紒`,
       });
@@ -2913,7 +3067,7 @@
       getTaskservelist({
         patid: this.patid,
         visitCount: 2,
-        leaveldeptcodes: [this.form.deptcode],
+        leaveldeptcodes: [this.form.leaveldeptcode],
       }).then((res) => {
         if (res.rows[0].serviceSubtaskList.length) {
           if (
@@ -2923,7 +3077,7 @@
             this.$modal
               .confirm(
                 '鏈偅鑰呭湪"' +
-                  res.rows[0].serviceSubtaskList[0].deptname +
+                  res.rows[0].serviceSubtaskList[0].leaveldeptname +
                   '"绉戝涓嬪凡鏈夊啀娆¢殢璁挎湇鍔¤繘琛屼腑鏄惁缁х画鍒涘缓锛�'
               )
               .then(() => {
@@ -3131,6 +3285,63 @@
         }
       });
     },
+    // 鏍规嵁宸蹭繚瀛樼瓟妗堝洖鏀锯�滈�夐」璺宠浆鈥濋�昏緫锛屾仮澶嶈璺宠繃棰樼洰鐨勯殣钘忕姸鎬侊紙astrict锛�
+    restoreJumpState() {
+      const list = this.tableDatatop;
+      if (!list || !list.length) return;
+
+      // 鍏堝叏閮ㄧ疆涓哄彲瑙�
+      list.forEach((item) => {
+        this.$set(item, "astrict", 0);
+        this.$set(item, "hiddenByEnd", false);
+      });
+
+      for (let i = 0; i < list.length; ) {
+        const q = list[i];
+        let jumped = false;
+
+        // 鍙湁鈥滃崟閫� + 鐢遍�夐」閰嶇疆璺宠浆鈥濅笖宸蹭綔绛旂殑棰樼洰鎵嶅彲鑳戒骇鐢熻烦杞�
+        if (q.branchFlag == 1 && q.scriptType == 1 && this.hasOptionValue(q)) {
+          const opt = (q.svyTaskTemplateTargetoptions || []).find(
+            (o) => o.optioncontent == q.scriptResult
+          );
+          const next = opt ? opt.nextQuestion : null;
+
+          if (next !== null && next !== undefined && next !== "") {
+            const targetNum = Number(next);
+
+            // 缁撴潫闂瓟锛氶殣钘忓悗闈㈡墍鏈夐
+            if (targetNum === 0) {
+              for (let j = i + 1; j < list.length; j++) {
+                this.$set(list[j], "astrict", 1);
+                this.$set(list[j], "hiddenByEnd", true);
+              }
+              break;
+            }
+
+            const target = targetNum - 1; // 杞� 0-indexed
+            if (target > i && target < list.length) {
+              // 闅愯棌褰撳墠棰樺拰鐩爣棰樹箣闂寸殑棰�
+              for (let j = i + 1; j < target; j++) {
+                this.$set(list[j], "astrict", 1);
+                this.$set(list[j], "hiddenByEnd", false);
+              }
+              // 鐩爣棰樹繚鎸佸彲瑙�
+              this.$set(list[target], "astrict", 0);
+              this.$set(list[target], "hiddenByEnd", false);
+              i = target;
+              jumped = true;
+            }
+          }
+        }
+
+        if (!jumped) {
+          i++;
+        }
+      }
+
+      this.$forceUpdate();
+    },
     // 鍒囨崲闅忚绫诲瀷鍚庯紝閲嶇疆鍖荤敓澶勭悊鎰忚鐨勬牎楠岀姸鎬侊紙蹇呭~鏉′欢闅忕被鍨嬪彉鍖栵級
     handleResourceChange() {
       this.$nextTick(() => {
@@ -3164,11 +3375,11 @@
             if (form.resource == 2) {
               form.visitDeptCode = localStorage.getItem("deptCode")
                 ? localStorage.getItem("deptCode")
-                : form.deptcode;
+                : form.leaveldeptcode;
               form.visitDeptName = "闅忚涓績";
             } else {
-              form.visitDeptCode = form.deptcode;
-              form.visitDeptName = form.deptname;
+              form.visitDeptCode = form.leaveldeptcode;
+              form.visitDeptName = form.leaveldeptname;
             }
           } else {
             this.$modal.msgError("鏈�夋嫨闅忚鏂瑰紡");
@@ -4540,4 +4751,53 @@
     margin-bottom: 12px;
   }
 }
+
+/* 鏈�夐�夐」鎻愮ず锛氬ぇ瀛楅啋鐩彁閱� */
+.unanswered-title {
+  font-size: 22px;
+  font-weight: 700;
+  color: #f56c6c;
+  display: flex;
+  align-items: center;
+}
+.unanswered-title i {
+  font-size: 26px;
+  margin-right: 10px;
+}
+.unanswered-warn {
+  font-size: 20px;
+  font-weight: 600;
+  color: #303133;
+  line-height: 1.8;
+}
+.unanswered-warn strong {
+  color: #f56c6c;
+  font-size: 22px;
+}
+.unanswered-count {
+  font-size: 40px;
+  font-weight: 700;
+  color: #f56c6c;
+  margin: 0 6px;
+  vertical-align: middle;
+}
+.unanswered-list {
+  margin-top: 14px;
+  max-height: 300px;
+  overflow-y: auto;
+  padding: 12px 16px;
+  background: #fef0f0;
+  border: 1px solid #fbc4c4;
+  border-radius: 6px;
+  font-size: 18px;
+  line-height: 2;
+  color: #303133;
+}
+.unanswered-tip {
+  margin-top: 18px;
+  font-size: 22px;
+  font-weight: 700;
+  color: #f56c6c;
+  text-align: center;
+}
 </style>

--
Gitblit v1.9.3