layui.use(['form', 'layer', 'table', 'laytpl', 'laydate'], function () { var form = layui.form, layer = parent.layer === undefined ? layui.layer : top.layer, $ = layui.jquery, laytpl = layui.laytpl, table = layui.table; laydate = layui.laydate; //初始化表单 $(function () { //机构、部门 联合下拉框查询 var orgStr = ""; $.ajax({ type: "post", url: "../../ashx/SysDeptHandler.ashx", data: { Action: "OrgTree" }, dataType: "json", success: function (result) { result.data.forEach(function (obj, index, arr) { orgStr += ""; }); $("#org_id").append(orgStr); form.render('select'); } }); }) form.on("submit(AddEdit)", function (data) { //load提交 var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 }); $.post("../../ashx/SysDeptHandler.ashx", { Action: $(".Action").val(), ID: $(".ID").val(), org_id: $("#org_id").val(), //机构ID dept_name: $("#dept_name").val(), //部门名称 random: new Date().getTime() //随机参数(员工表ID ","分割) }, function (res) { layer.close(index); res = $.parseJSON(res); if (res.code == 1) { top.layer.msg(res.msg); parent.location.reload(); } else { layer.close(index); layer.msg(res.msg); } }); layer.close(index); return false; }) })