let form, layer, laydate, checkedDate, formSelects, user = getUser(), dataObj = null; let orgName = user.orgName; layui.config({ base: "../../js/layui/", //此处路径请自行处理, 可以使用绝对路径 }).extend({ formSelects: 'formSelects-v4' }).use(["form", "laydate", "layer", "formSelects"], function () { layer = layui.layer; form = layui.form; laydate = layui.laydate; formSelects = layui.formSelects; laydate.render({ elem: "#createTime", //指定元素 元素选择器 type: "date", //选择时间类型 可选值:year(年) month(年月) date(年月日) time(时分秒) datetime(年月日时分秒) trigger: "click", range: true, format: "yyyy-MM-dd", //时间格式 常用时间格式:yyyy-MM-dd HH:mm:ss max: Date.parse(new Date()), btns: ["now", "confirm"], //选择框右下角显示的按钮 清除-现在-确定 done: function (value, date) { //时间回调 let dateArr = value.split(" - "); setDateData(getAllDate(dateArr[0], dateArr[1])); getDaily(dateArr[1]); }, }); if(user.isSup !== '1'){ $('.apply-back-btn').remove(); }else{ $('.apply-back-btn').css({'width':'180px','display':'block'}) } checkedDate = getNowTime(); $("#createTime").val(getBeforeDate(9) + " - " + getNowTime()); setDateData(getAllDate(getBeforeDate(9), getNowTime())); getDaily(getNowTime()); getOrgList(); }); // 设置日期数据 function setDateData(data) { let reverseData = data.reverse(); let html = ""; reverseData.forEach((item, index) => { if (index === 0) { html += '

" + item + "

"; } else { html += '

" + item + "

"; } }); $(".date-box").empty().append(html); } function dailyDetail(data, index) { formSelects.value('buildCode', []); $(".date-box").find("p").each(function () { if ($(this).hasClass("p-checked")) { $(this).removeClass("p-checked"); } }); $(".date" + index).addClass("p-checked"); $(".daily-box").css("display", "none"); $(".download-btn").css("display", "none"); getDaily(data); checkedDate = data; } /* -------------------------------------------------------------- */ // 初始化表格样式 function initTableData(tableName) { let tweTableIndex = $('#formInfo .' + tableName + ' tbody tr').length; if (tweTableIndex === 0) { $('#formInfo .' + tableName + ' thead tr td').each(function () { $(this).css({ 'border': '1px solid' }); }); } else { $('#formInfo .' + tableName + ' thead tr td').each(function () { $(this).css({ 'border-bottom': 'none' }); }); } } // 日报数据赋值 function setCityDailyData(currentDay, data) { if(currentDay === getNowTime()){ $('.apply-back-btn').css({'display':'block','width':'180px'}); getApplyBackDataNum(); }else{ $('.apply-back-btn').css({'display':'none'}); } hideImg(); dataObj = data; $(".daily-date").html(setDate(currentDay)); $(".daily-box").css("display", "block"); $(".download-btn").css("display", "block"); resetFormData(); setNoEditData(); setDailyViewData(JSON.parse(data.vo.dataJson)); } // 清空表单数据 function resetFormData() { // $('.nine-table tbody').empty(); $('.two-risk-table').remove(); $('.nine-table2 tbody').empty(); $('.nine-table3 tbody').empty(); $('.nine-table4 tbody').empty(); $('.nine-table5 tbody').empty(); $('.nine-table6 tbody').empty(); $('.nine-table7 tbody').empty(); $('.nine-table8 tbody').empty(); $('.nine-table9 tbody').empty(); $('.ten-table tbody').empty(); $('.ele-table tbody').empty(); $('.twe-table tbody').empty(); $('.two3-table tbody').empty(); $('.seven-table tbody').empty(); $('#checkSituationBox2').empty(); $('#leaderDynamicsBox2').empty(); $('#customizeBox2').empty(); $('#noStartRiskDataBox2').empty(); $('.nine-table4 thead tr').eq(0).removeAttr('style'); $('.nine-table5 thead tr').eq(0).removeAttr('style'); } // 不可编辑数据赋值 function setNoEditData() { // 班组及人员情况 if (dataObj && dataObj.numList && dataObj.numList.length > 0) { $.each(dataObj.numList, function (index, item) { $('#two_num' + ((index + 1) === 1 ? '' : index + 1)).html(item); }) } else { for (let i = 1; i <= 3; i++) { $('#two_num' + (i === 1 ? '' : i)).html(0); } } // 地市违章数据 if (dataObj && dataObj.vioNumList && dataObj.vioNumList.length > 0) { $.each(dataObj.vioNumList, function (index, item) { $('#five_num' + (index + 2)).html(item); }) } else { for (let i = 2; i <= 4; i++) { $('#two_num' + i).html(0); } } // 今日三级及以上风险 督查作业现场(站班会数量) if (dataObj && dataObj.classNums && dataObj.classNums.length > 0) { $('#five_num').html(dataObj.classNums[1]); $('#six_num').html(dataObj.classNums[0]); } else { $('#five_num').html(0); $('#six_num').html(0); } // 三级及以上风险作业未开展 if (dataObj && dataObj.classList && dataObj.classList.length > 0) { let html = ''; $.each(dataObj.classList, function (index, item) { html += '' + '' + item.orgName + '' + '' + item.twoNum + '' + '' + item.twoRiskNum + '' + '' + item.twoRate + '%' + '' + item.threeNum + '' + '' + item.threeRiskNum + '' + '' + item.threeRate + '%' + '' }) $('.nine-table6 tbody').append(html); } else { $('.nine-table6 tbody').append('1//////'); } initTableData('nine-table6'); // 二级风险到岗到位检查情况 if (dataObj && dataObj.dutyList && dataObj.dutyList.length > 0) { let html = ''; $.each(dataObj.dutyList, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.proName + '' + '' + item.yz + '' + '' + item.jl + '' + '' + item.sg + '' + '' }) html += '备注:“/”代表未到岗到位,“√”代表到岗到位。' $('.seven-table tbody').append(html); } else { $('.seven-table tbody').append('1////备注:“/”代表未到岗到位,“√”代表到岗到位。'); } // 违章情况 let vioHtml = ''; if (dataObj && dataObj.vioList && dataObj.vioList.length > 0) { $.each(dataObj.vioList, function (index, item) { if (item.levelId === '一般违章') { $('.close3').removeAttr('style'); return false; } }) $.each(dataObj.vioList, function (index, item) { let style = ''; if (item.levelId === '一般违章') { style = 'display:none;'; } vioHtml += '' + '' + '" + '" + '" + '" + '" + '" + '" + "
违章等级' + item.levelId + "
建管单位' + item.orgName + "
违章现场' + item.proName + "
违章照片' + setVoiPhotos(item) + "
违章内容' + item.content + "
违章判定依据' + item.voiYj + "
处理结果' + item.status + "
"; }) } else { vioHtml += '' + '' + '' + '' + '' + '' + '' + '' + '' + "
违章等级/
建管单位/
违章现场/
违章照片
违章内容/
违章判定依据/
处理结果/
"; } $(".general-voi-box").empty().append(vioHtml); if (dataObj && dataObj.vioList && dataObj.vioList.length > 0) { $.each(dataObj.vioList, function (index, item) { let viewer = new Viewer( document.getElementById("general-voi" + index + ""), { url: "data-original", show: function () { viewer.update(); }, } ); }); } /* 违章照片 */ function setVoiPhotos(obj) { let cent = ''; let imgList = obj.imgList; $.each(imgList, function (index, item) { let path = photoUrl + item.base64Url + "?token=" + token; cent += ''; }); return cent; } } // 设置日报表单数据-预览 function setDailyViewData(obj) { $('#three_reason').html(obj.three_reason); $('#scene').html(obj.scene); $('#establishment').html(obj.establishment); $('#check').html(obj.check); for (let i = 1; i <= 4; i++) { $('#one_num' + (i === 1 ? '' : i)).html(obj['one_num' + (i === 1 ? '' : i)]); } for (let i = 1; i <= 10; i++) { $('#three_num' + (i === 1 ? '' : i)).html(obj['three_num' + (i === 1 ? '' : i)]); } for (let i = 1; i <= 4; i++) { $('#four_num' + (i === 1 ? '' : i)).html(obj['four_num' + (i === 1 ? '' : i)]); } for (let i = 2; i <= 6; i++) { $('#six_num' + i).html(obj['six_num' + i]); } for (let i = 1; i <= 2; i++) { $('#seven_num' + (i === 1 ? '' : i)).html(obj['seven_num' + (i === 1 ? '' : i)]); } // 关键措施上传率合格率 let value = $('#six_num').html(); let value2 = $('#six_num2').html(); let rate = 0; if(value && parseInt(value) !== 0){ const result = new Decimal(value2).times(100).dividedBy(value); rate = result.toDecimalPlaces(2).toNumber(); } $('#hgRate').html(rate); if (obj.reportList && obj.reportList.length > 0) { // 通报情况 let html = ''; $.each(obj.reportList, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.reportStatus + '' + '' + item.reportContent + '' + ''; }) $('#view-box .nine-table7 tbody').append(html); } else { $('#view-box .nine-table7 tbody').append('1///'); } if (obj.noExecuteList && obj.noExecuteList.length > 0) { // 四级风险作业未执行数量超过5个情况说明: let html = ''; $.each(obj.noExecuteList, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.workContent + '' + '' + item.execSituation + '' + '' + item.noExecReason + '' + ''; }) $('#view-box .nine-table8 tbody').append(html); } else { $('#view-box .nine-table8 tbody').append('1//////'); } if (obj.sgUnitList && obj.sgUnitList.length > 0) { // 作业计划施工单位数据 let html = ''; $.each(obj.sgUnitList, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.sgUnit + '' + '' + item.num + '' + ''; }) $('#view-box .nine-table9 tbody').append(html); } else { $('#view-box .nine-table9 tbody').append('1///'); } if (obj.workPlanList5 && obj.workPlanList5.length > 0) { // 二级风险作业执行情况: let html = '', style = 'display:none;'; const firstExecutedIndex = obj.workPlanList5.findIndex(item => item.execSituation === "已执行"); // 获取第一个已执行的位置 $.each(obj.workPlanList5, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.workContent + '' + '' + item.execSituation + '' + '' + item.noExecReason + '' + ''; }) $('#view-box .nine-table5 tbody').append(html); if (firstExecutedIndex === 0) { $('.nine-table5 thead tr').eq(0).css('border-bottom', '1px solid'); $('.close4').removeAttr('style'); } else if (firstExecutedIndex > 0) { $('.nine-table5 tbody tr').eq(firstExecutedIndex - 1).css('border-bottom', '1px solid'); $('.close4').removeAttr('style'); } } else { $('#view-box .nine-table5 tbody').append('1//////'); } if (obj.workPlanList4 && obj.workPlanList4.length > 0) { // 三级风险作业执行情况: let html = '', style = 'display:none;'; const firstExecutedIndex = obj.workPlanList4.findIndex(item => item.execSituation === "已执行"); // 获取第一个已执行的位置 $.each(obj.workPlanList4, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.workContent + '' + '' + item.execSituation + '' + '' + item.noExecReason + '' + ''; }) $('#view-box .nine-table4 tbody').append(html); if (firstExecutedIndex === 0) { $('.nine-table4 thead tr').eq(0).css('border-bottom', '1px solid'); $('.close').removeAttr('style'); } else if (firstExecutedIndex > 0) { $('.nine-table4 tbody tr').eq(firstExecutedIndex - 1).css('border-bottom', '1px solid'); $('.close').removeAttr('style'); } } else { $('#view-box .nine-table4 tbody').append('1//////'); } if (obj.workPlanList3 && obj.workPlanList3.length > 0) { // 新增计划执行情况: let html = ''; $.each(obj.workPlanList3, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.workContent + '' + ''; }) $('#view-box .nine-table3 tbody').append(html); } else { $('#view-box .nine-table3 tbody').append('1////'); } // 处理二级风险作业计划 function handleTableData(index, item) { console.log(item.workContent); return '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
序号建管单位工程名称班组长作业内容
' + (index != null ? index + 1 : '1') + '
' + (item.orgName || '/') + '
' + (item.proName || '/') + '
' + (item.workManager || '/') + '
' + (item.workContent || '/') + '
作业总体情况
' + (item.ztqk || '/') + '
明日作业情况
' + (item.mrzyqk || '/') + '
勘察记录、技术、方案要点及关键措施执行情况
' + (item.zxqk || '/') + '
综合评估,风险提示、班组提醒
' + (item.bztx || '/') + '
'; } if (obj.workPlanList && obj.workPlanList.length > 0) { // 二级风险作业计划 let html = ''; $.each(obj.workPlanList, function (index, item) { html += handleTableData(index, item); }) $('#two-risk').append(html); } else { $('#two-risk').append(handleTableData(null, {})); } if (obj.workPlanList2 && obj.workPlanList2.length > 0) { // 三级风险作业计划 let html = '', style = ''; if (obj.workPlanList2.length > 5) { $('.close2').removeAttr('style'); style = 'display:none;'; } $.each(obj.workPlanList2, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.workContent + '' + ''; }) $('#view-box .nine-table2 tbody').append(html); $('.nine-table2 tbody tr').eq(4).css('border-bottom', '1px solid'); } else { $('#view-box .nine-table2 tbody').append('1////'); } if (obj.keyUserList && obj.keyUserList.length > 0) { // 远程抽查关键人员赋值 let html = ''; $.each(obj.keyUserList, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.proName + '' + '' + item.userName + '' + '' + item.position + '' + '' + item.checkResults + '' + ''; }) $('#view-box .ten-table tbody').append(html); } else { $('#view-box .ten-table tbody').append('1////'); } if (obj.workList && obj.workList.length > 0) { // 未开展机械化施工数据赋值 let html = ''; $.each(obj.workList, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.workContent + '' + '' + item.method + '' + '' + item.actualMethod + '' + '' + item.reviewResults + '' + ''; }) $('#view-box .ele-table tbody').append(html); } else { $('#view-box .ele-table tbody').append('1///////'); } if (obj.twoRiskList && obj.twoRiskList.length > 0) { // 今日二级风险 let html = ''; $.each(obj.twoRiskList, function (index, item) { html += '' + '' + (item.orgName ? (index + 1) : '') + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.orgName + '' + '' + item.workContent + '' + ''; }) $('#view-box .two3-table tbody').append(html); } else { $('#view-box .two3-table tbody').append('1////'); } if (obj.jcList && obj.jcList.length > 0) { // 环水保视频稽查情况赋值 let html = ''; $.each(obj.jcList, function (index, item) { html += '' + '' + (index + 1) + '' + '' + item.orgName + '' + '' + item.proName + '' + '' + item.workManager + '' + '' + item.workContent + '' + '' + item.issue + '' + ''; }) $('#view-box .twe-table tbody').append(html); } else { $('#view-box .twe-table tbody').append('1/////'); } if (obj.checkSituations && obj.checkSituations.length > 0) { // 检查情况赋值 let html = ''; $.each(obj.checkSituations, function (index, item) { html += '
' + '

(' + (index + 1) + ')

' + '
' + '
' + '

' + item.proName + '(' + item.teamName + '班组)作业内容:' + item.workContent + '

' + // '

(' + item.teamName + '班组)

' + '
' + // '
' + // '作业内容:

' + item.workContent + '

' + // '
' + '
' + '
'; }) $('#checkSituationBox2').append(html); } if (obj.leaderDynamics && obj.leaderDynamics.length > 0) { // 领导动态赋值 let html = ''; $.each(obj.leaderDynamics, function (index, item) { html += '
' + '' + (index + 1) + '.' + item.leaderDynamics + '' + '
'; }) $('#leaderDynamicsBox2').append(html); } if (obj.customizes && obj.customizes.length > 0) { // 自定义内容 let html = ''; $.each(obj.customizes, function (index, item) { html += '
' + '' + (index + 1) + '.' + item.customize + '' + '
'; }) $('#customizeBox2').append(html); } } // 查询 function queryData() { let buildCode = formSelects.value('buildCode', 'val'); getDaily(checkedDate, buildCode); } // 展开 type 1.三级及以上作业风险计划未执行原因 2.三级风险作业计划 3.违章 function openData(type) { if (type === 1) { $('.open').removeAttr('style'); $('.close').css('display', 'none'); let firstExecutedIndex = -1; $('.nine-table4 tbody tr').each(function (index, item) { let execSituation = $(this).attr('execSituation'); firstExecutedIndex = $(this).attr('firstExecutedIndex'); if (execSituation === '已执行') { $(this).removeAttr('style'); } }); if(parseInt(firstExecutedIndex) === 0){ $('.nine-table4 thead tr').eq(0).css('border-bottom', 'none'); }else if(parseInt(firstExecutedIndex) > 0){ $('.nine-table4 tbody tr').eq(firstExecutedIndex - 1).css('border-bottom', 'none'); } } else if (type === 2) { $('.open2').removeAttr('style'); $('.close2').css('display', 'none'); $('.nine-table2 tbody tr').each(function (index, item) { if (index > 4) { $(this).removeAttr('style'); } }); $('.nine-table2 tbody tr').eq(4).css('border-bottom', 'none'); } else if (type === 3) { $('.open3').removeAttr('style'); $('.close3').css('display', 'none'); $('.general-voi').each(function (index, item) { let levelId = $(this).attr('levelId'); if (levelId === '一般违章') { $(this).removeAttr('style'); } }); } else if (type === 4) { $('.open4').removeAttr('style'); $('.close4').css('display', 'none'); let firstExecutedIndex = -1; $('.nine-table5 tbody tr').each(function (index, item) { let execSituation = $(this).attr('execSituation'); firstExecutedIndex = $(this).attr('firstExecutedIndex'); if (execSituation === '已执行') { $(this).removeAttr('style'); } }); if(parseInt(firstExecutedIndex) === 0){ $('.nine-table5 thead tr').eq(0).css('border-bottom', 'none'); }else if(parseInt(firstExecutedIndex) > 0){ $('.nine-table5 tbody tr').eq(firstExecutedIndex - 1).css('border-bottom', 'none'); } } } // 收起 type 1.三级及以上作业风险计划未执行原因 2.三级风险作业计划 3.违章 function closeData(type) { if (type === 1) { $('.close').removeAttr('style'); $('.open').css('display', 'none'); let firstExecutedIndex = -1; firstExecutedIndex = $(this).attr('firstExecutedIndex'); $('.nine-table4 tbody tr').each(function (index, item) { let execSituation = $(this).attr('execSituation'); firstExecutedIndex = $(this).attr('firstExecutedIndex'); if (execSituation === '已执行') { $(this).css('display', 'none'); } }); if(parseInt(firstExecutedIndex) === 0){ $('.nine-table4 thead tr').eq(0).css('border-bottom', '1px solid'); }else if(parseInt(firstExecutedIndex) > 0){ $('.nine-table4 tbody tr').eq(firstExecutedIndex - 1).css('border-bottom', '1px solid'); } } else if (type === 2) { $('.close2').removeAttr('style'); $('.open2').css('display', 'none'); $('.nine-table2 tbody tr').each(function (index, item) { if (index > 4) { $(this).css('display', 'none'); } }); $('.nine-table2 tbody tr').eq(4).css('border-bottom', '1px solid'); } else if (type === 3) { $('.close3').removeAttr('style'); $('.open3').css('display', 'none'); $('.general-voi').each(function (index, item) { let levelId = $(this).attr('levelId'); if (levelId === '一般违章') { $(this).css('display', 'none'); } }); } else if (type === 4) { $('.close4').removeAttr('style'); $('.open4').css('display', 'none'); let firstExecutedIndex = -1; firstExecutedIndex = $(this).attr('firstExecutedIndex'); $('.nine-table5 tbody tr').each(function (index, item) { let execSituation = $(this).attr('execSituation'); firstExecutedIndex = $(this).attr('firstExecutedIndex'); if (execSituation === '已执行') { $(this).css('display', 'none'); } }); if(parseInt(firstExecutedIndex) === 0){ $('.nine-table5 thead tr').eq(0).css('border-bottom', '1px solid'); }else if(parseInt(firstExecutedIndex) > 0){ $('.nine-table5 tbody tr').eq(firstExecutedIndex - 1).css('border-bottom', '1px solid'); } } } function hideImg() { $('.open').css('display', 'none'); $('.close').css('display', 'none'); $('.open2').css('display', 'none'); $('.close2').css('display', 'none'); $('.open3').css('display', 'none'); $('.close3').css('display', 'none'); $('.open4').css('display', 'none'); $('.close4').css('display', 'none'); } // 申请退回列表 function applyBackList(){ openIframeByParamObj("applyBackList", '申请退回列表', "cityDailyBackRecord.html", "80%", "90%", {}); }