From af08dae54f74aa9a94f82f298410165fa9b7b614 Mon Sep 17 00:00:00 2001
From: yinbangzhong <zhongbangyin@126.com>
Date: 星期三, 04 九月 2024 13:56:02 +0800
Subject: [PATCH] 单文档

---
 src/views/authority/users/index.vue |   66 +++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/src/views/authority/users/index.vue b/src/views/authority/users/index.vue
index 068e9b5..37aeefe 100644
--- a/src/views/authority/users/index.vue
+++ b/src/views/authority/users/index.vue
@@ -171,10 +171,8 @@
           </a-col>
           <a-col :span="10">
             <a-form-item
-              required
               field="role"
               label="瑙掕壊"
-              :rules="[{ required: true, message: '瑙掕壊蹇呴��' }]"
             >
               <a-select
                 multiple
@@ -218,17 +216,28 @@
           >
           </a-tree>
         </a-card>
-        <a-card class="card-demo" title="鐢ㄦ埛鎵�灞炴満鏋�" hoverable>
-          <a-space wrap>
-            <a-tag
-              v-for="(tag, index) of checkStrictly"
-              :key="tag.deptId"
-              @close="handleRemove(tag)"
-            >
-              {{ tag.deptName }}
-            </a-tag>
-          </a-space>
-        </a-card>
+        <div :style="{ 'display': 'flex', 'flex-direction': 'column' }">
+          <a-card class="card-demo" title="鐢ㄦ埛鎵�灞為儴闂�" :style="{ 'width': '460px', 'height': '500px', 'overflow-y': 'auto' }">
+            <a-space wrap>
+              <a-tag
+                v-for="(tag, index) of checkStrictly"
+                :key="tag.deptId"
+              >
+                {{ tag.deptName }}
+              </a-tag>
+            </a-space>
+            <a-divider />
+            <a-space wrap>
+              閮ㄩ棬瑙掕壊:
+              <a-tag
+                v-for="(tag, index) of checkStrictlyDeptRole"
+                :key="tag.roleId"
+              >
+                {{ tag.roleName }}
+              </a-tag>
+            </a-space>
+          </a-card>
+        </div>
       </div>
     </a-modal>
     <a-modal
@@ -327,6 +336,7 @@
   let checkStrictlyKnowledge = ref([]);
   let checkStrictlyDialog = ref([]);
   let checkStrictlyAgent = ref([]);
+  let checkStrictlyDeptRole = ref([]);
   let formRef = ref();
 
   let menuTips = ref(['鏉冮檺绠$悊', '璐﹀彿']);
@@ -377,12 +387,22 @@
   const onCheck = (newCheckedKeys, event) => {
     let o = { deptId: event.node.deptId, deptName: event.node.deptName };
     if (event.checked) {
+      event.node.roles.forEach(
+        (val) => {
+          checkStrictlyDeptRole.value.push(val);
+        }
+      );
       checkStrictly.value.push(o);
     } else {
       checkStrictly.value.forEach((val, idx, array) => {
         // val: 褰撳墠鍊�
         if (val.deptId == event.node.deptId) {
           checkStrictly.value.splice(idx, 1);
+          checkStrictlyDeptRole.value.forEach((val2, idx2, array2) => {
+            if (val2.deptId == event.node.deptId) {
+              checkStrictlyDeptRole.value.splice(idx2, 1);
+            }
+          });
           return true;
         }
       });
@@ -632,16 +652,32 @@
       checkedKeys.value = [];
       expandKdys.value = [];
       checkStrictly.value = [];
+      checkStrictlyDeptRole.value=[];
       selectUser.value = record;
-      expandKdys.value.push('0');
+      expandKdys.value.push("0");
       if (record?.dept) {
         record.dept.forEach((val) => {
           checkStrictly.value.push({
             deptId: val.deptId,
-            deptName: val.deptName,
+            deptName: val.deptName
           });
           checkedKeys.value.push(val.deptId);
           expandKdys.value.push(val.deptId);
+          record.roles.forEach(
+            (r) => {
+              if (r.dept) {
+                r.dept.forEach((d) => {
+                  if (d.deptId == val.deptId) {
+                    checkStrictlyDeptRole.value.push({
+                      roleId: r.roleId,
+                      roleName: r.roleName,
+                      deptId:d.deptId,
+                    });
+                  }
+                });
+              }
+            }
+          );
         });
       }
     }

--
Gitblit v1.8.0