From e17811c1d7b1e6318af32a366d23bd586750b6d2 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期三, 27 十一月 2024 11:32:48 +0800
Subject: [PATCH] 2024 11 27

---
 src/views/doctor/checkAll/index.vue |  534 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 380 insertions(+), 154 deletions(-)

diff --git a/src/views/doctor/checkAll/index.vue b/src/views/doctor/checkAll/index.vue
index 878a99e..ef48f09 100644
--- a/src/views/doctor/checkAll/index.vue
+++ b/src/views/doctor/checkAll/index.vue
@@ -229,7 +229,7 @@
             :total="total"
             :page.sync="queryParams.page"
             :limit.sync="queryParams.pageSize"
-            @pagination="getList"
+            @pagination="submitForm"
           />
         </div>
       </div>
@@ -262,7 +262,11 @@
                   }}鐨勪綋妫�璧勬枡
                 </caption>
                 <tr
-                  style="border: 1px solid #dfe6ec; border-collapse: collapse;height: 36px;"
+                  style="
+                    border: 1px solid #dfe6ec;
+                    border-collapse: collapse;
+                    height: 36px;
+                  "
                 >
                   <td
                     style="border: 1px solid #dfe6ec; border-collapse: collapse"
@@ -292,7 +296,11 @@
                   </td>
                 </tr>
                 <tr
-                  style="border: 1px solid #dfe6ec; border-collapse: collapse;height: 36px;"
+                  style="
+                    border: 1px solid #dfe6ec;
+                    border-collapse: collapse;
+                    height: 36px;
+                  "
                 >
                   <td
                     style="border: 1px solid #dfe6ec; border-collapse: collapse"
@@ -367,122 +375,204 @@
               >
                 {{ item.parent || "" }}
               </div>
-              <el-table
-                :data="item.sons"
-                border
-                style="width: 100%"
-                :row-style="changRed"
-                :header-cell-style="{background:'#aad8df'}"
-              >
-                <el-table-column align="center" label="妫�娴嬮」鐩�" width="240">
-                  <template slot-scope="scope">
-                    <div v-if="scope.row.project != null">
-                      {{ scope.row.project.proName || "" }}
-                    </div>
-                    <div v-else>{{ scope.row.proName }}</div>
-                  </template>
-                </el-table-column>
-                <el-table-column
-                  align="center"
-                  prop="proResult"
-                  label="妫�娴嬬粨鏋�"
-                  width="180"
+              <div v-if="item.xmlb == '0'">
+                <el-table
+                  :data="item.sons"
+                  border
+                  style="width: 100%"
+                  :row-style="changRed"
+                  :header-cell-style="{ background: '#aad8df' }"
                 >
-                </el-table-column>
-                <el-table-column align="center" prop="" label="鍗曚綅">
-                  <template slot-scope="scope">
-                    <div v-if="scope.row.project != null">
-                      {{ scope.row.standard.company || "" }}
-                    </div>
-                    <div v-else>{{ scope.row.proAdvice }}</div>
-                  </template>
-                </el-table-column>
-                <el-table-column align="center" prop="" label=" 鍙傝�冭寖鍥�">
-                  <template slot-scope="scope">
-                    <div v-if="scope.row.project != null">
-                      {{
-                        scope.row.standard.tjStandardGtValue ||
-                        "/" + "-" + scope.row.standard.tjStandardLtValue ||
-                        "/"
-                      }}
-                    </div>
-                    <div v-else>{{ scope.row.stanId || "/" }}</div>
-                  </template>
-                </el-table-column>
-              </el-table>
-              <table style="width: 100%" v-if="tjproject != '1'">
-                <tr
-                  style="border: 1px solid #dfe6ec; border-collapse: collapse"
-                >
-                  <td
-                    style="
-                      border: 1px solid #dfe6ec;
-                      border-collapse: collapse;
-                      width:7%
-                    "
-                     
+                  <el-table-column align="center" label="妫�娴嬮」鐩�" width="240">
+                    <template slot-scope="scope">
+                      <div>{{ scope.row.proName }}</div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column
+                    align="center"
+                    prop="proResult"
+                    label="妫�娴嬬粨鏋�"
+                    width="180"
                   >
-                    灏忕粨锛�
-                  </td>
-                  <td
-                    style="
-                      border: 1px solid #dfe6ec;width:45%
-                    "
-
+                  </el-table-column>
+                  <el-table-column align="center" prop="" label="鍗曚綅">
+                    <template slot-scope="scope">
+                      <div v-if="scope.row.project != null">
+                        {{ scope.row.standard.company || "" }}
+                      </div>
+                      <div v-else>{{ scope.row.proAdvice }}</div>
+                    </template>
+                  </el-table-column>
+                  <el-table-column align="center" prop="" label=" 鍙傝�冭寖鍥�">
+                    <template slot-scope="scope">
+                      <div v-if="scope.row.project != null">
+                        {{
+                          scope.row.standard.tjStandardGtValue ||
+                          "/" + "-" + scope.row.standard.tjStandardLtValue ||
+                          "/"
+                        }}
+                      </div>
+                      <div v-else>{{ scope.row.stanId || "/" }}</div>
+                    </template>
+                  </el-table-column>
+                </el-table>
+                <table style="width: 100%" v-if="tjproject != '1'">
+                  <tr
+                    style="border: 1px solid #dfe6ec; border-collapse: collapse"
                   >
-                    <el-input v-model="item.remark" disabled></el-input>
-                    <!-- <el-select v-model="item.value" multiple filterable placeholder="璇烽�夋嫨" style="width: 100%" @change="xiAoJieChange($event, item)">
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                        width: 7%;
+                      "
+                    >
+                      灏忕粨锛�
+                    </td>
+                    <td style="border: 1px solid #dfe6ec; width: 45%">
+                      <el-input v-model="item.remark" disabled></el-input>
+                      <!-- <el-select v-model="item.value" multiple filterable placeholder="璇烽�夋嫨" style="width: 100%" @change="xiAoJieChange($event, item)">
                 <el-option v-for="item1 in item.parentAdvice" :key="item1.id" :label="item1.title" :value="item1.id">
                 </el-option>
               </el-select> -->
-                  </td>
-                  <td
+                    </td>
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                        width: 15%;
+                      "
+                    >
+                      涓绘鍖诲笀锛�
+                    </td>
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                      "
+                      colspan="2"
+                    >
+                      {{ item.doctorName }}
+                    </td>
+                  </tr>
+                  <tr
                     style="
                       border: 1px solid #dfe6ec;
                       border-collapse: collapse;
-                      width:15%
+                      width: 200px;
                     "
                   >
-                    涓绘鍖诲笀锛�
-                  </td>
-                  <td
-                    style="border: 1px solid #dfe6ec; border-collapse: collapse" colspan="2"
-                  >
-                    {{ item.doctorName }}
-                  </td>
-                </tr>
-                <tr
-                  style="
-                    border: 1px solid #dfe6ec;
-                    border-collapse: collapse;
-                    width: 200px;
-                  "
-                >
-                  <td
-                    style="
-                      border: 1px solid #dfe6ec;
-                      border-collapse: collapse;
-                      width: 240px;
-                    "
-                  >
-                    澶囨敞锛�
-                  </td>
-                  <td
-                    style="border: 1px solid #dfe6ec; border-collapse: collapse"
-                    colspan="3"
-                  >
-                    <textarea
-                      placeholder="璇疯緭鍏ュ唴瀹�"
-                      :autosize="{ minRows: 2, maxRows: 2 }"
-                      style="width: 100%; height: 100%"
-                      v-model="changedate[index].remark"
-                      v-on:input="change"
-                    ></textarea>
-                    <!-- <el-input type="textarea" autosize >
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                        width: 240px;
+                      "
+                    >
+                      澶囨敞锛�
+                    </td>
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                      "
+                      colspan="3"
+                    >
+                      <textarea
+                        placeholder="璇疯緭鍏ュ唴瀹�"
+                        :autosize="{ minRows: 2, maxRows: 2 }"
+                        style="width: 100%; height: 100%; resize: none"
+                        v-model="changedate[index].remark"
+                        v-on:input="change"
+                      ></textarea>
+                      <!-- <el-input type="textarea" autosize >
               </el-input> -->
-                  </td>
-                </tr>
-              </table>
+                    </td>
+                  </tr>
+                </table>
+              </div>
+              <div v-else>
+                <table style="width: 100%" v-if="tjproject != '1'">
+                  <tr style="border: 1px solid #dfe6ec">
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                        width: 15%;
+                        height: 52px;
+                      "
+                    >
+                      妫�鏌ユ墍瑙侊細
+                    </td>
+                    <td
+                      style="border: 1px solid #dfe6ec; height: 52px"
+                      colspan="2"
+                    >
+                      <textarea
+                        placeholder="璇疯緭鍏ュ唴瀹�"
+                        :autosize="{ minRows: 3, maxRows: 4 }"
+                        style="width: 100%; height: 100%; resize: none"
+                        v-model="item.jgbx"
+                      ></textarea>
+                    </td>
+                  </tr>
+                  <tr
+                    style="border: 1px solid #dfe6ec; border-collapse: collapse"
+                  >
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                        width: 15%;
+                      "
+                    >
+                      妫�鏌ユ彁绀猴細
+                    </td>
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                      "
+                      colspan="2"
+                    >
+                      <!-- <el-input v-model="item.remark"></el-input> -->
+                      <textarea
+                        placeholder="璇疯緭鍏ュ唴瀹�"
+                        :autosize="{ minRows: 2, maxRows: 3 }"
+                        style="width: 100%; height: 100%; resize: none"
+                        v-model="item.remark"
+                      ></textarea>
+                    </td>
+                  </tr>
+                  <tr
+                    style="
+                      border: 1px solid #dfe6ec;
+                      border-collapse: collapse;
+                      width: 200px;
+                      height: 36px;
+                    "
+                  >
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                        width: 15%;
+                      "
+                    >
+                      涓绘鍖诲笀锛�
+                    </td>
+                    <td
+                      style="
+                        border: 1px solid #dfe6ec;
+                        border-collapse: collapse;
+                      "
+                      colspan="2"
+                    >
+                      {{ item.doctorName }}
+                    </td>
+                  </tr>
+                </table>
+              </div>
             </div>
 
             <div style="margin: 0 0px 10px 15px" v-if="tjproject != '1'">
@@ -1062,6 +1152,9 @@
   name: "checkAll",
   data() {
     return {
+      // 鏇存柊鎬绘寤鸿
+      initialTotalCheckAdvice: "",
+      initialState: "",
       preObj: {},
       baogao: [],
       flags: false,
@@ -1433,6 +1526,8 @@
     radioChange(value) {
       this.loading = true;
       this.queryParams.checkStatus = value;
+      this.queryParams.page = 1;
+      this.queryParams.pageSize = 10;
       getcheckList(this.queryParams).then((response) => {
         if (response.data) {
           this.checkList = response.data.customers;
@@ -1451,7 +1546,6 @@
     },
     eventchange(data) {
       this.dataText = data;
-      console.log(this.textarea1);
       if (this.textarea1 == null) {
         this.textarea1 = "";
       }
@@ -1564,6 +1658,7 @@
 
     // 鎼滅储
     submitForm() {
+      console.log(this.tjStatus);
       this.loading = true;
       this.queryParams.compId = this.CheckBox.drugManufacturerId;
       this.queryParams.checkStatus = this.tjStatus;
@@ -1607,8 +1702,25 @@
       }
     },
 
+    /*  changRed(row) {
+      if (row.label === "鈫�") {
+        return {
+          color: "green", // 璁剧疆涓婄澶翠负缁胯壊
+        };
+      } else if (row.label === "鈫�") {
+        return {
+          color: "red", // 璁剧疆涓嬬澶翠负绾㈣壊
+        };
+      }
+      // 榛樿棰滆壊
+      return {
+        color: "black",
+      };
+    }, */
     handleCurrentChange(val) {
-      this.handleClick(val);
+      if (val != null) {
+        this.handleClick(val);
+      }
     },
 
     // 鐐瑰嚮璇︽儏
@@ -1616,15 +1728,7 @@
       this.$refs.Pre.open = false;
       this.tableAll = row;
       this.tjproject = "0";
-      // if (this.tableAll.cusSex === 0) {
-      //   this.tableAll.cusSex = "鐢�";
-      // }
-      // if (this.tableAll.cusSex === 1) {
-      //   this.tableAll.cusSex = "濂�";
-      // }
-      // if (this.tableAll.cusSex === 2) {
-      //   this.tableAll.cusSex = "鏈煡";
-      // }
+
       this.tjNumber = this.tableAll.tjNumber;
       getState(this.tjNumber).then((res) => {
         this.status = res.data;
@@ -1644,12 +1748,20 @@
                   this.changedate = response.data;
                   if (this.changedate) {
                     this.changedate.forEach((item) => {
-                      this.textarea1 = item.checkAdvice;
+                      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;
                     }
-                    console.log(this.changedate);
                     this.changedate.forEach((item) => {
                       // this.remark = item.remark;
                       // item.sons.forEach((item3) => {
@@ -1699,8 +1811,12 @@
                         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;
+                          this.textarea1 = item.checkAdvice || "";
 
                           // this.remark = item.remark;
                           // item.sons.forEach((item3) => {
@@ -1713,6 +1829,11 @@
                           // });
                           // item.remark = "";
                         });
+
+                        // 淇濆瓨鎬绘寤鸿
+                        this.totalCheckAdvice = this.changedate.map(
+                          (item) => item.totalCheckAdvice
+                        );
                       } else {
                         this.$message({
                           type: "warning ",
@@ -1763,28 +1884,44 @@
       if (this.loading) {
         return;
       }
-      this.$confirm("纭畾瑕佹彁浜ゅ悧锛�")
-        .then((_) => {
-          this.loading = true;
-          this.timer = setTimeout(() => {
-            done();
-            this.determine();
-            // 鍔ㄧ敾鍏抽棴闇�瑕佷竴瀹氱殑鏃堕棿
-            setTimeout(() => {
-              this.loading = false;
-            }, 400);
-          }, 2000);
-        })
-        .catch((_) => {
-          this.drawer = false;
-          let data = {
-            userId: this.userId,
-            tjNumber: this.tjNumber,
-            state: 1,
-            id: this.MsgId,
-          };
-          getfiedState(data).then((res) => {});
-        });
+
+      // 妫�鏌ユ槸鍚︽湁淇敼
+      let isModified =
+        JSON.stringify(this.changedate) !== JSON.stringify(this.initialState) ||
+        (this.textarea1 !== this.initialTotalCheckAdvice &&
+          this.textarea1 !== null);
+      console.log("Initial Total Check Advice:", this.initialTotalCheckAdvice);
+
+      console.log("Current textarea1:", this.textarea1);
+      if (isModified) {
+        // 濡傛灉鏈変慨鏀癸紝寮瑰嚭纭妗�
+        this.$confirm("妫�娴嬪唴瀹规湁淇敼锛岀‘瀹氳鎻愪氦鍚楋紵")
+          .then(() => {
+            this.loading = true;
+            this.timer = setTimeout(() => {
+              done();
+              this.determine();
+              setTimeout(() => {
+                this.loading = false;
+              }, 400);
+            }, 2000);
+          })
+          .catch(() => {
+            // 鐢ㄦ埛鍙栨秷鎿嶄綔
+            this.drawer = false;
+            let data = {
+              userId: this.userId,
+              tjNumber: this.tjNumber,
+              state: 1,
+              id: this.MsgId,
+            };
+            getfiedState(data).then((res) => {});
+            this.submitForm();
+          });
+      } else {
+        // 濡傛灉娌℃湁淇敼锛岀洿鎺ュ叧闂�
+        done();
+      }
     },
     handleClose1() {
       this.jianqians = false;
@@ -1810,10 +1947,8 @@
     //     });
     //   }
     // },
-    change(vale) {
-      // console.log(this.changedate[index].remark);
-    },
-    determine() {
+    change(vale) {},
+   /*  determine() {
       let tjNumber = this.tableAll.tjNumber;
       let advice = this.textarea1;
       let data = {
@@ -1821,6 +1956,7 @@
         advice,
         checkStatus: 1,
       };
+      this.loading = true;
       getTjdetailList(data).then((response) => {
         if (response.code === 200) {
           this.$modal.msgSuccess("鎻愪氦鎴愬姛");
@@ -1831,13 +1967,22 @@
             state: 1,
             id: this.MsgId,
           };
-          gettoPdf(tjNumber).then((res) => {
-            this.$modal.msgSuccess("宸茬敓鎴愭姤鍛婏紒璇峰墠寰�鎶ュ憡鏍告敹椤甸潰纭锛�");
-          });
+          gettoPdf(tjNumber)
+            .then((res) => {
+              this.$modal.msgSuccess("宸茬敓鎴愭姤鍛婏紒璇峰墠寰�鎶ュ憡鏍告敹椤甸潰纭锛�");
+            })
+            .catch((error) => {
+              this.$modal.msgError(
+                "鎵撳嵃鎶ュ憡澶辫触锛岃鍓嶅線鎶ュ憡鎵撳嵃椤甸潰琛ユ墦鎶ュ憡锛�"
+              );
+            })
           getfiedState(data).then((res) => {
             this.drawer = false;
           });
-        }
+          this.queryParams.page = 1;
+          this.queryParams.pageSize = 10;
+          this.submitForm();
+          this.$forceUpdate();
       });
 
       for (let i = 0; i < this.changedate.length; i++) {
@@ -1852,12 +1997,94 @@
         ];
         getModified(updateOrderRemarkVos).then((response) => {});
       }
-      this.submitForm();
-      this.$forceUpdate();
+
       // this.changedate.forEach((item) => {
       //   this.proIds = item.parentId;
       //   // this.remark = item.remark;
       // });
+    }, */
+    determine() {
+      let tjNumber = this.tableAll.tjNumber;
+      let advice = this.textarea1;
+      let data = {
+        tjNumber,
+        advice,
+        checkStatus: 1,
+      };
+
+      // 寮�濮嬪姞杞�
+      this.loading = true;
+
+      // 鎻愪氦鏁版嵁
+      getTjdetailList(data)
+        .then((response) => {
+          if (response.code === 200) {
+            this.$modal.msgSuccess("鎻愪氦鎴愬姛");
+
+            // 鍑嗗鐢熸垚鎶ュ憡鐨勮姹傛暟鎹�
+            let reportData = {
+              userId: this.userId,
+              tjNumber: tjNumber,
+              state: 1,
+              id: this.MsgId,
+            };
+
+            // 鐢熸垚鎶ュ憡骞朵繚鎸� loading 鎵撳紑
+            const reportPromise = gettoPdf(tjNumber)
+              .then((res) => {
+                this.$modal.msgSuccess("宸茬敓鎴愭姤鍛婏紒璇峰墠寰�鎶ュ憡鏍告敹椤甸潰纭锛�");
+              })
+              .catch((error) => {
+                this.$modal.msgError(
+                  "鎵撳嵃鎶ュ憡澶辫触锛岃鍓嶅線鎶ュ憡鎵撳嵃椤甸潰琛ユ墦鎶ュ憡锛�"
+                );
+              });
+
+            // 鏇存柊鐘舵�佸苟鎻愪氦淇敼璇锋眰
+            const statePromise = getfiedState(reportData).then((res) => {
+              this.drawer = false;
+            });
+
+            // 澶勭悊鍏朵粬淇敼鎿嶄綔
+            const updatePromises = this.changedate.map((item) => {
+              this.proIds = item.parentId;
+              let remarks = item.remark;
+              let updateOrderRemarkVos = [
+                {
+                  tjNumber,
+                  proId: this.proIds.toString(),
+                  remarks,
+                },
+              ];
+              return getModified(updateOrderRemarkVos); // 杩斿洖 Promise
+            });
+
+            // 绛夊緟鎵�鏈夎姹傚畬鎴�
+            Promise.all([reportPromise, statePromise, ...updatePromises])
+              .then(() => {
+                // 鎵�鏈夎姹傚畬鎴愶紝鍏抽棴 loading
+                this.loading = false;
+                // 鏇存柊鍒嗛〉淇℃伅
+                this.queryParams.page = 1;
+                this.queryParams.pageSize = 10;
+                this.submitForm();
+                this.$forceUpdate();
+              })
+              .catch((error) => {
+                // 澶勭悊閿欒鎯呭喌
+                this.loading = false;
+                console.error("鍙戠敓閿欒:", error);
+              });
+          } else {
+            // 鎻愪氦澶辫触锛屽叧闂� loading
+            this.loading = false;
+          }
+        })
+        .catch((error) => {
+          // 鎻愪氦璇锋眰澶辫触锛屽叧闂� loading
+          this.loading = false;
+          console.error("鎻愪氦璇锋眰澶辫触:", error);
+        });
     },
   },
 };
@@ -1928,7 +2155,6 @@
   border: none;
   outline: none;
 }
-
 </style>
 
   

--
Gitblit v1.8.0