File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
QMPlusVuePage/src/view/superAdmin/authority/components Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <div class =" clearflex" >
3
+ <div class =" clearflex" style = " margin : 18 px " >
4
4
<el-button @click =" authDataEnter" class =" fl-right" size =" small" type =" primary" >确 定</el-button >
5
+ <el-button @click =" all" class =" fl-left" size =" small" type =" primary" >全选</el-button >
6
+ <el-button @click =" self" class =" fl-left" size =" small" type =" primary" >本部门</el-button >
7
+ <el-button @click =" selfAndChildren" class =" fl-left" size =" small" type =" primary" >部门及以下</el-button >
5
8
</div >
6
9
<el-checkbox-group v-model =" dataAuthorityId" @change =" selectAuthority" >
7
10
<el-checkbox v-for =" (item,key) in authoritys" :label =" item" :key =" key" >{{item.authorityName}}</el-checkbox >
@@ -33,6 +36,23 @@ export default {
33
36
}
34
37
},
35
38
methods: {
39
+ all (){
40
+ this .dataAuthorityId = [... this .authoritys ]
41
+ },
42
+ self (){
43
+ this .dataAuthorityId = this .authoritys .filter (item => item .ID === this .row .ID )
44
+ },
45
+ selfAndChildren (){
46
+ const arrBox = []
47
+ this .getChildrenId (this .row ,arrBox)
48
+ this .dataAuthorityId = this .authoritys .filter (item => arrBox .indexOf (item .ID )> - 1 )
49
+ },
50
+ getChildrenId (row ,arrBox ){
51
+ arrBox .push (row .ID )
52
+ row .children && row .children .map (item => {
53
+ this .getChildrenId (item,arrBox)
54
+ })
55
+ },
36
56
// 提交
37
57
async authDataEnter (){
38
58
const res = await setDataAuthority (this .row )
You can’t perform that action at this time.
0 commit comments