|
@@ -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) {
|