From 78c84cf61b2a7f558582673a3eecdf8b91eb24c3 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期五, 17 四月 2026 16:48:26 +0800
Subject: [PATCH] 测试完成

---
 src/views/followvisit/record/detailpage/index.vue |  201 ++++++++++++++++++++++++++-----------------------
 1 files changed, 106 insertions(+), 95 deletions(-)

diff --git a/src/views/followvisit/record/detailpage/index.vue b/src/views/followvisit/record/detailpage/index.vue
index 360bc90..ca6a493 100644
--- a/src/views/followvisit/record/detailpage/index.vue
+++ b/src/views/followvisit/record/detailpage/index.vue
@@ -129,9 +129,7 @@
                 >
               </div>
               <div v-if="scope.row.sendstate == 7">
-                <el-tag type="danger" :disable-transitions="false"
-                  >瓒呮椂</el-tag
-                >
+                <el-tag type="danger" :disable-transitions="false">瓒呮椂</el-tag>
               </div>
             </template>
           </el-table-column>
@@ -449,7 +447,7 @@
                       <div class="scriptTopic-dev" :key="index" v-else>
                         <div class="dev-text">
                           {{ index + 1 }}銆乕闂瓟]<span>{{
-                            item.scriptContent
+                            item.questiontext
                           }}</span>
                           <span v-if="item.valueType == 3">(鍙兘杈撳叆鏁板瓧)</span>
                         </div>
@@ -563,7 +561,7 @@
                 <el-button
                   type="primary"
                   plain
-                  @click="Editsingletasksonyic('')"
+                  @click="alterpatient('')"
                 >
                   淇濆瓨鍩虹淇℃伅
                 </el-button>
@@ -653,6 +651,23 @@
                         icon="el-icon-phone"
                         @click="handleCall(userform.telcode, 'tel')"
                         :disabled="!isValidPhone(userform.telcode)"
+                      ></el-button>
+                    </el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="10">
+                  <el-form-item
+                    label="鐭彿鐢佃瘽"
+                    v-if="orgname == '鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�'"
+                  >
+                    <el-input
+                      placeholder="鑱旂郴鐢佃瘽缂哄け"
+                      v-model="userform.telshortcode"
+                    >
+                      <el-button
+                        slot="append"
+                        icon="el-icon-phone"
+                        @click="handleCall(userform.telshortcode, 'tel', true)"
                       ></el-button>
                     </el-input>
                   </el-form-item>
@@ -1060,7 +1075,7 @@
                 align="right"
                 v-model="form.date1"
                 class="custom-disabled"
-                value-format="yyyy-MM-dd"
+                value-format="yyyy-MM-dd hh:mm:ss"
                 @change="checkFollowupDate"
               ></el-date-picker>
             </el-form-item>
@@ -1110,6 +1125,7 @@
   serviceSubtaskDetailedit,
   serviceSubtaskDetailadd,
   updatePersonVoices,
+  savequestiondetail,
   addPersonVoices,
   query360PatInfo,
   sendMsg,
@@ -1554,8 +1570,6 @@
   methods: {
     // 鑾峰彇涓婚鏍峰紡绫�
     getTopicClass(item) {
-      console.log(item.isabnormal, "getTopicClass");
-
       // 鏍规嵁鐘舵�佸�艰繑鍥炲搴旂殑鏍峰紡绫�
       if (item.isabnormal == 1) {
         return "scriptTopic-isabnormal"; // 寮傚父 - 绾㈣壊
@@ -1598,13 +1612,15 @@
           this.tableDatatop = res.data.scriptResult;
 
           this.tableDatatop.forEach((item) => {
-            if (item.scriptType == 2) item.scriptResult = [];
             if (item.scriptResultId && item.scriptType != 2) {
               item.isoption = 3;
               item.scriptResult = item.scriptResult;
             } else if (item.scriptResultId && item.scriptType == 2) {
+              console.log(item.scriptResult, "item.scriptResult");
               item.scriptResult = item.scriptResult.split("&");
               item.isoption = 3;
+            } else if (!item.scriptResultId && item.scriptType == 2) {
+              item.scriptResult = [];
             }
           });
           this.taskname = res.data.taskName;
@@ -1728,7 +1744,7 @@
             if (item.targetvalue) {
               item.scriptResult = item.targetvalue.split("&");
             } else {
-              item.scriptResult = [];
+              item.scriptResult = item.asrtext;
             }
           });
 
@@ -1744,19 +1760,19 @@
         if (res.code == 200) {
           this.tableDatatop = res.data.ivrTaskTemplateScriptVOList;
           this.tableDatatop.forEach((item) => {
+            item.scriptID = item.id;
             item.id = null;
             // 绫诲瀷鍒ゆ柇璧嬪��
-            if (item.ivrTaskScriptTargetoptionList) {
+            if (item.ivrTaskScriptTargetoptionList.length) {
               item.targetvalue = 1;
               item.questiontext = item.scriptContent;
+
               item.targetvalue = item.ivrTaskScriptTargetoptionList
                 .map((obj) => obj.targetvalue)
                 .join("&");
             }
             if (item.targetvalue) {
               item.scriptResult = item.targetvalue.split("&");
-            } else {
-              item.scriptResult = [];
             }
           });
         }
@@ -1764,16 +1780,18 @@
     },
     // 鍖绘姢浜哄憳瀛樺偍鏁版嵁
     getdetail() {
+      console.log(1);
       let excep = "";
-      const promises = [];
+
+      // 鍏堝鐞� tableDatatop 涓殑鏁版嵁
       this.tableDatatop.forEach((item) => {
         if (item.valueType == 3 && item.scriptResult) {
-          // 楠岃瘉鏄惁涓烘湁鏁堟暟瀛�
           if (!/^\d+$/.test(item.scriptResult)) {
             this.$message.error(`闂 "${item.scriptContent}" 蹇呴』杈撳叆鏁板瓧`);
             return;
           }
         }
+
         var objs = item.svyTaskTemplateTargetoptions.find(
           (items) => items.optioncontent == item.scriptResult
         );
@@ -1784,44 +1802,43 @@
             this.selectedTag = objs.isabnormal;
           }
         }
-        console.log(excep, "excep");
 
-        let obj = {
-          asrtext: null,
-          patid: this.patid,
-          subId: this.id,
-          taskid: this.taskid,
-          scriptid: item.id,
-          excep: excep,
-          questiontext: item.scriptContent,
-          categoryid: item.categoryid,
-          answerps: item.answerps || null, // 娣诲姞闄勫姞淇℃伅
-        };
-        if (item.scriptType == 2 && item.scriptResult[0]) {
-          obj.asrtext = item.scriptResult.join("&");
+        // 澶勭悊 scriptResult锛岀洿鎺ヤ慨鏀瑰師濮嬫暟鎹�
+        if (item.scriptType == 2 && item.scriptResult) {
+          // 澶勭悊鏁扮粍绫诲瀷鐨� scriptResult
+          if (Array.isArray(item.scriptResult)) {
+            item.originalScriptResult = item.scriptResult; // 淇濆瓨鍘熷鏁扮粍锛堝彲閫夛級
+            item.scriptResult = item.scriptResult.join("&"); // 杞崲涓哄瓧绗︿覆
+          }
         } else if (item.scriptType != 2 && item.scriptResult) {
-          obj.asrtext = item.scriptResult;
-        }
-
-        if (item.isoption == 3) {
-          promises.push(serviceSubtaskDetailedit(obj));
-        } else {
-          promises.push(serviceSubtaskDetailadd(obj));
+          // 纭繚闈炴暟缁勭被鍨嬪凡缁忔槸瀛楃涓�
+          if (Array.isArray(item.scriptResult)) {
+            item.originalScriptResult = item.scriptResult; // 淇濆瓨鍘熷鏁扮粍锛堝彲閫夛級
+            item.scriptResult =
+              item.scriptResult.length > 0 ? item.scriptResult[0] : "";
+          }
         }
       });
 
-      // 浣跨敤 Promise.all 绛夊緟鎵�鏈夊紓姝ユ搷浣滃畬鎴�
-      Promise.all(promises)
-        .then((results) => {
-          // 鎵�鏈夊紓姝ユ搷浣滄垚鍔熷畬鎴愬悗鐨勯�昏緫
-          results.forEach((res) => {
-            if (res.code !== 200) {
-              this.$modal.error("淇敼澶辫触");
-            }
-          });
+      // 鍒涘缓鍓湰鐢ㄤ簬淇濆瓨锛岄伩鍏嶅奖鍝嶆樉绀�
+      const saveData = this.tableDatatop.map((item) => ({
+        ...item,
+        // 濡傛灉闇�瑕侊紝鍙互鍦ㄨ繖閲屽仛鏈�鍚庣殑鏁版嵁娓呯悊
+        scriptResult: item.scriptResult || "", // 纭繚涓嶄负 undefined
+      }));
+
+      let obj = {
+        svyTaskTemplateScriptVOS: saveData, // 浣跨敤澶勭悊鍚庣殑鏁版嵁
+        param1: this.taskid,
+        param2: this.patid,
+        param6: this.id,
+        type: 2,
+      };
+      savequestiondetail(obj).then((res) => {
+        if (res.code == 200) {
+          this.$modal.msgSuccess("鏈嶅姟淇濆瓨鎴愬姛");
           this.Editsingletasksonyic(6);
           const orgName = localStorage.getItem("orgname");
-          console.log(orgName, "orgName");
 
           if (this.form.isVisitAgain != 1 || orgName == "涓芥按甯備腑鍖婚櫌") {
             this.Torouter();
@@ -1850,11 +1867,8 @@
             .catch(() => {
               this.Torouter();
             });
-        })
-        .catch((error) => {
-          // 濡傛灉鏈変换浣曚竴涓紓姝ユ搷浣滃け璐ワ紝浼氳繘鍏ヨ繖閲�
-          console.error("鍙戠敓閿欒锛�", error);
-        });
+        }
+      });
     },
     Torouter() {
       if (this.form.serviceType == 13) {
@@ -1915,8 +1929,8 @@
     isValidPhone(phone) {
       return this.validatePhoneNumber(phone).isValid;
     },
-    handleCall(phone, type) {
-      if (!this.isValidPhone(phone)) {
+    handleCall(phone, type, dh) {
+      if (!this.isValidPhone(phone) && !dh) {
         this.$message.error("璇疯緭鍏ユ纭殑鎵嬫満鍙风爜");
         return;
       }
@@ -1986,28 +2000,40 @@
     },
     yuyingetdetail() {
       const dataToSubmit = JSON.parse(JSON.stringify(this.tableDatatop));
-      console.log(dataToSubmit, "dataToSubmit");
-      // return;
+
       dataToSubmit.forEach((item, index) => {
         // 瀵规嫹璐濈殑鏁版嵁杩涜鎿嶄綔锛屼笉褰卞搷鍘熷鐨� scriptResult 鏁扮粍
-        item.scriptResult = item.scriptResult.join("&");
+        if (item.targetvalue) {
+          item.scriptResult = item.scriptResult.join("&");
+          item.asrtext = item.matchedtext;
+          item.ivrtext = item.matchedtext;
+        } else {
+          item.asrtext = item.scriptResult;
+          item.ivrtext = item.scriptResult;
+        }
         item.templatequestionnum = index + 1;
         item.subId = this.id;
+
         item.taskid = this.taskid;
-        item.asrtext = item.matchedtext;
         if (!item.id) {
           item.isoperation = 1;
         }
         item.patid = this.patid;
         item.templateid = item.templateID;
+        if (item.nextScriptno == null) {
+          item.nextScriptno = index == dataToSubmit.length - 1 ? 0 : index + 2;
+        }
       });
+      console.log("c", 3);
 
       let obj = {
-        serviceSubtaskDetailList: dataToSubmit, // 鎻愪氦澶勭悊鍚庣殑鍓湰
+        ivrTaskTemplateScriptVOList: dataToSubmit, // 鎻愪氦澶勭悊鍚庣殑鍓湰
         param1: this.taskid,
         param2: this.patid,
-        subId: this.id,
+        param6: this.id,
+        type: 1,
       };
+      console.log("c", 4);
       const orgName = localStorage.getItem("orgname");
       console.log(orgName, "orgName");
 
@@ -2015,7 +2041,7 @@
         this.Torouter();
         return;
       }
-      addPersonVoices(obj).then((res) => {
+      savequestiondetail(obj).then((res) => {
         if (res.code == 200) {
           this.$modal.msgSuccess("鏈嶅姟淇濆瓨鎴愬姛");
           this.$modal
@@ -2047,7 +2073,7 @@
     // 鍐嶆闅忚鏁版嵁鏇存浛
     formtidy() {
       this.form.visitType2 = this.form.visitType;
-      this.form.date2 = this.form.longSendTime;
+      this.form.date2 = this.form.visitTime;
       // this.form.date1 = this.setCurrentDate();
       this.form.remark2 = this.form.remark;
     },
@@ -2076,12 +2102,11 @@
           this.form = res.rows[0].serviceSubtaskList.find(
             (item) => item.id == this.id
           );
-          console.log(this.form, "serviceType");
 
           this.logsheetlist = res.rows[0].serviceSubtaskList;
           this.templateid = this.form.templateid;
           this.selectedTag = this.form.excep;
-          const targetDate = new Date(this.form.longSendTime); // 鐩爣鏃ユ湡
+          const targetDate = new Date(this.form.visitTime); // 鐩爣鏃ユ湡
           const now = new Date(); // 褰撳墠鏃堕棿
           if (now < targetDate && this.form.sendstate == 2) {
             this.$confirm("褰撳墠鏈嶅姟鏈埌鍙戦�佹椂闂磋璋ㄦ厧淇敼", "鎻愮ず", {
@@ -2177,6 +2202,15 @@
         }
       });
     },
+    alterpatient(sendstate) {
+      alterpatient(this.userform).then((res) => {
+        if (res.code == 200) {
+          this.$modal.msgSuccess("鍩虹淇℃伅淇濆瓨鎴愬姛");
+        } else {
+          this.$modal.msgError("鍩虹淇℃伅淇敼澶辫触");
+        }
+      });
+    },
     // 寮傚父鍒楁覆鏌�
     tableRowClassName({ row, rowIndex }) {
       if (row.id == this.id) {
@@ -2261,35 +2295,7 @@
         })
         .catch(() => {});
     },
-    aahandleOptionChange(a, b, c) {
-      const result = c.find((item) => item.optioncontent == a);
-      if (result.nextQuestion == 0) {
-        this.tableDatatop = this.tableDatatop.reduce((acc, item, i) => {
-          acc.push(i > b ? { ...item, astrict: 1 } : item);
-          return acc;
-        }, []);
-      } else {
-        this.tableDatatop = this.tableDatatop.reduce((acc, item, i) => {
-          acc.push(i > b ? { ...item, astrict: 0 } : item);
-          return acc;
-        }, []);
-      }
-      if (this.Voicetype) {
-        var obj = this.tableDatatop[b].ivrTaskScriptTargetoptionList.find(
-          (item) => item.optioncontent == a
-        );
-      } else {
-        var obj = this.tableDatatop[b].svyTaskTemplateTargetoptions.find(
-          (item) => item.optioncontent == a
-        );
-      }
-      if (obj.isabnormal) {
-        this.tableDatatop[b].isabnormal = true;
-      } else {
-        this.tableDatatop[b].isabnormal = false;
-      }
-      this.$forceUpdate();
-    },
+
     handleRadioToggles(questionItem, optionValue) {
       if (!questionItem.matchedtext) {
         questionItem.matchedtext == "";
@@ -2348,7 +2354,13 @@
       this.tableDatatop[questionIndex].showAppendInput =
         selectedOptionObj.appendflag == 1;
       console.log(this.tableDatatop);
-
+      if (
+        selectedOptionObj.nextQuestion !== undefined &&
+        selectedOptionObj.nextQuestion !== null
+      ) {
+        this.tableDatatop[questionIndex].nextScriptno =
+          selectedOptionObj.nextQuestion;
+      }
       // if (!this.tableDatatop[questionIndex].showAppendInput) {
       //   this.tableDatatop[questionIndex].answerps = ""; // 娓呴櫎闄勫姞淇℃伅
       // }
@@ -2418,7 +2430,6 @@
           hiddenByEnd: index === questionIndex + 1 ? false : item.hiddenByEnd,
         }));
       }
-      2;
 
       this.$forceUpdate();
     },
@@ -2450,7 +2461,7 @@
           this.form.remark =
             this.form.remark + "銆�" + this.getCurrentTime() + "銆�";
           let form = structuredClone(this.form);
-          form.longSendTime = this.formatTime(form.date1);
+          form.visitTime = this.parseTime(form.date1);
           form.finishtime = "";
           if (form.resource) {
             if (form.resource == 2) {

--
Gitblit v1.9.3