var pers = [] var table, form, laydate layui.use(['form', 'layer', 'table', 'laydate'], function() { table = layui.table; form = layui.form; laydate = layui.laydate //初始化日期选择框 laydate.render({ elem: '#insMonth', type: 'month', btns: ['now', 'confirm'] }); init(); }); //查询 function queryClick() { let fgsName = $('#fgsName').val(); let yjName = $('#yjName').val(); let insMonth = $('#insMonth').val(); let aiDitStatus = $('#aiDitStatus').val(); table.reload('layui_table', { where: { fgsId: '26', fgsName: fgsName, yjName: yjName, insMonth: insMonth, aiDitStatus: aiDitStatus, } }) } //重置 function resetClick() { $('#fgsName').val(''); $('#yjName').val(''); $('#insMonth').val(''); $('#aiDitStatus').val('0'); form.render(); table.reload('layui_table', { where: { fgsId: "26", fgsName: "", yjName: "", insMonth: "", aiDitStatus: "", } }) } /** * 初始化数据 */ function init() { let aiDitStatus = $('#aiDitStatus').val(); // 渲染表格 table.render({ id: 'layui_table', elem: '#table', url: PATH_URL + '/inspectionPlan/getLineProjectListAuditPage', where: { fgsId: '26', aiDitStatus: aiDitStatus }, page: true, method: 'post', skin: 'line', // 表格样式 cols: [ [{ title: '序号', field: 'zizeng', align: 'center', type: 'numbers', width: '5%' }, { field: 'fgsName', title: '分公司', align: 'center', width: '15%' }, { field: 'yjName', title: '运检站', align: 'center', width: '15%' }, { field: 'insMonth', title: '月份', align: 'center', width: '6%' }, { field: 'proPlanNum', title: '工程计划数量', align: 'center', width: '7%' }, { field: 'createUser', title: '提交人', align: 'center', width: '7%' }, { field: 'createTime', title: '提交时间', align: 'center', width: '15%' }, { field: '', title: '审核状态', align: 'center', width: '10%', templet: function(d) { var status = d.aiDitStatus; console.log(status) var text; var color; var html = ""; if (status == '2') { text = '已通过'; color = '#19BE6B'; } if (status == '0') { text = '待审核'; color = '#FF9900'; } if (status == '3') { text = '未通过'; color = '#F56C6C'; } if (status == '1') { text = '已撤销'; color = '#999999'; } html += "" html += `  ` html += `${text}` html += "" return html; }, }, { field: '', title: '操作', align: 'center', width: '20%', templet: function(d) { var id = d.id; var yjId = d.yjId; var insMonth = d.insMonth; var status = d.aiDitStatus; var text; var html = ""; if (status == '2') { //已审核 html += `` html += `` } if (status == '0') { //分公司待审核 html += `` html += `` html += `` } if (status == '4') { //总公司待审核 html += `` html += `` html += `` } if (status == '3') { //未通过 html += `` html += `` } return html; }, } ] ], }); } //详情 function detailsView(yjId, insMonth) { let height = '98%'; let width = '95%'; $.ajax({ type: 'POST', url: PATH_URL + '/inspectionPlan/getDetails', contentType: "application/json; charset=utf-8", data: JSON.stringify({ "yjId": yjId, "insMonth": insMonth }), success: function(data) { console.log("data:", data) var index = layer.open({ title: ['月计划详情'], type: 2, content: './monthPlanDetails.html', area: [width, height], maxmin: false, success: function(layero, index) { // console.log(data); var myIframe = window[layero.find('iframe')[0]['name']]; // myIframe.hideSubmit(); var fnc = myIframe.setData(data.data, yjId, insMonth); //aaa()为子页面的方法 }, }); } }) } //审批 function auditView(yjId, insMonth,id) { let height = '98%'; let width = '95%'; $.ajax({ type: 'POST', url: PATH_URL + '/inspectionPlan/getDetails', contentType: "application/json; charset=utf-8", data: JSON.stringify({ "yjId": yjId, "insMonth": insMonth }), success: function(data) { var index = layer.open({ title: ['月计划审核'], type: 2, content: './monthPlanAudit.html', area: [width, height], maxmin: false, success: function(layero, index) { // console.log(data); var myIframe = window[layero.find('iframe')[0]['name']]; // myIframe.hideSubmit(); var fnc = myIframe.setData(data.data, yjId, insMonth,id); //aaa()为子页面的方法 }, }); } }) } //总公司审批 function auditTotalView(yjId, insMonth,id) { let height = '98%'; let width = '95%'; $.ajax({ type: 'POST', url: PATH_URL + '/inspectionPlan/getDetails', contentType: "application/json; charset=utf-8", data: JSON.stringify({ "yjId": yjId, "insMonth": insMonth }), success: function(data) { var index = layer.open({ title: ['月计划审核'], type: 2, content: './monthPlanAuditTotal.html', area: [width, height], maxmin: false, success: function(layero, index) { // console.log(data); var myIframe = window[layero.find('iframe')[0]['name']]; // myIframe.hideSubmit(); var fnc = myIframe.setData(data.data, yjId, insMonth,id); //aaa()为子页面的方法 }, }); } }) } //导出 function exportData() { let fgsName = $('#fgsName').val(); let yjName = $('#yjName').val(); let insMonth = $('#insMonth').val(); let aiDitStatus = $('#aiDitStatus').val(); let fgsId = '26' window.location.href = PATH_URL + `/inspectionPlan/exportAuditPlanData?token=` + token + "&fgsName=" + fgsName + "&yjName=" + yjName + "&insMonth=" + insMonth + "&aiDitStatus=" + aiDitStatus + "&fgsId=" + fgsId layer.msg('下载中,请稍等', { icon: 16, scrollbar: false }); } //导出 function exportDataDetails(yjId, insMonth) { window.location.href = PATH_URL + `/inspectionPlan/exportMonthPlanData?token=` + token + "&insMonth=" + insMonth + "&yjId=" + yjId layer.msg('下载中,请稍等', { icon: 16, scrollbar: false }); }