anxiao_web/pages/video/js/schoolBaseInfo.js

166 lines
5.1 KiB
JavaScript

import { boroughInfoArr,layuiObj } from "./index.js";
import { getEntranceStaffSign,showEntranceStaffSign } from "./orgApi/getEntranceStaffSign.js";
function showSchoolBaseInfo(obj){
var div=getSchoolInfoDiv(obj);
$(".schoolBaseInfo").html(div);
$(".schoolName").html(obj["name"]);
var value= getGradeValue(obj["score_total"])
//显示文字
layuiObj["rate"].render({
elem: '.schoolInfoGrade',
value: value ,//初始值
readonly:true
});
$(".policeName").html(obj["borough"])
showBoroughInfo(obj);
}
function getSchoolInfoDiv(obj){
return `
<div class="sb_bInfo">
<div>
<p>
<span>校园地址:</span>
<span title=${obj["address"]}>${obj["address"]}</span>
</p>
<p>
<span>派出所:</span>
<span>${obj["borough"]}</span>
</p>
</div>
<div>
<p>
<span>校长:</span>
<span>${obj["legal_person"]}(${obj["legal_person_phone"]})</span>
</p>
<p>
<span>综治专干:</span>
<span>${obj["specially_police"]}(${obj["specially_police_phone"]})</span>
</p>
</div>
</div>
<div class="sb_Device">
<div>
<p>
<span>职工数量:</span>
<span>${obj["teachers"]}</span>
</p>
<p>
<span>学生数量:</span>
<span>${obj["students"]}</span>
</p>
<p>
<span>安保人员:</span>
<span>${obj["guardersmax"]}</span>
</p>
<p>
<span>校车数量:</span>
<span>${obj["schoolbus"]}</span>
</p>
</div>
<div>
<p>
<span>登记车辆:</span>
<span>${obj["vehicles"]}</span>
</p>
<p>
<span>校外监控:</span>
<span>10</span>
</p>
<p>
<span>校内监控:</span>
<span>10</span>
</p>
<p>
<span>安装率:</span>
<span>80%</span>
</p>
</div>
</div>
<div class="sb_grade">
<div>
<p>
<img src="${obj["collision"]>0?'./pages/cmddispatch/image/optionOK.png':'./pages/cmddispatch/image/optionNO.png'}" alt="">
<span>防冲撞设施</span>
</p>
<p>
<img src="${obj["sealzone"]>0?'./pages/cmddispatch/image/optionOK.png':'./pages/cmddispatch/image/optionNO.png'}" alt="">
<span>封闭式管理</span>
</p>
<p>
<img src="${obj["schoolbox"]>0?'./pages/cmddispatch/image/optionOK.png':'./pages/cmddispatch/image/optionNO.png'}" alt="">
<span>护学岗</span>
</p>
<p>
<img src="${obj["ipclinked"]>0?'./pages/cmddispatch/image/optionOK.png':'./pages/cmddispatch/image/optionNO.png'}" alt="">
<span>监控联网</span>
</p>
<p>
<img src="${obj["alarmpush"]>0?'./pages/cmddispatch/image/optionOK.png':'./pages/cmddispatch/image/optionNO.png'}" alt="">
<span>紧急报警</span>
</p>
<p>
<img src="${obj["kitchensystem"]>0?'./pages/cmddispatch/image/optionOK.png':'./pages/cmddispatch/image/optionNO.png'}" alt="">
<span>明厨亮灶</span>
</p>
</div>
</div>
`
}
function getGradeValue(score_total){
var value=0;
if(score_total<=20){
value=1;
}else if(score_total<=40){
value=2;
}else if(score_total<=60){
value=3;
}else if(score_total<=80){
value=4;
}else if(score_total<=80){
value=5;
}
return value;
}
function showBoroughInfo(obj){
var borough=obj["borough"];
var div=``;
for(var i=0;i<boroughInfoArr.length;i++){
if(boroughInfoArr[i]["borough"]==borough){
div+=`
<div class="sb_bInfo">
<div>
<p>
<span>派出所:</span>
<span>${boroughInfoArr[i]["legal_person"]}(${boroughInfoArr[i]["phone"]})</span>
</p>
<p>
<span>派出所地址:</span>
<span>${boroughInfoArr[i]["address"]}</span>
</p>
</div>
</div>
<div class="policeInfoTableBox">
<table class="layui-hide" id="policeInfoTable" lay-filter="policeInfoTable"></table>
</div>
`;
}
}
$(".policeBaseInfo").html(div);
getEntranceStaffSign(obj).then(res=>{
var code=res["data"]["code"];
if(code==0){
var data=res["data"]["data"];
showEntranceStaffSign(data)
}
})
}
export {
showSchoolBaseInfo,
getSchoolInfoDiv,
getGradeValue
}