// 筛选弹框 var layer = layui.layer; var layerCreateIndex = ''; var layerCreateIndex2 = ''; layui.use('layer', function () { layerCreateIndex = layer.open({ type: 1, title: false, closeBtn: 0, // shadeClose: true, skin: 'yourclass', area: [ '380px', '300px' ], content: $(".reportOut"), success: function () { $('.clsBtn,.cancel').click(function () { layer.close(layerCreateIndex); }) } }) }) layui.use([ 'form', 'layedit', 'laydate' ], function () { }); //时间日期选择 layui.use('laydate', function () { var laydate = layui.laydate; // 开始日期 var insStart = laydate.render({ elem: '#startTime', trigger: 'click', done: function (value, date) { // 更新结束日期的最小日期 insEnd.config.min = lay.extend({}, date, { month: date.month - 1 }); // 自动弹出结束日期的选择器 insEnd.config.elem[0].focus(); } }); // 结束日期 var insEnd = laydate.render({ elem: '#endTime', trigger: 'click', done: function (value, date) { // 更新开始日期的最大日期 insStart.config.max = lay.extend({}, date, { month: date.month - 1 }); } }); }); getNameList() // 单位下拉 ajax请求 function getNameList() { ajaxRequest(DEVICE_TYPE_COMPANYLIST, "POST", {}, function (result) { let data = result.RESULT; let items = ''; data.forEach(function (item, key) { items += `` }) $('#getNameList').html(items); }, function (errorMsg) { alert("请求数据失败!"); }) } /* 筛选提交发送请求 */ $('#nextStep').click(function() { //获取表单的值 并转换成对象 let allParam = serializeArrayToObj($("#reportOutForm").serializeArray()); //验证数据是否为空 let res = validParamIsEmpty(allParam, { "startTime": "请选择开始日期", "endTime": "请选择结束日期", "companyId": "请选择建筑物", }); if (res.code == -1) { alert(res.msg); return; } //验证通过 请求ajax ajaxRequest(MONTH_REPORT, "POST", allParam, function(result) { layer.close(layerCreateIndex); layer.msg('添加成功!', { icon: 6 }); $('#reportOutForm')[0].reset(); layui.use('layer', function () { layerCreateIndex2 = layer.open({ type: 1, title: false, closeBtn: 0, skin: 'yourclass', area: [ '700px', '800px' ], content: $(".reportContentOut"), success: function () { $('.clsBtn,.cancel').click(function () { window.open("./index.html"); }) } }) }) }, function(errorMsg) { alert("异常错误!"); }) }) layui.use('layer', function () { layerCreateIndex2 = layer.open({ type: 1, title: false, closeBtn: 0, skin: 'yourclass', area: [ '700px', '800px' ], content: $(".reportContentOut"), success: function () { $('.clsBtn,.cancel').click(function () { layer.close(layerCreateIndex2); // window.open("./index.html"); }) } }) })