Răsfoiți Sursa

岗位管理修改

zhongxiaoyu 3 ani în urmă
părinte
comite
7d1a44863e

+ 7 - 2
src/components/rolelist/index.vue

@@ -101,6 +101,10 @@ export default {
       type: String,
       default: "",
     },
+    queryAll: {
+      type: String,
+      default: "",
+    },
     needId: [String, Number],
     GroupIds: {
       type: Array,
@@ -178,6 +182,9 @@ export default {
     msgDatas: {
       handler (arr) {
         if (arr && arr.length >= 2) {
+          if (this.queryAll) {
+              this.getRoleData('RoleId', 'RoleName');
+          }
           this.getRoleDataByUpId();
         } else {
           if (this.roleType == 'account') {
@@ -309,7 +316,6 @@ export default {
             this.dataList = msgs;
           }
           this.total = num;
-          this.$emit('roleListChange', msgs)
 
           this.loading = false;
         } else {
@@ -344,7 +350,6 @@ export default {
           } else {
             this.dataList = msgs;
           }
-          this.$emit('roleListChange', msgs)
           // this.checkBoxs(this.dataList, "RoleId");
           this.loading = false;
         } else {

+ 33 - 18
src/views/accountGroupManagement/components/accountGroupEdit.vue

@@ -68,13 +68,14 @@
               <RoleList
                 title="角色列表"
                 :role-type="roleType"
+                :needType="needType"
+                :queryAll="queryAll"
                 :group-ids="groupIds"
                 :check-box-list="roleListCheckedList"
                 :number="8"
                 :active="true"
                 @checkChange="getRoleListChecked"
                 @checkClick="selectRole"
-                @roleListChange="roleListCheckedChange"
               />
             </div>
           </el-col>
@@ -165,12 +166,15 @@ export default {
       accountGroupTreeCheckedList: [], // 岗位树初始勾选项
       accountGroupTreeCheckedTemp: [], // 岗位树当前勾选项
       roleListCheckedList: [], // 角色列表初始勾选项
+      roleListCheckedListCopy: [],
       roleListCheckedTemp: [], // 角色列表当前勾选项
       permissionTreeChckedKeys: [], // 权限树初始勾选项
       permissionTreeChckedTemp: [], // 权限树当前勾选项
       rulesOfCompetency: null, // 当前编辑的权限规则
       queryType: '',
+      queryAll: '',
       roleType: '',
+      needType: '',
       groupIds: [],
       queryIds: [],
       currentSelectedRoleId: 0,
@@ -210,16 +214,17 @@ export default {
     // console.log(obj)
     const { OpenRole } = obj
     this.openRole = OpenRole
-    this.accountGroupTreeCheckedTemp = [this.GroupUpId]
+    this.accountGroupTreeCheckedTemp.push(this.GroupUpId)
     this.queryIds.push(this.GroupUpId)
-    this.doesGroupExist && (this.GroupId = Number(this.$route.query.GroupId))
+    this.doesGroupExist && (this.GroupId = parseInt(this.$route.query.GroupId))
   },
   mounted() {
-    this.groupIds.push(this.GroupUpId)
+    this.GroupUpId !== -1 && this.groupIds.push(this.GroupUpId)
     if (this.doesGroupExist) {
       this.getGroupDetails()
     } else {
       this.roleType = 'onlyRole'
+      this.needType = 'yes'
       this.queryType = 'all'
     }
     this.accountGroupTreeCheckedList = [this.GroupUpId]
@@ -241,17 +246,25 @@ export default {
           RoleList &&
             RoleList.length &&
             RoleList.forEach(role => {
-              role.IsSelected && this.roleListCheckedTemp.push(role)
+              role.IsSelected &&
+                (this.roleListCheckedTemp.push(role),
+                this.roleListCheckedListCopy.push(role),
+                this.roleListCheckedList.push(role.RoleId))
             })
-
           AuthList &&
             AuthList.length &&
             AuthList.forEach(auth => {
               this.permissionTreeChckedKeys.push(auth.AuthId)
               this.permissionTreeChckedTemp.push(auth)
             })
-          this.roleType = this.GroupUpId === -1 ? 'onlyRole' : 'roleByUpId'
-          this.queryType = this.GroupUpId === -1 ? 'all' : 'group'
+          if (this.GroupUpId === -1) {
+            this.needType = 'yes'
+            this.roleType = 'onlyRole'
+            this.queryType = 'all'
+          } else {
+            this.roleType = 'roleByUpId'
+            this.queryType = 'group'
+          }
         } else {
           this.$message.error(res.message)
         }
@@ -277,28 +290,30 @@ export default {
     },
     // 获取当前勾选的岗位
     getAccountGroupChecked(arr) {
-      if (arr && arr.length === 1 && arr[0] !== -1) {
-        console.log(arr)
+      console.log(arr)
+      if (arr.length === 1 && arr[0] !== -1) {
         const GroupIds = arr.map(item => item.GroupId)
         this.accountGroupTreeCheckedTemp = GroupIds
-        this.roleType = 'roleByUpId'
+        this.needType = ''
+        this.queryAll = ''
+        this.roleType = ''
         this.groupIds = GroupIds
         this.queryType = 'group'
         this.queryIds = GroupIds
-      } else {
+      } else if (arr.length === 0) {
+        console.log(1)
         this.accountGroupTreeCheckedTemp = [-1]
-        // this.roleType = 'onlyRole'
-        this.groupIds = []
+        this.queryAll = 'yes'
+        this.needType = 'yes'
+        this.roleType = 'onlyRole'
+        this.roleListCheckedList = this.roleListCheckedListCopy.map(role => role.RoleId)
         this.queryType = 'all'
       }
     },
     // 角色选取
     getRoleListChecked(arr) {
       this.roleListCheckedTemp = arr
-    },
-    roleListCheckedChange(arr) {
-      this.roleListCheckedTemp = this.roleListCheckedTemp.filter(role => arr.some(data => data.RoleId === role.RoleId))
-      this.roleListCheckedList = this.roleListCheckedTemp.map(role => role.RoleId)
+      this.roleListCheckedListCopy = arr
     },
     // 获取当前编辑的权限规则
     getRulesOfCompetency(obj) {

+ 12 - 1
src/views/accountGroupManagement/components/accountGroupHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-08 09:27:43
- * @LastEditTime: 2022-03-10 16:02:46
+ * @LastEditTime: 2022-03-10 21:34:47
  * @LastEditors: your name
  * @Description: 用户组管理
  * @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
@@ -455,6 +455,17 @@ export default {
         if (res.code === 0) {
           this.$message.success(res.message)
           this.currDataArr[0].Status = val
+          if (!val) {
+            this.childrenData.forEach(data => {
+              data.Status = '2'
+              data.flag = false
+            })
+          }
+          this.dataArr.forEach(data => {
+            if (data.GroupUpid === id) {
+              data.Status = '2'
+            }
+          })
         } else {
           this.$message.error(res.message)
           this.currDataArr[0].flag = !val

+ 4 - 4
src/views/accountGroupManagement/minixs/treeData.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-22 17:00:22
- * @LastEditTime: 2022-03-03 16:29:07
+ * @LastEditTime: 2022-03-10 19:03:10
  * @LastEditors: your name
  * @Description: 获取权限树
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js
@@ -14,7 +14,7 @@ export default {
     return {
       dataList: {
         GroupId: -1,
-        GroupName: "系统权限组",
+        GroupName: "岗位",
         GroupUpid: -2,
         UserCount: 0,
         AuthCount: 0,
@@ -40,7 +40,7 @@ export default {
           })
           const obj = {
             GroupId: -1,
-            GroupName: "系统权限组",
+            GroupName: "岗位",
             GroupUpid: -2,
             UserCount: 0,
             AuthCount: 0,
@@ -52,7 +52,7 @@ export default {
           this.dataArr = result.returnData;
           this.dataArr.push({
             GroupId: -1,
-            GroupName: "系统权限组",
+            GroupName: "岗位",
             GroupUpid: -2,
             UserCount: 0,
             AuthCount: 0,