From d747406e0eb22d47726916be55e85376c4aa2729 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期三, 04 十二月 2024 18:23:14 +0800
Subject: [PATCH] 12.04

---
 src/views/sampling/sampling/index.vue |   70 +++++++++++++++++++++++------------
 1 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index 1d411b0..fa9158e 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -96,23 +96,18 @@
         v-if="samplingList.length > 0 && tjStatus == 1"
       >
         <el-button type="primary" @click="Merging">鍚堝苟椤圭洰</el-button>
-        <el-button
+        <!-- <el-button
           type="primary"
           icon="el-icon-thumb"
           style="margin: 0 15px"
           v-hasPermi="['hosp:detail:add']"
           @click="Confirmreceipt"
           >纭閲囨牱</el-button
-        >
+        > -->
         <el-button type="primary" :disabled="!disabled" @click="Cancellation"
           >鎾ら攢鍚堝苟</el-button
         >
-        <el-button
-          type="primary"
-          :disabled="!selectList.length"
-          @click="Collection"
-          >閲囨牱鎵撶爜</el-button
-        >
+        <el-button type="primary" @click="Confirmreceipt">閲囨牱鎵撶爜</el-button>
       </el-col>
       <el-col
         :span="12"
@@ -190,15 +185,21 @@
         </el-table>
       </div>
       <div style="width: 50%">
+        <!-- :default-sort="{ prop: 'specimenType', order: 'ascending' }"  :default-sort="{ prop: 'specimenType', order: 'ascending' }"
+          @sort-change="handleSortChange"
+          :span-method="objectSpanMethod"
+          @selection-change="handleChange" ref="tab1"
+          :row-class-name="tableRowClassName"-->
         <el-table
           v-loading="loading"
           :data="tableList"
-          :span-method="objectSpanMethod"
+          @sort-change="handleSortChange"
           @selection-change="handleChange"
-          border
-          height="520px"
+          :span-method="objectSpanMethod"
           ref="tab1"
           :row-class-name="tableRowClassName"
+          border
+          height="520px"
         >
           <el-table-column type="selection" width="40" align="center" />
           <!--  :selectable="selectEnable" -->
@@ -291,8 +292,9 @@
           </div>
           <div class="tj">
             <span>浣撴涓績</span>
-            <span>{{ item.cardId.substring(0, 14) }}</span>
-            <!-- <span>{{ item.cardId ? item.cardId.substring(0, 14) : '' }}</span> -->
+            <!-- <span>{{ item.cardId.slice(0, 14) }}</span> -->
+            <!-- <span>{{ item.cardId }}</span> -->
+            <span>{{ item.cardId ? item.cardId.substring(0, 14) : "" }}</span>
           </div>
           <div class="tj">
             <span>{{ item.jyxh }}</span>
@@ -477,17 +479,34 @@
   },
 
   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, "");
+
       const number = this.msg;
 
       const truncated =
         trimmedProName.length > number
           ? trimmedProName.slice(0, number)
           : trimmedProName;
-      const remaining =
+      let remaining =
         trimmedProName.length > number ? trimmedProName.slice(number) : "";
+
+      if (remaining.length > number) {
+        remaining = remaining.slice(0, number) + "...";
+      }
       return { truncated, remaining }; // 杩斿洖缁撴灉
     },
 
@@ -717,8 +736,9 @@
       getCusCyList(cusId, this.tjStatus) // 璋冪敤API鑾峰彇鏁版嵁
         .then((response) => {
           if (response.data) {
+            console.log(response, 2525);
+
             this.tableList = response.data; // 纭 list 瀛樺湪鍚庡啀杩涜璧嬪��
-            // console.log(this.tableList, 123);
           } else {
             // 濡傛灉娌℃湁鏁版嵁鎴� list 涓虹┖锛屾竻绌鸿〃鏍煎苟鎻愮ず
             this.tableList = [];
@@ -963,24 +983,26 @@
     // 纭閲囨牱
     Confirmreceipt() {
       let data = this.ids;
-      if (data.length === 0) {
-        // 濡傛灉娌℃湁宸插悎骞剁殑椤圭洰锛岀粰鍑烘彁绀轰俊鎭�
-        this.$message.error("娌℃湁宸插悎骞剁殑椤圭洰鍙互鎾ら攢锛�");
-        return;
-      }
+      console.log(this.ids, 999);
+
       const loadingInstance = this.$loading({
         lock: true, // 閿佸畾灞忓箷
         text: "鍔犺浇涓�...", // 鍔犺浇鏂囨湰
         spinner: "el-icon-loading", // 鑷畾涔夊姞杞藉浘鏍�
         background: "rgba(255, 255, 255, 0.7)", // 鑳屾櫙棰滆壊
       });
-      confirmSampling(data)
+      confirmSampling(this.ids)
         .then((res) => {
-          this.$modal.msgSuccess("閲囨牱鎴愬姛");
-          this.getList();
+          if (res.code === 200) {
+            this.$modal.msgSuccess("閲囨牱鎴愬姛");
+            this.Collection();
+          }else{
+            this.$message.error(res.msg)
+          }
+          // this.getList();
         })
         .catch((error) => {
-          this.$message.error("閲囨牱澶辫触");
+          this.$message.error(res.msg);
         })
         .finally(() => {
           loadingInstance.close();

--
Gitblit v1.8.0