提交 | 用户 | 时间
|
1ac2bc
|
1 |
layui.use(['form', 'admin', 'ax', 'laydate', 'func'], function () { |
懒 |
2 |
var $ = layui.jquery; |
|
3 |
var $ax = layui.ax; |
|
4 |
var form = layui.form; |
|
5 |
var func = layui.func; |
|
6 |
var admin = layui.admin; |
|
7 |
var laydate = layui.laydate; |
|
8 |
|
|
9 |
//加载请假类型 |
|
10 |
func.initDictSelect("/myleave/getLeaves", "type", "dictName", "dictName"); |
|
11 |
|
|
12 |
//渲染时间选择框 |
|
13 |
laydate.render({ |
|
14 |
elem: '#starttime' |
|
15 |
,trigger: 'click' |
|
16 |
}); |
|
17 |
laydate.render({ |
|
18 |
elem: '#endtime' |
|
19 |
,trigger: 'click' |
|
20 |
}); |
|
21 |
|
|
22 |
//表单提交事件 |
|
23 |
form.on('submit(btnSubmit)', function (data) { |
|
24 |
|
|
25 |
var ajax = new $ax(Feng.ctxPath + "/myleave/addItem", function (data) { |
|
26 |
Feng.success("添加成功!"); |
|
27 |
admin.putTempData('formOk', true); |
|
28 |
admin.closeThisDialog(); |
|
29 |
}, function (data) { |
|
30 |
Feng.error("添加失败!" + data.responseJSON.message); |
|
31 |
}); |
|
32 |
ajax.set(data.field); |
|
33 |
ajax.start(); |
|
34 |
|
|
35 |
return false; |
|
36 |
|
|
37 |
}); |
|
38 |
|
|
39 |
}); |