first commit

This commit is contained in:
yanwenwu
2018-11-16 17:45:37 +08:00
parent a9865a2982
commit 4d8f109e10
235 changed files with 38293 additions and 36 deletions

View File

@@ -0,0 +1,11 @@
{extend name="public:form" /}
{block name="menu"}角色管理 / 创建角色{/block}
{block name='action'}{:url('role/create')}{/block}
{block name="form"}
<div class="form-group">
<label class="col-sm-2 control-label">角色名</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="name">
</div>
</div>
{/block}

View File

@@ -0,0 +1,12 @@
{extend name="public:form" /}
{block name="menu"}角色管理 / 编辑角色{/block}
{block name='action'}{:url('role/edit')}{/block}
{block name="form"}
<div class="form-group">
<label class="col-sm-2 control-label">角色名</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="name" required value="{$role->name}">
</div>
<input type="hidden" name="id" value="{$role->id}">
</div>
{/block}

View File

@@ -0,0 +1,47 @@
{extend name="public:form" /}
{block name="menu"}角色管理 / 权限分配{/block}
{block name="css"}
<link rel="stylesheet" href="__PLUGINS__/css/ztree/bootstrapStyle/bootstrapStyle.css" type="text/css">
{/block}
{block name="form"}
<ul id="tree" class="ztree text-center"></ul>
{/block}
{block name="js"}
<script type="text/javascript" src="__PLUGINS__/js/ztree/jquery.ztree.core.js"></script>
<script type="text/javascript" src="__PLUGINS__/js/ztree/jquery.ztree.excheck.js"></script>
<script type="text/javascript" src="__PLUGINS__/js/ztree/jquery.ztree.exedit.js"></script>
<script>
let setting = {
view: {},
check: {enable: true},
data: {simpleData: {enable: true, pIdKey : "pid",}},
callback:{onCheck:onCheck}
};
$(document).ready(function(){
$.get('{:url("role/getPermissionsOfRole")}', {role_id:"{$role_id}"},function(response){
console.log(response.data)
$.fn.zTree.init($("#tree"), setting, response.data);
})
});
let ids = new Array();
function onCheck(e,treeId,treeNode){
let treeObj=$.fn.zTree.getZTreeObj("tree");
nodes = treeObj.getCheckedNodes(true);
for(let i=0; i<nodes.length; i++){
ids.push(nodes[i].id); //获取选中节点的值
}
}
$(".btn-primary").click(function(){
$.post("{:url('role/givePermissions')}", {role_id:"{$role_id}", permissions: ids}, function(response){
if (!response.code ) {
warning(response.msg); return false;
}
success(response.msg)
setTimeout(function(){
window.location.href = response.url
}, response.wait * 1000);
});
})
</script>
{/block}

View File

@@ -0,0 +1,36 @@
{extend name="public:base" /}
{block name="menu"}角色管理{/block}
{block name="search"}
{:createButton(url('role/create'), '创建角色')}
{/block}
{block name="table-head"}
<tr>
<th>ID</th>
<th>角色名</th>
<th>创建时间</th>
<th>操作</th>
</tr>
{/block}
{block name="table-body"}
{if condition="!$roles->count()"}
<tr>
<td colspan="7" class="text-center">没有数据</td>
</tr>
{else/}
{foreach $roles as $key => $role}
<tr>
<td>{$key + 1}</td>
<td>{$role->name}</td>
<td>{$role->created_at}</td>
<td>
{:editButton(url('role/edit', ['id' => $role->id ]))}
{:deleteButton(url('role/delete'), $role->id)}
{:createButton(url('role/givePermissions', ['id' => $role->id ]), '分配权限', false)}
</td>
</tr>
{/foreach}
{/if}
{/block}
{block name="paginate"}
{$roles->render()|raw}
{/block}