import { schoolCheckList, layuiObj } from "./index.js"; import { checkStateText } from "./checkStateText.js"; import { showPersonProvidePopPage, showThingProvidePopPage, showSkillProvidePopPage, showHeartProvidePopPage, showSystemProvidePopPage } from "./threeColorDetail.js"; var checkListTotal=[]; var checkOkList={}; var checkNoList={}; var checkOkCount=0; var checkNoCount=0; function showSchoolCheckList() { showPoliceDetailData(schoolCheckList) } //显示派出所的详情数据 function showPoliceDetailData(schoolCheckList) { layuiObj.layuitable.render({ elem: '#workInclockTable', data: schoolCheckList, cols: [[ { field: 'borough', width: "10%", title: '派出所' }, { field: 'station', width: "10%", title: '学校',event:'scoreHuman'}, { field: 'timestamp', width: "10%", title: '检查时间' }, { field: 'scoreTotal', width: "10%", title: '总分',event:'scoreTotal' }, { field: 'scoreHuman', width: "10%", title: '人防',event:'scoreHuman',templet:function(res){ return `` }}, { field: 'scoreDevices', width: "10%", title: '物防' ,event:'scoreDevices',templet:function(res){ return `` }}, { field: 'scoreTech', width: "10%", title: '技防',event:'scoreTech',templet:function(res){ return `` } }, { field: 'scoreDesire', width: "10%", title: '心防',event:'scoreDesire',templet:function(res){ return `` }}, { field: 'scoreScheme', width: "10%", title: '制度防',event:'scoreScheme' ,templet:function(res){ return `` }}, ]], limit: Number.MAX_VALUE // 数据表格默认全部显示 }); layuiObj.layuitable.on('tool(workInclockTable)', function (obj) { var event=obj["event"]; var data=obj["data"]; switch(event){ case "scoreHuman"://人防 showPersonProvidePopPage(data); break; case "scoreDevices"://物防 showThingProvidePopPage(data) break; case "scoreTech"://技防 showSkillProvidePopPage(data) break; case "scoreDesire"://心防 showHeartProvidePopPage(data) break; case "scoreScheme"://制度防 showSystemProvidePopPage(data) break; default: break; } }) //监听行工具事件 // layuiObj.layuitable.on('tool(workInclockTable)', function (obj) { // checkListTotal=JSON.parse(JSON.stringify(obj["data"])); // showCheckStationDetail(checkListTotal); // }) } //显示检查的信息 function showCheckStationDetail(data) { console.log(data); checkOkCount=0; checkNoCount=0; checkNoList={}; checkOkList={}; var signatureImageSchool=data['signatureImageSchool'] var signatureImage=data['signatureImage'] layuiObj["layer"].open({ type: 1, title: `安全检查【${data["station"]}】`, //不显示标题栏 area: ['1260px', '600px'], id: new Date().getTime(), //设定一个id,防止重复弹出 btnAlign: 'c', resize: false, content: `

学校签名

没有签名

派出所签名

没有签名

检查内容

检查时间:${data["timestamp"]}

达标 (0)

未达标 (0)

    ${getCheckListLi(data)}
`, success:function(){ showViewerImg(signatureImageSchool,signatureImage); $(".checkOk").html(checkOkCount) $(".checkNo").html(checkNoCount) addCheckFilter(); } }) } //图片放大 function showViewerImg(signatureImageSchool,signatureImage){ if(signatureImageSchool!=null&&signatureImageSchool.length!=0){ new Viewer(document.getElementById(signatureImageSchool), { inline: false, // 是否启用 inline 模式 title: true, // 是否显示当前图片的标题 }) } if(signatureImage!=null&&signatureImage.length!=0){ new Viewer(document.getElementById(signatureImage), { inline: false, // 是否启用 inline 模式 title: true, // 是否显示当前图片的标题 }) } } //添加过滤 function addCheckFilter(){ $(".checkListTitle>div>p").on('click',function(){ var name=$(this).attr("name"); var state=$(this).attr("state"); if(name=="ok"){ var nextState=$(this).next().attr("state"); if(state=="open"){ $(this).children("img").attr("src","./image/checkbox1.png"); $(this).attr("state","close"); if(nextState=="open"){ var oul = getCheckListLi(checkNoList); }else{ var oul =""; } }else{ $(this).children("img").attr("src","./image/checkbox2.png"); $(this).attr("state","open"); if(nextState=="open"){ var oul = getCheckListLi(checkListTotal); }else{ var oul = getCheckListLi(checkOkList); } } }else if(name=="no"){ var prevState=$(this).prev().attr("state"); if(state=="open"){ $(this).children("img").attr("src","./image/checkbox1.png"); $(this).attr("state","close"); if(prevState=="open"){ var oul = getCheckListLi(checkOkList); }else{ var oul =""; } }else{ $(this).children("img").attr("src","./image/checkbox2.png"); $(this).attr("state","open"); if(prevState=="open"){ var oul = getCheckListLi(checkListTotal); }else{ var oul = getCheckListLi(checkNoList); } } } $(".popintellEarlyWarningInfo_right_content>ul").html(oul); }) } //获取每个li function getCheckListLi(data){ var oli = ""; for (var type in data) { var val = data[type]; var flag=0; if(type in checkStateText){ flag++; var text=checkStateText[type] } if(flag!=0){ oli += getImgLi(val,text,type); } } return oli; } function getImgLi(val,text,type) { var img1="./image/checkbox1.png"; var img2="./image/checkbox2.png"; if (val != 0) { var imgsrc = img1; var imgsrc2 = img2; checkOkCount++; if(!(type in checkOkList)){ checkOkList[type]=val; } } else { var imgsrc = img2; var imgsrc2 = img1; checkNoCount++; if(!(type in checkNoList)){ checkNoList[type]=val; } } return `
  • ${text} 1 2
  • ` } export { showSchoolCheckList }