From ebfb7d8acb3beb183552684df05ecbcc64ff4136 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Mon, 24 Aug 2020 09:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=91=98=E5=B7=A5?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/pages/dev/privilege/privilege.js | 3 - .../frame/staffPrivilege/staffPrivilege.js | 65 ++++++++++--------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/public/pages/dev/privilege/privilege.js b/public/pages/dev/privilege/privilege.js index c7544bc00..0dbde823a 100644 --- a/public/pages/dev/privilege/privilege.js +++ b/public/pages/dev/privilege/privilege.js @@ -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"); diff --git a/public/pages/frame/staffPrivilege/staffPrivilege.js b/public/pages/frame/staffPrivilege/staffPrivilege.js index c9ec180c7..440d1913a 100644 --- a/public/pages/frame/staffPrivilege/staffPrivilege.js +++ b/public/pages/frame/staffPrivilege/staffPrivilege.js @@ -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++) {