117 lines
3.7 KiB
JavaScript
117 lines
3.7 KiB
JavaScript
import { stationurl,brigade } from "../../../../public/js/url.js";
|
||
import { stationGradeArr } from "../index.js";
|
||
import { getGradeValue } from "./getBoroughGrade.js";
|
||
var sManage_box_echart=null;
|
||
function getStationGrade(){
|
||
var data={
|
||
"brigade":brigade
|
||
}
|
||
var loginurl=stationurl+"/firectrl/client/statistics/stations_last_list";
|
||
return axios({
|
||
method: 'post',
|
||
url:loginurl,
|
||
data: data
|
||
})
|
||
}
|
||
|
||
function showStationGrade(){
|
||
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 policeManageScopeChart(data,stationGradeArr){
|
||
var option={
|
||
color: ['#02b4fe', '#e7b554', '#6877f8', '#77a871', '#ee6666', '#73c0de',],
|
||
tooltip: {
|
||
trigger: 'item'
|
||
},
|
||
legend: {
|
||
top: '15%',
|
||
right: '60px',
|
||
icon: 'circle',
|
||
width: '200px',
|
||
orient: 'horizontal', // 排列方式 horizontal(水平) vertical(垂直)
|
||
itemHeight: 10, // 控制小圆点的大小
|
||
itemWidth: 12,
|
||
itemGap: 20,
|
||
textStyle: {
|
||
color: '#fff', // 文字颜色
|
||
lineHeight: 16,
|
||
fontFamily: 'myRegular',
|
||
backgroundColor: "transparent"
|
||
},
|
||
formatter: (name) => {
|
||
let total = 0 // 总数,用来计算百分比
|
||
let number = 0 // 数字
|
||
let pec = 0 // 百分比
|
||
for (let i = 0; i < data.length; i++) {
|
||
total += data[i].value
|
||
}
|
||
for (let i = 0; i < data.length; i++) {
|
||
if (data[i].name == name) {
|
||
number = data[i].value
|
||
pec = (number / total * 100).toFixed(2)
|
||
}
|
||
}
|
||
return [
|
||
`${name}`,
|
||
`${number} (${pec})%`,
|
||
].join("\n");
|
||
}
|
||
},
|
||
title: { // 用title显示环中间固定的文字
|
||
text: stationGradeArr.length, // \n 换行
|
||
subtext: '校园数量', // 子标题
|
||
top: '40%',
|
||
left: '24%',
|
||
textAlign: 'center', // 字体居中对齐
|
||
textStyle: {
|
||
color: '#fff',
|
||
fontSize:24,
|
||
lineHeight:10,
|
||
fontWeight: 'normal',
|
||
},
|
||
subtextStyle: { // 子标题样式
|
||
color: '#fff',
|
||
fontSize: 14,
|
||
fontFamily: 'myRegular'
|
||
}
|
||
},
|
||
series: [
|
||
{
|
||
type: 'pie',
|
||
radius: ['70%', '90%'],
|
||
center: ['25%', '55%'], // 环形图中心点
|
||
label: {
|
||
show: false,
|
||
},
|
||
data: data
|
||
}
|
||
]
|
||
}
|
||
threeColorTotalEchat = echarts.init(document.getElementById('threeColorTotalEchat'));
|
||
//使用制定的配置项和数据显示图表
|
||
threeColorTotalEchat.setOption(option);
|
||
}
|
||
|
||
|
||
export {
|
||
getStationGrade,
|
||
showStationGrade,
|
||
policeManageScopeChart
|
||
} |