From d90b45d7e9e38e34c044b772006004f2a4cb8b8e Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期五, 26 六月 2026 13:51:50 +0800
Subject: [PATCH] 测试完成

---
 src/views/patient/propaganda/QuestionnaireTask.vue |  264 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 193 insertions(+), 71 deletions(-)

diff --git a/src/views/patient/propaganda/QuestionnaireTask.vue b/src/views/patient/propaganda/QuestionnaireTask.vue
index 47284f1..f5cfbd4 100644
--- a/src/views/patient/propaganda/QuestionnaireTask.vue
+++ b/src/views/patient/propaganda/QuestionnaireTask.vue
@@ -370,27 +370,103 @@
                   </el-row>
                 </el-row>
                 <el-row v-if="form.appltype == 4">
-                  <el-col :span="20"
-                    ><el-form-item label="閫傜敤鎵嬫湳" prop="region">
-                      <el-select
-                        v-model="form.oplevelcode"
-                        style="width: 400px"
-                        @remove-tag="removeopera"
-                        size="medium"
-                        :remote-method="remoteopcode"
-                        filterable
-                        remote
-                        placeholder="璇烽�夋嫨鎵嬫湳"
+                  <el-form-item label="閫傜敤鎵嬫湳" prop="region">
+                    <el-select
+                      v-model="form.oplevelcode"
+                      style="width: 400px"
+                      @remove-tag="removeopera"
+                      size="medium"
+                      :remote-method="remoteopcode"
+                      filterable
+                      remote
+                      placeholder="璇烽�夋嫨鎵嬫湳"
+                    >
+                      <el-option
+                        class="ruleFormaa"
+                        v-for="item in baseoperaList"
+                        :label="item.label"
+                        :value="item.value"
                       >
-                        <el-option
-                          class="ruleFormaa"
-                          v-for="item in baseoperaList"
-                          :label="item.label"
-                          :value="item.value"
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                  <div
+                    style="
+                      margin-bottom: 20px;
+                      padding: 8px 12px;
+                      background-color: #f0f9ff;
+                      border-left: 4px solid #409eff;
+                    "
+                  >
+                    <p
+                      style="
+                        margin: 0;
+                        color: #606266;
+                        font-size: 13px;
+                        line-height: 1.4;
+                      "
+                    >
+                      <i
+                        class="el-icon-info"
+                        style="color: #409eff; margin-right: 6px"
+                      ></i>
+                      閽堝鍚屼竴鎵嬫湳绫诲瀷鍦ㄥ绉戝/鐥呭尯涓嬪瓨鍦ㄧ殑鎯呭喌锛屽彲閫夋嫨鎬ч厤缃浐瀹氱瀹�/鐥呭尯
+                    </p>
+                  </div>
+                  <!-- 鏂板锛氭墜鏈叧鑱斾笅鐨勭瀹ら厤缃紙鍗曢�夛級 -->
+                  <el-row :gutter="20" style="margin-top: 20px">
+                    <el-col :span="12">
+                      <el-form-item label="鍏宠仈绉戝" prop="diseaseDept">
+                        <el-select
+                          v-model="diseaseDept"
+                          style="width: 100%"
+                          clearable
+                          filterable
+                          placeholder="璇烽�夋嫨绉戝锛堝彲閫夛級"
+                          value-key="deptCode"
+                          @change="handleDiseaseDeptChange"
                         >
-                        </el-option>
-                      </el-select> </el-form-item
-                  ></el-col>
+                          <el-option
+                            v-for="item in belongDepts"
+                            :key="item.deptCode"
+                            :label="item.deptName"
+                            :value="item"
+                          ></el-option>
+                        </el-select>
+                        <div v-if="diseaseDept" class="selected-info">
+                          宸查�夋嫨: {{ diseaseDept.deptName }} ({{
+                            diseaseDept.deptCode
+                          }})
+                        </div>
+                      </el-form-item>
+                    </el-col>
+
+                    <el-col :span="12">
+                      <el-form-item label="鍏宠仈鐥呭尯" prop="diseaseWard">
+                        <el-select
+                          v-model="diseaseWard"
+                          style="width: 100%"
+                          clearable
+                          filterable
+                          placeholder="璇烽�夋嫨鐥呭尯锛堝彲閫夛級"
+                          value-key="districtCode"
+                          @change="handleDiseaseWardChange"
+                        >
+                          <el-option
+                            v-for="item in belongWards"
+                            :key="item.districtCode"
+                            :label="item.districtName"
+                            :value="item"
+                          ></el-option>
+                        </el-select>
+                        <div v-if="diseaseWard" class="selected-info">
+                          宸查�夋嫨: {{ diseaseWard.districtName }} ({{
+                            diseaseWard.districtCode
+                          }})
+                        </div>
+                      </el-form-item>
+                    </el-col>
+                  </el-row>
                 </el-row>
                 <el-row>
                   <el-col :span="12"
@@ -428,7 +504,6 @@
                       placeholder="璇风偣鍑诲彸渚ч�夋嫨"
                     />
                     <el-button
-                      v-if="form.templateid"
                       style="margin-left: 10px"
                       type="primary"
                       icon="el-icon-edit"
@@ -1098,8 +1173,8 @@
       // 鏃堕棿澶勭悊
       daytime: [], //鏃ユ湡
       applydaytime: [], //璁$畻鏃ユ湡
-      diseaseDept: null, // 鐤剧梾鍏宠仈涓嬬殑绉戝锛堝瓨鍌ㄦ暣涓璞★級
-      diseaseWard: null, // 鐤剧梾鍏宠仈涓嬬殑鐥呭尯锛堝瓨鍌ㄦ暣涓璞★級
+      diseaseDept: null, // 鐤剧梾鎴栨墜鏈叧鑱斾笅鐨勭瀹わ紙瀛樺偍鏁翠釜瀵硅薄锛�
+      diseaseWard: null, // 鐤剧梾鎴栨墜鏈叧鑱斾笅鐨勭梾鍖猴紙瀛樺偍鏁翠釜瀵硅薄锛�
       diseaseDepts: "",
       diseaseWards: "",
       time1: "", //涓婂崍鏃堕棿娈�
@@ -1504,13 +1579,16 @@
       if (this.submitLoading) {
         return;
       }
-      // 绗簩姝ワ細寮�鍚姞杞界姸鎬侊紝绂佺敤鎸夐挳
+
+      // 寮�鍚姞杞界姸鎬�
       this.submitLoading = true;
       console.log(this.submitLoading);
 
       try {
-        if (this.time4 && this.form.sendType == 3)
+        // 鏃堕棿澶勭悊
+        if (this.time4 && this.form.sendType == 3) {
           this.form.showTimeMorn = this.time4;
+        }
         this.form.sendTimeslot = [
           {
             begantime: this.time4,
@@ -1518,8 +1596,8 @@
             xh: 1,
           },
         ];
-        console.log(1);
 
+        // 鏍规嵁搴旂敤绫诲瀷娓呯悊瀛楁
         if (this.form.appltype == 1) {
           this.leavehospitaldistrictcodes = [];
           this.form.oplevelcode = null;
@@ -1537,75 +1615,90 @@
           this.illnesscodes = [];
           this.leavehospitaldistrictcodes = [];
         }
+
+        // 鏍¢獙锛氭湇鍔$被鍨�
         if (this.checkList) {
           this.form.preachform = this.checkList.join(",");
           this.form.preachformList = this.selectedOrder;
         } else {
           this.$modal.msgError("璇烽�夋嫨鏈嶅姟绫诲瀷");
           this.submitLoading = false;
-
           return;
         }
-        console.log(2);
 
-        if (
+        // 鏍¢獙锛氱柧鐥呭叧鑱旂瀹ゆ垨鐥呭尯
+        if (this.form.appltype == 3 || this.form.appltype == 4) {
+          const hasDept = this.diseaseDept?.deptCode;
+          const hasWard = this.diseaseWard?.districtCode;
+
+          if (!hasDept && !hasWard) {
+            this.$modal.msgError("闇�鍏宠仈绉戝鎴栫梾鍖�");
+            this.submitLoading = false;
+            return;
+          }
+        }
+
+        // 鏍¢獙锛氫换鍔″叧鑱旀潯浠�
+        const hasCondition =
           this.deptcodesWards[0] ||
           this.leavehospitaldistrictcodes[0] ||
           this.diagglist[0] ||
           this.form.oplevelcode ||
           this.form.longTask == 2 ||
-          this.serviceType == 3
-        ) {
-        } else {
+          this.serviceType == 3;
+
+        if (!hasCondition) {
           this.$modal.msgError("璇烽�夋嫨浠诲姟鍏宠仈鏉′欢");
           this.submitLoading = false;
           return;
         }
-        //鏆傚仠浠诲姟鎮h�呴檺鍒�
-        // if (!this.form.patTaskRelevances[0] && !this.form.longTask) {
-        //   this.$modal.msgError("璇烽�夋嫨鐥呬汉");
-        //   return;
-        // }
-        console.log(3);
 
+        // 鏍¢獙锛氭ā鏉�
         if (!this.form.templatename && !this.templateor) {
           this.$modal.msgError("鏈�夋嫨妯℃澘");
           this.submitLoading = false;
-
           return;
         }
 
-        if (
+        // 鏍¢獙锛氭椂闂翠俊鎭�
+        const isValidTime =
           (this.form.sendType == 1 && this.time1) ||
-          this.form.sendType == 2
-        ) {
-        } else if (
+          this.form.sendType == 2 ||
           (this.form.sendType == 3 && this.time4) ||
-          this.form.longTask
-        ) {
-        } else {
+          this.form.longTask;
+
+        if (!isValidTime) {
           this.submitLoading = false;
-          return this.$modal.msgError("鏃堕棿淇℃伅缂哄け");
+          this.$modal.msgError("鏃堕棿淇℃伅缂哄け");
+          return;
         }
+
+        // 澶勭悊鏂囨湰鍙傛暟
         const filteredArray = this.variableList.filter(
           (item) =>
             item.name !== "濮撳悕" && item.name !== "鐢佃瘽" && item.name !== "鍦板潃"
         );
         this.form.textParam = this.convertFormat2ToFormat1(filteredArray);
+
+        // 璁剧疆鎿嶄綔绫诲瀷
         if (this.form.taskid) {
           this.form.isoperation = 2;
         } else {
           this.form.isoperation = 1;
         }
+
+        // 璁剧疆绫诲瀷
         if (!this.form.type) {
           this.form.type = this.$route.query.type;
         }
-        console.log(4);
+
+        // 缁勮鎻愪氦鏁版嵁
         this.form.serviceType = this.serviceType;
         this.form.deptcode = this.deptcodesWards.join(",");
         this.form.leavehospitaldistrictcode =
           this.leavehospitaldistrictcodes.join(",");
-        // this.form.opcode = this.operationcodes.join(",");
+
+        // 鐤剧梾鍏宠仈鐨勭瀹�/鐥呭尯
         if (this.form.appltype == 3) {
           if (this.diseaseDept) {
             this.form.deptcode = this.diseaseDept.deptCode;
@@ -1618,30 +1711,46 @@
           }
         }
 
+        // 璇婃柇淇℃伅
         this.form.icd10code = this.diagglist
           .map((item) => item.icdcode)
           .join(",");
         this.form.icd10name = this.diagglist
           .map((item) => item.icdname)
           .join(",");
-        Editsingletask(this.form).then((res) => {
-          if (res.code == 200) {
-            if (this.form.taskid) {
-              this.$modal.msgSuccess("淇敼鎴愬姛");
+
+        // 鎻愪氦鎺ュ彛
+        Editsingletask(this.form)
+          .then((res) => {
+            if (res.code == 200) {
+              if (this.form.taskid) {
+                this.$modal.msgSuccess("淇敼鎴愬姛");
+              } else {
+                this.$modal.msgSuccess("鏂板鎴愬姛");
+              }
+              this.$router.push({
+                path: "/followvisit/tasklist",
+                query: { tasktopic: this.form.serviceType },
+              });
             } else {
-              this.$modal.msgSuccess("鏂板鎴愬姛");
+              // 鉁� 鎺ュ彛杩斿洖閿欒鐮佹椂鐨勫鐞�
+              this.$modal.msgError(res.msg || "鎿嶄綔澶辫触");
             }
-            this.$router.push({
-              path: "/followvisit/tasklist",
-              query: { tasktopic: this.form.serviceType },
-            });
+          })
+          .catch((error) => {
+            // 鉁� 鎹曡幏鎺ュ彛璇锋眰寮傚父
+            console.error("鎻愪氦澶辫触:", error);
+            this.$modal.msgError(error.message || "缃戠粶寮傚父锛岃绋嶅悗閲嶈瘯");
+          })
+          .finally(() => {
+            // 鉁� 鏃犺鎴愬姛鎴栧け璐ワ紝鏈�缁堥兘鍏抽棴鍔犺浇鐘舵��
             this.submitLoading = false;
-          }
-        });
+          });
       } catch (error) {
+        // 鉁� 鎹曡幏鍚屾浠g爜寮傚父
+        console.error("琛ㄥ崟鎻愪氦寮傚父:", error);
+        this.$modal.msgError(error.message || "琛ㄥ崟鎻愪氦寮傚父");
         this.submitLoading = false;
-      } finally {
-        // 绗洓姝ワ細鏃犺鎴愬姛鎴栧け璐ワ紝鏈�缁堥兘鍏抽棴鍔犺浇鐘舵��
       }
     },
     handleDiseaseDeptChange(dept) {
@@ -2103,6 +2212,14 @@
             this.form.patTaskRelevances = this.form.patTaskRelevances
               ? this.form.patTaskRelevances
               : [];
+            this.diseaseDept = {
+              deptCode: this.form.deptcode,
+              deptName: this.form.deptname,
+            };
+            this.diseaseWard = {
+              districtCode: this.form.leavehospitaldistrictcode,
+              districtName: this.form.leavehospitaldistrictname,
+            };
             this.overallCase = this.form.patTaskRelevances.concat();
             this.checkList = this.form.preachform.split(",");
             this.selectedOrder = this.form.preachformList;
@@ -2371,19 +2488,24 @@
 
       this.objyl.isoperation = 1;
       this.objyl.taskid = this.form.taskid;
-
+      this.objyl.svyTemplateLibScripts.forEach((item) => {
+        item.qremark = [];
+        item.svyTaskTemplateTargetoptions = item.svyLibTemplateTargetoptions;
+      });
+      this.objyl.svyTaskTemplateScriptVOS = this.objyl.svyTemplateLibScripts;
       if (this.objyl.id) {
         deleteTaskQuestioncomit(this.objyl.id).then((res) => {
           if (res.code == 200) {
-            (this.objyl.id = null),
-              TaskQuestioncomit(this.objyl).then((response) => {
-                this.previewtf = false;
-                this.form.libtemplateid = this.objyl.svyid;
-                this.form.libtemplatename = this.objyl.svyname;
-                this.form.templateid = response.data;
-                this.form.templatename = this.objyl.svyname;
-                this.$modal.msgSuccess("閫夋嫨妯℃澘鎴愬姛");
-              });
+            this.objyl.id = null;
+
+            TaskQuestioncomit(this.objyl).then((response) => {
+              this.previewtf = false;
+              this.form.libtemplateid = this.objyl.svyid;
+              this.form.libtemplatename = this.objyl.svyname;
+              this.form.templateid = response.data;
+              this.form.templatename = this.objyl.svyname;
+              this.$modal.msgSuccess("閫夋嫨妯℃澘鎴愬姛");
+            });
           }
         });
       } else {

--
Gitblit v1.9.3