From e3cac4fb5b540b45d6ec1a53a534d08c03d7c174 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期六, 15 十一月 2025 16:36:08 +0800
Subject: [PATCH] 打的修改
---
src/views/archiveManager/seleUser.vue | 39 +++++++++++++++++++++++++++------------
1 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/src/views/archiveManager/seleUser.vue b/src/views/archiveManager/seleUser.vue
index ba874e2..0b313c2 100644
--- a/src/views/archiveManager/seleUser.vue
+++ b/src/views/archiveManager/seleUser.vue
@@ -24,7 +24,8 @@
</el-form-item>
</el-form>
<el-row>
- <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
+ <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSingleSelection"
+ height="260px">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="鐢ㄦ埛鍚嶇О" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="鐢ㄦ埛鏄电О" prop="nickName" :show-overflow-tooltip="true" />
@@ -93,11 +94,21 @@
}
},
methods: {
+ // 鏇挎崲鍘熸湁鐨刪andleSelectionChange鏂规硶
+ handleSingleSelection(selection) {
+ if (selection.length > 1) {
+ this.$refs.table.clearSelection();
+ this.$refs.table.toggleRowSelection(selection[selection.length - 1]);
+ }
+ else
+ this.userIds = selection.map(item => item.userId);
+ },
// 鏄剧ず寮规
show(archiveRecordsId) {
if (archiveRecordsId) {
- this.archiveRecordsId = archiveRecordsId
- }
+ // 杩涜绫诲瀷杞崲
+ this.archiveRecordsId = !isNaN(Number(archiveRecordsId)) ? Number(archiveRecordsId) : 0
+ }
this.queryParams.roleId = this.roleId
this.queryParams.archiveRecordsId = this.archiveRecordsId
@@ -105,7 +116,8 @@
this.visible = true
},
clickRow(row) {
- this.$refs.table.toggleRowSelection(row)
+ this.$refs.table.clearSelection();
+ this.$refs.table.toggleRowSelection(row);
},
// 澶氶�夋閫変腑鏁版嵁
handleSelectionChange(selection) {
@@ -135,19 +147,22 @@
const archiveRecordsId = this.queryParams.archiveRecordsId
const userIds = this.userIds.join(",")
-
if (userIds == "") {
this.$modal.msgError("璇烽�夋嫨瑕佸垎閰嶇殑鐢ㄦ埛")
return
}
- authRecordToUser({ recordId: archiveRecordsId, userIds: userIds }).then(res => {
+
+ // 鍒涘缓杞崲鍚庣殑鍙傛暟锛岀‘淇漴ecordId鏄暟瀛楃被鍨�
+ const convertedRecordId = !isNaN(Number(archiveRecordsId)) ? Number(archiveRecordsId) : 0
+
+ authRecordToUser({ recordId: convertedRecordId, userIds: userIds }).then(res => {
if(res.code === 200) {
- this.$modal.msgSuccess(res.msg)
- this.visible = false
- this.$emit("ok")
- } else {
- this.$modal.msgError(res.msg || "鎺堟潈澶辫触锛屽凡缁忔巿鏉冭繃浜�")
- }
+ this.$modal.msgSuccess(res.msg)
+ this.visible = false
+ this.$emit("ok")
+ } else {
+ this.$modal.msgError(res.msg || "鎺堟潈澶辫触锛屽凡缁忔巿鏉冭繃浜�")
+ }
})
}
}
--
Gitblit v1.9.1