|
@@ -153,32 +153,58 @@ |
|
@@ -153,32 +153,58 @@ |
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
|
>
|
162
|
- <el-row>
|
|
|
163
|
- <el-col :span="4" >
|
|
|
164
|
- <el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>
|
|
|
165
|
- </el-col>
|
|
|
166
|
- <el-col :span="4">
|
|
|
167
|
- <el-button type="success" @click.native="treeMerge(true)">展开节点</el-button>
|
|
|
168
|
- </el-col>
|
|
|
169
|
- </el-row>
|
|
|
170
|
- <el-divider></el-divider>
|
|
|
171
|
- <el-form :model="permForm" style="width: 95%" ref="permForm">
|
|
|
172
|
- <el-tree :data="permissons" :props="treeDefaultProps"
|
|
|
173
|
- @check="clickDeal"
|
|
|
174
|
- :default-expand-all = "treeExpand"
|
|
|
175
|
- show-checkbox highlight-current
|
|
|
176
|
- node-key="permissionId" ref="tree">
|
|
|
177
|
- </el-tree>
|
|
|
178
|
- </el-form>
|
|
|
179
|
- <div slot="footer" class="dialog-footer">
|
|
|
180
|
- <el-button @click.native="PermFormVisible = false">取消</el-button>
|
|
|
181
|
- <el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>
|
164
|
+ <div v-loading.lock="isLoading">
|
|
|
165
|
+ <template>
|
|
|
166
|
+ <el-tabs style="border: 0px;background-color: rgba(0,0,0,0)" v-model="activeName" @tab-click="handleClick">
|
|
|
167
|
+ <el-tab-pane style="border: 0px;background-color: rgba(0,0,0,0)" label="权限管理" name="first">
|
|
|
168
|
+ <el-row>
|
|
|
169
|
+ <el-col :span="4" >
|
|
|
170
|
+ <el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>
|
|
|
171
|
+ </el-col>
|
|
|
172
|
+ <el-col :span="4">
|
|
|
173
|
+ <el-button type="success" @click.native="treeMerge(true)">展开节点</el-button>
|
|
|
174
|
+ </el-col>
|
|
|
175
|
+ </el-row>
|
|
|
176
|
+ <el-divider></el-divider>
|
|
|
177
|
+ <el-form :model="permForm" style="width: 95%" ref="permForm">
|
|
|
178
|
+ <el-tree :data="permissons" :props="treeDefaultProps"
|
|
|
179
|
+ @check="clickDeal"
|
|
|
180
|
+ :default-expand-all = "treeExpand"
|
|
|
181
|
+ show-checkbox highlight-current
|
|
|
182
|
+ node-key="permissionId" ref="tree">
|
|
|
183
|
+ </el-tree>
|
|
|
184
|
+ </el-form>
|
|
|
185
|
+ <div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
|
|
186
|
+ <el-button @click.native="PermFormVisible = false">取消</el-button>
|
|
|
187
|
+ <el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>
|
|
|
188
|
+ </div>
|
|
|
189
|
+ </el-tab-pane>
|
|
|
190
|
+ <el-tab-pane label="数据权限" name="second">
|
|
|
191
|
+ <el-divider></el-divider>
|
|
|
192
|
+ <el-form :model="permForms" style="width: 95%" ref="permForm">
|
|
|
193
|
+ <el-tree :data="departmentList" :props="treeDefaultPropss"
|
|
|
194
|
+ @check="dataPermTreeClickDeal"
|
|
|
195
|
+ :default-expand-all = "treeExpands"
|
|
|
196
|
+ show-checkbox highlight-current
|
|
|
197
|
+ node-key="data_perm_id" ref="trees">
|
|
|
198
|
+ </el-tree>
|
|
|
199
|
+ </el-form>
|
|
|
200
|
+ <div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
|
|
201
|
+ <el-button @click.native="PermFormVisible = false">取消</el-button>
|
|
|
202
|
+ <el-button type="primary" @click.native="setDataPerm" :loading="addLoading">提交</el-button>
|
|
|
203
|
+ </div>
|
|
|
204
|
+ </el-tab-pane>
|
|
|
205
|
+ </el-tabs>
|
|
|
206
|
+ </template>
|
|
|
207
|
+
|
182
|
</div>
|
208
|
</div>
|
183
|
</el-dialog>
|
209
|
</el-dialog>
|
184
|
</section>
|
210
|
</section>
|
|
@@ -187,14 +213,19 @@ |
|
@@ -187,14 +213,19 @@ |
187
|
<script>
|
213
|
<script>
|
188
|
import util from '../../common/js/util'
|
214
|
import util from '../../common/js/util'
|
189
|
import NProgress from 'nprogress'
|
215
|
import NProgress from 'nprogress'
|
190
|
- import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api';
|
|
|
191
|
- import { getList as getDepartmentList} from '../../api/department';
|
216
|
+ import { getList, remove, batchRemove, edit, add, updateRolePerm ,roleDataPermGet,dataPermSet} from '../../api/role_api';
|
|
|
217
|
+ import { getList as getDepartmentList } from '@/api/user/data_perm_api.js'
|
|
|
218
|
+
|
|
|
219
|
+ // import { getList as getDepartmentList} from '../../api/department';
|
192
|
import { getList as permList } from '../../api/perm_api';
|
220
|
import { getList as permList } from '../../api/perm_api';
|
193
|
import moment from 'moment'
|
221
|
import moment from 'moment'
|
|
|
222
|
+ import {selectList} from "../../api/consigner/vehicle";
|
|
|
223
|
+ import {addTrans} from "../../api/trn";
|
194
|
export default {
|
224
|
export default {
|
195
|
name:'Role',
|
225
|
name:'Role',
|
196
|
data() {
|
226
|
data() {
|
197
|
return {
|
227
|
return {
|
|
|
228
|
+ activeName: 'first',
|
198
|
filters: {
|
229
|
filters: {
|
199
|
roleName: ''
|
230
|
roleName: ''
|
200
|
},
|
231
|
},
|
|
@@ -224,15 +255,24 @@ |
|
@@ -224,15 +255,24 @@ |
224
|
children: 'children',
|
255
|
children: 'children',
|
225
|
label: 'name',
|
256
|
label: 'name',
|
226
|
},
|
257
|
},
|
|
|
258
|
+ treeDefaultPropss: {
|
|
|
259
|
+ children: 'children',
|
|
|
260
|
+ label: 'perm_name',
|
|
|
261
|
+ },
|
227
|
treeExpand: true,
|
262
|
treeExpand: true,
|
228
|
- departmentNameList:[],
|
263
|
+ treeExpands: true,
|
229
|
roles: [],
|
264
|
roles: [],
|
230
|
permissons: [],
|
265
|
permissons: [],
|
|
|
266
|
+ departmentList:[],
|
|
|
267
|
+ currentRolePermList: [],
|
231
|
permIds: [],
|
268
|
permIds: [],
|
|
|
269
|
+ permIdss: [],
|
232
|
total: 0,
|
270
|
total: 0,
|
233
|
pageNum: 1,
|
271
|
pageNum: 1,
|
234
|
pageSize: 5,
|
272
|
pageSize: 5,
|
235
|
listLoading: false,
|
273
|
listLoading: false,
|
|
|
274
|
+ loading:{},
|
|
|
275
|
+ isLoading: false,
|
236
|
sels: [],//列表选中列
|
276
|
sels: [],//列表选中列
|
237
|
dialogMap: {
|
277
|
dialogMap: {
|
238
|
update: '编辑',
|
278
|
update: '编辑',
|
|
@@ -272,7 +312,11 @@ |
|
@@ -272,7 +312,11 @@ |
272
|
roleName: '',
|
312
|
roleName: '',
|
273
|
roleSign: 1,
|
313
|
roleSign: 1,
|
274
|
permissions: []
|
314
|
permissions: []
|
275
|
- }
|
315
|
+ },
|
|
|
316
|
+ permForms: {
|
|
|
317
|
+ roleId: -1,
|
|
|
318
|
+ permissionIds: []
|
|
|
319
|
+ },
|
276
|
|
320
|
|
277
|
}
|
321
|
}
|
278
|
},
|
322
|
},
|
|
@@ -310,6 +354,12 @@ |
|
@@ -310,6 +354,12 @@ |
310
|
this.$refs.tree.store._getAllNodes()[i].expanded=this.treeExpand;
|
354
|
this.$refs.tree.store._getAllNodes()[i].expanded=this.treeExpand;
|
311
|
}
|
355
|
}
|
312
|
},
|
356
|
},
|
|
|
357
|
+ treeMerges: function (expand) {
|
|
|
358
|
+ this.treeExpands = expand;
|
|
|
359
|
+ for(var i=0;i<this.$refs.trees.store._getAllNodes().length;i++){
|
|
|
360
|
+ this.$refs.trees.store._getAllNodes()[i].expanded=this.treeExpands;
|
|
|
361
|
+ }
|
|
|
362
|
+ },
|
313
|
handleCurrentChange(val) {
|
363
|
handleCurrentChange(val) {
|
314
|
this.pageNum = val;
|
364
|
this.pageNum = val;
|
315
|
this.getRoles();
|
365
|
this.getRoles();
|
|
@@ -341,32 +391,45 @@ |
|
@@ -341,32 +391,45 @@ |
341
|
});
|
391
|
});
|
342
|
|
392
|
|
343
|
},
|
393
|
},
|
344
|
-
|
|
|
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
|
-
|
|
|
368
|
- },
|
|
|
369
|
-
|
394
|
+ //获取数据权限列表
|
|
|
395
|
+ // getdepartmentNames() {
|
|
|
396
|
+ //
|
|
|
397
|
+ // this.listLoading = true;
|
|
|
398
|
+ // //NProgress.start();
|
|
|
399
|
+ // getDepartmentList().then((res) => {
|
|
|
400
|
+ // // this.total = res.data.total;
|
|
|
401
|
+ // this.departmentNameList = res.data.list;
|
|
|
402
|
+ // console.log(this.departmentNameList);
|
|
|
403
|
+ //
|
|
|
404
|
+ // this.listLoading = false;
|
|
|
405
|
+ // //NProgress.done();
|
|
|
406
|
+ // }).catch((error) => {
|
|
|
407
|
+ //
|
|
|
408
|
+ // this.listLoading = false;
|
|
|
409
|
+ // if(null!= error.response && error.response!==undefined){
|
|
|
410
|
+ // let status= error.response.status;
|
|
|
411
|
+ // let msg = error.response.statusText;
|
|
|
412
|
+ // alert(status+msg);
|
|
|
413
|
+ // }else {
|
|
|
414
|
+ // alert(error);
|
|
|
415
|
+ // }
|
|
|
416
|
+ //
|
|
|
417
|
+ // });
|
|
|
418
|
+ //
|
|
|
419
|
+ // },
|
|
|
420
|
+ getDataList() {
|
|
|
421
|
+ let para = {
|
|
|
422
|
+ pageNum: 1,
|
|
|
423
|
+ pageSize: 700
|
|
|
424
|
+ };
|
|
|
425
|
+ getDepartmentList(para).then(res => {
|
|
|
426
|
+ this.$message.success('获取列表成功')
|
|
|
427
|
+ this.departmentList = res.list
|
|
|
428
|
+ // console.log(this.departmentList);
|
|
|
429
|
+ }).catch(error => {
|
|
|
430
|
+ this.$message.error(error)
|
|
|
431
|
+ })
|
|
|
432
|
+ },
|
370
|
//获取权限列表
|
433
|
//获取权限列表
|
371
|
getPermList() {
|
434
|
getPermList() {
|
372
|
let para = {
|
435
|
let para = {
|
|
@@ -426,27 +489,80 @@ |
|
@@ -426,27 +489,80 @@ |
426
|
this.addForm = Object.assign({}, row);
|
489
|
this.addForm = Object.assign({}, row);
|
427
|
// this.getdepartmentNames();
|
490
|
// this.getdepartmentNames();
|
428
|
},
|
491
|
},
|
|
|
492
|
+ // 配置权限管理
|
429
|
setPerm: function (index, row) {
|
493
|
setPerm: function (index, row) {
|
|
|
494
|
+ // this.loading = this.$loading({
|
|
|
495
|
+ // lock: true,
|
|
|
496
|
+ // text: '加载中',
|
|
|
497
|
+ // spinner: 'el-icon-loading',
|
|
|
498
|
+ // background: 'rgba(0, 0, 0, 0.7)',
|
|
|
499
|
+ // fullscreen: true
|
|
|
500
|
+ // });
|
|
|
501
|
+ this.isLoading = true;
|
430
|
this.PermFormVisible = true;
|
502
|
this.PermFormVisible = true;
|
|
|
503
|
+ this.activeName= 'first';
|
|
|
504
|
+ //获取接口权限
|
431
|
this.getPermList();
|
505
|
this.getPermList();
|
|
|
506
|
+ //获取数据权限信息
|
|
|
507
|
+ this.getRoleDataPerm(row.roleId);
|
432
|
var _this = this;
|
508
|
var _this = this;
|
433
|
this.permIds = [];
|
509
|
this.permIds = [];
|
434
|
this.permForm = Object.assign({}, row);
|
510
|
this.permForm = Object.assign({}, row);
|
435
|
let rolePerms = this.permForm.permissions;
|
511
|
let rolePerms = this.permForm.permissions;
|
436
|
- if (util.checkNull(rolePerms)){
|
512
|
+ this.permForms.roleId = this.permForm.roleId;
|
|
|
513
|
+ if (util.checkNull(rolePerms)){
|
437
|
rolePerms.forEach(function (perm,v_index,v_arr) {
|
514
|
rolePerms.forEach(function (perm,v_index,v_arr) {
|
438
|
if(util.checkNull(perm)){
|
515
|
if(util.checkNull(perm)){
|
439
|
_this.permIds[v_index] = perm.permissionId;
|
516
|
_this.permIds[v_index] = perm.permissionId;
|
440
|
}
|
517
|
}
|
441
|
});
|
518
|
});
|
442
|
}
|
519
|
}
|
443
|
-
|
|
|
444
|
this.$nextTick(() => {
|
520
|
this.$nextTick(() => {
|
445
|
-
|
|
|
446
|
//反向适配
|
521
|
//反向适配
|
447
|
this.$refs.tree.setCheckedKeys(this.permIds);
|
522
|
this.$refs.tree.setCheckedKeys(this.permIds);
|
448
|
});
|
523
|
});
|
449
|
},
|
524
|
},
|
|
|
525
|
+ //获取已增加数据权限的数据
|
|
|
526
|
+ getRoleDataPerm(roleId) {
|
|
|
527
|
+ const _this = this
|
|
|
528
|
+ roleDataPermGet({roleId:roleId}).then((response) => {
|
|
|
529
|
+ const res = response.data
|
|
|
530
|
+ // console.log(res)
|
|
|
531
|
+ if (res.code !== '200') {
|
|
|
532
|
+ return _this.$message.error('获取已有的数据权限,失败!')
|
|
|
533
|
+ }else {
|
|
|
534
|
+ // 获取列表数据
|
|
|
535
|
+ if (res.data){
|
|
|
536
|
+ _this.currentRolePermList = res.data.dataPermissions;
|
|
|
537
|
+ }else{
|
|
|
538
|
+ _this.currentRolePermList = [];
|
|
|
539
|
+ }
|
|
|
540
|
+ // console.log(this.data_perm_id)
|
|
|
541
|
+ _this.$message.success('获取已有的数据权限,成功!')
|
|
|
542
|
+ }
|
|
|
543
|
+ }).catch(error => {
|
|
|
544
|
+ // 关闭加载
|
|
|
545
|
+ _this.$message.error(error.toString())
|
|
|
546
|
+ }).finally(()=>{
|
|
|
547
|
+ this.isLoading = false;
|
|
|
548
|
+ })
|
|
|
549
|
+ },
|
|
|
550
|
+ // 配置数据权限
|
|
|
551
|
+ handleClick: function (tab, index,row) {
|
|
|
552
|
+ let _this = this;
|
|
|
553
|
+ this.permForms.permissionIds = [];
|
|
|
554
|
+ if (tab.name === 'second'){
|
|
|
555
|
+ if (this.currentRolePermList && this.currentRolePermList.length>0){
|
|
|
556
|
+ this.currentRolePermList.forEach((v,i) =>{
|
|
|
557
|
+ _this.permForms.permissionIds[i]=v.data_perm_id;
|
|
|
558
|
+ })
|
|
|
559
|
+ }
|
|
|
560
|
+ }
|
|
|
561
|
+ this.$nextTick(() => {
|
|
|
562
|
+ //反向适配
|
|
|
563
|
+ this.$refs.trees.setCheckedKeys(this.permForms.permissionIds);
|
|
|
564
|
+ });
|
|
|
565
|
+ },
|
450
|
//显示新增界面,每次点开初始化数据
|
566
|
//显示新增界面,每次点开初始化数据
|
451
|
handleAdd: function (index,row) {
|
567
|
handleAdd: function (index,row) {
|
452
|
this.addFormVisible = true;
|
568
|
this.addFormVisible = true;
|
|
@@ -663,10 +779,44 @@ |
|
@@ -663,10 +779,44 @@ |
663
|
// this.uniteParentSame(currentObj.id,treeStatus)
|
779
|
// this.uniteParentSame(currentObj.id,treeStatus)
|
664
|
// }
|
780
|
// }
|
665
|
}
|
781
|
}
|
666
|
- }
|
782
|
+ },
|
|
|
783
|
+ dataPermTreeClickDeal: function (currentObj, tree) {
|
|
|
784
|
+ // alert(JSON.stringify(tree.checkedKeys))
|
|
|
785
|
+ // alert("选择前的数组="+this.permForms.permissionIds)
|
|
|
786
|
+ this.permForms.permissionIds = tree.checkedKeys
|
|
|
787
|
+ // alert("选择后的数组="+this.permForms.permissionIds)
|
|
|
788
|
+ },
|
|
|
789
|
+ //提交数据权限
|
|
|
790
|
+ setDataPerm(){
|
|
|
791
|
+ this.loading = this.$loading({
|
|
|
792
|
+ lock: true,
|
|
|
793
|
+ text: '正在提交',
|
|
|
794
|
+ spinner: 'el-icon-loading',
|
|
|
795
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
796
|
+ });
|
|
|
797
|
+ let _this = this;
|
|
|
798
|
+ dataPermSet(this.permForms).then((response) => {
|
|
|
799
|
+ const res = response.data
|
|
|
800
|
+ // 添加失败
|
|
|
801
|
+ if (res.code !== '200') {
|
|
|
802
|
+ // 关闭加载
|
|
|
803
|
+ return this.$message.error(res.msg)
|
|
|
804
|
+ }
|
|
|
805
|
+ // 添加,成功
|
|
|
806
|
+ this.$message.success(res.msg)
|
|
|
807
|
+ // 隐藏对话框
|
|
|
808
|
+ this.PermFormVisible = false;
|
|
|
809
|
+ }).catch(error => {
|
|
|
810
|
+ this.$message.error(error.toString())
|
|
|
811
|
+ }).finally(()=>{
|
|
|
812
|
+ this.loading.close()
|
|
|
813
|
+ })
|
|
|
814
|
+ },
|
|
|
815
|
+
|
667
|
},
|
816
|
},
|
668
|
mounted() {
|
817
|
mounted() {
|
669
|
this.getRoles();
|
818
|
this.getRoles();
|
|
|
819
|
+ this.getDataList();
|
670
|
let _this = this;
|
820
|
let _this = this;
|
671
|
document.onkeydown = function (e) {
|
821
|
document.onkeydown = function (e) {
|
672
|
let key = window.event.keyCode;
|
822
|
let key = window.event.keyCode;
|
|
@@ -675,6 +825,7 @@ |
|
@@ -675,6 +825,7 @@ |
675
|
}
|
825
|
}
|
676
|
};
|
826
|
};
|
677
|
this.isExpansion=true;
|
827
|
this.isExpansion=true;
|
|
|
828
|
+
|
678
|
}
|
829
|
}
|
679
|
}
|
830
|
}
|
680
|
|
831
|
|
|
@@ -686,6 +837,9 @@ |
|
@@ -686,6 +837,9 @@ |
686
|
|
837
|
|
687
|
|
838
|
|
688
|
<style lang="scss">
|
839
|
<style lang="scss">
|
|
|
840
|
+ .v-modal{
|
|
|
841
|
+ z-index:-2000;
|
|
|
842
|
+ }
|
689
|
/*//一级节点选择器*!*!*/
|
843
|
/*//一级节点选择器*!*!*/
|
690
|
.el-tree-node>.el-tree-node__content {
|
844
|
.el-tree-node>.el-tree-node__content {
|
691
|
font-weight: 900;
|
845
|
font-weight: 900;
|