From 5c8adc16e9b0c0e71998d3cefc35170fa4a60900 Mon Sep 17 00:00:00 2001
From: lkk <364857242@qq.com>
Date: 星期五, 11 四月 2025 16:01:13 +0800
Subject: [PATCH] 1

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

diff --git a/src/components/public/index.vue b/src/components/public/index.vue
index 98c8513..482915f 100644
--- a/src/components/public/index.vue
+++ b/src/components/public/index.vue
@@ -58,6 +58,7 @@
             :data="dataList"
             ref="multipleTable"
             v-loading="loading"
+            row-key="aid"
             @selection-change="handleSelectionChange"
             border
             height="420px"
@@ -178,7 +179,7 @@
         bingzhong: "",
         bzPinyin: "",
         proId:"",
-        proName:"",
+      //   proName:"",
         pageNum: 1,
         pageSize: 10,
       },
@@ -203,7 +204,7 @@
         if (newVal && newVal.length > 0) {
           const firstProject = newVal[0]; // 浣犱篃鍙互閬嶅巻鎵�鏈夐」鐩紝鐪嬩綘涓氬姟闇�姹�
           this.queryParams.proId = firstProject.proId; // 鍋囪椤圭洰涓彨 id
-          this.queryParams.proName = firstProject.proName; // 鍋囪鍙� proName
+          // this.queryParams.proName = firstProject.proName;
           this.proName = firstProject.proName
         }
       },
@@ -236,6 +237,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 +268,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 +284,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