From 4155e844855e22f52e82f657eab6d3c1e616706e Mon Sep 17 00:00:00 2001 From: lkk <364857242@qq.com> Date: 星期五, 11 四月 2025 11:59:29 +0800 Subject: [PATCH] 1 --- src/components/public/index.vue | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/components/public/index.vue b/src/components/public/index.vue index 7eb7eec..4d4470b 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" > @@ -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