109 lines
3.7 KiB
HTML
109 lines
3.7 KiB
HTML
{extend name="common/base"/}
|
||
<!-- 主体 -->
|
||
{block name="body"}
|
||
<form class="layui-form body-content">
|
||
<h3 class="h3-title">系统菜单</h3>
|
||
{if condition="$id eq 0"}
|
||
<table class="layui-table">
|
||
<tr>
|
||
<td class="layui-td-gray2">父级菜单<font>*</font></td>
|
||
<td>
|
||
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单">
|
||
<option value="0">作为顶级菜单</option>
|
||
{volist name=":set_recursion(get_admin_menu())" id="v"}
|
||
<option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
|
||
{/volist}
|
||
</select>
|
||
</td>
|
||
<td class="layui-td-gray2">菜单名称<font>*</font></td>
|
||
<td>
|
||
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入菜单名称" lay-reqText="请输入菜单名称" class="layui-input">
|
||
</td>
|
||
<td class="layui-td-gray2">菜单路径</td>
|
||
<td>
|
||
<input type="text" name="src" placeholder="请输入菜单路径,可空" autocomplete="off" class="layui-input">
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="layui-td-gray2">菜单图标</td>
|
||
<td>
|
||
<input type="text" name="icon" placeholder="请输入图标样式,可空" autocomplete="off" class="layui-input">
|
||
</td>
|
||
<td colspan="4">
|
||
如:icon-jichuguanli<a href="{__LAYUI__}/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[点击查看可选图标]</a>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
{else/}
|
||
<table class="layui-table">
|
||
<tr>
|
||
<td class="layui-td-gray2">父级菜单<font>*</font></td>
|
||
<td>
|
||
<input type="hidden" name="id" value="0">
|
||
<select name="pid" lay-verify="required" lay-reqText="请选择父级菜单">
|
||
<option value="0">作为顶级菜单</option>
|
||
{volist name=":set_recursion(get_admin_menu())" id="v"}
|
||
<option value="{$v.id}" {eq name="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
|
||
{/volist}
|
||
</select>
|
||
</td>
|
||
<td class="layui-td-gray2">菜单名称<font>*</font></td>
|
||
<td>
|
||
<input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入菜单名称" lay-reqText="请输入菜单名称" class="layui-input" value="{$detail.title}">
|
||
</td>
|
||
<td class="layui-td-gray2">菜单路径</td>
|
||
<td>
|
||
<input type="text" name="src" placeholder="请输入菜单路径,可空" autocomplete="off" class="layui-input" value="{$detail.src}">
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="layui-td-gray2">菜单图标</td>
|
||
<td>
|
||
<input type="text" name="icon" placeholder="请输入图标样式,可空" autocomplete="off" class="layui-input" value="{$detail.icon}">
|
||
</td>
|
||
<td colspan="4">
|
||
如:icon-jichuguanli<a href="{__LAYUI__}/font/extend/demo_index.html" target="_blank" style="margin-left:10px; color:#007AFF">[点击查看可选图标]</a>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
{/if}
|
||
<div style="padding: 10px 0">
|
||
<input type="hidden" name="id" value="{$id}">
|
||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||
</div>
|
||
</form>
|
||
{/block}
|
||
<!-- /主体 -->
|
||
|
||
<!-- 脚本 -->
|
||
{block name="script"}
|
||
<script>
|
||
function init(layui) {
|
||
var form = layui.form,
|
||
layer = layui.layer;
|
||
|
||
//监听提交
|
||
form.on('submit(webform)', function(data) {
|
||
$.ajax({
|
||
url: "/home/menu/add",
|
||
type: 'post',
|
||
data: data.field,
|
||
success: function(e) {
|
||
if (e.code == 0) {
|
||
layer.confirm('保存成功,返回列表页吗?', { icon: 3, title: '提示' }, function (index) {
|
||
parent.location.reload();
|
||
});
|
||
} else {
|
||
layer.msg(e.msg);
|
||
}
|
||
}
|
||
})
|
||
return false;
|
||
});
|
||
}
|
||
</script>
|
||
{include file="common/layui" base="base" extend="[]" callback="init" /}
|
||
{/block}
|
||
<!-- /脚本 -->
|