From 1901de2a3138adeabf118aa80303b520200960c7 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 03 四月 2025 10:52:48 +0800
Subject: [PATCH] qx

---
 src/views/system/comp/index.vue       |  176 ++++++++++++++--------------
 src/views/sampling/sampling/index.vue |  159 +++++++++++++++-----------
 2 files changed, 177 insertions(+), 158 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 }) {
diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue
index 2e7d7b9..1840edc 100644
--- a/src/views/system/comp/index.vue
+++ b/src/views/system/comp/index.vue
@@ -1,45 +1,27 @@
 <template>
   <div class="app-container">
     <el-dialog title="閫夋嫨濂楅" :visible.sync="taocan" width="70%" height="700px" :close-on-click-modal="false">
-  <!-- <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto">
-    <el-form-item label="濂楅鍚嶇О" prop="pacName">
-      <el-input 
-        v-model="queryParam.pacName" 
-        placeholder="璇疯緭鍏ュ椁愬悕绉�" 
-        clearable 
-        @keyup.enter.native="handle" 
-        style="width: 200px"
-      />
-    </el-form-item>
-    <el-form-item>
-      <el-button 
-        type="primary" 
-        icon="el-icon-search" 
-        size="mini" 
-        @click="handle"
-      >鎼滅储</el-button>
-    </el-form-item>
-  </el-form> -->
-  <el-table 
-    v-loading="loading" 
-    element-loading-text="姝e湪鍔犺浇涓�..." 
-    element-loading-spinner="el-icon-loading" 
-    border
-    :data="newpacName1" 
-    @selection-change="handleSelectionChange1" 
-    height="450px" 
-    ref="tb"
-  >
-    <el-table-column type="selection" width="40px" align="center" label="閫夋嫨" />
-    <el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" width="120px" />
-    <el-table-column label="濂楅浠锋牸" align="center" prop="price" width="120px" />
-    <el-table-column label="濂楅鏄庣粏" align="center" prop="allProName" :show-overflow-tooltip="true" />
-  </el-table>
-  <span slot="footer" class="dialog-footer">
-    <el-button @click="cancel1">鍙� 娑�</el-button>
-    <el-button type="primary" @click="submit">纭� 瀹�</el-button>
-  </span>
-</el-dialog>
+      <!-- <el-form :model="queryParam" ref="queryForm" size="small" :inline="true" label-width="auto">
+        <el-form-item label="濂楅鍚嶇О" prop="pacName">
+          <el-input v-model="queryParam.pacName" placeholder="璇疯緭鍏ュ椁愬悕绉�" clearable @keyup.enter.native="handle"
+            style="width: 200px" />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handle">鎼滅储</el-button>
+        </el-form-item>
+      </el-form> -->
+      <el-table v-loading="loading" element-loading-text="姝e湪鍔犺浇涓�..." element-loading-spinner="el-icon-loading" border
+        :data="newpacName1" @selection-change="handleSelectionChange1" height="450px" ref="tb">
+        <el-table-column type="selection" width="40px" align="center" label="閫夋嫨" />
+        <el-table-column label="濂楅鍚嶇О" align="center" prop="pacName" width="120px" />
+        <el-table-column label="濂楅浠锋牸" align="center" prop="price" width="120px" />
+        <el-table-column label="濂楅鏄庣粏" align="center" prop="allProName" :show-overflow-tooltip="true" />
+      </el-table>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="cancel1">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submit">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"
       @submit.native.prevent>
       <el-form-item label="鍗曚綅鍚嶇О" prop="cnName">
@@ -331,7 +313,7 @@
             </el-table>
             <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{
               OnenewpacName.length
-            }}</span>鏉�</div>
+                }}</span>鏉�</div>
 
           </el-col>
           <el-col :span="2" :xs="24">
@@ -417,7 +399,7 @@
             </el-table>
             <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{
               OnenewpacName.length
-            }}</span>鏉�</div>
+                }}</span>鏉�</div>
 
           </el-col>
           <el-col :span="2" :xs="24">
@@ -512,7 +494,7 @@
             </el-table>
             <div style="font-size: 16px;margin-top: 10px;">褰撳墠椤圭洰鏉℃暟锛�<span style="font-weight: 700;">{{
               OnenewpacName.length
-            }}</span>鏉�</div>
+                }}</span>鏉�</div>
 
           </el-col>
           <el-col :span="2" :xs="24">
@@ -640,7 +622,7 @@
   getDetails,
 
 } from "@/api/system/comp";
-import { deptTreeSelect, projectGetList, getconfigKey,} from "@/api/system/tijian";
+import { deptTreeSelect, projectGetList, getconfigKey, } from "@/api/system/tijian";
 import { getInfo } from "@/api/login";
 export default {
   name: "Comp",
@@ -662,7 +644,7 @@
       }
     };
     return {
-      
+
       newpacName1: [],
       taocan: false,
       queryParam: {
@@ -803,60 +785,76 @@
     this.getList();
   },
   methods: {
+    handle() {
+      this.loading = true;
+      deptTreeSelect(this.forms.sex, this.queryParam).then((res) => {
+        if (res.rows) {
+          this.newpacName1 = res.rows; // 鏇存柊濂楅鍒楄〃
+        } else {
+          this.newpacName1 = [];
+        }
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+        this.$modal.msgError("鎼滅储澶辫触锛岃绋嶅悗閲嶈瘯");
+      });
+    },
+
+
     handleSelectionChange1(selection) {
-  // 瀹炵幇鍗曢�夐�昏緫
-  if (selection.length > 1) {
-    const lastSelected = selection[selection.length - 1];
-    this.$refs.tb.clearSelection();
-    this.$refs.tb.toggleRowSelection(lastSelected, true);
-    this.selectedPackage = lastSelected;
-  } else if (selection.length === 1) {
-    this.selectedPackage = selection[0];
-  } else {
-    this.selectedPackage = null;
-  }
-},
+      // 瀹炵幇鍗曢�夐�昏緫
+      if (selection.length > 1) {
+        const lastSelected = selection[selection.length - 1];
+        this.$refs.tb.clearSelection();
+        this.$refs.tb.toggleRowSelection(lastSelected, true);
+        this.selectedPackage = lastSelected;
+      } else if (selection.length === 1) {
+        this.selectedPackage = selection[0];
+      } else {
+        this.selectedPackage = null;
+      }
+    },
 
-submit() {
-  if (!this.selectedPackage) {
-    this.$modal.msgError("璇峰厛閫夋嫨涓�涓椁�");
-    return;
-  }
+    submit() {
+      if (!this.selectedPackage) {
+        this.$modal.msgError("璇峰厛閫夋嫨涓�涓椁�");
+        return;
+      }
 
-  // 娓呯┖宸︿晶琛ㄦ牸
-  this.OnenewpacName = [];
+      // 娓呯┖宸︿晶琛ㄦ牸
+      this.OnenewpacName = [];
 
-  // 鑾峰彇閫変腑鐨勫椁愰」鐩垪琛�
-  const newProjects = this.selectedPackage.tjProjectList || [];
+      // 鑾峰彇閫変腑鐨勫椁愰」鐩垪琛�
+      const newProjects = this.selectedPackage.tjProjectList || [];
 
-  // 灏嗛�変腑鐨勫椁愰」鐩坊鍔犲埌宸︿晶琛ㄦ牸
-  this.loading = true;
-  newProjects.forEach(project => {
-    // 涓烘瘡涓」鐩缃粯璁ゆ姌鎵e拰鐜颁环
-    this.$set(project, 'limits', 10); // 榛樿鎶樻墸 10锛堝嵆鍘熶环锛�
-    this.$set(project, 'ysPrice', project.proPrice); // 鐜颁环鍒濆鍖栦负鍘熶环
-    this.OnenewpacName.push(project);
-  });
+      // 灏嗛�変腑鐨勫椁愰」鐩坊鍔犲埌宸︿晶琛ㄦ牸
+      this.loading = true;
+      newProjects.forEach(project => {
+        // 涓烘瘡涓」鐩缃粯璁ゆ姌鎵e拰鐜颁环
+        this.$set(project, 'limits', 10); // 榛樿鎶樻墸 10锛堝嵆鍘熶环锛�
+        this.$set(project, 'ysPrice', project.proPrice); // 鐜颁环鍒濆鍖栦负鍘熶环
+        this.OnenewpacName.push(project);
+      });
 
-  // 鏇存柊鎬讳环鍜岀幇浠�
-  this.queryParams.price = this.OnenewpacName.reduce((sum, item) => {
-    return sum + (item.proPrice || 0);
-  }, 0);
+      // 鏇存柊鎬讳环鍜岀幇浠�
+      this.queryParams.price = this.OnenewpacName.reduce((sum, item) => {
+        return sum + (item.proPrice || 0);
+      }, 0);
 
-  this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
-    return sum + (item.ysPrice || 0);
-  }, 0);
+      this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+        return sum + (item.ysPrice || 0);
+      }, 0);
 
-  // 鏇存柊浼樻儬鍊�
-  this.youhui = this.queryParams.price > 0 
-    ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10 
-    : 0;
+      // 鏇存柊浼樻儬鍊�
+      this.youhui = this.queryParams.price > 0
+        ? (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
+        : 0;
 
-  // 鍏抽棴瀵硅瘽妗�
-  this.taocan = false;
-  this.loading = false;
-  this.$modal.msgSuccess("娣诲姞鎴愬姛");
-},
+      // 鍏抽棴瀵硅瘽妗�
+      this.taocan = false;
+      this.loading = false;
+      this.$modal.msgSuccess("娣诲姞鎴愬姛");
+    },
     cancel1() {
       this.taocan = false;
     },

--
Gitblit v1.8.0