提交 | 用户 | 时间
|
1ac2bc
|
1 |
/** |
懒 |
2 |
* 详情对话框 |
|
3 |
*/ |
|
4 |
var MenuInfoDlg = { |
|
5 |
data: { |
|
6 |
pid: "", |
|
7 |
pcodeName: "" |
|
8 |
} |
|
9 |
}; |
|
10 |
|
|
11 |
layui.use(['layer', 'form', 'admin', 'laydate', 'ax', 'iconPicker'], function () { |
|
12 |
var $ = layui.jquery; |
|
13 |
var $ax = layui.ax; |
|
14 |
var form = layui.form; |
|
15 |
var admin = layui.admin; |
|
16 |
var laydate = layui.laydate; |
|
17 |
var layer = layui.layer; |
|
18 |
var iconPicker = layui.iconPicker; |
|
19 |
|
|
20 |
//初始化字典详细列表 |
|
21 |
$("#dictDetails").html(''); |
|
22 |
var ajax = new $ax(Feng.ctxPath + "/dict/listDictsByCode", function (data) { |
|
23 |
for (var i = 0; i < data.data.length; i++) { |
|
24 |
var name = data.data[i].name; |
|
25 |
var code = data.data[i].code; |
|
26 |
$("#dictDetails").append('<input type="radio" name="systemType" value="' + code + '" title="' + name + '">'); |
|
27 |
} |
|
28 |
}, function (data) { |
|
29 |
}); |
|
30 |
ajax.set("dictTypeCode", "SYSTEM_TYPE"); |
|
31 |
ajax.start(); |
|
32 |
|
|
33 |
//获取菜单信息 |
|
34 |
var ajax = new $ax(Feng.ctxPath + "/menu/getMenuInfo?menuId=" + Feng.getUrlParam("menuId")); |
|
35 |
var result = ajax.start(); |
|
36 |
form.val('menuForm', result.data); |
|
37 |
|
|
38 |
// 点击父级菜单 |
|
39 |
$('#pcodeName').click(function () { |
|
40 |
var formName = encodeURIComponent("parent.MenuInfoDlg.data.pcodeName"); |
|
41 |
var formId = encodeURIComponent("parent.MenuInfoDlg.data.pid"); |
|
42 |
var treeUrl = encodeURIComponent("/menu/selectMenuTreeList"); |
|
43 |
|
|
44 |
layer.open({ |
|
45 |
type: 2, |
|
46 |
title: '父级菜单', |
|
47 |
area: ['300px', '400px'], |
|
48 |
content: Feng.ctxPath + '/system/commonTree?formName=' + formName + "&formId=" + formId + "&treeUrl=" + treeUrl, |
|
49 |
end: function () { |
|
50 |
$("#pid").val(MenuInfoDlg.data.pid); |
|
51 |
$("#pcodeName").val(MenuInfoDlg.data.pcodeName); |
|
52 |
} |
|
53 |
}); |
|
54 |
}); |
|
55 |
|
|
56 |
// 表单提交事件 |
|
57 |
form.on('submit(btnSubmit)', function (data) { |
|
58 |
var ajax = new $ax(Feng.ctxPath + "/menu/edit", function (data) { |
|
59 |
Feng.success("修改成功!"); |
|
60 |
|
|
61 |
//传给上个页面,刷新table用 |
|
62 |
admin.putTempData('formOk', true); |
|
63 |
|
|
64 |
//关掉对话框 |
|
65 |
admin.closeThisDialog(); |
|
66 |
|
|
67 |
}, function (data) { |
|
68 |
Feng.error("修改失败!" + data.responseJSON.message) |
|
69 |
}); |
|
70 |
ajax.set(data.field); |
|
71 |
ajax.start(); |
|
72 |
|
|
73 |
//添加 return false 可成功跳转页面 |
|
74 |
return false; |
|
75 |
}); |
|
76 |
|
|
77 |
//初始化图标选择 |
|
78 |
iconPicker.render({ |
|
79 |
elem: '#icon', |
|
80 |
type: 'fontClass', |
|
81 |
search: true, |
|
82 |
page: true, |
|
83 |
limit: 12, |
|
84 |
click: function (data) { |
|
85 |
|
|
86 |
} |
|
87 |
}); |
|
88 |
|
|
89 |
iconPicker.checkIcon('iconPicker', result.data.icon); |
|
90 |
}); |