From 5b58a2c07e2317b2dc8f60c6bfe83dd0774896bc Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期五, 04 七月 2025 17:36:21 +0800
Subject: [PATCH] 1

---
 src/views/sampling/sampling/index.vue |   93 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 71 insertions(+), 22 deletions(-)

diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index 395b18a..71781d5 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -69,18 +69,20 @@
         <el-button type="primary" :disabled="!disabled" @click="Cancellation">鎾ら攢鍚堝苟</el-button>
         <el-button type="primary" @click="Confirmreceipt" :disabled="!selectList.length">閲囨牱鎵撶爜</el-button>
         <el-button type="primary" @click="piliangPrint" :disabled="!isAllSelected">鎵归噺鎵撳嵃</el-button>
+
       </el-col>
       <el-col :span="12" style="margin: 10px 15px" v-show="samplingList.length > 0 && tjStatus == 0">
         <el-button type="primary" :disabled="!selectList.length" @click="buda">琛ユ墦鏉$爜</el-button>
         <!-- @click="Collection" -->
         <el-button type="primary" :disabled="!disabled" @click="Cancellation">鎾ら攢鍚堝苟</el-button>
+        <el-button type="primary" @click="jydPrint">鎵撳嵃妫�楠屽崟</el-button>
       </el-col>
     </el-row>
 
     <div style="width: 100%; margin-left: 10px; display: flex">
       <div style="width: 40%; margin-right: 20px">
         <el-table id="ta" v-loading="loading1" ref="tb" :data="samplingList" @selection-change="handleSelectionChange"
-          border height="520px" :row-class-name="tableRowClassName">
+          @current-change="handleCurrentChangess" border height="520px" :row-class-name="tableRowClassName">
           <el-table-column type="selection" width="40" align="center" :selectable="selectable" />
           <el-table-column label="浣撴鍙�" align="center" prop="tjNumber" width="160px" />
           <el-table-column label="濮撳悕" align="center" prop="cusName" width="80px" />
@@ -105,8 +107,9 @@
       </div>
       <div style="width: 50%">
         <!-- 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 :key="tableKey" :row-key="getRowKey" 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" /> -->
@@ -298,6 +301,7 @@
         proName: null,
       },
       startTime: "",
+      tableKey: "",
       pickerOptions: {
         shortcuts: [
           {
@@ -449,6 +453,14 @@
         loadingInstance.close();
       }
     },
+
+
+    jydPrint() {
+      const tjnumber = this.piliangList[0].tjNumber;
+      const viewNum = "1086792376946569216";
+      const params = { viewNum, tjnumber };
+      this.$tab.openPage("妫�楠岀瀵兼鍗�", "/report/clinical", params);
+    },
     getTruncatedName(proName) {
       // 鍘绘帀鎵�鏈夌┖鏍�
       const trimmedProName = proName.replace(/\s+/g, "");
@@ -532,6 +544,7 @@
       return ""; // 濡傛灉 applicationTime 鏃犳晥锛岃繑鍥炵┖瀛楃涓�
     },
     /** 鏌ヨ浣撴閲囨牱绠$悊鍒楄〃 */
+    /** 鏌ヨ浣撴閲囨牱绠$悊鍒楄〃 */
     getList() {
       this.queryParams.compId = this.CheckBox.drugManufacturerId;
       this.loading1 = true;
@@ -550,10 +563,11 @@
         if (response.data && response.data.list && response.data.list.length > 0) {
           this.samplingList = response.data.list;
           this.total = response.data.total;
-          this.$nextTick(() => {
-            this.$refs.tb.toggleRowSelection(this.samplingList[0], true); // 榛樿閫変腑绗竴琛�
-            this.fetchData(this.samplingList[0].tjNumber); // 鍒锋柊鍙充晶琛ㄦ牸
-          });
+          // 绉婚櫎榛樿閫変腑绗竴琛岀殑閫昏緫
+          // this.$nextTick(() => {
+          //   this.$refs.tb.toggleRowSelection(this.samplingList[0], true); // 榛樿閫変腑绗竴琛�
+          //   this.fetchData(this.samplingList[0].tjNumber); // 鍒锋柊鍙充晶琛ㄦ牸
+          // });
         } else {
           this.samplingList = [];
           this.tableList = [];
@@ -602,8 +616,25 @@
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
-      this.createTimeList = [];
-      this.handleQuery();
+      this.createTimeList = []; // 娓呯┖鏃ユ湡鑼冨洿
+      this.queryParams.tjNumber = null; // 娓呯┖浣撴鍙�
+      this.queryParams.name = null; // 娓呯┖濮撳悕
+      this.queryParams.tjCompName = null; // 娓呯┖鍗曚綅鍚嶇О
+      this.selectList = []; // 娓呯┖鍙充晶閫変腑椤�
+      this.selectedRows = []; // 娓呯┖宸︿晶閫変腑椤�
+      this.tableList = []; // 娓呯┖鍙充晶琛ㄦ牸鏁版嵁
+      this.ids = []; // 娓呯┖閫変腑鐨� ID
+      this.$refs.tb.clearSelection(); // 娓呯┖宸︿晶琛ㄦ牸閫変腑鐘舵��
+      if (this.$refs.tab1) {
+        this.$refs.tab1.clearSelection(); // 娓呯┖鍙充晶琛ㄦ牸閫変腑鐘舵��
+      }
+      this.handleQuery(); // 閲嶆柊鏌ヨ
+    },
+    handleCurrentChangess(val) {
+      if (val != null) {
+          this.$refs.tb.toggleRowSelection(val, true);
+        this.handleSelectionChange(val);
+      }
     },
 
     handleSelectionChange(selection) {
@@ -647,6 +678,11 @@
       // 璋冭瘯鏃ュ織
       console.log(`褰撳墠閫変腑鏁伴噺: ${selectedCount}`);
       console.log(`鏄惁绂佺敤閫夋嫨: ${this.disableSelections}`);
+
+    },
+
+    getRowKey(row) {
+      return row.id; // 蹇呴』鍞竴涓旂ǔ瀹�
     },
 
     fetchData(tjNumber) {
@@ -656,13 +692,18 @@
           .then((response) => {
             if (response.data) {
               this.tableList = response.data;
+              this.tableKey = Date.now()
               this.$nextTick(() => {
-                this.$refs.elTable.doLayout(); // 閫氳繃 ref 璋冪敤琛ㄦ牸鏂规硶
                 if (this.$refs.tab1) {
-                  this.$refs.tab1.clearSelection(); // 娓呯┖涔嬪墠鐨勯�変腑鐘舵��
+                  this.$refs.tab1.doLayout(); // 淇敼涓烘纭殑 ref 鍚嶇О
+                  this.$refs.tab1.clearSelection(); // 娓呯┖閫変腑鐘舵��
+                  const headerCheckbox = this.$refs.tab1.$el.querySelector('.el-table__header .el-checkbox');
+                  if (headerCheckbox) headerCheckbox.style.display = 'inline';
+
                 }
               });
               resolve(this.tableList);
+              this.loading = false;
             } else {
               this.tableList = [];
               this.selectList = [];
@@ -910,6 +951,7 @@
       };
       websocket.onopen = () => {
         this.websocket = websocket;
+        console.log(this.selectList, "this.selectList")
         this.dayinData = this.selectList.map((item) => ({
           jyxh: item.jyxh,
           proName: item.proName,
@@ -919,6 +961,8 @@
           cardId: item.cardId,
           tjTime: item.createTime,
         }));
+
+
         // 杩炴帴璁惧
         this.jsonObj = {
           type: "3",
@@ -927,7 +971,12 @@
           },
         };
         var jStr = JSON.stringify(this.jsonObj);
+        console.log(jStr, "jStr");
+
         this.websocket.send(jStr);
+        this.$refs.tab1.clearSelection(); // 娓呴櫎鍙充晶琛ㄦ牸鐨勯�変腑鐘舵��
+        this.selectList = []; // 娓呯┖ selectList
+        this.ids = []; // 娓呯┖ ids
         this.jsonObj = {};
         // this.dialogVisible = false;
       };
@@ -945,9 +994,7 @@
         .then((res) => {
           if (res.code === 200) {
             this.buda(); // 鎵撳嵃鏉$爜
-            this.$refs.tab1.clearSelection(); // 娓呴櫎鍙充晶琛ㄦ牸鐨勯�変腑鐘舵��
-            this.selectList = []; // 娓呯┖ selectList
-            this.ids = []; // 娓呯┖ ids
+
             this.getList(); // 鍒锋柊宸︿晶琛ㄦ牸
             console.log("閲囨牱鍚� - selectList:", this.selectList, "qiehuan:", this.qiehuan);
           } else {
@@ -978,6 +1025,7 @@
         });
     },
     // 鍗曢�夋寜閽�
+    // 鍗曢�夋寜閽�
     radioChange(value) {
       this.loading = true;
       this.queryParams.isSignFor = value;
@@ -990,13 +1038,14 @@
           } else {
             this.samplingList = response.data.list;
             this.loading = false;
-            if (this.samplingList.length != 0) {
-              this.$nextTick(() => {
-                this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
-              });
-            } else {
-              this.$refs.tb.clearSelection();
-            }
+            // 绉婚櫎榛樿閫変腑绗竴琛岀殑閫昏緫
+            // 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;
@@ -1058,7 +1107,7 @@
 
 <style>
 #ta .el-table__header-wrapper .el-checkbox {
-  /* display: none; */
+  display: none;
 }
 
 .el-table .warning-row {

--
Gitblit v1.8.0