1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
| <template>
| <el-dialog v-dialogDrag
| :title="dialog.title"
| :visible.sync="dialog.showDialog"
| width="1000px"
| :append-to-body="true"
| class="avue-dialog"
| :destroy-on-close="true"
| :close-on-click-modal="false"
| @close="cancelDialog">
| <el-aside>
| <basic-container>
| <avue-tree ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick">
| <span slot-scope="{ node, data }" class="el-tree-node__label">
| <span style="font-size: 15px">
| <i class="el-icon-user-solid"></i>
| {{ (node || {}).label }}
| </span>
| </span>
| </avue-tree>
| </basic-container>
| </el-aside>
|
| <el-main>
| <basic-container>
| <avue-tree ref="uiTree" :data="uiTreeData" :option="uiTreeOption">
| <span slot-scope="{ node, data }" class="el-tree-node__label">
| <span style="font-size: 15px">
| <i class="el-icon-user-solid"></i>
| {{ (node || {}).label }}
| </span>
| </span>
| </avue-tree>
| </basic-container>
| </el-main>
| <div class="dialog-footer avue-dialog__footer">
| <el-button type="primary" plain size="small" @click="submitDialog" >授权</el-button>
| <el-button type="primary" plain size="small" @click="clearValue" >重置</el-button>
| <el-button size="small" @click="cancelDialog">取 消</el-button>
| </div>
| </el-dialog>
| </template>
|
| <script>
| import {gridRoles} from '@/api/system/role/api'
| import {getUIAuthor,authorizedUI} from "@/api/authority/ui/uiAuthor";
|
| export default {
| name: "UIDialog",
| data() {
| return {
| dialog: {
| showDialog: false,
| title: "UI授权",
| loading: false,
| type: "add",
| },
| type:'',//业务类型
| context:'',//UI上下文code
| treeOption: {
| height: '500px',
| menu: false,
| addBtn: false,
| props: {
| label: 'name',
| value: 'oid',
| children: 'children'
| }
| },
| nodeRow: {},
| treeData: [],
| uiTreeOption: {
| height: '500px',
| menu: false,
| addBtn: false,
| filter:false,
| props: {
| label: 'name',
| value: 'oid',
| children: 'children'
| }
| },
| uiTreeData: [],
| }
| },
| methods:{
| openDialog(type,context) {
| this.type=type;
| this.context=context;
| this.dialog.showDialog = true;
| this.getTreeList()
|
| },
| cancelDialog() {
| this.dialog.loading = false;
| this.dialog.showDialog = false;
| },
| getTreeList() {
| const loading = this.$loading({});
| gridRoles().then(res => {
| this.treeData = res.data.data;
| loading.close();
| }).catch(error=>{
| loading.close();
| })
| },
| // 角色点击
| nodeClick(row) {
| this.nodeRow = row;
|
| const loading = this.$loading({});
| getUIAuthor().then(res => {
| this.uiTreeData = res.data.data;
| loading.close();
| }).catch(error=>{
| loading.close();
| })
| },
| submitDialog() {
| this.$refs.form.validate((valid) => {
| if (valid) {
| const formData={}
| authorizedUI(formData).then(res => {
| if (res.data.success) {
| this.$message.success("保存成功");
| this.cancelDialog();
| }
| });
| } else {
| return false;
| }
| });
| },
| clearValue(){
| this.$refs.uiTree.setCheckedNodes([])
| }
| }
| }
| </script>
|
| <style scoped>
|
| </style>
|
|