diff --git a/src/app/statistic-analysis/echarts-data.service.ts b/src/app/statistic-analysis/echarts-data.service.ts new file mode 100644 index 0000000..829e562 --- /dev/null +++ b/src/app/statistic-analysis/echarts-data.service.ts @@ -0,0 +1,15 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class EchartsDataService { + + constructor() { } + + //预案状态分析 + statefulInspectionName:string; + + + +} diff --git a/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts b/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts index 3d60f7b..bfebea3 100644 --- a/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts +++ b/src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { Router,ActivatedRoute } from '@angular/router' import { PageZhongDuiDetailsComponent } from '../page-zhong-dui-details/page-zhong-dui-details.component'; +import {EchartsDataService} from '../../echarts-data.service' declare var echarts: any; @Component({ selector: 'app-page-two-name', @@ -9,7 +10,7 @@ declare var echarts: any; }) export class PageTwoNameComponent implements OnInit { - constructor(private router:Router,private route:ActivatedRoute) { } + constructor(private router:Router,private route:ActivatedRoute,public data:EchartsDataService) { } @ViewChild('zhongDuiChild') zhongDuiChild:PageZhongDuiDetailsComponent; //父组件中获得子组件的引用 @@ -87,8 +88,8 @@ export class PageTwoNameComponent implements OnInit { }; addEchart.setOption(option); addEchart.on('click', function (params) { + _this.data.statefulInspectionName = '预案新增' _this.isTrue = !_this.isTrue - _this.zhongDuiChild.detailEcharts("预案新增") }); } //预案审核通过 @@ -124,8 +125,8 @@ export class PageTwoNameComponent implements OnInit { }; passPlanEchart.setOption(option); passPlanEchart.on('click', function (params) { + _this.data.statefulInspectionName = '预案审核通过' _this.isTrue = !_this.isTrue - _this.zhongDuiChild.detailEcharts("预案审核通过") }); } @@ -162,8 +163,8 @@ export class PageTwoNameComponent implements OnInit { }; passMakeEchart.setOption(option); passMakeEchart.on('click', function (params) { + _this.data.statefulInspectionName = '预案编制' _this.isTrue = !_this.isTrue - _this.zhongDuiChild.detailEcharts("预案编制") }); } @@ -200,8 +201,8 @@ export class PageTwoNameComponent implements OnInit { }; passBackEchart.setOption(option); passBackEchart.on('click', function (params) { + _this.data.statefulInspectionName = '预案审核退回' _this.isTrue = !_this.isTrue - _this.zhongDuiChild.detailEcharts("预案审核退回") }); } @@ -238,8 +239,8 @@ export class PageTwoNameComponent implements OnInit { }; planAuditEchart.setOption(option); planAuditEchart.on('click', function (params) { + _this.data.statefulInspectionName = '预案审核中' _this.isTrue = !_this.isTrue - _this.zhongDuiChild.detailEcharts("预案审核中") }); } //预案状态统计 diff --git a/src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts b/src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts index 074163e..ff89e8b 100644 --- a/src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts +++ b/src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; +import {EchartsDataService} from '../../echarts-data.service' declare var echarts: any; @Component({ selector: 'app-page-zhong-dui-details', @@ -8,19 +9,22 @@ declare var echarts: any; }) export class PageZhongDuiDetailsComponent implements OnInit { - constructor( public route: ActivatedRoute) { } + constructor( public route: ActivatedRoute,public data: EchartsDataService) { } zhongNameData = ["浦东中队","黄埔中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] zhongNumData = [200,190,180,170,160,150,140,130,120,110,100] ngOnInit(): void { + window.setTimeout(()=>{ + this.detailEcharts() + }) } - detailEcharts(title){ + detailEcharts(){ var detailPlanEchart = echarts.init(document.getElementById('detailBox')); var option = { title: { - text: title, + text: this.data.statefulInspectionName, left: "center", textStyle: { fontSize: 28