优化 员工权限展示

This commit is contained in:
java110 2020-08-24 09:23:40 +08:00
parent 6e0b5b55bd
commit ebfb7d8acb
2 changed files with 34 additions and 34 deletions

View File

@ -111,9 +111,6 @@
}
});
$('#jstree_privilege').on("changed.jstree", function (e, data) {
console.log(data);
if (data.action == 'model' || data.action == 'ready') {
//默认合并
$("#jstree_privilege").jstree("close_all");

View File

@ -1,44 +1,44 @@
(function(vc){
(function (vc) {
//员工权限
vc.extends({
data:{
staffPrivilegeInfo:{
privileges:[],
_currentStaffId:'',
data: {
staffPrivilegeInfo: {
privileges: [],
_currentStaffId: '',
}
},
_initMethod:function(){
_initMethod: function () {
},
_initEvent:function(){
vc.on('staffPrivilege','_loadStaffPrivileges',function(_param){
_initEvent: function () {
vc.on('staffPrivilege', '_loadStaffPrivileges', function (_param) {
vc.component._loadStaffPrivileges(_param);
});
},
methods:{
_loadStaffPrivileges:function(_param){
vc.component.staffPrivilegeInfo._currentStaffId=_param.staffId;
methods: {
_loadStaffPrivileges: function (_param) {
vc.component.staffPrivilegeInfo._currentStaffId = _param.staffId;
var param = {
params:{
staffId:_param.staffId
params: {
staffId: _param.staffId
}
};
//发送get请求
vc.http.get('staffPrivilege',
'listStaffPrivileges',
param,
function(json){
var _staffPrivilegeInfo = JSON.parse(json);
vc.component.staffPrivilegeInfo.privileges = _staffPrivilegeInfo.datas;
$that._initJsTreePrivilege(_staffPrivilegeInfo.datas);
//发送get请求
vc.http.get('staffPrivilege',
'listStaffPrivileges',
param,
function (json) {
var _staffPrivilegeInfo = JSON.parse(json);
vc.component.staffPrivilegeInfo.privileges = _staffPrivilegeInfo.datas;
$that._initJsTreePrivilege(_staffPrivilegeInfo.datas);
},function(){
console.log('请求失败处理');
});
}, function () {
console.log('请求失败处理');
});
},
_openDeleteStaffPrivilegeModel:function(_staffPrivilege){
_openDeleteStaffPrivilegeModel: function (_staffPrivilege) {
_staffPrivilege.staffId = vc.component.staffPrivilegeInfo._currentStaffId;
vc.emit('deleteStaffPrivilege','openStaffPrivilegeModel',_staffPrivilege);
vc.emit('deleteStaffPrivilege', 'openStaffPrivilegeModel', _staffPrivilege);
},
_initJsTreePrivilege: function (_privileges) {
@ -48,18 +48,21 @@
"checkbox": {
"keep_selected_style": false
},
'state': { //一些初始化状态
"opened": false,
"opened": true,
},
'core': {
'data': _data
}
});
$('#jstree_privilege').on("changed.jstree", function (e, data) {
$('#jstree_privilege').on("loaded.jstree", function (e, data) {
console.log(data);
//默认合并
$("#jstree_privilege").jstree("open_all");
});
},
_doJsTreeData: function (_privileges) {
let _mGroupTree = [];
@ -90,7 +93,7 @@
},
_doJsTreeMenuData: function (_groupItem) {
let _privileges = $that.staffPrivilegeInfo.privileges;
//构建菜单
let _children = _groupItem.children;
for (let _pIndex = 0; _pIndex < _privileges.length; _pIndex++) {