|
@@ -128,6 +128,8 @@ export default {
|
|
|
loading: false,
|
|
|
asyncData: [],
|
|
|
msgDatas: [],
|
|
|
+ capDatas: [],
|
|
|
+ grpDatas: [],
|
|
|
OpenGroup: null
|
|
|
}
|
|
|
},
|
|
@@ -156,6 +158,7 @@ export default {
|
|
|
},
|
|
|
checkBoxList: {
|
|
|
handler (arr) {
|
|
|
+ console.log(arr)
|
|
|
if (arr && arr.length) {
|
|
|
this.asyncData.push(true)
|
|
|
}
|
|
@@ -168,9 +171,9 @@ export default {
|
|
|
if (this.roleType == 'account') {
|
|
|
this.checkBoxs('UserId')
|
|
|
}
|
|
|
- if (this.roleType == 'onlyRole' || this.roleType == 'roleByUpId' || this.roleType === 'groups') {
|
|
|
- this.checkBoxs('RoleId')
|
|
|
- }
|
|
|
+ // if (this.roleType == 'onlyRole' || this.roleType == 'roleByUpId' || this.roleType === 'groups') {
|
|
|
+ // this.checkBoxs('RoleId')
|
|
|
+ // }
|
|
|
}
|
|
|
},
|
|
|
deep: true
|
|
@@ -180,9 +183,6 @@ export default {
|
|
|
const obj = {}
|
|
|
obj['GroupIds'] = 'GroupIds'
|
|
|
this.msgDatas.push(obj)
|
|
|
- // if (this.roleType == 'q') {
|
|
|
- // this.checkList = []
|
|
|
- // }
|
|
|
},
|
|
|
deep: true
|
|
|
},
|
|
@@ -216,7 +216,7 @@ export default {
|
|
|
this.msg = -1
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
noMore () {
|
|
@@ -240,6 +240,11 @@ export default {
|
|
|
//多选框
|
|
|
checkChange (arr) {
|
|
|
const datas = this.formatChecks(arr)
|
|
|
+ const arrs = []
|
|
|
+ arr.forEach(item => {
|
|
|
+ arrs.push(this.dataList[item])
|
|
|
+ })
|
|
|
+ this.capDatas = arrs
|
|
|
// if (this.roleType == 'account') {
|
|
|
// datas = this.formatChecks(arr, 'UserId');
|
|
|
// }
|
|
@@ -342,7 +347,18 @@ export default {
|
|
|
this.loading = false
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ formatCheckBox () {
|
|
|
+ const caps = []
|
|
|
+ const arrs = this.capDatas.concat(this.checkBoxList)
|
|
|
+ this.dataList.forEach((item, index) => {
|
|
|
+ arrs.forEach(p => {
|
|
|
+ if (item['RoleId'] == p['RoleId']) {
|
|
|
+ caps.push(index)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.checkList = caps
|
|
|
+ },
|
|
|
//获取列表2
|
|
|
async getRoleDataByUpId () {
|
|
|
try {
|
|
@@ -350,6 +366,7 @@ export default {
|
|
|
const obj = {
|
|
|
GroupIds: this.GroupIds
|
|
|
}
|
|
|
+ this.grpDatas.push(this.GroupIds)
|
|
|
const result = await GetRoleByGroup(obj)
|
|
|
if (result.code === 0) {
|
|
|
const datas = result.returnData
|
|
@@ -366,7 +383,26 @@ export default {
|
|
|
this.dataList = msgs
|
|
|
}
|
|
|
this.$emit('role-list-change', msgs)
|
|
|
- // this.checkBoxs(this.dataList, "RoleId");
|
|
|
+ if (this.dataList.length) {
|
|
|
+ this.formatCheckBox()
|
|
|
+ const grpDatasTs = this.grpDatas;
|
|
|
+ if (grpDatasTs.length > 1) {
|
|
|
+ if (grpDatasTs[grpDatasTs.length - 1].length < grpDatasTs[grpDatasTs.length - 2].length) {
|
|
|
+ const wts = []
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ this.capDatas.forEach(p => {
|
|
|
+ if (item.RoleId == p.RoleId) {
|
|
|
+ wts.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.capDatas = wts
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.capDatas = []
|
|
|
+ this.msg = null
|
|
|
+ }
|
|
|
this.loading = false
|
|
|
} else {
|
|
|
this.$message.error(result.message)
|