From dfd32b299236e015fe80e10fae01548288d91000 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 02 十一月 2026 09:56:32 +0800
Subject: [PATCH] Merge branch 'subtask' of http://116.62.18.175:6699/r/~yxh/smartor-web into subtask

---
 src/views/followvisit/record/detailpage/index.vue |  180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 178 insertions(+), 2 deletions(-)

diff --git a/src/views/followvisit/record/detailpage/index.vue b/src/views/followvisit/record/detailpage/index.vue
index 1f704a4..61ae393 100644
--- a/src/views/followvisit/record/detailpage/index.vue
+++ b/src/views/followvisit/record/detailpage/index.vue
@@ -639,10 +639,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>
@@ -700,10 +706,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>
@@ -712,6 +723,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">
@@ -1589,6 +1632,12 @@
         "棰勭害涓嬫澶嶈瘖",
       ],
       tableDatatop: [], //棰樼洰琛�
+      // 淇濆瓨闂嵎锛氭湭绛旈鎻愮ず寮圭獥 / 鐢ㄦ埛鍧氭寔淇濆瓨鏍囪
+      confirmSaveVisible: false,
+      forceSave: false,
+      // 闃查噸澶嶆彁浜わ細淇濆瓨涓鐢ㄦ寜閽�
+      savingQuestion: false,
+      savingVoice: false,
       voiceDatatop: [], //棰樼洰琛�
       dynamicTags: [],
       isMergeMode: false,
@@ -1742,6 +1791,26 @@
     }
   },
   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 }))
+        .filter((q) => !this.hasOptionValue(q.raw));
+    },
     callStatusText() {
       if (this.customCallStatus) {
         return this.customCallStatus;
@@ -2153,8 +2222,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 = "";
 
@@ -2209,6 +2322,11 @@
         param6: this.id,
         type: 2,
       };
+      // 闃查噸澶嶆彁浜わ細淇濆瓨涓啀娆$偣鍑荤洿鎺ュ拷鐣�
+      if (this.savingQuestion) {
+        return;
+      }
+      this.savingQuestion = true;
       savequestiondetail(obj).then((res) => {
         if (res.code == 200) {
           this.$modal.msgSuccess("鏈嶅姟淇濆瓨鎴愬姛");
@@ -2251,6 +2369,8 @@
               });
           }
         }
+      }).finally(() => {
+        this.savingQuestion = false;
       });
     },
     Torouter() {
@@ -2554,6 +2674,11 @@
         type: 1,
       };
       console.log("c", 4);
+      // 闃查噸澶嶆彁浜わ細淇濆瓨涓啀娆$偣鍑荤洿鎺ュ拷鐣�
+      if (this.savingVoice) {
+        return;
+      }
+      this.savingVoice = true;
       const orgName = localStorage.getItem("orgname");
       console.log(orgName, "orgName");
 
@@ -2596,6 +2721,8 @@
               this.Torouter();
             });
         }
+      }).finally(() => {
+        this.savingVoice = false;
       });
     },
     // 鍐嶆闅忚鏁版嵁鏇存浛
@@ -4431,4 +4558,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