TaoLer/app/admin/view/auth_rule/edit.html
2021-05-10 13:59:58 +08:00

122 lines
4.0 KiB
HTML

{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-rule-edit" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$rules.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<div id="menuSelectBox" class="ew-xmselect-tree"></div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单名称</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入权限名" autocomplete="off" class="layui-input" value="{$rules.title}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限地址</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="请输入权限地址" autocomplete="off" class="layui-input" value="{$rules.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-inline">
<input type="text" name="icon" id="iconPicker" lay-filter="iconPicker" value="{$rules.icon}" style="display:none;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="required" placeholder="排序序号" autocomplete="off" class="layui-input" value="{$rules.sort}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block">
<input type="radio" name="ishidden" lay-skin="primary" title="目录" value="-1" {if condition="$rules.ishidden == -1"}checked{/if}>
<input type="radio" name="ishidden" lay-skin="primary" title="菜单" value="1" {if condition="$rules.ishidden == 1"}checked{/if}>
<input type="radio" name="ishidden" lay-skin="primary" title="按钮" value="0" {if condition="$rules.ishidden == 0"}checked{/if}>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-rule-submit" id="LAY-user-rule-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form','admin', 'xmSelect', 'iconPicker'], function(){
var $ = layui.$
,form = layui.form ;
var admin = layui.admin;
var xmSelect = layui.xmSelect;
var iconPicker = layui.iconPicker;
//初始化图标选择
iconPicker.render({
elem: '#iconPicker',
type: 'fontClass',
search: false,
page: true,
limit: 12,
click: function (data) {
//console.log(data);
}
});
//权限菜单结构
admin.req({
type: "post",
url: "{:url('AuthRule/tree')}",
data:{},
done:function(res){
var data = res.data;
// 渲染下拉树
xmSelect.render({
el: '#menuSelectBox',
name: 'pid',
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: data,
initValue: [{$rules['pid']}],
model: {label: {type: 'text'}},
prop: {
name: 'title',
value: 'id'
},
radio: true,
clickClose: true,
tree: {
show: true,
indent: 15,
strict: false,
expandedKeys: true
},
tips: '请选择上级菜单'
});
}
});
})
</script>
{/block}