From 99dcb0a585582d195a33e0d0cefcd6ec7857c537 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期二, 15 四月 2025 17:11:35 +0800
Subject: [PATCH] qx

---
 src/components/public/index.vue |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/components/public/index.vue b/src/components/public/index.vue
index 7eb7eec..12ba45e 100644
--- a/src/components/public/index.vue
+++ b/src/components/public/index.vue
@@ -58,7 +58,9 @@
               :data="dataList"
               ref="multipleTable"
               v-loading="loading"
+              row-key="aid"
               @selection-change="handleSelectionChange"
+              :reserve-selection="false"
               border
               height="420px"
             >
@@ -218,8 +220,8 @@
           this.loading = true; // 娣诲姞鍔犺浇鐘舵��
   
           const res = await getlist(this.queryParams);
-          this.dataList = res.rows;
-          this.total = res.total;
+          this.dataList = res.data.rows;
+          this.total = res.data.total;
   
           // 濡傛灉闇�瑕侀�変腑鎿嶄綔锛屽皢鍏跺皝瑁呬负鐙珛鏂规硶
           await this.handleAutoSelection();
@@ -236,6 +238,9 @@
         if (!this.fList?.rulesList?.length) return;
   
         await this.$nextTick();
+        // 鍏堟竻闄ゆ墍鏈夐�夋嫨
+        this.$refs.multipleTable?.clearSelection();
+        // 鍐嶈繘琛岄�夋嫨
         this.dataList.forEach((item) => {
           const shouldSelect = this.fList.rulesList.some(
             (rule) => rule.aid === item.aid
@@ -264,13 +269,12 @@
       },
   
       handleSelectionChange(selection) {
-        this.list = selection;
+        console.log('Selection changed:', selection);
+        this.list = [...selection]; // 浣跨敤灞曞紑杩愮畻绗﹀垱寤烘柊鏁扮粍
         this.updateFormContent(selection);
       },
   
       updateFormContent(selection) {
-        if (!selection.length) return;
-  
         // 濡傛灉澶勪簬妫�鏌ョ姸鎬侊紝浣跨敤浼犲叆鐨勫��
         if (this.checkStatus === "1") {
           this.updateData(this.proResult, this.conclusion);
@@ -281,16 +285,19 @@
         this.form.desc = "";
         this.form.jcsj = "";
   
-        // 浣跨敤map鍜宩oin鏇夸唬forEach鍜屽瓧绗︿覆鎷兼帴
-        this.form.desc = selection
-          .map((item) => item.bingzhong || item.ruleStr)
-          .filter(Boolean)
-          .join(",");
+        // 鍙湁鍦ㄦ湁閫変腑椤规椂鎵嶈繘琛屾嫾鎺�
+        if (selection.length > 0) {
+          // 浣跨敤map鍜宩oin鏇夸唬forEach鍜屽瓧绗︿覆鎷兼帴
+          this.form.desc = selection
+            .map((item) => item.bingzhong || item.ruleStr)
+            .filter(Boolean)
+            .join(",");
   
-        this.form.jcsj = selection
-          .map((item) => item.yxbx)
-          .filter(Boolean)
-          .join(",");
+          this.form.jcsj = selection
+            .map((item) => item.yxbx)
+            .filter(Boolean)
+            .join(",");
+        }
       },
   
       handleOk() {

--
Gitblit v1.8.0