From c5647495c3cd52131326aa117d8704d017d5bca9 Mon Sep 17 00:00:00 2001
From: wwl <xchao828@163.com>
Date: 星期四, 27 三月 2025 17:31:04 +0800
Subject: [PATCH] 1

---
 src/views/doctor/check/index.vue      |  230 +++++++++++++++++++++++++-------------
 src/views/doctor/checkAll/index.vue   |   12 -
 src/views/sampling/sampling/index.vue |  102 ++++++----------
 3 files changed, 192 insertions(+), 152 deletions(-)

diff --git a/src/views/doctor/check/index.vue b/src/views/doctor/check/index.vue
index bed0077..655e49e 100644
--- a/src/views/doctor/check/index.vue
+++ b/src/views/doctor/check/index.vue
@@ -274,23 +274,19 @@
         <el-col v-show="baogaoqian">
           <template>
             <el-tabs v-model="radio" type="border-card" @tab-click="handleTabClick" style="margin-left: 10px">
-              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index" :lazy="false">
+              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index"
+                :lazy="false">
                 <el-table class="bgc" v-loading="loading" :data="proParentList.sons" border height="460px"
                   style="width: 96%; margin: 10px 10px" :row-class-name="tableRowClassName">
                   <el-table-column prop="project.proName" label="妫�娴嬮」鐩�" width="150">
                   </el-table-column>
                   <el-table-column prop="proResult" label="妫�娴嬬粨鏋�" width="150">
-                    <!-- <template slot-scope="scope">
-                      <el-input type="textarea" autosize size="mini" v-model="scope.row.proResult" autocomplete="off"
-                        placeholder="璇疯緭鍏ユ娴嬬粨鏋�" @focus="handleFocus(scope.row)" @blur="handleInputConfirm(scope.row)"
-                        @input="vale($event, scope.row)" :disabled="scope.row.project.proName === 'BMI'"
-                        ></el-input> -->
-                        <template slot-scope="{ row, $index }">
-                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-item${index}-row${$index}`"
-                      @keydown.enter.native="keyInputConfirm($event,index,$index)" @focus="handleFocus(row)"
+                    <template slot-scope="{ row, $index }">
+                      <el-input type="textarea" autosize size="mini" v-model="row.proResult"
+                        :ref="`input-item${index}-row${$index}`"
+                        @keydown.enter.native="keyInputConfirm($event, index, $index)" @focus="handleFocus(row)"
                         @blur="handleInputConfirm(row)" @input="vale($event, row)"
-                        :disabled="row.project.proName === 'BMI'"
-                        ></el-input>
+                        :disabled="row.project.proName === 'BMI'"></el-input>
                     </template>
                   </el-table-column>
                   <el-table-column prop="exceptionDesc" label="寮傚父" width="55px" align="center">
@@ -420,22 +416,19 @@
         <el-col :span="18" v-show="baogaohou">
           <template>
             <el-tabs v-model="radio" type="border-card" @tab-click="handleTabClick" style="margin-left: 10px">
-              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index" :lazy="false">
+              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index"
+                :lazy="false">
                 <el-table class="bgc" v-loading="loading" :data="proParentList.sons" border height="460px"
                   style="width: 96%; margin: 10px 10px" :row-class-name="tableRowClassName">
                   <el-table-column prop="project.proName" label="妫�娴嬮」鐩�" width="100">
                   </el-table-column>
                   <el-table-column prop="proResult" label="妫�娴嬬粨鏋�" width="150">
-                    <!-- <template slot-scope="scope">
-                      <el-input type="textarea" autosize size="mini" v-model="scope.row.proResult" autocomplete="off"
-                        placeholder="璇疯緭鍏ユ娴嬬粨鏋�" @focus="handleFocus(scope.row)" @blur="handleInputConfirm(scope.row)"
-                        @input="vale"></el-input> -->
-                        <template slot-scope="{ row, $index }">
-                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-item${index}-row${$index}`"
-                      @keydown.enter.native="keyInputConfirm($event,index,$index)" @focus="handleFocus(row)"
+                    <template slot-scope="{ row, $index }">
+                      <el-input type="textarea" autosize size="mini" v-model="row.proResult"
+                        :ref="`input-item${index}-row${$index}`"
+                        @keydown.enter.native="keyInputConfirm($event, index, $index)" @focus="handleFocus(row)"
                         @blur="handleInputConfirm(row)" @input="vale($event, row)"
-                        :disabled="row.project.proName === 'BMI'"
-                        ></el-input>
+                        :disabled="row.project.proName === 'BMI'"></el-input>
                     </template>
                   </el-table-column>
                   <el-table-column label="瑙勫垯" width="70">
@@ -1005,7 +998,18 @@
     },
 
     // 杈撳叆纭鏃舵洿鏂� BMI
-    handleInputConfirm(row) {
+    handleInputConfirm(row, params) {
+      // 濡傛灉鏈� params 涓斾负绌猴紝鍙栨秷寮傚父鐘舵�佸苟娓呯┖鐩稿叧瀛楁
+      if (params && params.length === 0) {
+        row.exceptionDesc = false;
+        row.proResult = "";
+        row.conclusion = "";
+        row.proAdvice = "";
+        row.rulesList = [];
+        return;
+      }
+
+      // 鐜版湁 BMI 璁$畻閫昏緫
       if (row.proResult) {
         if (row.project.proName === '韬珮' || row.project.proName === '浣撻噸') {
           const heightRow = this.proParentList.sons.find(
@@ -1025,7 +1029,73 @@
             bmiRow.proResult = bmi || '';
           }
         }
+
+        this.focusrow = row;
+        this.proResult = row;
+        const pattern3 = new RegExp("[0-9]+");
+        if (pattern3.test(row.proResult)) {
+          let data = {
+            proId: this.focusrow.proId,
+            cusId: this.tableAll.cusId,
+            tjNum: this.tableAll.tjNumber,
+            keyNum: this.proResult.proResult,
+          };
+          AutoGetRule(data).then((res) => {
+            this.focusrow.conclusion = "";
+            if (res.data) {
+              this.autorule = res.data;
+              this.focusrow.rulesList = res.data;
+              if (res.data.length > 0) {
+                const conditions = ["姝e父", "鏈寮傚父", "闃存��", "鏈鏄庢樉寮傚父"];
+                this.focusrow.exceptionDesc = !conditions.some((condition) =>
+                  this.autorule[0].bz.includes(condition)
+                );
+              } else {
+                this.focusrow.exceptionDesc = false;
+              }
+              if (this.autorule.length !== 0 && (this.autorule[0] || this.autorule[0].nr)) {
+                this.focusrow.proAdvice = this.autorule[0].nr;
+              }
+              this.autorule.forEach((item) => {
+                this.focusrow.conclusion += this.focusrow.conclusion ? item.bz : item.bz;
+              });
+            }
+          });
+        } else {
+          let data = {
+            proId: this.focusrow.proId,
+            cusId: this.tableAll.cusId,
+            keyWord: this.proResult.proResult, // 淇敼涓� proResult.proResult
+            tjNum: this.tableAll.tjNumber,
+            keyNum: this.proResult.proResult,
+          };
+          AutoGetRule(data).then((res) => {
+            this.focusrow.conclusion = "";
+            if (res.data) {
+              this.autorule = res.data;
+              this.focusrow.rulesList = res.data;
+              if (res.data.length > 0) {
+                const conditions = ["姝e父", "鏈寮傚父", "闃存��", "鏈鏄庢樉寮傚父"];
+                this.focusrow.exceptionDesc = !conditions.some((condition) =>
+                  this.autorule[0].bz.includes(condition)
+                );
+              } else {
+                this.focusrow.exceptionDesc = false;
+              }
+              if (this.autorule.length !== 0 && (this.autorule[0] || this.autorule[0].nr)) {
+                this.focusrow.proAdvice = this.autorule[0].nr;
+              }
+              this.autorule.forEach((item) => {
+                this.focusrow.conclusion += this.focusrow.conclusion ? item.bz : item.bz;
+              });
+            }
+          });
+        }
+
+        // 灏嗗綋鍓嶈娣诲姞鍒� rows 涓�
         this.rows.push(row);
+        console.log(this.rows, row);
+        
       }
     },
 
@@ -1093,26 +1163,25 @@
       });
     },
 
-    // 浠ヤ笅涓哄叾浠栨柟娉曪紝鏈仛淇敼锛屼粎淇濈暀蹇呰閮ㄥ垎锛屽叾浣欑渷鐣ヤ互淇濇寔绠�娲�
     handleFocus(row) {
       this.autorule = [];
-      if (!row.resultType || row.resultType == 2 ) {
+      if (!row.resultType || row.resultType == 2) {
         return;
       } else {
         this.curindex = row;
-      selectZT({
-        proId: row.proId,
-      }).then((res) => {
-        if (res.data.length > 0) {
-          this.$refs.bbb.title = "閫夋嫨妫�娴嬬粨鏋�";
-        // this.$refs.bbb.proId = row.proId;
-        this.$refs.bbb.open = true;
-        this.$refs.bbb.getList(this.curindex);
-        } else {
-          this.$refs.bbb.open = false;
-        }
-      });
-        
+        selectZT({
+          proId: row.proId,
+        }).then((res) => {
+          if (res.data.length > 0) {
+            this.$refs.bbb.title = "閫夋嫨妫�娴嬬粨鏋�";
+            // this.$refs.bbb.proId = row.proId;
+            this.$refs.bbb.open = true;
+            this.$refs.bbb.getList(this.curindex);
+          } else {
+            this.$refs.bbb.open = false;
+          }
+        });
+
       }
     },
 
@@ -1121,7 +1190,7 @@
       this.handleInputConfirm(this.curindex, params);
     },
 
-      handleChanges(param1, param2) {
+    handleChanges(param1, param2) {
       this.row.conclusion = param1;
       this.row.rulesList = param2;
     },
@@ -1286,6 +1355,8 @@
     },
 
     changDesc(item) {
+      console.log(item);
+      
       item.conclusion = item.exceptionDesc ? "寮傚父" : "姝e父";
     },
 
@@ -1325,10 +1396,10 @@
 
 
 
-    keyInputConfirm(event,index, currentRowIndex) {
+    keyInputConfirm(event, index, currentRowIndex) {
       // 闃绘榛樿鍥炶溅琛屼负锛屾瘮濡傛彁浜よ〃鍗�
       event.preventDefault();
-     event.stopPropagation()
+      event.stopPropagation()
       const nextRowIndex = currentRowIndex + 1; // 璁$畻涓嬩竴琛岀储寮�
       // 濡傛灉涓嬩竴琛屽瓨鍦紝鍒欒仛鐒﹁琛岀殑杈撳叆妗�
       if (nextRowIndex < this.proParentList.sons.length) {
@@ -1376,7 +1447,7 @@
       });
     },
 
-    hb() {},
+    hb() { },
 
     propoChange() {
       this.cusobj = { sex: this.tableAll.cusSex, isZj: 1 };
@@ -1768,46 +1839,47 @@
     },
 
     determine() {
-      let tjNumber = this.tableAll.tjNumber;
-      this.userList.forEach((item) => {
-        if (this.doctorName == item.nickName) this.doctorName = item.userId;
+  let tjNumber = this.tableAll.tjNumber;
+  this.userList.forEach((item) => {
+    if (this.doctorName == item.nickName) this.doctorName = item.userId;
+  });
+  this.proParentList.sons.forEach((item) => {
+    if (this.rows) {
+      this.rows.forEach((item1) => {
+        if (item1 === item) item = item1;
       });
-      this.proParentList.sons.forEach((item) => {
-        if (this.rows) {
-          this.rows.forEach((item1) => {
-            if (item1 === item) item = item1;
-          });
-        }
-        this.tjOrderDetail.push({
-          proAdvice: item.proAdvice,
-          proName: item.project.proName,
-          proId: item.project.proId,
-          orderDetailId: item.orderDetailId,
-          flowingWaterId: item.flowingWaterId,
-          proResult: item.proResult,
-          tjStatus: 1,
-          isReturn: item.isReturn === true ? 1 : 0,
-          exceptionDesc: item.exceptionDesc === true ? 1 : 0,
-          conclusion: item.conclusion,
-          rulesList: item.rulesList,
-        });
-      });
+    }
+    this.tjOrderDetail.push({
+      proAdvice: item.proAdvice,
+      proName: item.project.proName,
+      proId: item.project.proId,
+      orderDetailId: item.orderDetailId,
+      flowingWaterId: item.flowingWaterId,
+      proResult: item.proResult,
+      tjStatus: 1,
+      isReturn: item.isReturn === true ? 1 : 0,
+      exceptionDesc: item.exceptionDesc === true ? 1 : 0,
+      conclusion: item.conclusion,
+      rulesList: item.rulesList,
+    });
+  });
 
-      let data = [{
-        tjNumber,
-        proId: this.proId,
-        remark: this.proParentList.remark,
-        proName: this.proName,
-        summaryList: this.vaids1,
-        doctorName: this.doctorName,
-        tjOrderDetailList: this.tjOrderDetail,
-      }];
-      getaddRemark(data).then((res) => {
-        this.$modal.msgSuccess("鎻愪氦鎴愬姛");
-        this.drawer = false;
-      });
-      this.handleClose();
-    },
+  let data = [{
+    tjNumber,
+    proId: this.proId,
+    remark: this.proParentList.remark,
+    proName: this.proName,
+    summaryList: this.vaids1,
+    doctorName: this.doctorName,
+    tjOrderDetailList: this.tjOrderDetail,
+  }];
+  getaddRemark(data).then((res) => {
+    this.$modal.msgSuccess("鎻愪氦鎴愬姛");
+    this.rows = []; // 鎻愪氦鎴愬姛鍚庢竻绌� this.rows
+    this.drawer = false;
+  });
+  this.handleClose();
+},
   },
 };
 </script>
diff --git a/src/views/doctor/checkAll/index.vue b/src/views/doctor/checkAll/index.vue
index 0524fff..33c4f63 100644
--- a/src/views/doctor/checkAll/index.vue
+++ b/src/views/doctor/checkAll/index.vue
@@ -720,8 +720,7 @@
         <el-button @click="jianqians = false">鍙� 娑�</el-button>
       </span>
     </el-dialog>
-    <el-dialog title="鏂板寮傚父缁撴灉" :visible.sync="addNewDialogVisible" width="900px" :before-close="handleAddNewClose"
-      class="custom-dialog">
+    <el-dialog title="鏂板寮傚父缁撴灉" :visible.sync="addNewDialogVisible" width="900px" class="custom-dialog">
       <el-form :model="newItem" ref="newItemForm" label-width="100px" class="custom-form">
         <el-form-item label="椤圭洰鍒嗙被" prop="parentName">
           <el-select v-model="newItem.parentName" placeholder="璇烽�夋嫨椤圭洰鍒嗙被" clearable filterable
@@ -771,7 +770,7 @@
         <el-form :inline="true">
           <el-form-item label="寤鸿鍚嶇О">
             <el-input v-model="queryParams1.zyzd" placeholder="璇疯緭鍏ュ缓璁悕绉拌繘琛岀瓫閫�" clearable style="width: 200px"
-              @input="filterAdvices(true)" onkeydown="if(event.keyCode === 32) return false;" />
+              @input="filterAdvices(true)" onkeydown="if(event.keyCode === 32 || event.keyCode === 13) return false;" />
           </el-form-item>
         </el-form>
       </div>
@@ -1044,6 +1043,7 @@
     });
   },
   methods: {
+
     handleAdviceBlur(row, index) {
       // 鏋勯�� advices 鏁版嵁
       let advicesToSubmit = [];
@@ -1205,12 +1205,6 @@
       if (value) {
         this.newItem.jcxm = value; // 灏嗛�夋嫨鐨勯」鐩垎绫昏祴鍊肩粰妫�娴嬮」鐩�
       }
-    },
-
-    handleAddNewClose(done) {
-      // this.$confirm('纭畾鍏抽棴鏂板绐楀彛鍚楋紵鏈繚瀛樼殑鏁版嵁灏嗕涪澶便��')
-      //   .then(() => done())
-      //   .catch(() => { });
     },
 
     // 娣诲姞鏂扮殑寤鸿缁�
diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index 2d6c38c..395b18a 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -104,9 +104,9 @@
         </el-table>
       </div>
       <div style="width: 50%">
-        <!-- v-if="this.rightTabShow"  v-if="tableList.length > 0"-->
-        <el-table v-loading="loading" :data="tableList" @selection-change="handleChange" :span-method="objectSpanMethod"
-          ref="elTable" :row-class-name="tableRowClassName" border height="520px">
+        <!-- v-if="this.rightTabShow" -->
+        <el-table v-if="tableList.length > 0" v-loading="loading" :data="tableList" @selection-change="handleChange"
+          :span-method="objectSpanMethod" ref="tab1" :row-class-name="tableRowClassName" border height="520px">
           <el-table-column type="selection" width="40" align="center" />
           <!--  :selectable="selectEnable" -->
           <!-- <el-table-column label="鏄惁绛炬敹" align="center" prop="isSignFor" /> -->
@@ -540,68 +540,31 @@
       if (this.createTimeList) {
         this.queryParams.beginTime = this.createTimeList[0];
         this.queryParams.endTime = this.createTimeList[1];
-      } else if (this.createTimeList == null) {
+      } else {
         this.queryParams.beginTime = null;
         this.queryParams.endTime = null;
       }
+
       getList(this.queryParams).then((response) => {
         this.loading1 = false;
-        if (response.data) {
-          if (!response.data.list || response.data.list.length === 0) {
-            this.samplingList = [];
-            this.tableList = [];
-            this.loading1 = false;
-            this.loading = false;
-            return;
-          } else {
-            this.samplingList = response.data.list;
-            // 鍒ゆ柇鏄惁闇�瑕佸埛鏂板彸杈硅〃鏍�
-            this.$nextTick(() => {
-              this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
-              // 妫�鏌ユ槸鍚﹀叏閫�
-              if (this.samplingList.length === this.selectedRows.length) {
-                this.disableSelections = true;
-              } else {
-                this.disableSelections = false;
-              }
-            });
-          }
+        if (response.data && response.data.list && response.data.list.length > 0) {
+          this.samplingList = response.data.list;
           this.total = response.data.total;
-          this.loading1 = false;
+          this.$nextTick(() => {
+            this.$refs.tb.toggleRowSelection(this.samplingList[0], true); // 榛樿閫変腑绗竴琛�
+            this.fetchData(this.samplingList[0].tjNumber); // 鍒锋柊鍙充晶琛ㄦ牸
+          });
         } else {
           this.samplingList = [];
           this.tableList = [];
-          this.loading1 = false;
+          this.selectList = []; // 娓呯┖ selectList
+          this.ids = []; // 娓呯┖ ids
+          if (this.$refs.tab1) {
+            this.$refs.tab1.clearSelection(); // 娓呯┖鍙充晶琛ㄦ牸閫変腑鐘舵��
+          }
         }
+        this.loading1 = false;
       });
-
-      /* getList(this.queryParams).then((response) => {
-        if (response.data) {
-          if (response.data.list == null) {
-            this.samplingList = [];
-            this.tableList = [];
-            this.loading = false;
-          } else {
-            this.samplingList = response.data.list;
-            console.log(this.samplingList,888);
-            
-            this.loading = false;
-            if (this.samplingList.length != 0) {
-              this.$nextTick(() => {
-                this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
-              });
-            } else {
-              this.$refs.tb.clearSelection();
-            }
-          }
-          this.total = response.data.total;
-          this.loading = false;
-        } else {
-          this.samplingList = [];
-          this.tableList = [];
-          this.loading = false;
-        }
-      }); */
     },
     // 鍙栨秷鎸夐挳
     cancel() {
@@ -694,11 +657,19 @@
             if (response.data) {
               this.tableList = response.data;
               this.$nextTick(() => {
-      this.$refs.elTable.doLayout(); // 閫氳繃 ref 璋冪敤琛ㄦ牸鏂规硶
-    });
+                this.$refs.elTable.doLayout(); // 閫氳繃 ref 璋冪敤琛ㄦ牸鏂规硶
+                if (this.$refs.tab1) {
+                  this.$refs.tab1.clearSelection(); // 娓呯┖涔嬪墠鐨勯�変腑鐘舵��
+                }
+              });
               resolve(this.tableList);
             } else {
               this.tableList = [];
+              this.selectList = [];
+              this.ids = [];
+              if (this.$refs.tab1) {
+                this.$refs.tab1.clearSelection();
+              }
               resolve([]);
             }
           })
@@ -965,23 +936,26 @@
     // 纭閲囨牱
     Confirmreceipt() {
       const loadingInstance = this.$loading({
-        lock: true, // 閿佸畾灞忓箷
-        text: "鍔犺浇涓�...", // 鍔犺浇鏂囨湰
-        spinner: "el-icon-loading", // 鑷畾涔夊姞杞藉浘鏍�
-        background: "rgba(255, 255, 255, 0.7)", // 鑳屾櫙棰滆壊
+        lock: true,
+        text: "鍔犺浇涓�...",
+        spinner: "el-icon-loading",
+        background: "rgba(255, 255, 255, 0.7)",
       });
       confirmSampling(this.ids)
         .then((res) => {
-          console.log(this.selectList, 2222);
-
           if (res.code === 200) {
-            this.buda();
-            this.getList();
+            this.buda(); // 鎵撳嵃鏉$爜
+            this.$refs.tab1.clearSelection(); // 娓呴櫎鍙充晶琛ㄦ牸鐨勯�変腑鐘舵��
+            this.selectList = []; // 娓呯┖ selectList
+            this.ids = []; // 娓呯┖ ids
+            this.getList(); // 鍒锋柊宸︿晶琛ㄦ牸
+            console.log("閲囨牱鍚� - selectList:", this.selectList, "qiehuan:", this.qiehuan);
           } else {
             this.$message.error(res.msg);
           }
         })
         .catch((error) => {
+          console.error("閲囨牱澶辫触:", error);
         })
         .finally(() => {
           loadingInstance.close();

--
Gitblit v1.8.0