|
@@ -153,12 +153,17 @@ |
|
@@ -153,12 +153,17 @@ |
153
|
</div>
|
153
|
</div>
|
154
|
</el-dialog>
|
154
|
</el-dialog>
|
155
|
|
155
|
|
|
|
156
|
+
|
|
|
157
|
+
|
156
|
<!--权限设置界面-->
|
158
|
<!--权限设置界面-->
|
157
|
<el-dialog title="岗位的权限设置"
|
159
|
<el-dialog title="岗位的权限设置"
|
158
|
:visible.sync="PermFormVisible"
|
160
|
:visible.sync="PermFormVisible"
|
159
|
:close-on-click-modal="false"
|
161
|
:close-on-click-modal="false"
|
160
|
top="5vh" width="75%"
|
162
|
top="5vh" width="75%"
|
161
|
>
|
163
|
>
|
|
|
164
|
+ <template>
|
|
|
165
|
+ <el-tabs style="border: 0px;background-color: rgba(0,0,0,0)" v-model="activeName" @tab-click="handleClick">
|
|
|
166
|
+ <el-tab-pane style="border: 0px;background-color: rgba(0,0,0,0)" label="权限管理" name="first">
|
162
|
<el-row>
|
167
|
<el-row>
|
163
|
<el-col :span="4" >
|
168
|
<el-col :span="4" >
|
164
|
<el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>
|
169
|
<el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>
|
|
@@ -176,10 +181,36 @@ |
|
@@ -176,10 +181,36 @@ |
176
|
node-key="permissionId" ref="tree">
|
181
|
node-key="permissionId" ref="tree">
|
177
|
</el-tree>
|
182
|
</el-tree>
|
178
|
</el-form>
|
183
|
</el-form>
|
179
|
- <div slot="footer" class="dialog-footer">
|
184
|
+ <div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
180
|
<el-button @click.native="PermFormVisible = false">取消</el-button>
|
185
|
<el-button @click.native="PermFormVisible = false">取消</el-button>
|
181
|
<el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>
|
186
|
<el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>
|
182
|
</div>
|
187
|
</div>
|
|
|
188
|
+ </el-tab-pane>
|
|
|
189
|
+ <el-tab-pane label="数据权限" name="second">
|
|
|
190
|
+<!-- <el-row>-->
|
|
|
191
|
+<!-- <el-col :span="4" >-->
|
|
|
192
|
+<!-- <el-button type="primary" @click.native="treeMerges(false)">合并节点</el-button>-->
|
|
|
193
|
+<!-- </el-col>-->
|
|
|
194
|
+<!-- <el-col :span="4">-->
|
|
|
195
|
+<!-- <el-button type="success" @click.native="treeMerges(true)">展开节点</el-button>-->
|
|
|
196
|
+<!-- </el-col>-->
|
|
|
197
|
+<!-- </el-row>-->
|
|
|
198
|
+ <el-divider></el-divider>
|
|
|
199
|
+ <el-form :model="permForms" style="width: 95%" ref="permForm">
|
|
|
200
|
+ <el-tree :data="departmentNameList" :props="treeDefaultPropss"
|
|
|
201
|
+ @check="clickDeal"
|
|
|
202
|
+ :default-expand-all = "treeExpands"
|
|
|
203
|
+ show-checkbox highlight-current
|
|
|
204
|
+ node-key="dataPermId" ref="trees">
|
|
|
205
|
+ </el-tree>
|
|
|
206
|
+ </el-form>
|
|
|
207
|
+ <div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
|
|
208
|
+ <el-button @click.native="PermFormVisible = false">取消</el-button>
|
|
|
209
|
+ <el-button type="primary" :loading="addLoading">提交</el-button>
|
|
|
210
|
+ </div>
|
|
|
211
|
+ </el-tab-pane>
|
|
|
212
|
+ </el-tabs>
|
|
|
213
|
+ </template>
|
183
|
</el-dialog>
|
214
|
</el-dialog>
|
184
|
</section>
|
215
|
</section>
|
185
|
</template>
|
216
|
</template>
|
|
@@ -188,13 +219,16 @@ |
|
@@ -188,13 +219,16 @@ |
188
|
import util from '../../common/js/util'
|
219
|
import util from '../../common/js/util'
|
189
|
import NProgress from 'nprogress'
|
220
|
import NProgress from 'nprogress'
|
190
|
import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api';
|
221
|
import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api';
|
191
|
- import { getList as getDepartmentList} from '../../api/department';
|
222
|
+ import { getList as getDepartmentList } from '@/api/user/data_perm_api.js'
|
|
|
223
|
+
|
|
|
224
|
+ // import { getList as getDepartmentList} from '../../api/department';
|
192
|
import { getList as permList } from '../../api/perm_api';
|
225
|
import { getList as permList } from '../../api/perm_api';
|
193
|
import moment from 'moment'
|
226
|
import moment from 'moment'
|
194
|
export default {
|
227
|
export default {
|
195
|
name:'Role',
|
228
|
name:'Role',
|
196
|
data() {
|
229
|
data() {
|
197
|
return {
|
230
|
return {
|
|
|
231
|
+ activeName: 'first',
|
198
|
filters: {
|
232
|
filters: {
|
199
|
roleName: ''
|
233
|
roleName: ''
|
200
|
},
|
234
|
},
|
|
@@ -224,11 +258,17 @@ |
|
@@ -224,11 +258,17 @@ |
224
|
children: 'children',
|
258
|
children: 'children',
|
225
|
label: 'name',
|
259
|
label: 'name',
|
226
|
},
|
260
|
},
|
|
|
261
|
+ treeDefaultPropss: {
|
|
|
262
|
+ children: 'children',
|
|
|
263
|
+ label: 'perm_des',
|
|
|
264
|
+ },
|
227
|
treeExpand: true,
|
265
|
treeExpand: true,
|
228
|
- departmentNameList:[],
|
266
|
+ treeExpands: true,
|
229
|
roles: [],
|
267
|
roles: [],
|
230
|
permissons: [],
|
268
|
permissons: [],
|
|
|
269
|
+ departmentNameList:[],
|
231
|
permIds: [],
|
270
|
permIds: [],
|
|
|
271
|
+ permIdss: [],
|
232
|
total: 0,
|
272
|
total: 0,
|
233
|
pageNum: 1,
|
273
|
pageNum: 1,
|
234
|
pageSize: 5,
|
274
|
pageSize: 5,
|
|
@@ -272,7 +312,14 @@ |
|
@@ -272,7 +312,14 @@ |
272
|
roleName: '',
|
312
|
roleName: '',
|
273
|
roleSign: 1,
|
313
|
roleSign: 1,
|
274
|
permissions: []
|
314
|
permissions: []
|
275
|
- }
|
315
|
+ },
|
|
|
316
|
+ permForms: {
|
|
|
317
|
+ roleId: 1,
|
|
|
318
|
+ description: '',
|
|
|
319
|
+ roleName: '',
|
|
|
320
|
+ roleSign: 1,
|
|
|
321
|
+ departmentNameList: []
|
|
|
322
|
+ },
|
276
|
|
323
|
|
277
|
}
|
324
|
}
|
278
|
},
|
325
|
},
|
|
@@ -310,6 +357,12 @@ |
|
@@ -310,6 +357,12 @@ |
310
|
this.$refs.tree.store._getAllNodes()[i].expanded=this.treeExpand;
|
357
|
this.$refs.tree.store._getAllNodes()[i].expanded=this.treeExpand;
|
311
|
}
|
358
|
}
|
312
|
},
|
359
|
},
|
|
|
360
|
+ treeMerges: function (expand) {
|
|
|
361
|
+ this.treeExpands = expand;
|
|
|
362
|
+ for(var i=0;i<this.$refs.trees.store._getAllNodes().length;i++){
|
|
|
363
|
+ this.$refs.trees.store._getAllNodes()[i].expanded=this.treeExpands;
|
|
|
364
|
+ }
|
|
|
365
|
+ },
|
313
|
handleCurrentChange(val) {
|
366
|
handleCurrentChange(val) {
|
314
|
this.pageNum = val;
|
367
|
this.pageNum = val;
|
315
|
this.getRoles();
|
368
|
this.getRoles();
|
|
@@ -342,31 +395,46 @@ |
|
@@ -342,31 +395,46 @@ |
342
|
|
395
|
|
343
|
},
|
396
|
},
|
344
|
|
397
|
|
345
|
- //获取部门列表
|
|
|
346
|
- getdepartmentNames() {
|
|
|
347
|
-
|
|
|
348
|
- this.listLoading = true;
|
|
|
349
|
- //NProgress.start();
|
|
|
350
|
- getDepartmentList().then((res) => {
|
|
|
351
|
- this.total = res.data.total;
|
|
|
352
|
- this.departmentNameList = res.data.list;
|
|
|
353
|
- this.listLoading = false;
|
|
|
354
|
- //NProgress.done();
|
|
|
355
|
- }).catch((error) => {
|
|
|
356
|
-
|
|
|
357
|
- this.listLoading = false;
|
|
|
358
|
- if(null!= error.response && error.response!==undefined){
|
|
|
359
|
- let status= error.response.status;
|
|
|
360
|
- let msg = error.response.statusText;
|
|
|
361
|
- alert(status+msg);
|
|
|
362
|
- }else {
|
|
|
363
|
- alert(error);
|
|
|
364
|
- }
|
|
|
365
|
-
|
|
|
366
|
- });
|
|
|
367
|
-
|
398
|
+ //获取数据权限列表
|
|
|
399
|
+ // getdepartmentNames() {
|
|
|
400
|
+ //
|
|
|
401
|
+ // this.listLoading = true;
|
|
|
402
|
+ // //NProgress.start();
|
|
|
403
|
+ // getDepartmentList().then((res) => {
|
|
|
404
|
+ // // this.total = res.data.total;
|
|
|
405
|
+ // this.departmentNameList = res.data.list;
|
|
|
406
|
+ // console.log(this.departmentNameList);
|
|
|
407
|
+ //
|
|
|
408
|
+ // this.listLoading = false;
|
|
|
409
|
+ // //NProgress.done();
|
|
|
410
|
+ // }).catch((error) => {
|
|
|
411
|
+ //
|
|
|
412
|
+ // this.listLoading = false;
|
|
|
413
|
+ // if(null!= error.response && error.response!==undefined){
|
|
|
414
|
+ // let status= error.response.status;
|
|
|
415
|
+ // let msg = error.response.statusText;
|
|
|
416
|
+ // alert(status+msg);
|
|
|
417
|
+ // }else {
|
|
|
418
|
+ // alert(error);
|
|
|
419
|
+ // }
|
|
|
420
|
+ //
|
|
|
421
|
+ // });
|
|
|
422
|
+ //
|
|
|
423
|
+ // },
|
|
|
424
|
+ getDataList() {
|
|
|
425
|
+ let para = {
|
|
|
426
|
+ pageNum: 1,
|
|
|
427
|
+ pageSize: 700
|
|
|
428
|
+ };
|
|
|
429
|
+ getDepartmentList(para).then(res => {
|
|
|
430
|
+ this.$message.success('获取列表成功')
|
|
|
431
|
+ this.departmentNameList = res.list
|
|
|
432
|
+ console.log(this.departmentNameList);
|
|
|
433
|
+ // this.total = res.total
|
|
|
434
|
+ }).catch(error => {
|
|
|
435
|
+ this.$message.error(error)
|
|
|
436
|
+ })
|
368
|
},
|
437
|
},
|
369
|
-
|
|
|
370
|
//获取权限列表
|
438
|
//获取权限列表
|
371
|
getPermList() {
|
439
|
getPermList() {
|
372
|
let para = {
|
440
|
let para = {
|
|
@@ -426,6 +494,7 @@ |
|
@@ -426,6 +494,7 @@ |
426
|
this.addForm = Object.assign({}, row);
|
494
|
this.addForm = Object.assign({}, row);
|
427
|
// this.getdepartmentNames();
|
495
|
// this.getdepartmentNames();
|
428
|
},
|
496
|
},
|
|
|
497
|
+ // 配置权限管理
|
429
|
setPerm: function (index, row) {
|
498
|
setPerm: function (index, row) {
|
430
|
this.PermFormVisible = true;
|
499
|
this.PermFormVisible = true;
|
431
|
this.getPermList();
|
500
|
this.getPermList();
|
|
@@ -440,13 +509,32 @@ |
|
@@ -440,13 +509,32 @@ |
440
|
}
|
509
|
}
|
441
|
});
|
510
|
});
|
442
|
}
|
511
|
}
|
443
|
-
|
|
|
444
|
this.$nextTick(() => {
|
512
|
this.$nextTick(() => {
|
445
|
-
|
|
|
446
|
//反向适配
|
513
|
//反向适配
|
447
|
this.$refs.tree.setCheckedKeys(this.permIds);
|
514
|
this.$refs.tree.setCheckedKeys(this.permIds);
|
448
|
});
|
515
|
});
|
449
|
},
|
516
|
},
|
|
|
517
|
+ // 配置数据权限
|
|
|
518
|
+ handleClick(tab, row) {
|
|
|
519
|
+ if (tab.name === 'second'){
|
|
|
520
|
+ this.getDataList();
|
|
|
521
|
+ var _this = this;
|
|
|
522
|
+ this.permIdss = [];
|
|
|
523
|
+ this.permForms = Object.assign({}, row);
|
|
|
524
|
+ let rolePermss = this.permForms.departmentNameList;
|
|
|
525
|
+ if (util.checkNull(rolePermss)){
|
|
|
526
|
+ rolePermss.forEach(function (perm,v_index,v_arr) {
|
|
|
527
|
+ if(util.checkNull(perm)){
|
|
|
528
|
+ _this.permIdss[v_index] = perm.dataPermId;
|
|
|
529
|
+ }
|
|
|
530
|
+ });
|
|
|
531
|
+ }
|
|
|
532
|
+ this.$nextTick(() => {
|
|
|
533
|
+ //反向适配
|
|
|
534
|
+ this.$refs.trees.setCheckedKeys(this.permIdss);
|
|
|
535
|
+ });
|
|
|
536
|
+ }
|
|
|
537
|
+ },
|
450
|
//显示新增界面,每次点开初始化数据
|
538
|
//显示新增界面,每次点开初始化数据
|
451
|
handleAdd: function (index,row) {
|
539
|
handleAdd: function (index,row) {
|
452
|
this.addFormVisible = true;
|
540
|
this.addFormVisible = true;
|
|
@@ -675,6 +763,8 @@ |
|
@@ -675,6 +763,8 @@ |
675
|
}
|
763
|
}
|
676
|
};
|
764
|
};
|
677
|
this.isExpansion=true;
|
765
|
this.isExpansion=true;
|
|
|
766
|
+ // this.getdepartmentNames();
|
|
|
767
|
+
|
678
|
}
|
768
|
}
|
679
|
}
|
769
|
}
|
680
|
|
770
|
|