瀏覽代碼

组件优化:完善审核配置用户选择逻辑,支持用户名与ID的映射处理

刘博博 1 周之前
父節點
當前提交
678d059bf4
共有 1 個文件被更改,包括 20 次插入4 次删除
  1. 20 4
      src/views/system/auditConfig/index.vue

+ 20 - 4
src/views/system/auditConfig/index.vue

@@ -384,9 +384,25 @@ export default {
       this.currentForm.nodeOrder = row.nodeOrder;
       this.currentForm.id = row.id;
       
-      // 设置选中的用户
-      this.selectedUsers = row.approverList || [];
-      this.currentForm.approver = row.approverList ? row.approverList.map(user => user.userId) : [];
+      // 根据userName和approverList设置选中的用户
+      if (row.userName && row.approverList) {
+        const userNames = row.userName.split(',');
+        const userIds = row.approverList;
+        
+        // 创建selectedUsers数组
+        this.selectedUsers = userIds.map((userId, index) => ({
+          userId: userId,
+          userName: userNames[index] || '',
+          nickName: userNames[index] || ''
+        }));
+        
+        // 设置表单中的审核人ID数组
+        this.currentForm.approver = userIds;
+      } else {
+        // 如果没有数据,清空选中状态
+        this.selectedUsers = [];
+        this.currentForm.approver = [];
+      }
       
       this.open = true;
       this.title = "修改审核配置";
@@ -440,7 +456,7 @@ export default {
     },
     // 处理用户选择确认
     handleUserSelectConfirm(data) {
-      // 将选中的用户添加到已选列表中
+      // 多选模式,将选中的用户添加到已选列表中
       const newUsers = data.users.filter(user => 
         !this.selectedUsers.some(selected => selected.userId === user.userId)
       );