mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 21:59:12 +08:00
优化 员工权限展示
This commit is contained in:
parent
6e0b5b55bd
commit
ebfb7d8acb
@ -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");
|
||||
|
||||
@ -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++) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user