|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
import { Router,ActivatedRoute } from '@angular/router'
|
|
|
|
declare var echarts: any;
|
|
|
|
@Component({
|
|
|
|
selector: 'app-page-two-name',
|
|
|
|
templateUrl: './page-two-name.component.html',
|
|
|
|
styleUrls: ['./page-two-name.component.scss']
|
|
|
|
})
|
|
|
|
export class PageTwoNameComponent implements OnInit {
|
|
|
|
|
|
|
|
constructor(private router:Router,private route:ActivatedRoute) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.planState()
|
|
|
|
this.planAdd()
|
|
|
|
this.passPlanEchart()
|
|
|
|
this.planMake()
|
|
|
|
this.planBack()
|
|
|
|
this.planAudit()
|
|
|
|
}, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
axisLabel = {
|
|
|
|
interval: 0,
|
|
|
|
formatter:function(value)
|
|
|
|
{
|
|
|
|
var ret = "";//拼接加\n返回的类目项
|
|
|
|
var maxLength = 2;//每项显示文字个数
|
|
|
|
var valLength = value.length;//X轴类目项的文字个数
|
|
|
|
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
|
|
|
|
if (rowN > 1)//如果类目项的文字大于3,
|
|
|
|
{
|
|
|
|
for (var i = 0; i < rowN; i++) {
|
|
|
|
var temp = "";//每次截取的字符串
|
|
|
|
var start = i * maxLength;//开始截取的位置
|
|
|
|
var end = start + maxLength;//结束截取的位置
|
|
|
|
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
|
|
|
|
temp = value.substring(start, end) + "\n";
|
|
|
|
ret += temp; //凭借最终的字符串
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}//echarts两个字换行
|
|
|
|
zhiNameData = ["浦东支队","黄埔支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"]
|
|
|
|
zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70]
|
|
|
|
//预案新增统计
|
|
|
|
planAdd () {
|
|
|
|
let _this = this
|
|
|
|
var addEchart = echarts.init(document.getElementById('addEchart'));
|
|
|
|
var option = {
|
|
|
|
title: {
|
|
|
|
text: "预案新增",
|
|
|
|
left: "center",
|
|
|
|
top: "15",
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 23
|
|
|
|
}
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
data: this.zhiNameData,
|
|
|
|
axisLabel: this.axisLabel
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'value'
|
|
|
|
},
|
|
|
|
series: [{
|
|
|
|
data: this.zhiNumData,
|
|
|
|
type: 'bar',
|
|
|
|
showBackground: true,
|
|
|
|
backgroundStyle: {
|
|
|
|
color: 'rgba(220, 220, 220, 0.8)'
|
|
|
|
},
|
|
|
|
barWidth :'28'
|
|
|
|
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
addEchart.setOption(option);
|
|
|
|
addEchart.on('click', function (params) {
|
|
|
|
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案新增"}})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//审核通过
|
|
|
|
passPlanEchart (){
|
|
|
|
let _this = this
|
|
|
|
var passPlanEchart = echarts.init(document.getElementById('passPlanEchart'));
|
|
|
|
var option = {
|
|
|
|
title: {
|
|
|
|
text: "预案审核通过",
|
|
|
|
left: "center",
|
|
|
|
top: "15",
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 23
|
|
|
|
}
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
data: this.zhiNameData,
|
|
|
|
axisLabel: this.axisLabel
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'value'
|
|
|
|
},
|
|
|
|
series: [{
|
|
|
|
data: this.zhiNumData,
|
|
|
|
type: 'bar',
|
|
|
|
showBackground: true,
|
|
|
|
backgroundStyle: {
|
|
|
|
color: 'rgba(220, 220, 220, 0.8)'
|
|
|
|
},
|
|
|
|
barWidth :'28'
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
passPlanEchart.setOption(option);
|
|
|
|
passPlanEchart.on('click', function (params) {
|
|
|
|
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案审核通过"}})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//预案编制
|
|
|
|
planMake (){
|
|
|
|
let _this = this
|
|
|
|
var passMakeEchart = echarts.init(document.getElementById('planMake'));
|
|
|
|
var option = {
|
|
|
|
title: {
|
|
|
|
text: "预案编制",
|
|
|
|
left: "center",
|
|
|
|
top: "15",
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 23
|
|
|
|
}
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
data: this.zhiNameData,
|
|
|
|
axisLabel: this.axisLabel
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'value'
|
|
|
|
},
|
|
|
|
series: [{
|
|
|
|
data: this.zhiNumData,
|
|
|
|
type: 'bar',
|
|
|
|
showBackground: true,
|
|
|
|
backgroundStyle: {
|
|
|
|
color: 'rgba(220, 220, 220, 0.8)'
|
|
|
|
},
|
|
|
|
barWidth :'28'
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
passMakeEchart.setOption(option);
|
|
|
|
passMakeEchart.on('click', function (params) {
|
|
|
|
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案编制"}})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//预案退回
|
|
|
|
planBack (){
|
|
|
|
let _this = this
|
|
|
|
var passBackEchart = echarts.init(document.getElementById('planBack'));
|
|
|
|
var option = {
|
|
|
|
title: {
|
|
|
|
text: "预案审核退回",
|
|
|
|
left: "center",
|
|
|
|
top: "15",
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 23
|
|
|
|
}
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
data: this.zhiNameData,
|
|
|
|
axisLabel: this.axisLabel
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'value'
|
|
|
|
},
|
|
|
|
series: [{
|
|
|
|
data: this.zhiNumData,
|
|
|
|
type: 'bar',
|
|
|
|
showBackground: true,
|
|
|
|
backgroundStyle: {
|
|
|
|
color: 'rgba(220, 220, 220, 0.8)'
|
|
|
|
},
|
|
|
|
barWidth :'28'
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
passBackEchart.setOption(option);
|
|
|
|
passBackEchart.on('click', function (params) {
|
|
|
|
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案审核退回"}})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//预案审核中
|
|
|
|
planAudit (){
|
|
|
|
let _this = this
|
|
|
|
var planAuditEchart = echarts.init(document.getElementById('planAudit'));
|
|
|
|
var option = {
|
|
|
|
title: {
|
|
|
|
text: "预案审核中",
|
|
|
|
left: "center",
|
|
|
|
top: "15",
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 23
|
|
|
|
}
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
data: this.zhiNameData,
|
|
|
|
axisLabel: this.axisLabel
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'value'
|
|
|
|
},
|
|
|
|
series: [{
|
|
|
|
data: this.zhiNumData,
|
|
|
|
type: 'bar',
|
|
|
|
showBackground: true,
|
|
|
|
backgroundStyle: {
|
|
|
|
color: 'rgba(220, 220, 220, 0.8)'
|
|
|
|
},
|
|
|
|
barWidth :'28'
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
planAuditEchart.setOption(option);
|
|
|
|
planAuditEchart.on('click', function (params) {
|
|
|
|
|
|
|
|
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案审核中"}})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//预案状态统计
|
|
|
|
planState(){
|
|
|
|
var shuju='[{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"},{"name":"浦东支队","number":"23","zhanbi":"21%"}]';
|
|
|
|
var jsonObj = JSON.parse(shuju);
|
|
|
|
var passPlanEchart = echarts.init(document.getElementById('pie'));
|
|
|
|
var option = {
|
|
|
|
title: {
|
|
|
|
text: '预案状态统计(7005份)',
|
|
|
|
left: 'center',
|
|
|
|
top: "11%",
|
|
|
|
textStyle: {
|
|
|
|
fontSize: 23
|
|
|
|
}
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'item',
|
|
|
|
formatter: function (params){
|
|
|
|
var res = '<div class="tishi" style="background:#FFFFFF"><span style="color:#000000;font-size:25px;padding:10px 10px">预案补充</span>'
|
|
|
|
res+='</br><table style="width:100% background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0" >';
|
|
|
|
res+='<thead><tr>';
|
|
|
|
res+='<td style="border:1px solid #000000">名称</td>';
|
|
|
|
res+='<td style="border:1px solid #000000">数量</td>'
|
|
|
|
res+='<td style="border:1px solid #000000">总占比</td>'
|
|
|
|
res+='</tr></thead>'
|
|
|
|
res+='<tbody>';
|
|
|
|
console.log(jsonObj)
|
|
|
|
for(var i=0;i<jsonObj.length;i++){
|
|
|
|
res+='<tr>'
|
|
|
|
res+='<td style="border:1px solid #000000">'+jsonObj[i].name+'</td>'
|
|
|
|
res+='<td style="border:1px solid #000000">'+jsonObj[i].number+'</td>'
|
|
|
|
res+='<td style="border:1px solid #000000">'+jsonObj[i].zhanbi+'</td></tr>'
|
|
|
|
}
|
|
|
|
res+='</tbody>'
|
|
|
|
res+='</table></div>'
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
orient: 'vertical',
|
|
|
|
right: '23%',
|
|
|
|
top: "26%",
|
|
|
|
data: ['预案新增', '预案审核通过', '预案编制', '预案审核退回', '预案审核中']
|
|
|
|
},
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
name: '访问来源',
|
|
|
|
type: 'pie',
|
|
|
|
radius: '60%',
|
|
|
|
center: ['50%', '60%'],
|
|
|
|
data: [
|
|
|
|
{value: 1585, name: '预案新增'},
|
|
|
|
{value: 2000, name: '预案审核通过'},
|
|
|
|
{value: 2600, name: '预案编制'},
|
|
|
|
{value: 1500, name: '预案审核退回'},
|
|
|
|
{value: 1800, name: '预案审核中'}
|
|
|
|
],
|
|
|
|
label: {
|
|
|
|
formatter: '{b}({c}份)\n{d|{d}%}',
|
|
|
|
rich: {
|
|
|
|
d: {
|
|
|
|
align: 'center',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
emphasis: {
|
|
|
|
itemStyle: {
|
|
|
|
shadowBlur: 10,
|
|
|
|
shadowOffsetX: 0,
|
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
passPlanEchart.setOption(option);
|
|
|
|
}
|
|
|
|
}
|