|
@@ -187,26 +187,18 @@ |
|
@@ -187,26 +187,18 @@ |
187
|
</div>
|
187
|
</div>
|
188
|
</el-tab-pane>
|
188
|
</el-tab-pane>
|
189
|
<el-tab-pane label="数据权限" name="second">
|
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>
|
190
|
<el-divider></el-divider>
|
199
|
<el-form :model="permForms" style="width: 95%" ref="permForm">
|
191
|
<el-form :model="permForms" style="width: 95%" ref="permForm">
|
200
|
- <el-tree :data="departmentNameList" :props="treeDefaultPropss"
|
|
|
201
|
- @check="clickDeal"
|
192
|
+ <el-tree :data="departmentList" :props="treeDefaultPropss"
|
|
|
193
|
+ @check="dataPermTreeClickDeal"
|
202
|
:default-expand-all = "treeExpands"
|
194
|
:default-expand-all = "treeExpands"
|
203
|
show-checkbox highlight-current
|
195
|
show-checkbox highlight-current
|
204
|
- node-key="dataPermId" ref="trees">
|
196
|
+ node-key="data_perm_id" ref="trees">
|
205
|
</el-tree>
|
197
|
</el-tree>
|
206
|
</el-form>
|
198
|
</el-form>
|
207
|
<div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
199
|
<div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
208
|
<el-button @click.native="PermFormVisible = false">取消</el-button>
|
200
|
<el-button @click.native="PermFormVisible = false">取消</el-button>
|
209
|
- <el-button type="primary" :loading="addLoading">提交</el-button>
|
201
|
+ <el-button type="primary" @click.native="setDataPerm" :loading="addLoading">提交</el-button>
|
210
|
</div>
|
202
|
</div>
|
211
|
</el-tab-pane>
|
203
|
</el-tab-pane>
|
212
|
</el-tabs>
|
204
|
</el-tabs>
|
|
@@ -218,12 +210,14 @@ |
|
@@ -218,12 +210,14 @@ |
218
|
<script>
|
210
|
<script>
|
219
|
import util from '../../common/js/util'
|
211
|
import util from '../../common/js/util'
|
220
|
import NProgress from 'nprogress'
|
212
|
import NProgress from 'nprogress'
|
221
|
- import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api';
|
213
|
+ import { getList, remove, batchRemove, edit, add, updateRolePerm ,roleDataPermGet,dataPermSet} from '../../api/role_api';
|
222
|
import { getList as getDepartmentList } from '@/api/user/data_perm_api.js'
|
214
|
import { getList as getDepartmentList } from '@/api/user/data_perm_api.js'
|
223
|
|
215
|
|
224
|
// import { getList as getDepartmentList} from '../../api/department';
|
216
|
// import { getList as getDepartmentList} from '../../api/department';
|
225
|
import { getList as permList } from '../../api/perm_api';
|
217
|
import { getList as permList } from '../../api/perm_api';
|
226
|
import moment from 'moment'
|
218
|
import moment from 'moment'
|
|
|
219
|
+ import {selectList} from "../../api/consigner/vehicle";
|
|
|
220
|
+ import {addTrans} from "../../api/trn";
|
227
|
export default {
|
221
|
export default {
|
228
|
name:'Role',
|
222
|
name:'Role',
|
229
|
data() {
|
223
|
data() {
|
|
@@ -260,13 +254,14 @@ |
|
@@ -260,13 +254,14 @@ |
260
|
},
|
254
|
},
|
261
|
treeDefaultPropss: {
|
255
|
treeDefaultPropss: {
|
262
|
children: 'children',
|
256
|
children: 'children',
|
263
|
- label: 'perm_des',
|
257
|
+ label: 'perm_name',
|
264
|
},
|
258
|
},
|
265
|
treeExpand: true,
|
259
|
treeExpand: true,
|
266
|
treeExpands: true,
|
260
|
treeExpands: true,
|
267
|
roles: [],
|
261
|
roles: [],
|
268
|
permissons: [],
|
262
|
permissons: [],
|
269
|
- departmentNameList:[],
|
263
|
+ departmentList:[],
|
|
|
264
|
+ currentRolePermList: [],
|
270
|
permIds: [],
|
265
|
permIds: [],
|
271
|
permIdss: [],
|
266
|
permIdss: [],
|
272
|
total: 0,
|
267
|
total: 0,
|
|
@@ -314,11 +309,8 @@ |
|
@@ -314,11 +309,8 @@ |
314
|
permissions: []
|
309
|
permissions: []
|
315
|
},
|
310
|
},
|
316
|
permForms: {
|
311
|
permForms: {
|
317
|
- roleId: 1,
|
|
|
318
|
- description: '',
|
|
|
319
|
- roleName: '',
|
|
|
320
|
- roleSign: 1,
|
|
|
321
|
- departmentNameList: []
|
312
|
+ roleId: -1,
|
|
|
313
|
+ permissionIds: []
|
322
|
},
|
314
|
},
|
323
|
|
315
|
|
324
|
}
|
316
|
}
|
|
@@ -394,7 +386,6 @@ |
|
@@ -394,7 +386,6 @@ |
394
|
});
|
386
|
});
|
395
|
|
387
|
|
396
|
},
|
388
|
},
|
397
|
-
|
|
|
398
|
//获取数据权限列表
|
389
|
//获取数据权限列表
|
399
|
// getdepartmentNames() {
|
390
|
// getdepartmentNames() {
|
400
|
//
|
391
|
//
|
|
@@ -428,9 +419,8 @@ |
|
@@ -428,9 +419,8 @@ |
428
|
};
|
419
|
};
|
429
|
getDepartmentList(para).then(res => {
|
420
|
getDepartmentList(para).then(res => {
|
430
|
this.$message.success('获取列表成功')
|
421
|
this.$message.success('获取列表成功')
|
431
|
- this.departmentNameList = res.list
|
|
|
432
|
- console.log(this.departmentNameList);
|
|
|
433
|
- // this.total = res.total
|
422
|
+ this.departmentList = res.list
|
|
|
423
|
+ // console.log(this.departmentList);
|
434
|
}).catch(error => {
|
424
|
}).catch(error => {
|
435
|
this.$message.error(error)
|
425
|
this.$message.error(error)
|
436
|
})
|
426
|
})
|
|
@@ -497,11 +487,16 @@ |
|
@@ -497,11 +487,16 @@ |
497
|
// 配置权限管理
|
487
|
// 配置权限管理
|
498
|
setPerm: function (index, row) {
|
488
|
setPerm: function (index, row) {
|
499
|
this.PermFormVisible = true;
|
489
|
this.PermFormVisible = true;
|
|
|
490
|
+ this.activeName= 'first';
|
|
|
491
|
+ //获取接口权限
|
500
|
this.getPermList();
|
492
|
this.getPermList();
|
|
|
493
|
+ //获取数据权限信息
|
|
|
494
|
+ this.getRoleDataPerm(row.roleId);
|
501
|
var _this = this;
|
495
|
var _this = this;
|
502
|
this.permIds = [];
|
496
|
this.permIds = [];
|
503
|
this.permForm = Object.assign({}, row);
|
497
|
this.permForm = Object.assign({}, row);
|
504
|
let rolePerms = this.permForm.permissions;
|
498
|
let rolePerms = this.permForm.permissions;
|
|
|
499
|
+ this.permForms.roleId = this.permForm.roleId;
|
505
|
if (util.checkNull(rolePerms)){
|
500
|
if (util.checkNull(rolePerms)){
|
506
|
rolePerms.forEach(function (perm,v_index,v_arr) {
|
501
|
rolePerms.forEach(function (perm,v_index,v_arr) {
|
507
|
if(util.checkNull(perm)){
|
502
|
if(util.checkNull(perm)){
|
|
@@ -514,26 +509,68 @@ |
|
@@ -514,26 +509,68 @@ |
514
|
this.$refs.tree.setCheckedKeys(this.permIds);
|
509
|
this.$refs.tree.setCheckedKeys(this.permIds);
|
515
|
});
|
510
|
});
|
516
|
},
|
511
|
},
|
|
|
512
|
+ //获取已增加数据权限的数据
|
|
|
513
|
+ getRoleDataPerm(roleId) {
|
|
|
514
|
+ const _this = this
|
|
|
515
|
+ roleDataPermGet({roleId:roleId}).then((response) => {
|
|
|
516
|
+ const res = response.data
|
|
|
517
|
+ // console.log(res)
|
|
|
518
|
+ if (res.code !== '200') {
|
|
|
519
|
+ return _this.$message.error('获取已有的数据权限,失败!')
|
|
|
520
|
+ }else {
|
|
|
521
|
+ // 获取列表数据
|
|
|
522
|
+ if (res.data){
|
|
|
523
|
+ _this.currentRolePermList = res.data.dataPermissions;
|
|
|
524
|
+ }else{
|
|
|
525
|
+ _this.currentRolePermList = [];
|
|
|
526
|
+ }
|
|
|
527
|
+ // console.log(this.data_perm_id)
|
|
|
528
|
+ _this.$message.success('获取已有的数据权限,成功!')
|
|
|
529
|
+ }
|
|
|
530
|
+ }).catch(error => {
|
|
|
531
|
+ // 关闭加载
|
|
|
532
|
+ _this.$message.error(error.toString())
|
|
|
533
|
+ })
|
|
|
534
|
+ },
|
517
|
// 配置数据权限
|
535
|
// 配置数据权限
|
518
|
- handleClick(tab, row) {
|
536
|
+ handleClick: function (tab, index,row) {
|
|
|
537
|
+ let _this = this;
|
|
|
538
|
+ this.permForms.permissionIds = [];
|
519
|
if (tab.name === 'second'){
|
539
|
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;
|
540
|
+ if (this.currentRolePermList && this.currentRolePermList.length>0){
|
|
|
541
|
+ this.currentRolePermList.forEach((v,i) =>{
|
|
|
542
|
+ _this.permForms.permissionIds[i]=v.data_perm_id;
|
|
|
543
|
+ })
|
529
|
}
|
544
|
}
|
530
|
- });
|
|
|
531
|
}
|
545
|
}
|
532
|
this.$nextTick(() => {
|
546
|
this.$nextTick(() => {
|
533
|
//反向适配
|
547
|
//反向适配
|
534
|
- this.$refs.trees.setCheckedKeys(this.permIdss);
|
548
|
+ this.$refs.trees.setCheckedKeys(this.permForms.permissionIds);
|
535
|
});
|
549
|
});
|
|
|
550
|
+ },
|
|
|
551
|
+ //提交数据权限
|
|
|
552
|
+ setDataPerm(){
|
|
|
553
|
+ let _this = this;
|
|
|
554
|
+
|
|
|
555
|
+ if (this.currentRolePermList && this.currentRolePermList.length>0){
|
|
|
556
|
+ this.currentRolePermList.forEach((v,i) =>{
|
|
|
557
|
+ _this.permForms.permissionIds[i]=v.data_perm_id;
|
|
|
558
|
+ })
|
536
|
}
|
559
|
}
|
|
|
560
|
+ dataPermSet(this.permForms).then((response) => {
|
|
|
561
|
+ const res = response.data
|
|
|
562
|
+ // 添加失败
|
|
|
563
|
+ if (res.code !== '200') {
|
|
|
564
|
+ // 关闭加载
|
|
|
565
|
+ return this.$message.error(res.msg)
|
|
|
566
|
+ }
|
|
|
567
|
+ // 添加,成功
|
|
|
568
|
+ this.$message.success(res.msg)
|
|
|
569
|
+ // 隐藏对话框
|
|
|
570
|
+ this.PermFormVisible = false;
|
|
|
571
|
+ }).catch(error => {
|
|
|
572
|
+ this.$message.error(error.toString())
|
|
|
573
|
+ })
|
537
|
},
|
574
|
},
|
538
|
//显示新增界面,每次点开初始化数据
|
575
|
//显示新增界面,每次点开初始化数据
|
539
|
handleAdd: function (index,row) {
|
576
|
handleAdd: function (index,row) {
|
|
@@ -751,10 +788,15 @@ |
|
@@ -751,10 +788,15 @@ |
751
|
// this.uniteParentSame(currentObj.id,treeStatus)
|
788
|
// this.uniteParentSame(currentObj.id,treeStatus)
|
752
|
// }
|
789
|
// }
|
753
|
}
|
790
|
}
|
754
|
- }
|
791
|
+ },
|
|
|
792
|
+ dataPermTreeClickDeal: function (currentObj, treeStatus) {
|
|
|
793
|
+ this.permForms.permissionIds.push(currentObj.data_perm_id);
|
|
|
794
|
+ },
|
|
|
795
|
+
|
755
|
},
|
796
|
},
|
756
|
mounted() {
|
797
|
mounted() {
|
757
|
this.getRoles();
|
798
|
this.getRoles();
|
|
|
799
|
+ this.getDataList();
|
758
|
let _this = this;
|
800
|
let _this = this;
|
759
|
document.onkeydown = function (e) {
|
801
|
document.onkeydown = function (e) {
|
760
|
let key = window.event.keyCode;
|
802
|
let key = window.event.keyCode;
|
|
@@ -763,8 +805,6 @@ |
|
@@ -763,8 +805,6 @@ |
763
|
}
|
805
|
}
|
764
|
};
|
806
|
};
|
765
|
this.isExpansion=true;
|
807
|
this.isExpansion=true;
|
766
|
- // this.getdepartmentNames();
|
|
|
767
|
-
|
|
|
768
|
}
|
808
|
}
|
769
|
}
|
809
|
}
|
770
|
|
810
|
|
|
@@ -776,6 +816,9 @@ |
|
@@ -776,6 +816,9 @@ |
776
|
|
816
|
|
777
|
|
817
|
|
778
|
<style lang="scss">
|
818
|
<style lang="scss">
|
|
|
819
|
+ .v-modal{
|
|
|
820
|
+ z-index:-2000;
|
|
|
821
|
+ }
|
779
|
/*//一级节点选择器*!*!*/
|
822
|
/*//一级节点选择器*!*!*/
|
780
|
.el-tree-node>.el-tree-node__content {
|
823
|
.el-tree-node>.el-tree-node__content {
|
781
|
font-weight: 900;
|
824
|
font-weight: 900;
|