From 81f0a7c8b364fe7b8d566b27bfc9c8ef11d2be7f Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期四, 05 十二月 2024 11:59:12 +0800
Subject: [PATCH] 12.05

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

diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index fa9158e..4836242 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -8,10 +8,10 @@
       v-show="showSearch"
       label-width="68px"
     >
-      <el-form-item label="浣撴鍙�" prop="tjNum">
+      <el-form-item label="浣撴鍙�" prop="tjNumber">
         <el-input
           ref="inputName"
-          v-model="queryParams.tjNum"
+          v-model="queryParams.tjNumber"
           placeholder="璇疯緭鍏ヤ綋妫�鍙�"
           clearable
           @keyup.enter.native="handleQuery"
@@ -86,8 +86,8 @@
           @input="radioChange"
           style="margin: 10px 15px"
         >
-          <el-radio-button label="1">鏈噰鏍�</el-radio-button>
-          <el-radio-button label="0">宸查噰鏍�</el-radio-button>
+          <el-radio-button label="1" :disabled="qiehuan && disabledId === 0">鏈噰鏍�</el-radio-button>
+          <el-radio-button label="0" :disabled="qiehuan && disabledId === 1">宸查噰鏍�</el-radio-button>
         </el-radio-group>
       </el-col>
       <el-col
@@ -193,7 +193,6 @@
         <el-table
           v-loading="loading"
           :data="tableList"
-          @sort-change="handleSortChange"
           @selection-change="handleChange"
           :span-method="objectSpanMethod"
           ref="tab1"
@@ -411,7 +410,7 @@
         pageNum: 1,
         pageSize: 20,
         name: null,
-        tjNum: null,
+        tjNumber: null,
         applicationTime: null,
         isSignFor: null,
         tjTime: null,
@@ -476,21 +475,20 @@
         this.selectList[this.selectList.length - 1].isMerge === 1
       );
     },
+    qiehuan() {
+      return (
+        this.selectList.length > 0
+      );
+    },
+    disabledId() {
+      return (
+        this.tjStatus == "1" ? 1 :  0
+      );
+    },
   },
 
   methods: {
-    handleSortChange({ prop, order }) {
-      if (order === null) return; // 鏃犳帓搴忔椂涓嶅鐞�
-
-      this.tableList.sort((a, b) => {
-        // 濡傛灉鏍囨湰绫诲瀷鐩稿悓锛岀户缁寜鐓ч噰鏍风紪鍙锋帓搴�
-        if (a.jyxh !== b.jyxh) {
-          return order === "ascending" ? a.jyxh - b.jyxh : b.jyxh - a.jyxh;
-        }
-
-        return 0;
-      });
-    },
+ 
     getTruncatedName(proName) {
       // 鍘绘帀鎵�鏈夌┖鏍�
       const trimmedProName = proName.replace(/\s+/g, "");
@@ -600,7 +598,7 @@
             // 鍒ゆ柇鏄惁闇�瑕佸埛鏂板彸杈硅〃鏍�
             this.$nextTick(() => {
               this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
-              this.fetchData(this.samplingList[0].cusId);
+              // this.fetchData(this.samplingList[0].tjNumber);
             });
           }
           this.total = response.data.total;
@@ -650,7 +648,7 @@
       this.form = {
         id: null,
         samplingNumber: null,
-        cusId: null,
+        tjNumber: null,
         applicationTime: null,
         isSignFor: null,
         tjTime: null,
@@ -663,10 +661,9 @@
         updateTime: null,
         deleted: null,
       };
-      this.resetForm("form");
     },
     hb() {
-      if (this.queryParams.tjNum != null) {
+      if (this.queryParams.tjNumber != null) {
         this.handleQuery();
       }
     },
@@ -678,7 +675,6 @@
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
       this.createTimeList = [];
-      this.resetForm("queryForm");
       this.handleQuery();
     },
     // 鍗曢�夋閫変腑鏁版嵁
@@ -712,9 +708,10 @@
       // 鍙湁涓�涓汉琚�変腑鏃惰繘琛屾搷浣�
       if (selection.length === 1) {
         const selectedPerson = selection[0]; // 鑾峰彇閫変腑鐨勯偅涓汉
-        const cusId = selectedPerson.cusId; // 鍋囪cusId鍦ㄩ�変腑鐨勫璞′腑
+        const tjNumber = selectedPerson.tjNumber; 
+        console.log(selectedPerson.tjNumber, 6363);
 
-        this.fetchData(cusId);
+        this.fetchData(tjNumber);
       } else {
         // 濡傛灉閫変腑澶氫汉锛屽垯鍙栨秷閫変腑
         if (selection.length > 1) {
@@ -730,10 +727,10 @@
       this.selectedRows = selection;
     },
 
-    fetchData(cusId) {
+    fetchData(tjNumber) {
       this.loading = true; // 鏄剧ず鍔犺浇鐘舵��
 
-      getCusCyList(cusId, this.tjStatus) // 璋冪敤API鑾峰彇鏁版嵁
+      getCusCyList(tjNumber, this.tjStatus) // 璋冪敤API鑾峰彇鏁版嵁
         .then((response) => {
           if (response.data) {
             console.log(response, 2525);
@@ -820,14 +817,17 @@
 
     /** 鐐瑰嚮琛ユ墦鏉$爜鎸夐挳 **/
     async Collection() {
+      // console.log("selectList:", this.selectList); 
+      const jyxh = this.selectList.map((item) => item.jyxh);
+      console.log("jyxh:", jyxh); 
       try {
         // 璇锋眰鎺ュ彛骞惰幏鍙栧搴﹀��
         const widthResponse = await getTxmkd();
         const barcodeWidth = `${Number(widthResponse.msg)}%` || "70%"; // 鑾峰彇瀹藉害鍊硷紝榛樿浣跨敤 70%
 
-        const jyxh = this.selectList.map((item) => item.jyxh);
+        // const jyxh = this.selectList.map((item) => item.jyxh);
 
-        await this.$nextTick(); // 纭繚 DOM 鏇存柊
+        // await this.$nextTick(); // 纭繚 DOM 鏇存柊
 
         jyxh.forEach((number, index) => {
           const barcodeContent = number; // 纭繚 jyxh 鏄湁鏁堢殑
@@ -843,7 +843,7 @@
           }
         });
 
-        await this.$nextTick(); // 纭繚鏉″舰鐮佺敓鎴愬畬鎴�
+        // await this.$nextTick();
 
         const barcodeElements = jyxh.map((_, index) =>
           document.querySelector(`#barcode${index}`)
@@ -862,7 +862,7 @@
         const newWindow = window.open("", "_blank", "width=800,height=600");
         const printContents = document.getElementById("printSection").innerHTML;
 
-        console.log(printContents);
+        // console.log(printContents);
         newWindow.document.write(`
       <html>
         <head>
@@ -964,6 +964,7 @@
       // console.log(selection);
 
       this.selectList = selection;
+      console.log(this.selectList, 5555);
 
       this.ids = selection.map((item) => item.id);
     },
@@ -994,15 +995,17 @@
       confirmSampling(this.ids)
         .then((res) => {
           if (res.code === 200) {
-            this.$modal.msgSuccess("閲囨牱鎴愬姛");
+            // this.$modal.msgSuccess("閲囨牱鎴愬姛");
+
             this.Collection();
-          }else{
-            this.$message.error(res.msg)
+            this.getList();
+          } else {
+            this.$message.error(res.msg);
           }
           // this.getList();
         })
         .catch((error) => {
-          this.$message.error(res.msg);
+          this.$message.error("閲囨牱澶辫触");
         })
         .finally(() => {
           loadingInstance.close();
@@ -1011,33 +1014,41 @@
 
     // 鍗曢�夋寜閽�
     radioChange(value) {
-      this.loading = true;
-      this.queryParams.isSignFor = value;
-      getList(this.queryParams).then((response) => {
-        if (response.data) {
-          if (response.data.list == null) {
+
+      if (this.selectList.length > 0) {
+        alert("宸查�変腑鍚庣姝㈠垏鎹�");
+    
+      } else {
+        console.log("鍒囨崲");
+        
+        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;
-          } 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;
-        }
-      });
+        });
+      }
     },
 
     // 榛樿鎺ュ彈鍥涗釜鍊� { 褰撳墠琛岀殑鍊�, 褰撳墠鍒楃殑鍊�, 琛岀殑涓嬫爣, 鍒楃殑涓嬫爣 }

--
Gitblit v1.8.0