74 lines
2.4 KiB
JavaScript
74 lines
2.4 KiB
JavaScript
|
import {getBoroughInfo} from "./orgApi/getBoroughInfo.js";
|
||
|
import {getDetachmentInfo} from "./orgApi/getDetachmentInfo.js";
|
||
|
import {getstationcount,stationInfoPageReq,initSchoolSearchSelect} from "./orgApi/getStationInfo.js";
|
||
|
import { selectSchoolNewsGetlist} from "./orgApi/schoolNewsGetlist.js";
|
||
|
let layuiObj={};
|
||
|
let basicloginInfo={};
|
||
|
let boroughInfoArr=[];//派出所
|
||
|
let detachmentInfoArr=[];//警务室
|
||
|
let stationInfoTableList=[];
|
||
|
layui.use(['carousel','table','form','laydate','slider','element'],function() {
|
||
|
layuiObj["layer"] = layui.layer;
|
||
|
layuiObj["carousel"] = layui.carousel;
|
||
|
layuiObj["layuitable"] = layui.table;
|
||
|
layuiObj["rate"] = layui.rate;
|
||
|
layuiObj["layuiForm"] = layui.form;
|
||
|
layuiObj["laydate"] =layui.laydate;
|
||
|
layuiObj["slider"] =layui.slider;
|
||
|
layuiObj["element"] =layui.element;
|
||
|
var loginJson=sessionStorage.getItem("unameInfoStr");
|
||
|
basicloginInfo=JSON.parse(loginJson);
|
||
|
axios.defaults.headers.common['Authorization'] = basicloginInfo["session"];
|
||
|
initApi();
|
||
|
})
|
||
|
|
||
|
async function initApi(){
|
||
|
//获取派出所的信息
|
||
|
var boroughRes=await getBoroughInfo();
|
||
|
boroughInfoArr=boroughRes.data.data;
|
||
|
//获取警务区
|
||
|
var detachmentRes=await getDetachmentInfo();
|
||
|
detachmentInfoArr=detachmentRes.data.data;
|
||
|
//获取学校的信息
|
||
|
var stationcountRes=await getstationcount();
|
||
|
var stationcount=stationcountRes.data.data.count;
|
||
|
var stationlistRes= await stationInfoPageReq(stationcount)
|
||
|
stationlistRes.forEach(item=>{
|
||
|
var data=item.data.data;
|
||
|
for(let i=0;i<data.length;i++){
|
||
|
stationInfoTableList.push(data[i]);
|
||
|
}
|
||
|
initSchoolSearchSelect();
|
||
|
})
|
||
|
//获取学校的风采
|
||
|
selectSchoolNewsGetlist();
|
||
|
//计算所有的总数
|
||
|
schoolInfoTotal();
|
||
|
}
|
||
|
|
||
|
function schoolInfoTotal(){
|
||
|
var teacherCountTotal=0;
|
||
|
var roomCountTotal=0;
|
||
|
var studentCountTotal=0;
|
||
|
var guarderCountTotal=0;
|
||
|
stationInfoTableList.forEach(item=>{
|
||
|
teacherCountTotal+=item["teacherCount"];
|
||
|
roomCountTotal+=item["roomCount"];
|
||
|
studentCountTotal+=item["studentCount"];
|
||
|
guarderCountTotal+=item["guarderCount"];
|
||
|
})
|
||
|
$(".teacherCountTotal").html(teacherCountTotal);
|
||
|
$(".roomCountTotal").html(roomCountTotal);
|
||
|
$(".studentCountTotal").html(studentCountTotal);
|
||
|
$(".guarderCountTotal").html(guarderCountTotal);
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
layuiObj,
|
||
|
boroughInfoArr,
|
||
|
detachmentInfoArr,
|
||
|
stationInfoTableList
|
||
|
}
|
||
|
|
||
|
|