|
@@ -1,7 +1,7 @@
|
|
<!--
|
|
<!--
|
|
* @Author: zk
|
|
* @Author: zk
|
|
* @Date: 2022-02-09 15:47:09
|
|
* @Date: 2022-02-09 15:47:09
|
|
- * @LastEditTime: 2022-03-10 17:25:18
|
|
|
|
|
|
+ * @LastEditTime: 2022-03-11 16:42:20
|
|
* @LastEditors: your name
|
|
* @LastEditors: your name
|
|
* @Description: 用户组树
|
|
* @Description: 用户组树
|
|
* @FilePath: \Foshan4A4.0\src\components\usergrouptree\index.vue
|
|
* @FilePath: \Foshan4A4.0\src\components\usergrouptree\index.vue
|
|
@@ -53,6 +53,10 @@ export default {
|
|
checkDisabled: {
|
|
checkDisabled: {
|
|
type: Number,
|
|
type: Number,
|
|
default: 0
|
|
default: 0
|
|
|
|
+ },
|
|
|
|
+ singleNode: {
|
|
|
|
+ type: Number,
|
|
|
|
+ default: 0
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
@@ -97,38 +101,61 @@ export default {
|
|
PageSize: this.pageSize
|
|
PageSize: this.pageSize
|
|
})
|
|
})
|
|
const datas = result.returnData
|
|
const datas = result.returnData
|
|
- const tree = translateDataToTreeAll(datas, 'GroupUpid', 'GroupId')
|
|
|
|
- const setDisabled = (tree, key) => {
|
|
|
|
- if (key) {
|
|
|
|
- tree.find(node => {
|
|
|
|
- if (node.GroupId === key) {
|
|
|
|
- node.disabled = true
|
|
|
|
- node.children?.length && setDisabled(node.children)
|
|
|
|
|
|
+ if (this.singleNode) {
|
|
|
|
+ if (this.singleNode === -1) {
|
|
|
|
+ const obj = {
|
|
|
|
+ AuthCount: 0,
|
|
|
|
+ GroupId: -1,
|
|
|
|
+ GroupName: '岗位',
|
|
|
|
+ GroupUpid: 0,
|
|
|
|
+ QueryTarget: 0,
|
|
|
|
+ Status: 0,
|
|
|
|
+ UserCount: 0,
|
|
|
|
+ disabled: true
|
|
|
|
+ }
|
|
|
|
+ this.data = [obj]
|
|
|
|
+ } else {
|
|
|
|
+ this.data = [datas.find(data => {
|
|
|
|
+ if (data.GroupId === this.singleNode) {
|
|
|
|
+ data.disabled = true
|
|
return true
|
|
return true
|
|
- } else if (node.children?.length) {
|
|
|
|
- setDisabled(node.children, key)
|
|
|
|
}
|
|
}
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- tree.forEach(node => {
|
|
|
|
- node.disabled = true
|
|
|
|
- node.children?.length && setDisabled(node.children)
|
|
|
|
- })
|
|
|
|
|
|
+ })]
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ const tree = translateDataToTreeAll(datas, 'GroupUpid', 'GroupId')
|
|
|
|
+ const setDisabled = (tree, key) => {
|
|
|
|
+ if (key) {
|
|
|
|
+ tree.find(node => {
|
|
|
|
+ if (node.GroupId === key) {
|
|
|
|
+ node.disabled = true
|
|
|
|
+ node.children?.length && setDisabled(node.children)
|
|
|
|
+ return true
|
|
|
|
+ } else if (node.children?.length) {
|
|
|
|
+ setDisabled(node.children, key)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ tree.forEach(node => {
|
|
|
|
+ node.disabled = true
|
|
|
|
+ node.children?.length && setDisabled(node.children)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.checkDisabled && setDisabled(tree, this.checkDisabled)
|
|
|
|
+ const obj = {
|
|
|
|
+ AuthCount: 0,
|
|
|
|
+ GroupId: -1,
|
|
|
|
+ GroupName: '岗位',
|
|
|
|
+ GroupUpid: 0,
|
|
|
|
+ QueryTarget: 0,
|
|
|
|
+ Status: 0,
|
|
|
|
+ UserCount: 0,
|
|
|
|
+ disabled: true,
|
|
|
|
+ children: tree
|
|
|
|
+ }
|
|
|
|
+ this.data = [obj]
|
|
}
|
|
}
|
|
- this.checkDisabled && setDisabled(tree, this.checkDisabled)
|
|
|
|
- const obj = {
|
|
|
|
- AuthCount: 0,
|
|
|
|
- GroupId: -1,
|
|
|
|
- GroupName: '岗位',
|
|
|
|
- GroupUpid: 0,
|
|
|
|
- QueryTarget: 0,
|
|
|
|
- Status: 0,
|
|
|
|
- UserCount: 0,
|
|
|
|
- disabled: true,
|
|
|
|
- children: tree
|
|
|
|
- }
|
|
|
|
- this.data = [obj]
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|