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