|
|
|
|
@ -44,8 +44,8 @@
|
|
|
|
|
{{ data.name }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="action-item">
|
|
|
|
|
<el-checkbox v-for="(item, index) in data.auth_node_tags_array" :key="index"
|
|
|
|
|
v-model="item.checked" @change="()=>{}"
|
|
|
|
|
<el-checkbox v-for="(item, index) in data.auth_node_tags_array" :key="data.name+item.id"
|
|
|
|
|
v-model="item.checked" @change="()=>{tree = Object.assign([], tree)}"
|
|
|
|
|
>
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
@ -116,10 +116,10 @@ export default {
|
|
|
|
|
|
|
|
|
|
for (let mod of response) {
|
|
|
|
|
mod.rowid = mod.id.toString()
|
|
|
|
|
console.log(mod)
|
|
|
|
|
if (cur == 0) {
|
|
|
|
|
that.activeRole = mod.rowid
|
|
|
|
|
that.loadPermisstions(0, that.activeRole)
|
|
|
|
|
that.togglePermission(0, that.activeRole)
|
|
|
|
|
//TODO: that.loadPermisstions(0, that.activeRole)
|
|
|
|
|
}
|
|
|
|
|
cur++
|
|
|
|
|
}
|
|
|
|
|
@ -137,7 +137,7 @@ export default {
|
|
|
|
|
let children = tree.children
|
|
|
|
|
children.forEach((menu, index3) => {
|
|
|
|
|
|
|
|
|
|
menu.auth_node_tags_array.map((m, index4) => {
|
|
|
|
|
menu.auth_node_tags_array.forEach((m, index4) => {
|
|
|
|
|
m.checked = false
|
|
|
|
|
that.$forceUpdate()
|
|
|
|
|
|
|
|
|
|
@ -149,7 +149,35 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
roleChange(tab, event) {
|
|
|
|
|
this.loadPermisstions(parseInt(tab.index), tab.name)
|
|
|
|
|
this.togglePermission(parseInt(tab.index), tab.name)
|
|
|
|
|
// TODO: this.loadPermisstions(parseInt(tab.index), tab.name)
|
|
|
|
|
},
|
|
|
|
|
togglePermission (index, name) {
|
|
|
|
|
let select = this.rolelist[index].permissions;
|
|
|
|
|
this.$refs.tree.setCheckedKeys([]);
|
|
|
|
|
this.activeRole = name;
|
|
|
|
|
this.$refs["tree"].setCheckedKeys(select.map(item => item.id));
|
|
|
|
|
const toggleAuth = (arr, findId, selectItem) => {
|
|
|
|
|
for (let i of arr) {
|
|
|
|
|
if (i.id === findId) {
|
|
|
|
|
console.log(i)
|
|
|
|
|
if (i.auth_node_tags) {
|
|
|
|
|
i.auth_node_tags_array.forEach(item => {
|
|
|
|
|
this.$set(item, "checked", selectItem.has_auth_node_tags.indexOf(item.tag) > -1);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (i.children && i.children.length > 0) {
|
|
|
|
|
toggleAuth(i.children, findId, selectItem)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
select.filter(i => i.auth_node_tags && i.auth_node_tags.length > 0).forEach(i => {
|
|
|
|
|
toggleAuth(this.tree, i.id, i)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.tree = Object.assign([], this.tree)
|
|
|
|
|
},
|
|
|
|
|
loadPermisstions(index, name) {
|
|
|
|
|
let select = this.rolelist[index].permissions
|
|
|
|
|
@ -157,32 +185,27 @@ export default {
|
|
|
|
|
this.activeRole = name
|
|
|
|
|
|
|
|
|
|
let that = this
|
|
|
|
|
const toggleCheckBox = (arr) => {
|
|
|
|
|
arr.forEach((menu, index3) => {
|
|
|
|
|
if (item.has_auth_node_tags.length > 0) {
|
|
|
|
|
menu.auth_node_tags_array.forEach((m, index4) => {
|
|
|
|
|
if (item.has_auth_node_tags.indexOf(m.tag) > -1) {
|
|
|
|
|
that.$set(m,
|
|
|
|
|
'checked', true)
|
|
|
|
|
} else {
|
|
|
|
|
that.$set(m,
|
|
|
|
|
'checked', false)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
menu.auth_node_tags_array.map(m => {
|
|
|
|
|
m.checked = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const resolveChildren = (arr) => {
|
|
|
|
|
let temp = [];
|
|
|
|
|
if (arr.children && arr.children.length > 0) {
|
|
|
|
|
arr.children.forEach((child) => {
|
|
|
|
|
temp.push(child)
|
|
|
|
|
resolveChildren(child)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return temp;
|
|
|
|
|
}
|
|
|
|
|
this.tree.forEach((tree, index1) => {
|
|
|
|
|
let children = tree.children
|
|
|
|
|
if (tree.auth_node_tags) {
|
|
|
|
|
tree.auth_node_tags_array.forEach((auth) => {
|
|
|
|
|
this.$set(auth, "checked", true)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let children = resolveChildren(tree)
|
|
|
|
|
select.forEach((item, index2) => {
|
|
|
|
|
let selectMenu = children.filter(m => {
|
|
|
|
|
return m.id == item.id
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
selectMenu.forEach((menu, index3) => {
|
|
|
|
|
if (item.has_auth_node_tags.length > 0) {
|
|
|
|
|
menu.auth_node_tags_array.forEach((m, index4) => {
|
|
|
|
|
@ -245,7 +268,11 @@ export default {
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.t-tree {
|
|
|
|
|
::v-deep .el-tree-node__content {
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
height: auto;
|
|
|
|
|
}
|
|
|
|
|
.t-tree {
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
@ -298,7 +325,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
.action-group {
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
//display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-text {
|
|
|
|
|
@ -307,12 +334,13 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-item {
|
|
|
|
|
flex: 1;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-item > label {
|
|
|
|
|
width: 55px;
|
|
|
|
|
margin-left: 3px;
|
|
|
|
|
//width: 55px;
|
|
|
|
|
//margin-left: 3px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-container >>> .el-tree-node {
|
|
|
|
|
@ -320,6 +348,11 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.action-container >>> .el-checkbox__label {
|
|
|
|
|
padding-left: 5px;
|
|
|
|
|
//padding-left: 5px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<style>
|
|
|
|
|
.action-item > .el-checkbox .el-checkbox__inner {
|
|
|
|
|
border-radius: 100%;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|