From 42474a7ce3521994560ef7810f670ec4c0411619 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期三, 30 十月 2024 16:42:35 +0800
Subject: [PATCH] 10.30

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

diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index 5d4f164..fd4b7e1 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -274,12 +274,14 @@
         <!-- 鍔ㄦ�佺敓鎴愬涓潯褰㈢爜鐨勫鍣� -->
         <div v-for="(item, index) in selectList" :key="index">
           <svg :id="'barcode' + index"></svg>
-          <!-- <div class="name">{{ item.proName }}</div>
-          <div class="name1">{{ item.proName }}</div> -->
           <div class="name">{{ getTruncatedName(item.proName).truncated }}</div>
           <div class="name1">
             {{ getTruncatedName(item.proName).remaining }}
           </div>
+          <!-- <div class="name">{{ item.proName.slice(0, msg) }}</div>
+          <div class="name1">
+            {{ item.proName.slice(msg) }}
+          </div> -->
           <div class="last">
             <p>{{ item.cusName }}</p>
             <div>
@@ -290,6 +292,7 @@
           <div class="tj">
             <span>浣撴涓績</span>
             <span>{{ item.cardId.substring(0, 14) }}</span>
+            <!-- <span>{{ item.cardId ? item.cardId.substring(0, 14) : '' }}</span> -->
           </div>
           <div class="tj">
             <span>{{ item.jyxh }}</span>
@@ -369,6 +372,8 @@
   name: "Sampling",
   data() {
     return {
+      msg: "",
+      getNumbr: null,
       list: [],
       selectList: [],
       selectedRows: [],
@@ -452,7 +457,9 @@
   },
   created() {
     // this.getNowTime();
-
+    getTxmmccd().then((res) => {
+      this.msg = Number(res.msg);
+    });
     this.getdate();
   },
   mounted() {
@@ -470,73 +477,31 @@
   },
 
   methods: {
-    async getTruncatedName(proName) {
-      try {
-        const res = await getTxmmccd(); // 纭繚浣跨敤 async/await
-        console.log(res, 4545);
+    getTruncatedName(proName) {
+      // 鍘绘帀鎵�鏈夌┖鏍�
+      const trimmedProName = proName.replace(/\s+/g, "");
+      const number = this.msg;
 
-        // 鍘绘帀鎵�鏈夌┖鏍�
-        const trimmedProName = proName.replace(/\s+/g, "");
-
-        // 妫�鏌� res 鏄惁鏈夋晥
-        if (res && res.msg) {
-          const number = Number(res.msg);
-          console.log(number, 4444);
-
-          const truncated =
-            trimmedProName.length > number
-              ? trimmedProName.slice(0, number)
-              : trimmedProName;
-          const remaining =
-            trimmedProName.length > number ? trimmedProName.slice(number) : "";
-
-          return { truncated, remaining }; // 杩斿洖缁撴灉
-        } else {
-          // 濡傛灉 res 鏃犳晥锛屼娇鐢ㄩ粯璁ゅ��
-          const truncated =
-            trimmedProName.length > 35
-              ? trimmedProName.slice(0, 35)
-              : trimmedProName;
-          const remaining =
-            trimmedProName.length > 35 ? trimmedProName.slice(35) : "";
-
-          return { truncated, remaining }; // 纭繚杩斿洖
-        }
-      } catch (error) {
-        console.error("Error fetching data:", error);
-        return { truncated: "", remaining: "" }; // 鎹曡幏閿欒鏃剁殑杩斿洖鍊�
-      }
+      const truncated =
+        trimmedProName.length > number
+          ? trimmedProName.slice(0, number)
+          : trimmedProName;
+      const remaining =
+        trimmedProName.length > number ? trimmedProName.slice(number) : "";
+      return { truncated, remaining }; // 杩斿洖缁撴灉
     },
-    /* getTruncatedName(proName) {
-      getTxmmccd().then((res) => {
-        console.log(res, 4545);
-        const number = Number(res.msg);
-        console.log(number, 4444);
-        if (res) {
-          const trimmedProName = proName.replace(/\s+/g, ""); // 鍘绘帀鎵�鏈夌┖鏍�
-          const truncated =
-            trimmedProName.length > res.msg
-              ? trimmedProName.slice(0, res.msg)
-              : trimmedProName;
-          const remaining =
-            trimmedProName.length > res.msg
-              ? trimmedProName.slice(res.msg)
-              : "";
-          return { truncated, remaining };
-        } else {
-          res.msg == "35";
-        }
-      }); */
 
-    /* const trimmedProName = proName.replace(/\s+/g, ""); // 鍘绘帀鎵�鏈夌┖鏍�
-        const truncated =
-          trimmedProName.length > 35
-            ? trimmedProName.slice(0, 35)
-            : trimmedProName;
-        const remaining =
-          trimmedProName.length > 35 ? trimmedProName.slice(35) : "";
-        return { truncated, remaining }; */
-    // },
+    /* getTruncatedName(proName) {
+      const trimmedProName = proName.replace(/\s+/g, ""); // 鍘绘帀鎵�鏈夌┖鏍�
+      const truncated =
+        trimmedProName.length > 35
+          ? trimmedProName.slice(0, 35)
+          : trimmedProName;
+      const remaining =
+        trimmedProName.length > 35 ? trimmedProName.slice(35) : "";
+      return { truncated, remaining };
+    }, */
+
     // 绀轰緥鐨勬棩鏈熸牸寮忓寲鏂规硶
     formatDate(date) {
       const options = { year: "numeric", month: "2-digit", day: "2-digit" };
@@ -612,7 +577,7 @@
             return;
           } else {
             this.samplingList = response.data.list;
-            console.log(this.samplingList, 888);
+            // console.log(this.samplingList, 888);
             // 鍒ゆ柇鏄惁闇�瑕佸埛鏂板彸杈硅〃鏍�
             this.$nextTick(() => {
               this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
@@ -682,7 +647,6 @@
       this.resetForm("form");
     },
     hb() {
-      // console.log(this.queryParams.tjNum);
       if (this.queryParams.tjNum != null) {
         this.handleQuery();
       }
@@ -750,13 +714,11 @@
     fetchData(cusId) {
       this.loading = true; // 鏄剧ず鍔犺浇鐘舵��
 
-      console.log(this.tjStatus, 999);
-
       getCusCyList(cusId, this.tjStatus) // 璋冪敤API鑾峰彇鏁版嵁
         .then((response) => {
           if (response.data) {
             this.tableList = response.data; // 纭 list 瀛樺湪鍚庡啀杩涜璧嬪��
-            console.log(this.tableList, 123);
+            // console.log(this.tableList, 123);
           } else {
             // 濡傛灉娌℃湁鏁版嵁鎴� list 涓虹┖锛屾竻绌鸿〃鏍煎苟鎻愮ず
             this.tableList = [];
@@ -770,35 +732,6 @@
         });
     },
 
-    /* 鐐瑰嚮鍚堝苟鎸夐挳 */
-    /* Merging() {
-      // 妫�鏌ユ槸鍚﹂�変腑浜嗘暟鎹�
-      if (this.selectedRows.length === 0) {
-        this.$message.error("鑷冲皯閫変腑涓�涓汉");
-        return;
-      }
-
-      if (this.selectList.length === 0) {
-        this.$message.error("璇烽�夋嫨瑕佸悎骞堕」鐩�");
-        return;
-      }
-
-      // 鑾峰彇 tableList 绗竴琛岀殑 specimenTypeCode 浣滀负鍩哄噯
-      const baseSpecimenTypeCode = this.selectList[0].specimenTypeCode;
-
-      // 妫�鏌� specimenTypeCode 鏄惁涓�鑷�
-      const canMergeBySpecimenTypeCode = this.selectList.every(
-        (row) => row.specimenTypeCode === baseSpecimenTypeCode
-      );
-
-      // 鏍规嵁 canMergeBySpecimenTypeCode 鍒ゆ柇鏄惁鍚堝苟
-      if (canMergeBySpecimenTypeCode) {
-        this.$message.success("鍚堝苟鎴愬姛銆�");
-        console.log("鍚堝苟鐨勮:", this.selectedRows);
-      } else {
-        this.$message.error("椤圭洰鐨� 涓嶄竴鑷达紝鏃犳硶鍚堝苟锛�");
-      }
-    }, */
     /* 鐐瑰嚮鍚堝苟鎸夐挳 */
     Merging() {
       // 妫�鏌ユ槸鍚﹂�変腑浜嗘暟鎹�
@@ -824,7 +757,7 @@
 
           mergeCaiYang(data).then((response) => {
             this.$message.success("鍚堝苟鎴愬姛銆�");
-            console.log("鍚堝苟鐨勮:", this.selectedRows);
+            // console.log("鍚堝苟鐨勮:", this.selectedRows);
             // this.getList();
             this.fetchData(this.selectedRows[0].cusId);
           });
@@ -846,7 +779,7 @@
         return;
       }
 
-      console.log("鎾ら攢鐨勫凡鍚堝苟椤圭洰ID:", data);
+      // console.log("鎾ら攢鐨勫凡鍚堝苟椤圭洰ID:", data);
 
       // 璋冪敤鎾ら攢閲囨牱鐨勬帴鍙�
       chexiaoCaiYang(data)
@@ -870,11 +803,11 @@
       try {
         // 璇锋眰鎺ュ彛骞惰幏鍙栧搴﹀��
         const widthResponse = await getTxmkd();
-        console.log("浠� getTxmkd 杩斿洖鐨勫搷搴�:", widthResponse); // 鎵撳嵃鍚庣杩斿洖鍊�
+        // console.log("浠� getTxmkd 杩斿洖鐨勫搷搴�:", widthResponse); // 鎵撳嵃鍚庣杩斿洖鍊�
         const barcodeWidth = `${Number(widthResponse.msg)}%` || "70%"; // 鑾峰彇瀹藉害鍊硷紝榛樿浣跨敤 70%
 
         const jyxh = this.selectList.map((item) => item.jyxh);
-        console.log(this.selectList, 999);
+        // console.log(this.selectList, 999);
 
         await this.$nextTick(); // 纭繚 DOM 鏇存柊
 
@@ -923,6 +856,10 @@
                 padding: 0; /* 閲嶇疆鎵�鏈夊厓绱犵殑 margin 鍜� padding */
                 box-sizing: border-box; /* 浣垮唴杈硅窛鍜岃竟妗嗗寘鍚湪鍏冪礌鐨勬�诲搴﹀拰楂樺害鍐� */
               }
+              .name, .name1, .last, .tj, .last div span, .last p, .tj span {
+                font-family: Arial, sans-serif !important; /* 閲嶆柊鎸囧畾瀛椾綋 */
+                font-weight: bold !important; /* 寮哄埗鍔犵矖 */
+              }
               body {
                 margin: 0;
                 padding: 0;
@@ -935,6 +872,7 @@
                 padding: 0;
                 font-size: 18px;
                 width: 70%;
+                font-family: "Arial Black", sans-serif; /* 璁剧疆榛戜綋 */
               }
               p {
                 margin: 0;
@@ -952,20 +890,26 @@
                 display: flex;
                 font-size: 19px;
                 justify-content: space-between;
-                 font-family: "Arial Black", sans-serif; /* 璁剧疆榛戜綋 */
+                // font-family: "Arial Black", sans-serif !important; 
               }
               .last div span {
                 margin-left: 10px;
+                // font-family: "Arial Black", sans-serif !important;
               }
               .last p {
-                margin-left: 10px;
+                margin-left: 10px; 
+                // font-family: "Arial Black", sans-serif !important; 
+              }
+                p {
+                margin-left: 10px; 
+                // font-family: "Arial Black", sans-serif !important;  
               }
               .tj {
                 width: 70%;
                 display: flex;
                 font-size: 19px;
                 justify-content: space-between;
-                 font-family: "Arial Black", sans-serif; /* 璁剧疆榛戜綋 */
+                 font-family: "Arial Black", sans-serif !important; 
               }
               .tj span {
                 margin-left: 10px;
@@ -985,129 +929,6 @@
       }
     },
 
-    // Collection() {
-    // const jyxh = this.selectList.map((item) => item.jyxh);
-    // const selectedData = this.selectList.map((item) => ({
-    //   jyxh: item.jyxh,
-    // }));
-    // console.log(this.selectList, 999);
-    // console.log(selectedData, 888);
-
-    /* this.$nextTick(() => {
-        jyxh.forEach((number, index) => {
-          const barcodeContent = number; // 纭繚 jyxh 鏄湁鏁堢殑
-          if (barcodeContent && barcodeContent !== "鏈彁渚涗綋妫�鍙�") {
-            JsBarcode(`#barcode${index}`, barcodeContent, {
-              format: "CODE128",
-              width: 2,
-              height: 50,
-              displayValue: false,
-            });
-          } else {
-            console.log(`鏉″舰鐮佸唴瀹规棤鏁�: ${barcodeContent}`); // 璋冭瘯杈撳嚭
-          }
-        });
-      }); */
-
-    /* this.$nextTick(() => {
-        const barcodeElement = document.querySelector("#barcode");
-        // const barcodeElements = selectedData.map((_, index) =>
-        //   document.querySelector(`#barcode${index}`)
-        // );
-
-        if (barcodeElement) {
-          barcodeElement.forEach((element) => {
-            if (element) {
-              console.log(element.innerHTML); // 鎵撳嵃鏉″舰鐮佺殑鍐呭锛岀湅鐪嬫槸鍚︾敓鎴愭垚鍔�
-            }
-          });
-        } else {
-          console.log("鏉″舰鐮佸厓绱犳湭鎵惧埌");
-        }
-        const newWindow = window.open("", "_blank", "width=800,height=600");
-        const printContents = document.getElementById("printSection").innerHTML;
-
-        console.log(printContents); */
-    // newWindow.document.write(`
-    //  <html>
-    //   <head>
-    //     <title>Print Barcode</title>
-    //     <style>
-    //       @media print {
-    //        * {
-    //            margin: 0;
-    //            padding: 0; /* 閲嶇疆鎵�鏈夊厓绱犵殑 margin 鍜� padding */
-    //            box-sizing: border-box; /* 浣垮唴杈硅窛鍜岃竟妗嗗寘鍚湪鍏冪礌鐨勬�诲搴﹀拰楂樺害鍐� */
-    //          }
-    //          body {
-    //             margin: 0;
-    //             padding: 0;
-    //           }
-    //           .barcode-container {
-    //             // width: 100%; /* 鏍规嵁闇�瑕佽皟鏁� */
-    //             // text-align: center; /* 纭繚鏉″舰鐮佸眳涓� */
-    //           }
-    //           .name,.name1 {
-    //             padding: 0;
-    //             // margin: -5px auto 0;
-    //             // padding-left: 20px;
-    //             font-size: 18px;
-    //             width: 70%;
-    //             // max-height: 3.6em;
-    //             // display: -webkit-box;
-    //             // -webkit-box-orient: vertical;
-    //             // -webkit-line-clamp: 2;
-    //             // overflow: hidden;
-    //             // white-space: normal;
-    //           }
-    //           p {
-    //             margin: 0;
-    //             padding: 0;
-    //           }
-    //           svg {
-    //             display: block;
-    //             width: 70%;
-    //             margin-left: 10mm;
-    //             // margin: 0 auto;
-    //             height: auto;
-    //             margin-bottom: 0;
-    //           }
-    //           .last {
-    //             width: 66%;
-    //             display: flex;
-    //             font-size: 19px;
-    //             // margin-left: 20px;
-    //             justify-content: space-between;
-    //           }
-    //           .last div span{
-    //             margin-left: 10px
-    //             }
-    //             .last p{
-    //             margin-left: 10px
-    //             }
-    //           .tj{
-    //             width: 70%;
-    //             display: flex;
-    //             font-size: 19px;
-    //             // margin-left: 10px;
-    //             justify-content: space-between;
-    //           }
-    //           .tj span{
-    //             margin-left:10px;
-    //           }
-    //       }
-    //     </style>
-    //   </head>
-    //   <body>${printContents}</body>
-    // </html>
-    //   `);
-    //     newWindow.document.close();
-    //     newWindow.focus();
-    //     newWindow.print();
-    //     newWindow.close();
-    //   });
-    // },
-
     tableRowClassName({ row, rowIndex }) {
       for (let i = 0; i < this.selectList.length; i++) {
         if (row === this.selectList[i]) {
@@ -1117,7 +938,7 @@
     },
 
     handleChange(selection) {
-      console.log(selection);
+      // console.log(selection);
 
       this.selectList = selection;
 
@@ -1144,10 +965,23 @@
         this.$message.error("娌℃湁宸插悎骞剁殑椤圭洰鍙互鎾ら攢锛�");
         return;
       }
-      confirmSampling(data).then((res) => {
-        this.$modal.msgSuccess("閲囨牱鎴愬姛");
-        this.getList();
+      const loadingInstance = this.$loading({
+        lock: true, // 閿佸畾灞忓箷
+        text: "鍔犺浇涓�...", // 鍔犺浇鏂囨湰
+        spinner: "el-icon-loading", // 鑷畾涔夊姞杞藉浘鏍�
+        background: "rgba(255, 255, 255, 0.7)", // 鑳屾櫙棰滆壊
       });
+      confirmSampling(data)
+        .then((res) => {
+          this.$modal.msgSuccess("閲囨牱鎴愬姛");
+          this.getList();
+        })
+        .catch((error) => {
+          this.$message.error("閲囨牱澶辫触");
+        })
+        .finally(() => {
+          loadingInstance.close();
+        });
     },
 
     // 鍗曢�夋寜閽�

--
Gitblit v1.8.0