From 7101e7b6b22ebdf30168442e49f6470a454261de Mon Sep 17 00:00:00 2001
From: wwl <xchao828@163.com>
Date: 星期四, 03 四月 2025 10:46:24 +0800
Subject: [PATCH] 1

---
 src/views/sampling/sampling/index.vue |  159 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 90 insertions(+), 69 deletions(-)

diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index 395b18a..1b4d333 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -249,7 +249,7 @@
       piliangList: [],
       msg: "",
       getNumbr: null,
-      valueUrl: "ws://127.0.0.1:6789/websocket",
+      valueUrl: "ws://127.0.0.1/websocket",
       webSocket: null,
       list: [],
       selectList: [],
@@ -532,40 +532,42 @@
       return ""; // 濡傛灉 applicationTime 鏃犳晥锛岃繑鍥炵┖瀛楃涓�
     },
     /** 鏌ヨ浣撴閲囨牱绠$悊鍒楄〃 */
-    getList() {
-      this.queryParams.compId = this.CheckBox.drugManufacturerId;
-      this.loading1 = true;
-      this.queryParams.isSignFor = this.tjStatus;
+    /** 鏌ヨ浣撴閲囨牱绠$悊鍒楄〃 */
+getList() {
+  this.queryParams.compId = this.CheckBox.drugManufacturerId;
+  this.loading1 = true;
+  this.queryParams.isSignFor = this.tjStatus;
 
-      if (this.createTimeList) {
-        this.queryParams.beginTime = this.createTimeList[0];
-        this.queryParams.endTime = this.createTimeList[1];
-      } else {
-        this.queryParams.beginTime = null;
-        this.queryParams.endTime = null;
+  if (this.createTimeList) {
+    this.queryParams.beginTime = this.createTimeList[0];
+    this.queryParams.endTime = this.createTimeList[1];
+  } else {
+    this.queryParams.beginTime = null;
+    this.queryParams.endTime = null;
+  }
+
+  getList(this.queryParams).then((response) => {
+    this.loading1 = false;
+    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); // 鍒锋柊鍙充晶琛ㄦ牸
+      // });
+    } else {
+      this.samplingList = [];
+      this.tableList = [];
+      this.selectList = []; // 娓呯┖ selectList
+      this.ids = []; // 娓呯┖ ids
+      if (this.$refs.tab1) {
+        this.$refs.tab1.clearSelection(); // 娓呯┖鍙充晶琛ㄦ牸閫変腑鐘舵��
       }
-
-      getList(this.queryParams).then((response) => {
-        this.loading1 = false;
-        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); // 鍒锋柊鍙充晶琛ㄦ牸
-          });
-        } else {
-          this.samplingList = [];
-          this.tableList = [];
-          this.selectList = []; // 娓呯┖ selectList
-          this.ids = []; // 娓呯┖ ids
-          if (this.$refs.tab1) {
-            this.$refs.tab1.clearSelection(); // 娓呯┖鍙充晶琛ㄦ牸閫変腑鐘舵��
-          }
-        }
-        this.loading1 = false;
-      });
-    },
+    }
+    this.loading1 = false;
+  });
+},
     // 鍙栨秷鎸夐挳
     cancel() {
       this.open = false;
@@ -602,8 +604,19 @@
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     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(); // 閲嶆柊鏌ヨ
     },
 
     handleSelectionChange(selection) {
@@ -657,9 +670,9 @@
             if (response.data) {
               this.tableList = response.data;
               this.$nextTick(() => {
-                this.$refs.elTable.doLayout(); // 閫氳繃 ref 璋冪敤琛ㄦ牸鏂规硶
                 if (this.$refs.tab1) {
-                  this.$refs.tab1.clearSelection(); // 娓呯┖涔嬪墠鐨勯�変腑鐘舵��
+                  this.$refs.tab1.doLayout(); // 淇敼涓烘纭殑 ref 鍚嶇О
+                  this.$refs.tab1.clearSelection(); // 娓呯┖閫変腑鐘舵��
                 }
               });
               resolve(this.tableList);
@@ -910,6 +923,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 +933,8 @@
           cardId: item.cardId,
           tjTime: item.createTime,
         }));
+
+
         // 杩炴帴璁惧
         this.jsonObj = {
           type: "3",
@@ -927,7 +943,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 +966,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,35 +997,37 @@
         });
     },
     // 鍗曢�夋寜閽�
-    radioChange(value) {
-      this.loading = true;
-      this.queryParams.isSignFor = value;
-      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;
-            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;
-        }
-      });
-    },
+   // 鍗曢�夋寜閽�
+radioChange(value) {
+  this.loading = true;
+  this.queryParams.isSignFor = value;
+  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;
+        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;
+    }
+  });
+},
 
     // 榛樿鎺ュ彈鍥涗釜鍊� { 褰撳墠琛岀殑鍊�, 褰撳墠鍒楃殑鍊�, 琛岀殑涓嬫爣, 鍒楃殑涓嬫爣 }
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {

--
Gitblit v1.8.0