let urlLis = ['getNoWorkByDay', 'getNewTeam', 'getNoWorkBySeven', 'getTeamByPer', 'getTeamByWork', 'getFocusWork', 'getBallByUnusual', 'getBallSignal', 'getTeamByJob','getDayPlanWarn','getLaterWarn','getMornWarn','getBallTime']; function setTable(table) { table.set({ elem: "#table", id: "table", height: "full-140", }); } //今日无施工,七日无施工,新进班组 function setTableCols(page, limit, type) { let tableCols = [ { title: "序号", width: 100, unresize: true, align: "center", templet: function (d) { return (page - 1) * limit + d.LAY_INDEX; } }, { field: "org", title: "建管单位", unresize: false, sort: true, width: 150, align: "center", }, { field: "proName", title: "工程名称", unresize: false, sort: true, width: 300, align: "center", }, { field: 'fzrName', title: "班组长", unresize: false, sort: true, width: 150, align: "center", templet: function (d) { return "" + transformNull(d.fzrName) + "
" + transformNull(d.phone) + ""; }, } ]; $('.riskLevel').addClass('layui-hide'); switch (type) { case 0: tableCols.push({ field: "content", title: "工作内容", unresize: false, sort: true, minWidth: 200, align: "center", templet: function (d) { if (d.content) { if (d.content.length > 60) { return '' + d.content.substring(0, 60) + '...' } else { return '' + d.content + '' } } else { return ''; } } } ) //addCols(tableCols,0); break; case 1: tableCols.push( { field: "teamName",title: "班组名称", unresize: false,sort: true,minWidth: 200,align: "center"}, {field: "createDay",title: "入场时间",unresize: false,sort: true,minWidth: 200,align: "center", }, ) break; case 2: tableCols.push( { field: "teamName",title: "班组名称", unresize: false,sort: true,minWidth: 200,align: "center"}, {field: "createDay",title: "入场时间",unresize: false,sort: true,minWidth: 200,align: "center", }, ) break; case 3: $('.riskLevel').removeClass('layui-hide'); tableCols = [ { title: "序号", width: 100, unresize: true,sort: true,align: "center", templet: function (d) { return (page - 1) * limit + d.LAY_INDEX; } }, { field: "org",title: "建管单位",unresize: false,sort: true,width: 150,align: "center",}, {field: "proName", title: "工程名称",unresize: false, sort: true,minWidth: 200,align: "center",}, {field: "riskLevel", title: "风险等级", unresize: false, width: 150,sort: true,align: "center", templet: function (d) { return setRiskLevelColor(d.riskLevel); }}, { field: 'fzrName', title: "班组长", unresize: false, sort: true, width: 150, align: "center", templet: function (d) { return "" + transformNull(d.fzrName) + "
" + transformNull(d.phone) + ""; }, }, { field: "dnum", title: "今日人数", unresize: false,sort: true, width: 150,align: "center"}, { field: "ynum", title: "昨日人数", unresize: false,sort: true,width: 150,align: "center"}, { field: "content", title: "工作内容", unresize: false,sort: true,minWidth: 200,align: "center", templet: function (d) { if (d.content) { if (d.content.length > 60) { return '' + d.content.substring(0, 60) + '...' } else { return '' + d.content + '' } } else { return ''; } } }, ]; addCols(tableCols,3); break; case 4: tableCols.push( {field: "teamName", title: "班组名称", unresize: false,sort: true, minWidth: 200, align: "center" }, { field: "tgx", title: "今日工序",unresize: false, sort: true, minWidth: 180,align: "center", templet: function (d) { if (d.tgx) { if (d.tgx.length > 60) { return '' + d.tgx.substring(0, 60) + '...' } else { return '' + d.tgx + '' } } else { return ''; } } }, {field: "ygx",title: "昨日工序", unresize: false,sort: true,minWidth: 180,align: "center", templet: function (d) { if (d.ygx) { if (d.ygx.length > 60) { return '' + d.ygx.substring(0, 60) + '...' } else { return '' + d.ygx + '' } } else { return ''; } } } ) addCols(tableCols,4); break; case 8: tableCols.push( { field: "teamName", title: "班组名称", unresize: false,sort: true,minWidth: 200, align: "center"}, { field: "tzylx", title: "今日作业类型", unresize: false,sort: true, minWidth: 180,align: "center", templet: function (d) { if (d.tzylx) { if (d.tzylx.length > 60) { return '' + d.tzylx.substring(0, 60) + '...' } else { return '' + d.tzylx + '' } } else { return ''; } } }, { field: "yzylx", title: "昨日作业类型",unresize: false, sort: true, minWidth: 180, align: "center", templet: function (d) { if (d.yzylx) { if (d.yzylx.length > 60) { return '' + d.yzylx.substring(0, 60) + '...' } else { return '' + d.yzylx + '' } } else { return ''; } } } ) addCols(tableCols,5); break; case 6: $('.riskLevel').removeClass('layui-hide'); tableCols = [ { title: "序号", width: 100,unresize: true, sort: true,align: "center", templet: function (d) { return (page - 1) * limit + d.LAY_INDEX; } }, { field: "org", title: "建管单位",unresize: false,sort: true, width: 150, align: "center", }, { field: "riskLevel", title: "风险等级",unresize: false, width: 150, sort: true, align: "center", templet: function (d) { return setRiskLevelColor(d.riskLevel); } }, {title: "监控",width: 100,unresize: false,align: "center", sort: true, templet: function (d) { let html = ''; if (d.isOnline === '不在线') { html += '' } else { html += '' } return html; } }, { field: "proName", title: "工程名称", unresize: false, sort: true, minWidth: 200, align: "center", }, {field: 'fzrName', title: "班组长", unresize: false, sort: true, width: 200, align: "center", templet: function (d) { return "" +transformNull( d.fzrName )+ "
" + transformNull (d.phone) + ""; }, } ]; addCols(tableCols,7); break; case 7: tableCols = [ { title: "序号",width: 80,unresize: true, align: "center", templet: function (d) { return (page - 1) * limit + d.LAY_INDEX; } }, { field: "org", title: "建管单位", unresize: false, sort: true, width: 180, align: "center",}, {field: "proName",title: "工程名称", unresize: false, sort: true,width: 180, align: "center", }, {field: 'fzrName',title: "班组长",unresize: false, sort: true, width: 150,align: "center", templet: function (d) { return "" + transformNull(d.fzrName) + "
" + transformNull(d.phone )+ ""; }, }, { field: "macId", title: "设备编码", unresize: false, sort: true,width: 215, align: "center", }, { field: "puid", title: "球机PUID", unresize: false, sort: true, width: 215,align: "center",}, { field: "qjXh", title: "球机信号值", unresize: false, sort: true, width: 200, align: "center", } ]; addCols(tableCols,8); break; default: tableCols.push({ field: "content", title: "工作内容", unresize: false, sort: true, minWidth: 200, align: "center", templet: function (d) { if (d.content) { if (d.content.length > 60) { return '' + d.content.substring(0, 60) + '...' } else { return '' + d.content + '' } } else { return ''; } } } ) break; } return tableCols; } /** * 添加模块 */ function addCols(tableCols,type){ if(user.isSup=='1' ){//管理员 tableCols.push( {field: "handleState",title: "是否处理",unresize: false,sort: true,minWidth: 200,align: "center", templet:function(d){ if(d.state){return '已处理';}else{return '未处理';} }}, {field: "handleUser",title: "处理人",unresize: false,sort: true,minWidth: 200,align: "center",templet:function(d){ if(d.userName){return NulltoStr(d.userName);}else{return NulltoStr(d.handleUser);} } }, {field: "handleState",title: "处理结果",unresize: false,sort: true,minWidth: 200,align: "center",templet:function(d){ if(d.state){if(d.state==1){return '符合'}else{return '不符合'}}else{return ''} } }, {field: "handleTime",title: "处理时间",unresize: false,sort: true,minWidth: 200,align: "center", }, {field: "handelRemark",title: "处理备注",unresize: false,sort: true,minWidth: 200,align: "center", } ) }else if(user.isSup=='2'){ tableCols.push( {field: "handleState",title: "是否处理",unresize: false,sort: true,minWidth: 200,align: "center", templet:function(d){ if(d.state){return '已处理';}else{return '未处理';} } }, {title: "操作",unresize: false,sort: true,minWidth: 200,align: "center",templet:function(obj){ let warnType=obj.type; let warnId=obj.id; //处理人id-及信息 let isIgnore=NulltoStr(obj.isIgnore); let handleId =NulltoStr(obj.handleId); let handleState=NulltoStr(obj.state); let handleTime=NulltoStr(obj.handleTime); let handleUser=NulltoStr(obj.handleUser); let handelRemark=NulltoStr(obj.handelRemark); return '' }}, ) } } function NulltoStr(data){ if(data==null || data=='null' || data=='NULL'){ return ''; } return data; } function updateFzrData(fzrNum, isHl) { let formData = { fzrNum: fzrNum, type: type, isHl: isHl } console.log(formData); $.ajax({ headers: { "encrypt": sm3(JSON.stringify(formData)) }, type: "post", url: dataUrl + 'proteam/pot/early/updateFzrData?token=' + token, data: formData, dataType: "json", success: function (data) { pages(1, limitSize, type); getEarlyNum(); }, error: function (data) { console.error("修改失败"); } }); } /** * 查询施工预警数量 */ function getEarlyNum() { let params = getReqParams(); $.ajax({ headers: { "encrypt": sm3(JSON.stringify(params)) }, url: dataUrl + "proteam/pot/early/getEarlyNum?token=" + token, data: params, type: 'POST', success: function (result) { console.log(result); $.each(result.data, function (index, item) { $('[value=' + index + ']').find('span').text("(" + item + ")"); }) }, error: function () { } }); } function opendata(warnId,warnType,handelId,handleUser,handleTime,handleState,handelRemark,isIgnore) { console.log(warnId,warnType,handelId,handleUser,handleTime,handleState,handelRemark,isIgnore); layer.open({ title: '告警处置', type: 2, area: ['30%','40%'], content: '../../html/earlyWarning/warnSure.html', cancel: function(){ }, btn: ['确定', '取消'] ,//只是为了演示 success: function (layero, index) { var body = layer.getChildFrame('body', index); var iframeWin = window[layero.find('iframe')[0]['name']];//获得iframe页的窗口对象,执行iframe页的方法: iframeWin.setForm(warnId,warnType,handelId,handleUser,handleTime,handleState,handelRemark,isIgnore);//调用子页面的方法,页面锁定 } ,yes: function(index,leyuo){ var body = layer.getChildFrame('body', index); body.find('#add-data').click(); } ,btn2: function(){ layer.closeAll(); } }); } function timestamp() { let date = new Date(); let year = date.getFullYear(); let month = date.getMonth() + 1; let day = date.getDate(); let hours = date.getHours(); let minutes = date.getMinutes(); let seconds = date.getSeconds() if (month < 10) { month = "0" + month; } if (day < 10) { day = "0" + day; } if (hours < 10) { hours = "0" + hours; } if (minutes < 10) { minutes = "0" + minutes; } if (seconds < 10) { seconds = "0" + seconds; } return year + "-" + month + "-" + day + " " + hours + "-" + minutes + "-" + seconds }