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 | 50 ++++++++++++++++++++++++++++++++++++--------------
1 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/src/views/archiveManager/seleUser.vue b/src/views/archiveManager/seleUser.vue
index 6249c65..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" />
@@ -57,7 +58,7 @@
</template>
<script>
- import {listArchiverecordstouser,addArchiverecordstouser,authRecordToUser} from "@/api/system/archiverecordstouser"
+ import {listArchiverecordstouser,addArchiverecordstouser,authRecordToUser,getArchiverecordstouserByReIdAndUid} from "@/api/system/archiverecordstouser"
import { UserRoleIdList,unallocatedUserList, authUserSelectAll } from "@/api/system/role"
export default {
@@ -67,7 +68,7 @@
roleId: {
type: [Number, String]
},
- recordId: {
+ archiveRecordsId: {
type: [Number, String]
}
},
@@ -86,22 +87,37 @@
pageNum: 1,
pageSize: 10,
roleId: undefined,
- recordId: undefined,
+ archiveRecordsId: undefined,
userName: undefined,
phonenumber: undefined
}
}
},
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() {
+ show(archiveRecordsId) {
+ if (archiveRecordsId) {
+ // 杩涜绫诲瀷杞崲
+ this.archiveRecordsId = !isNaN(Number(archiveRecordsId)) ? Number(archiveRecordsId) : 0
+ }
this.queryParams.roleId = this.roleId
- this.queryParams.recordId = this.recordId
+ this.queryParams.archiveRecordsId = this.archiveRecordsId
+
this.getList()
this.visible = true
},
clickRow(row) {
- this.$refs.table.toggleRowSelection(row)
+ this.$refs.table.clearSelection();
+ this.$refs.table.toggleRowSelection(row);
},
// 澶氶�夋閫変腑鏁版嵁
handleSelectionChange(selection) {
@@ -128,19 +144,25 @@
},
/** 閫夋嫨鎺堟潈鐢ㄦ埛鎿嶄綔 */
handleSelectUser() {
- const recordId = this.queryParams.recordId
+ const archiveRecordsId = this.queryParams.archiveRecordsId
const userIds = this.userIds.join(",")
- alert(recordId)
- alert(userIds)
if (userIds == "") {
this.$modal.msgError("璇烽�夋嫨瑕佸垎閰嶇殑鐢ㄦ埛")
return
}
- authRecordToUser({ recordId: recordId, userIds: userIds }).then(res => {
- this.$modal.msgSuccess(res.msg)
- this.visible = false
- this.$emit("ok")
+
+ // 鍒涘缓杞崲鍚庣殑鍙傛暟锛岀‘淇漴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 || "鎺堟潈澶辫触锛屽凡缁忔巿鏉冭繃浜�")
+ }
})
}
}
--
Gitblit v1.9.1