let form, layer, table, tableIns, classIdParam, bidNameParam, ticketNoParam, buildCodeParam, user = getUser(),tableHeight; let teamNameParam = null, riskLevelParam = null,bidCodeParam = null,signCodeParam = null; let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10 // 是否是值长管理员 let isShiftSup = user.roleName === '值长管理员' ? true : false; setBtns(); function setBtns(){ let html = '' if(user.isSup !== '3'){ $('.btn-box').css('height','60px') tableHeight = 'full-170' html += ''; }else{ tableHeight = 'full-110' $('.table-box2').css('height','calc(100% - 50px)') } $('.btn-box').append(html) } function setParams(classId, bidName, ticketNo, buildCode,teamName, riskLevel, bidCode, signCode) { classIdParam = classId; bidNameParam = bidName; ticketNoParam = ticketNo; buildCodeParam = buildCode; teamNameParam = teamName; riskLevelParam = riskLevel; bidCodeParam = bidCode; signCodeParam = signCode; layui.use(['form', 'layer', 'table'], function () { form = layui.form; layer = layui.layer; table = layui.table; pages(1, 10, 1); }) } function pages(pageNum, pageSize, typeNum) { let params = getReqParams(pageNum, pageSize, typeNum); $.ajax({ headers: { "encrypt": sm3(JSON.stringify(params)) }, url: dataUrl + "proteam/pot/superStatistics/getVoiRecordList?token=" + token, data: params, type: 'POST', async: false, success: function (result) { if (result.code === 200) { if (result.data) { initTable(result.data, result.limit, result.curr) laypages(result.count, result.curr, result.limit) } } else if (result.code === 500) { layer.alert(result.msg, {icon: 2}) } else if (result.code === 401) { logout(1); } }, error: function () { } }); } function laypages(total, page, limit) { layui.use(['laypage'], function () { let laypage = layui.laypage; laypage.render({ elem: 'voi-page', count: total, curr: page, limit: limit, limits: [10, 20, 50, 100, 200, 500], layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'], groups: 5, jump: function (obj, first) { if (!first) { pageNum = obj.curr, limitSize = obj.limit; pages(obj.curr, obj.limit, null); } } }); }) } /*初始化表格*/ function initTable(dataList, limit, page) { let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,}); tableIns = table.render({ elem: "#violationStatisticsTable", height: tableHeight, data: dataList, limit: limit, cols: [ [ //表头 { title: "序号", width: 80, unresize: true, align: "center", templet: function (d) { return (page - 1) * limit + d.LAY_INDEX; } }, { field: "ticketNo", title: "作业票编号", width: 200, unresize: true, align: "center", sort: true }, { field: "proName", title: "工程名称", width: 230, unresize: true, align: "center", sort: true }, { field: "riskLevel", title: "风险等级", width: 140, unresize: true, align: "center", sort: true, templet: function (d) { return setRiskLevelColor(d.riskLevel); } }, { field: "org", title: "违章单位", width: 140, unresize: true, align: "center", sort: true }, { field: "levelId", title: "违章等级", width: 150, unresize: true, align: "center", sort: true, templet: function (d) { if (d.levelId === '严重违章') { return '' + d.levelId + ''; } return '' + d.levelId + ''; } }, { field: "content", title: "违章内容", width: 260, unresize: true, align: "center", sort: true }, { field: "createTime", title: "督查日期", width: 150, unresize: true, align: "center", sort: true }, { field: "issUser", title: "督查人", width: 150, unresize: true, align: "center", sort: true }, { field: "status", title: "状态", width: 160, unresize: true, align: "center", sort: true }, { title: "操作", width: 200, unresize: true, align: "center", templet: function (d) { return setRoleAuth(d); } } ], ], done: function (res, curr, count) { layer.close(loadingMsg); table.resize("violationStatisticsTable"); count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block"); count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto"); }, }); } /*打开违章单下发页面*/ function openViolationForm() { let layerIndex = parent.layer.open({ id: "violationForm", title: false, type: 2, maxmin: false, content: '../dutyTask/remotePatrol/violationForm.html', area: ['700px', '780px'], closeBtn: 0, success: function (layero, index) { let iframeWin = parent.window["layui-layer-iframe" + layerIndex]; iframeWin.setParams(classIdParam, bidNameParam, ticketNoParam, buildCodeParam,teamNameParam,riskLevelParam,bidCodeParam,signCodeParam); }, end:function (){ reloadData(); } }); } /*修改违章单*/ function editData(id) { let layerIndex = layer.open({ id: "editVio", title: false, type: 2, maxmin: false, content: '../violation/editViolationForm.html', area: ['700px', '780px'], move: false, closeBtn: 0, success: function (layero, index) { let iframeWin = window["layui-layer-iframe" + layerIndex]; iframeWin.setParams(id); } }); } // 违章单驳回修改 function editData2(id) { let layerIndex = layer.open({ id: "editVio", title: false, type: 2, maxmin: false, content: '../violation/editViolationForm2.html', area: ['700px', '780px'], move: false, closeBtn: 0, success: function (layero, index) { let iframeWin = window["layui-layer-iframe" + layerIndex]; iframeWin.setParams(id); } }); } // 违章单回撤 function reback(id) { layer.confirm('确定回撤吗?', { 'move': false, 'title': '操作提示' }, function () { let loadingMsg = layer.msg('数据撤回中,请稍候...', { icon: 16, scrollbar: false, time: 0 }); let url = dataUrl + 'proteam/pot/superStatistics/rebackVoiStatus'; let params = { 'id': id, }; ajaxRequest(url, "POST", params, true, function () { }, function (result) { layer.close(loadingMsg); // 关闭提示层 if (result.code === 200) { parent.layer.msg(result.msg, { icon: 1 }) reloadData(); } else if (result.code === 500) { layer.alert(result.msg, { icon: 2 }) } }, function (xhr) { layer.close(loadingMsg); // 关闭提示层 error(xhr) }); }) } /*违章整改页面*/ function openRectification(id,classId, type) { let html = '../violation/rectifyForm.html'; if (type === '2') { html = '../violation/rectifyCheckForm.html'; }else if(type === '3'){ html = '../violation/rectifyFormByCity.html'; } let layerIndex = layer.open({ id: "rectify", title: false, type: 2, maxmin: false, content: html, area: ['700px', '780px'], move: false, closeBtn: 0, success: function (layero, index) { let iframeWin = window["layui-layer-iframe" + layerIndex]; iframeWin.setParams(id,classId); } }); } /*通知单*/ function noticeSheet(id,classId) { let layerIndex = parent.layer.open({ type: 2, title: false, closeBtn: 0, content: "../../html/dutyTask/violation/noticeSheet.html", shadeClose: false, area: ['740px', '780px'], move: false, success: function () { let iframeWin = parent.window["layui-layer-iframe" + layerIndex]; iframeWin.setParams(id,classId); } }); } // 值长审核页 / 查看页 function noticeSheet2(id, classId, type) { let layerIndex = layer.open({ type: 2, title: false, closeBtn: 0, content: "../violation/noticeSheetCheck.html", shadeClose: false, area: ['740px', '780px'], move: false, success: function () { let iframeWin = window["layui-layer-iframe" + layerIndex]; iframeWin.setParams(id, classId, type); } }); } /*违章照片*/ function openImg(obj) { let imgPath = obj.filePath; let width = getChooseWidth().toFixed(0) + "px"; let height = getChooseHeight().toFixed(0) + "px"; let layerIndex = layer.open({ id: "voiImg", title: ['