132 lines
4.1 KiB
JavaScript
132 lines
4.1 KiB
JavaScript
|
|
import {boroughGradeArr,layuiObj} from "../index.js";
|
|
import { brigade,stationurl } from "../../../../public/js/url.js";
|
|
import { policeManageScopeChart,showStationGrade } from "./getStationGrade.js";
|
|
import { showBrigadeGrade } from "./getBrigadeGrade.js";
|
|
import {
|
|
boroughSchoolChart,
|
|
brigadeSchoolChart,
|
|
brigadePostSchoolChart,
|
|
boroughPostSchoolChart,
|
|
brigadeCarSchoolChart,
|
|
boroughCarSchoolChart
|
|
} from "../carousel.js";
|
|
import { showBrigadeStationsData,showBoroughStationsData } from "./getStationsData.js";
|
|
function getBououghGrade(){
|
|
var data={
|
|
"brigade":brigade
|
|
}
|
|
var loginurl=stationurl+"/firectrl/client/statistics/boroughs_last_list";
|
|
return axios({
|
|
method: 'post',
|
|
url:loginurl,
|
|
data: data
|
|
})
|
|
}
|
|
|
|
|
|
function showBoroughGrade(){
|
|
var div="";
|
|
for(var i=0;i<boroughGradeArr.length;i++){
|
|
div+=`
|
|
<div class="sSafe_Index_rank">
|
|
<p><span>${boroughGradeArr[i]["borough"]}</span><span>(0)</span></p>
|
|
<p id="policeGrade${i}"></p>
|
|
</div>`;
|
|
}
|
|
$(".mainContentL_sSafe_box").html(div);
|
|
boroughGradeLayui();
|
|
addEventBoroughGrade();
|
|
}
|
|
|
|
//评分
|
|
function boroughGradeLayui(){
|
|
for(var i=0;i<boroughGradeArr.length;i++){
|
|
var score_total=boroughGradeArr[i]["score_total"];
|
|
var value=getGradeValue(score_total);
|
|
//显示文字
|
|
layuiObj["rate"].render({
|
|
elem: '#policeGrade'+i,
|
|
value: value ,//初始值
|
|
readonly:true
|
|
});
|
|
}
|
|
}
|
|
|
|
//添加派出所的事件
|
|
function addEventBoroughGrade(){
|
|
$(".sSafe_Index_rank").off('click')
|
|
$(".sSafe_Index_rank").on('click',function(){
|
|
var name=$(this).children("p:first-child").children("span:first-child").html();
|
|
$(this).siblings().removeClass("sSafe_Index_rank_select");
|
|
$(this).addClass("sSafe_Index_rank_select");
|
|
for(var i=0;i<boroughGradeArr.length;i++){
|
|
if(name==boroughGradeArr[i]["borough"]){
|
|
var score_total=boroughGradeArr[i]["score_total"]
|
|
var schoolInfo=JSON.parse(JSON.stringify(boroughGradeArr[i]["schoolInfo"]));
|
|
$(".systemTotal").html(score_total.toFixed(2));
|
|
$(".mainContentC_title").html(name);
|
|
$(".levelName").html(name);
|
|
boroughSchoolChart(name);
|
|
boroughPostSchoolChart(name);
|
|
boroughCarSchoolChart(name)
|
|
updateStationGrade(schoolInfo);
|
|
showBoroughStationsData(schoolInfo)
|
|
break;
|
|
}
|
|
}
|
|
})
|
|
|
|
$(".systemNameUpdate>p").off('click')
|
|
$(".systemNameUpdate>p").on('click',function(){
|
|
$(".sSafe_Index_rank").removeClass("sSafe_Index_rank_select");
|
|
$(".mainContentC_title").html("芙蓉区");
|
|
$(".levelName").html("芙蓉区");
|
|
showStationGrade();
|
|
showBrigadeGrade();
|
|
brigadeSchoolChart();
|
|
brigadePostSchoolChart();
|
|
brigadeCarSchoolChart();
|
|
showBrigadeStationsData();
|
|
})
|
|
}
|
|
|
|
|
|
function updateStationGrade(stationGradeArr){
|
|
|
|
var data=[
|
|
{ value: 0, name: '五星校园',scope:5 },
|
|
{ value: 0, name: '四星校园',scope:4 },
|
|
{ value: 0, name: '三星校园',scope:3 },
|
|
{ value: 0, name: '二星校园',scope:2 },
|
|
{ value: 0, name: '一星校园',scope:1 }
|
|
];
|
|
for(var i=0;i<stationGradeArr.length;i++){
|
|
var score_total=(stationGradeArr[i]["score_total"]).toFixed(2);
|
|
var value=getGradeValue(score_total);
|
|
for(var j=0;j<data.length;j++){
|
|
if(value==data[j]["scope"]){
|
|
data[j]["value"]++;
|
|
}
|
|
}
|
|
}
|
|
policeManageScopeChart(data,stationGradeArr);
|
|
}
|
|
|
|
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<=100){
|
|
value=5;
|
|
}
|
|
return value;
|
|
}
|
|
|
|
export {getBououghGrade,showBoroughGrade,getGradeValue} |