mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
修改权限组
This commit is contained in:
parent
6f6b0fc862
commit
55cb934edd
@ -16,6 +16,7 @@
|
||||
<link rel="stylesheet" href="/css/toastr.css" />
|
||||
<!-- SUMMERNOTE 富文本组件-->
|
||||
<link href="/css/plugins/summernote/summernote-bs4.min.css" rel="stylesheet">
|
||||
<link href="/css/plugins/jsTree/style.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/css/vc-ui.css" />
|
||||
<link rel="stylesheet" href="https://unpkg.com/bootstrap-submenu@3.0.1/dist/css/bootstrap-submenu.css">
|
||||
|
||||
@ -41,6 +42,7 @@
|
||||
<script src="/js/bootstrap/bootstrap-treeview.min.js"></script>
|
||||
<script src="/js/plugins/qrcode/qrcode.min.js"></script>
|
||||
<script src="/js/toastr.min.js"></script>
|
||||
<script src="/js/plugins/jsTree/jstree.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div class="col-lg-3" style="background:#FFFFFF">
|
||||
<div class="col-lg-4" style="background:#FFFFFF">
|
||||
<div class="ibox ">
|
||||
<div class="ibox-content mailbox-content">
|
||||
<div class="file-manager">
|
||||
|
||||
2
public/css/plugins/jsTree/style.min.css
vendored
2
public/css/plugins/jsTree/style.min.css
vendored
File diff suppressed because one or more lines are too long
10
public/js/plugins/jsTree/jstree.min.js
vendored
10
public/js/plugins/jsTree/jstree.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,57 +1,16 @@
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<vc:create path="dev/privilegeGroup"></vc:create>
|
||||
<div class="col-lg-9 animated fadeInRight">
|
||||
<div class="col-lg-8 animated fadeInRight">
|
||||
<div class="mail-box-header">
|
||||
<button v-if="privilegeInfo._currentStoreId != '9999'"
|
||||
class="btn btn-primary btn-sm float-right"
|
||||
data-toggle="tooltip"
|
||||
title="Refresh inbox"
|
||||
v-on:click="openAddPrivilegeModel()"
|
||||
><i class="fa fa-plus"></i> 添加权限</button>
|
||||
<div class="float-right mail-search" style="margin-right:10px">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control form-control-sm" v-model="privilegeInfo._pName" name="search" placeholder="请输入权限名称">
|
||||
<div class="input-group-btn">
|
||||
<button v-on:click="queryPrivilege()" class="btn btn-sm btn-primary">
|
||||
查询
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>
|
||||
{{privilegeInfo._currentPgName}}
|
||||
</h2>
|
||||
</div>
|
||||
<div class="mail-box">
|
||||
|
||||
<table class="table table-hover table-mail">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>权限编码</th>
|
||||
<th>权限名称</th>
|
||||
<th>权限描述</th>
|
||||
<th>创建时间</th>
|
||||
<th class="text-right">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="privilege in privilegeInfo._privileges" class="read">
|
||||
<td class="check-mail">
|
||||
{{privilege.pId}}
|
||||
</td>
|
||||
<td class="mail-ontact">{{privilege.name}}</td>
|
||||
<td class="mail-subject">{{privilege.description}}</td>
|
||||
<td class="">{{vc.dateFormat(privilege.createTime)}}</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn-white btn btn-xs" v-on:click="openDeletePrivilegeModel(privilege)">删除</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="jstree_privilege">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,64 +1,173 @@
|
||||
(function(vc){
|
||||
(function (vc) {
|
||||
|
||||
vc.extends({
|
||||
data:{
|
||||
privilegeInfo:{
|
||||
_currentPgId:"",
|
||||
_currentPgName:"",
|
||||
_pName:'',
|
||||
_currentStoreId:"9999",
|
||||
_privileges:[]
|
||||
data: {
|
||||
privilegeInfo: {
|
||||
_currentPgId: "",
|
||||
_currentPgName: "",
|
||||
_pName: '',
|
||||
_currentStoreId: "9999",
|
||||
_privileges: []
|
||||
}
|
||||
},
|
||||
_initMethod:function(){
|
||||
_initMethod: function () {
|
||||
|
||||
},
|
||||
_initEvent:function(){
|
||||
vc.component.$on('privilege_group_event',function(_pgObj){
|
||||
_initEvent: function () {
|
||||
vc.component.$on('privilege_group_event', function (_pgObj) {
|
||||
vc.component.privilegeInfo._currentPgId = _pgObj._pgId;
|
||||
vc.component.privilegeInfo._currentPgName = _pgObj._pgName;
|
||||
vc.component.privilegeInfo._currentStoreId = _pgObj._storeId;
|
||||
//调用接口查询权限
|
||||
vc.component._loadPrivilege(_pgObj._pgId);
|
||||
});
|
||||
vc.component.$on('privilege_loadPrivilege',function(_pgId){
|
||||
vc.component.$on('privilege_loadPrivilege', function (_pgId) {
|
||||
vc.component._loadPrivilege(_pgId);
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
_loadPrivilege:function(_pgId){
|
||||
vc.component.privilegeInfo._privileges=[];
|
||||
methods: {
|
||||
_loadPrivilege: function (_pgId) {
|
||||
vc.component.privilegeInfo._privileges = [];
|
||||
var param = {
|
||||
params:{
|
||||
pgId:_pgId,
|
||||
name:vc.component.privilegeInfo._pName
|
||||
params: {
|
||||
pgId: _pgId,
|
||||
name: vc.component.privilegeInfo._pName
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//发送get请求
|
||||
vc.http.get('privilege',
|
||||
'listPrivilege',
|
||||
param,
|
||||
function(json){
|
||||
var _privileges = JSON.parse(json);
|
||||
vc.component.privilegeInfo._privileges = _privileges;
|
||||
},function(){
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
//发送get请求
|
||||
vc.http.get('addPrivilege',
|
||||
'listNoAddPrivilege',
|
||||
param,
|
||||
function (json) {
|
||||
var _privileges = JSON.parse(json);
|
||||
vc.component.privilegeInfo._privileges = _privileges;
|
||||
$that._initJsTreePrivilege(_privileges);
|
||||
}, function () {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
openAddPrivilegeModel:function(){
|
||||
vc.component.$emit('addPrivilege_openPrivilegeModel',{
|
||||
pgId:vc.component.privilegeInfo._currentPgId
|
||||
openAddPrivilegeModel: function () {
|
||||
vc.component.$emit('addPrivilege_openPrivilegeModel', {
|
||||
pgId: vc.component.privilegeInfo._currentPgId
|
||||
});
|
||||
},
|
||||
openDeletePrivilegeModel:function(_p){
|
||||
openDeletePrivilegeModel: function (_p) {
|
||||
_p.pgId = vc.component.privilegeInfo._currentPgId;
|
||||
vc.emit('deletePrivilege','openDeletePrivilegeModel',_p);
|
||||
vc.emit('deletePrivilege', 'openDeletePrivilegeModel', _p);
|
||||
},
|
||||
queryPrivilege:function(){
|
||||
queryPrivilege: function () {
|
||||
vc.component._loadPrivilege(vc.component.privilegeInfo._currentPgId);
|
||||
},
|
||||
_initJsTreePrivilege: function (_privileges) {
|
||||
|
||||
let _data = $that._doJsTreeData(_privileges);
|
||||
|
||||
console.log('菜单', _data);
|
||||
|
||||
$.jstree.destroy()
|
||||
|
||||
$("#jstree_privilege").jstree({
|
||||
"checkbox": {
|
||||
"keep_selected_style": false
|
||||
},
|
||||
"plugins": ["checkbox"],
|
||||
'core': {
|
||||
'data': _data
|
||||
}
|
||||
});
|
||||
$('#jstree_privilege').on("changed.jstree", function (e, data) {
|
||||
console.log('点击', data);
|
||||
});
|
||||
|
||||
},
|
||||
_doJsTreeData: function (_privileges) {
|
||||
let _mGroupTree = [];
|
||||
|
||||
//构建 第一层菜单组
|
||||
_privileges.forEach(pItem => {
|
||||
let _includeGroup = false;
|
||||
for (let _mgIndex = 0; _mgIndex < _mGroupTree.length; _mgIndex++) {
|
||||
if (pItem.gId == _mGroupTree[_mgIndex].gId) {
|
||||
_includeGroup = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_includeGroup) {
|
||||
let _groupItem = {
|
||||
gId: pItem.gId,
|
||||
text: pItem.gName,
|
||||
state: {
|
||||
opened: false
|
||||
},
|
||||
children: []
|
||||
};
|
||||
$that._doJsTreeMenuData(_groupItem);
|
||||
_mGroupTree.push(_groupItem);
|
||||
}
|
||||
});
|
||||
return _mGroupTree;
|
||||
},
|
||||
_doJsTreeMenuData: function (_groupItem) {
|
||||
let _privileges = $that.privilegeInfo._privileges;
|
||||
//构建菜单
|
||||
let _children = _groupItem.children;
|
||||
for (let _pIndex = 0; _pIndex < _privileges.length; _pIndex++) {
|
||||
if (_groupItem.gId == _privileges[_pIndex].gId) {
|
||||
let _includeMenu = false;
|
||||
for (let _mgIndex = 0; _mgIndex < _children.length; _mgIndex++) {
|
||||
if (_privileges[_pIndex].mId == _children[_mgIndex].mId) {
|
||||
_includeMenu = true;
|
||||
}
|
||||
}
|
||||
if (!_includeMenu) {
|
||||
let _menuItem = {
|
||||
mId: _privileges[_pIndex].mId,
|
||||
text: _privileges[_pIndex].mName,
|
||||
state: {
|
||||
opened: false
|
||||
},
|
||||
children: []
|
||||
};
|
||||
$that._doJsTreePrivilegeData(_menuItem);
|
||||
_children.push(_menuItem);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
_doJsTreePrivilegeData: function (_menuItem) {
|
||||
let _privileges = $that.privilegeInfo._privileges;
|
||||
//构建菜单
|
||||
let _children = _menuItem.children;
|
||||
for (let _pIndex = 0; _pIndex < _privileges.length; _pIndex++) {
|
||||
if (_menuItem.mId == _privileges[_pIndex].mId) {
|
||||
let _includePrivilege = false;
|
||||
for (let _mIndex = 0; _mIndex < _children.length; _mIndex++) {
|
||||
if (_privileges[_pIndex].pId == _children[_mIndex].pId) {
|
||||
_includePrivilege = true;
|
||||
}
|
||||
}
|
||||
if (!_includePrivilege) {
|
||||
let _selected = false;
|
||||
if (_privileges[_pIndex].pgId) {
|
||||
_selected = true;
|
||||
}
|
||||
let _privilegeItem = {
|
||||
pId: _privileges[_pIndex].pId,
|
||||
text: _privileges[_pIndex].pName,
|
||||
state: {
|
||||
opened: false,
|
||||
selected: _selected
|
||||
}
|
||||
};
|
||||
_children.push(_privilegeItem);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user