mirror of https://gitee.com/stylefeng/guns
整理完成新增菜单
parent
10c862e1de
commit
45e340f7be
|
@ -28,7 +28,7 @@ layui.use(['HttpRequest', 'treeTable', 'func'], function () {
|
|||
{field: 'appName', align: "center", sort: true, title: '应用名称'},
|
||||
{field: 'layuiPath', align: "center", sort: true, title: '请求地址', minWidth: 180},
|
||||
{
|
||||
field: 'layuiIcon', align: "center", sort: true, title: '图标', templet: '<p><i class="{{d.layuiIcon}}"></i></p>'
|
||||
field: 'layuiIcon', align: "center", sort: true, title: '图标', templet: '<p><i class="layui-icon {{d.layuiIcon}}"></i></p>'
|
||||
},
|
||||
{
|
||||
field: 'visible', align: "center", sort: true, title: '是否可见', templet: function (data) {
|
||||
|
@ -70,7 +70,7 @@ layui.use(['HttpRequest', 'treeTable', 'func'], function () {
|
|||
*/
|
||||
Menu.openAddMenu = function () {
|
||||
func.open({
|
||||
height: 720,
|
||||
height: 660,
|
||||
title: '添加菜单',
|
||||
content: Feng.ctxPath + '/view/menu/add',
|
||||
tableId: Menu.tableId,
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
var MenuInfoDlg = {
|
||||
data: {
|
||||
pid: "",
|
||||
pcodeName: ""
|
||||
menuParentId: "",
|
||||
menuParentName: ""
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,26 +18,26 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'iconPicker'], fu
|
|||
var iconPicker = layui.iconPicker;
|
||||
|
||||
// 点击父级菜单
|
||||
$('#pcodeName').click(function () {
|
||||
var formName = encodeURIComponent("parent.MenuInfoDlg.data.pcodeName");
|
||||
var formId = encodeURIComponent("parent.MenuInfoDlg.data.pid");
|
||||
var treeUrl = encodeURIComponent("/menu/selectMenuTreeList");
|
||||
$('#menuParentName').click(function () {
|
||||
var formName = encodeURIComponent("parent.MenuInfoDlg.data.menuParentName");
|
||||
var formId = encodeURIComponent("parent.MenuInfoDlg.data.menuParentId");
|
||||
var treeUrl = encodeURIComponent("/sysMenu/layuiSelectParentMenuTreeList");
|
||||
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '父级菜单',
|
||||
area: ['300px', '400px'],
|
||||
content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl,
|
||||
content: Feng.ctxPath + '/view/common/tree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl,
|
||||
end: function () {
|
||||
$("#pid").val(MenuInfoDlg.data.pid);
|
||||
$("#pcodeName").val(MenuInfoDlg.data.pcodeName);
|
||||
$("#menuParentId").val(MenuInfoDlg.data.menuParentId);
|
||||
$("#menuParentName").val(MenuInfoDlg.data.menuParentName);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 表单提交事件
|
||||
form.on('submit(btnSubmit)', function (data) {
|
||||
var ajax = new $ax(Feng.ctxPath + "/menu/add", function (data) {
|
||||
var request = new HttpRequest(Feng.ctxPath + "/sysMenu/add", 'post', function (data) {
|
||||
Feng.success("添加成功!");
|
||||
|
||||
//传给上个页面,刷新table用
|
||||
|
@ -47,10 +47,10 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'iconPicker'], fu
|
|||
admin.closeThisDialog();
|
||||
|
||||
}, function (data) {
|
||||
Feng.error("添加失败!" + data.responseJSON.message)
|
||||
Feng.error("添加失败!" + data.message)
|
||||
});
|
||||
ajax.set(data.field);
|
||||
ajax.start();
|
||||
request.set(data.field);
|
||||
request.start(true);
|
||||
|
||||
//添加 return false 可成功跳转页面
|
||||
return false;
|
||||
|
@ -58,7 +58,7 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'iconPicker'], fu
|
|||
|
||||
//初始化图标选择
|
||||
iconPicker.render({
|
||||
elem: '#icon',
|
||||
elem: '#layuiIcon',
|
||||
type: 'fontClass',
|
||||
search: true,
|
||||
page: true,
|
||||
|
@ -71,18 +71,15 @@ layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'iconPicker'], fu
|
|||
|
||||
//初始化字典详细列表
|
||||
$("#dictDetails").html('');
|
||||
var ajax = new $ax(Feng.ctxPath + "/dict/listDictsByCode", function (data) {
|
||||
|
||||
var request = new HttpRequest(Feng.ctxPath + "/sysApp/list", 'get', function (data) {
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
var name = data.data[i].name;
|
||||
var code = data.data[i].code;
|
||||
$("#dictDetails").append('<input type="radio" name="systemType" value="' + code + '" title="' + name + '">');
|
||||
var name = data.data[i].appName;
|
||||
var code = data.data[i].appCode;
|
||||
$("#dictDetails").append('<input type="radio" name="appCode" value="' + code + '" title="' + name + '">');
|
||||
}
|
||||
form.render();
|
||||
|
||||
}, function (data) {
|
||||
});
|
||||
ajax.set("dictTypeCode", "SYSTEM_TYPE");
|
||||
ajax.start();
|
||||
request.start();
|
||||
|
||||
});
|
||||
|
|
|
@ -8,53 +8,46 @@
|
|||
<div class="layui-form-item layui-row">
|
||||
<input name="menuId" type="hidden"/>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">名称<span style="color: red;">*</span></label>
|
||||
<label class="layui-form-label">菜单名称<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input name="name" placeholder="请输入名称" type="text" class="layui-input" lay-verify="required" required/>
|
||||
<input name="menuName" placeholder="请输入菜单名称" type="text" class="layui-input" lay-verify="required" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">菜单编号<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input name="code" placeholder="请输入菜单编号" type="text" class="layui-input" lay-verify="required" required/>
|
||||
<input name="menuCode" placeholder="请输入菜单编号" type="text" class="layui-input" lay-verify="required" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">父级编号<span style="color: red;">*</span></label>
|
||||
<label class="layui-form-label">父级菜单<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input id="pid" name="pid" type="hidden">
|
||||
<input id="pcodeName" name="pcodeName" placeholder="请输入父级编号" type="text" class="layui-input" autocomplete="off" lay-verify="required" required/>
|
||||
<input id="menuParentId" name="menuParentId" type="hidden">
|
||||
<input id="menuParentName" name="menuParentName" placeholder="请选择父级菜单" type="text" class="layui-input" autocomplete="off" lay-verify="required" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">是否是菜单<span style="color: red;">*</span></label>
|
||||
<label class="layui-form-label">菜单的路径<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="menuFlag" value="Y" title="是" checked/>
|
||||
<input type="radio" name="menuFlag" value="N" title="不是"/>
|
||||
<input id="layuiPath" name="layuiPath" placeholder="请输入菜单的路径" type="text" class="layui-input" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">请求地址<span style="color: red;">*</span></label>
|
||||
<label class="layui-form-label">菜单图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="url" name="url" placeholder="请输入请求地址" type="text" class="layui-input" autocomplete="off"/>
|
||||
<input name="layuiIcon" id="layuiIcon" placeholder="请输入菜单图标" lay-filter="iconPicker" type="text" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="icon" id="icon" placeholder="请输入图标" lay-filter="iconPicker" type="text" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">系统分类<span style="color: red;">*</span></label>
|
||||
<label class="layui-form-label">所属应用<span style="color: red;">*</span></label>
|
||||
<div class="layui-input-block" id="dictDetails">
|
||||
<input type="radio" name="systemType" value="" title="无" disabled="disabled">
|
||||
<input type="radio" name="appCode" value="" title="无" disabled="disabled">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-col-md12">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="sort" placeholder="请输入排序" type="text" class="layui-input"/>
|
||||
<input name="menuSort" placeholder="请输入排序" type="text" class="layui-input"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue