上海预案管理平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

148 lines
5.5 KiB

/*
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2020-09-01 15:24:39
* @LastEditors: sueRimn
* @LastEditTime: 2020-11-10 14:35:31
*/
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import {EchartsDataService,} from '../../echarts-data.service'
declare var echarts: any;
@Component({
selector: 'app-page-one',
templateUrl: './page-one.component.html',
styleUrls: ['./page-one.component.scss']
})
export class PageOneComponent implements OnInit {
options:any;
constructor(private router: Router,public echartsData:EchartsDataService) { }
ngOnInit() {
window.setTimeout(()=>{
this.initCharts()
},0)
}
ngOnDestroy(): void {
this.indexBzt.clear()
this.indexBzt.dispose()
}
/* 饼状图跳转 */
/* 首页饼状图 */
indexBzt
initCharts(){
var ec = echarts as any;
this.indexBzt = ec.init(document.getElementById('indexBzt'),'walden');
var options={
title: {
text: '预案状态统计(7005家)',
top: "7%",
left: 'center',
textStyle:{
fontSize:31
}
},
tooltip: {
trigger: 'item',
formatter: (params)=>{
return this.echartsData.biaogeTishiZhi(params.name)
}
},
legend: {
orient: 'vertical',
right: 150,
top:80,
//padding:20,
// itemWidth:60,
// itemHeight:25,
textStyle:{
fontSize:18,
color:"#000000"
},
data: ['预案新增', '预案审核通过', '预案编制', '预案审核退回', '预案审核中']
},
series: [
{
name: '访问来源',
type: 'pie',
radius: '60%',
center: ['50%', '50%'],
label:{
normal:{
show:true,
// position: 'inner',
fontSize:18,
formatter:'{b} {c}份\n({d}%)',
},
rich: {
d: {
align: 'center',
}
},
},
data: [
{value: 1585, name: '预案新增'},
{value: 2000, name: '预案审核通过',itemStyle:{color:'#02A7F0'}},
{value: 2600, name: '预案编制'},
{value: 1500, name: '预案审核退回'},
{value: 1800, name: '预案审核中'}
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
this.indexBzt.on('click', (params) => {
this.router.navigateByUrl('/statisticanalysis/statePageOne/time');
});
this.indexBzt.setOption(options);
}
/**
* @name: 表格提示框封装
* @test: test font
* @msg:
* @param {string(表头)}
* @return {type}
*/
biaogeTishi(biaotou:string){
var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},'
shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},'
shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},'
shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]'
var jsonObj = JSON.parse(shuju);
var res = '<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#000000;font-size:30px;text-align: center;display:block;">'+biaotou+'</span></div>'
res+='</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >';
res+='<thead><tr>';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>'
res+='<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>'
res+='</tr></thead>'
res+='<tbody>';
for(var i=0;i<jsonObj.length;i++){
res+='<tr>'
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].name+'</td>'
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].number+'</td>'
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].zhanbi+'</td></tr>'
}
res+='</tbody>'
res+='<tfoot><td style="text-align:center;border:1px solid #000000"></td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>'
res+='</table></div></div>'
return res
}
}