From 44e7c74462e3dd3bf4bf24ab34b126d6e59c41f9 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 31 七月 2025 17:59:08 +0800
Subject: [PATCH] qx

---
 src/views/doctor/checkAll/index.vue |  256 +++++++++++++++++++++++++++++----------------------
 1 files changed, 145 insertions(+), 111 deletions(-)

diff --git a/src/views/doctor/checkAll/index.vue b/src/views/doctor/checkAll/index.vue
index f0a9a02..4af72f0 100644
--- a/src/views/doctor/checkAll/index.vue
+++ b/src/views/doctor/checkAll/index.vue
@@ -2583,36 +2583,49 @@
       this.loading = true;
       this.status1 = 0;
       this.yichangList = [];
-      yichang({
-        tjNum: this.tjNumber,
-      })
-        .then((res) => {
-          // this.isLoading = false
-          this.yichangList = res.data;
+      
+      return new Promise((resolve, reject) => {
+        yichang({
+          tjNum: this.tjNumber,
+        })
+          .then((res) => {
+            const data = res.data;
 
-          this.yichangList.forEach((item) => {
-            item.sone.forEach((soneItem) => {
-              if (
-                !Array.isArray(soneItem.advices) ||
-                soneItem.advices.length === 0
-              ) {
-                soneItem.advices = [{ bt: "", nr: "" }];
-              }
+            if (!data || data.length === 0) {
+              this.$message.warning("鏆傛棤寮傚父鎶ュ憡");
+              this.loading = false;
+              resolve(); // 杩斿洖 Promise锛屼絾涓嶇户缁悗缁�昏緫
+              return;
+            }
+            this.yichangList = data;
+
+            this.yichangList.forEach((item) => {
+              item.sone.forEach((soneItem) => {
+                if (
+                  !Array.isArray(soneItem.advices) ||
+                  soneItem.advices.length === 0
+                ) {
+                  soneItem.advices = [{ bt: "", nr: "" }];
+                }
+              });
             });
+            if (!this.yichangList) {
+              this.$message.warning("鏆傛棤寮傚父鎶ュ憡");
+            }
+            resolve(); // 鎴愬姛瀹屾垚
+          })
+          .catch((error) => {
+            this.loading = false;
+            console.error("鑾峰彇寮傚父缁撴灉澶辫触:", error);
+            this.$message.error("鑾峰彇寮傚父缁撴灉澶辫触");
+            reject(error); // 杩斿洖閿欒
+          })
+          .finally(() => {
+            if (this.loading) {
+              this.loading = false;
+            }
           });
-          if (!this.yichangList) {
-            this.$message.warning("鏆傛棤寮傚父鎶ュ憡");
-          }
-        })
-        .catch((error) => {
-          this.isLoading = false;
-          console.error("鑾峰彇寮傚父缁撴灉澶辫触:", error);
-          this.$message.error("鑾峰彇寮傚父缁撴灉澶辫触");
-        })
-        .finally(() => {
-          this.isLoading = false;
-          this.loading = false;
-        });
+      });
     },
 
     fuchaxiangmu() {
@@ -2939,6 +2952,7 @@
     radiotjprojectChange() {
       if (this.tjproject == "0") {
         getupdateCheckType(this.tjNumber).then((response) => {
+          this.isLoading = false;
           this.changedate = response.data;
           this.changedate.forEach((item) => {
             this.textarea1 = item.checkAdvice;
@@ -3162,6 +3176,7 @@
 
     handleClick(row) {
       this.qingkong();
+      this.isLoading = true; // 寮�濮嬫暣浣撳姞杞�
       this.$refs.Pre.open = false;
       this.tableAll = row;
       let dict = "dict_tjtype";
@@ -3183,49 +3198,58 @@
         this.status = res.data;
         if (this.status) {
           if (this.status.status === "1") {
-            this.yichangjieguo();
-            getInfo().then((response) => {
-              this.userId = response.user.userId;
-              if (this.userId) {
-                let data = {
-                  userId: this.userId,
-                  tjNumber: this.tjNumber,
-                  state: 0,
-                };
-                getModifiedState(data).then((res) => {
-                  this.MsgId = res.msg;
-                  this.isLoading = true;
-                  this.drawer = true;
-                  getupdateCheckType(this.tjNumber).then((response) => {
-                    // this.isLoading = false
-                    this.changedate = response.data;
-                    if (this.changedate) {
-                      this.changedate.forEach((item) => {
-                        this.textarea1 = item.checkAdvice || "";
-                      });
-                      this.initialTotalCheckAdvice = this.textarea1;
-                      this.initialState = JSON.parse(
-                        JSON.stringify(this.changedate)
-                      );
-                      for (let i = 0; i < this.changedate.length; i++) {
-                        this.remark = this.changedate[i].remark;
-                      }
-                      // 鍥炴樉 zhiyeJl 鍜� zhiyeJg
-                      this.zhiyeJl = this.changedate[0].zhiyejl || "";
-                      this.zhiyeJg =
-                        this.changedate[0].zhiyejg || "鏈彂鐜扮洰鏍囨�х柧鐥�";
-                    } else {
-                      this.$message({
-                        type: "warning",
-                        message: "璇ュ鎴锋病鏈変綋妫�椤圭洰鏁版嵁",
-                      });
-                      // 濡傛灉娌℃湁鏁版嵁锛屾竻绌哄瓧娈�
-                      this.zhiyeJl = "";
-                      this.zhiyeJg = "鏈彂鐜扮洰鏍囨�х柧鐥�";
-                    }
-                  });
-                });
+            // 鍏堣皟鐢ㄥ紓甯哥粨鏋滐紝绛夊緟鍏跺畬鎴愬悗鍐嶇户缁悗缁�昏緫
+            this.yichangjieguo().then(() => {
+              // 濡傛灉寮傚父缁撴灉涓虹┖锛岀珛鍗冲叧闂姞杞芥骞舵墦寮�鎶藉眽
+              if (!this.yichangList || this.yichangList.length === 0) {
+                this.isLoading = false;
+                this.drawer = true;
+                return;
               }
+              
+              // 寮傚父缁撴灉鏈夋暟鎹紝缁х画鍚庣画閫昏緫
+              getInfo().then((response) => {
+                this.userId = response.user.userId;
+                if (this.userId) {
+                  let data = {
+                    userId: this.userId,
+                    tjNumber: this.tjNumber,
+                    state: 0,
+                  };
+                  getModifiedState(data).then((res) => {
+                    this.MsgId = res.msg;
+                    this.drawer = true;
+                    getupdateCheckType(this.tjNumber).then((response) => {
+                      this.isLoading = false; // 鍏抽棴鍔犺浇妗�
+                      this.changedate = response.data;
+                      if (this.changedate) {
+                        this.changedate.forEach((item) => {
+                          this.textarea1 = item.checkAdvice || "";
+                        });
+                        this.initialTotalCheckAdvice = this.textarea1;
+                        this.initialState = JSON.parse(
+                          JSON.stringify(this.changedate)
+                        );
+                        for (let i = 0; i < this.changedate.length; i++) {
+                          this.remark = this.changedate[i].remark;
+                        }
+                        // 鍥炴樉 zhiyeJl 鍜� zhiyeJg
+                        this.zhiyeJl = this.changedate[0].zhiyejl || "";
+                        this.zhiyeJg =
+                          this.changedate[0].zhiyejg || "鏈彂鐜扮洰鏍囨�х柧鐥�";
+                      } else {
+                        this.$message({
+                          type: "warning",
+                          message: "璇ュ鎴锋病鏈変綋妫�椤圭洰鏁版嵁",
+                        });
+                        // 濡傛灉娌℃湁鏁版嵁锛屾竻绌哄瓧娈�
+                        this.zhiyeJl = "";
+                        this.zhiyeJg = "鏈彂鐜扮洰鏍囨�х柧鐥�";
+                      }
+                    });
+                  });
+                }
+              });
             });
           } else {
             this.$confirm(
@@ -3238,51 +3262,61 @@
               }
             )
               .then(() => {
-                this.yichangjieguo();
-                getInfo().then((response) => {
-                  this.userId = response.user.userId;
-                  if (this.userId) {
-                    let data = {
-                      userId: this.userId,
-                      tjNumber: this.tjNumber,
-                      state: 0,
-                    };
-                    getforceIn(data).then((res) => {
-                      this.MsgId = res.msg;
-                      this.isLoading = true;
-                      this.drawer = true;
-                      getupdateCheckType(this.tjNumber).then((response) => {
-                        // this.isLoading = false
-                        this.changedate = response.data;
-                        if (this.changedate) {
-                          for (let i = 0; i < this.changedate.length; i++) {
-                            this.remark = this.changedate[i].remark;
-                          }
-                          this.initialState = JSON.parse(
-                            JSON.stringify(this.changedate)
-                          );
-                          this.changedate.forEach((item) => {
-                            this.textarea1 = item.checkAdvice || "";
-                          });
-                          // 鍥炴樉 zhiyeJl 鍜� zhiyeJg
-                          this.zhiyeJl = this.changedate[0].zhiyejl || "";
-                          this.zhiyeJg =
-                            this.changedate[0].zhiyejg || "鏈彂鐜扮洰鏍囨�х柧鐥�";
-                        } else {
-                          this.$message({
-                            type: "warning",
-                            message: "璇ュ鎴锋病鏈変綋妫�椤圭洰鏁版嵁",
-                          });
-                          // 濡傛灉娌℃湁鏁版嵁锛屾竻绌哄瓧娈�
-                          this.zhiyeJl = "";
-                          this.zhiyeJg = "鏈彂鐜扮洰鏍囨�х柧鐥�";
-                        }
-                      });
-                    });
+                // 鍏堣皟鐢ㄥ紓甯哥粨鏋滐紝绛夊緟鍏跺畬鎴愬悗鍐嶇户缁悗缁�昏緫
+                this.yichangjieguo().then(() => {
+                  // 濡傛灉寮傚父缁撴灉涓虹┖锛岀珛鍗冲叧闂姞杞芥骞舵墦寮�鎶藉眽
+                  if (!this.yichangList || this.yichangList.length === 0) {
+                    this.isLoading = false;
+                    this.drawer = true;
+                    return;
                   }
+                  
+                  // 寮傚父缁撴灉鏈夋暟鎹紝缁х画鍚庣画閫昏緫
+                  getInfo().then((response) => {
+                    this.userId = response.user.userId;
+                    if (this.userId) {
+                      let data = {
+                        userId: this.userId,
+                        tjNumber: this.tjNumber,
+                        state: 0,
+                      };
+                      getforceIn(data).then((res) => {
+                        this.MsgId = res.msg;
+                        this.drawer = true;
+                        getupdateCheckType(this.tjNumber).then((response) => {
+                          this.isLoading = false; // 鍏抽棴鍔犺浇妗�
+                          this.changedate = response.data;
+                          if (this.changedate) {
+                            for (let i = 0; i < this.changedate.length; i++) {
+                              this.remark = this.changedate[i].remark;
+                            }
+                            this.initialState = JSON.parse(
+                              JSON.stringify(this.changedate)
+                            );
+                            this.changedate.forEach((item) => {
+                              this.textarea1 = item.checkAdvice || "";
+                            });
+                            // 鍥炴樉 zhiyeJl 鍜� zhiyeJg
+                            this.zhiyeJl = this.changedate[0].zhiyejl || "";
+                            this.zhiyeJg =
+                              this.changedate[0].zhiyejg || "鏈彂鐜扮洰鏍囨�х柧鐥�";
+                          } else {
+                            this.$message({
+                              type: "warning",
+                              message: "璇ュ鎴锋病鏈変綋妫�椤圭洰鏁版嵁",
+                            });
+                            // 濡傛灉娌℃湁鏁版嵁锛屾竻绌哄瓧娈�
+                            this.zhiyeJl = "";
+                            this.zhiyeJg = "鏈彂鐜扮洰鏍囨�х柧鐥�";
+                          }
+                        });
+                      });
+                    }
+                  });
                 });
               })
               .catch(() => {
+                this.isLoading = false; // 鍙栨秷鏃朵篃瑕佸叧闂姞杞芥
                 this.$message({
                   type: "info",
                   message: "宸插彇娑堣繘鍏�",
@@ -3366,7 +3400,7 @@
         .then((response) => {
           if (response.code === 200) {
             this.isLoading = false;
-           this.$modal.msgSuccess(response.msg);
+            this.$modal.msgSuccess(response.msg);
             // 娓呯┖瀛楁
             this.zhiyeJl = "";
             this.zhiyeJg = "";

--
Gitblit v1.8.0