252 lines
9.1 KiB
JavaScript
252 lines
9.1 KiB
JavaScript
|
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 `<button type="button" class="layui-btn layui-btn-normal">${res["scoreHuman"]}/20</button>`
|
|||
|
}},
|
|||
|
{ field: 'scoreDevices', width: "10%", title: '物防' ,event:'scoreDevices',templet:function(res){
|
|||
|
return `<button type="button" class="layui-btn layui-btn-normal">${res["scoreDevices"]}/20</button>`
|
|||
|
}},
|
|||
|
{ field: 'scoreTech', width: "10%", title: '技防',event:'scoreTech',templet:function(res){
|
|||
|
return `<button type="button" class="layui-btn layui-btn-normal">${res["scoreTech"]}/30</button>`
|
|||
|
} },
|
|||
|
{ field: 'scoreDesire', width: "10%", title: '心防',event:'scoreDesire',templet:function(res){
|
|||
|
return `<button type="button" class="layui-btn layui-btn-normal">${res["scoreDesire"]}/10</button>`
|
|||
|
}},
|
|||
|
{ field: 'scoreScheme', width: "10%", title: '制度防',event:'scoreScheme' ,templet:function(res){
|
|||
|
return `<button type="button" class="layui-btn layui-btn-normal">${res["scoreScheme"]}/20</button>`
|
|||
|
}},
|
|||
|
|
|||
|
]],
|
|||
|
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: `
|
|||
|
<div class="popintellEarlyWarningInfo">
|
|||
|
<div class="dailyInspectionContent">
|
|||
|
<div class="popintellEarlyWarningInfo_left">
|
|||
|
<p>学校签名</p>
|
|||
|
<div class="schoolSign">
|
|||
|
<img src="${signatureImageSchool}" id="${signatureImageSchool}" alt="没有签名">
|
|||
|
</div>
|
|||
|
<p>派出所签名</p>
|
|||
|
<div class="policeSign">
|
|||
|
<img src="${signatureImage}" id="${signatureImage}" alt="没有签名">
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="popintellEarlyWarningInfo_right">
|
|||
|
<div class="checkListTitle">
|
|||
|
<p>检查内容</p>
|
|||
|
<div>
|
|||
|
<p>检查时间:${data["timestamp"]}<p>
|
|||
|
<p name="ok" state="open">
|
|||
|
<img src="./image/checkbox2.png">
|
|||
|
<span>达标</span>
|
|||
|
<span class="checkOk">(0)</span>
|
|||
|
</p>
|
|||
|
<p name="no" state="open">
|
|||
|
<img src="./image/checkbox2.png">
|
|||
|
<span>未达标</span>
|
|||
|
<span class="checkNo">(0)</span>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="popintellEarlyWarningInfo_right_content">
|
|||
|
<ul>
|
|||
|
${getCheckListLi(data)}
|
|||
|
</ul>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>`,
|
|||
|
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 `<li>
|
|||
|
<span>${text}</span>
|
|||
|
<span>
|
|||
|
<img src="${imgsrc2}" alt="1"><span>是</span>
|
|||
|
<img src="${imgsrc}" alt="2"><span>否</span>
|
|||
|
</span>
|
|||
|
</li>`
|
|||
|
}
|
|||
|
|
|||
|
export {
|
|||
|
showSchoolCheckList
|
|||
|
}
|