diff --git a/src/app/statistic-analysis/echarts-data.service.ts b/src/app/statistic-analysis/echarts-data.service.ts index 829e562..b6a0ca3 100644 --- a/src/app/statistic-analysis/echarts-data.service.ts +++ b/src/app/statistic-analysis/echarts-data.service.ts @@ -9,7 +9,8 @@ export class EchartsDataService { //预案状态分析 statefulInspectionName:string; + statefulInspectionToggle:boolean = true; // true=显示所有柱状图 flase=显示当前点击柱状图 + - } diff --git a/src/app/statistic-analysis/state/page-two-name/page-two-name.component.html b/src/app/statistic-analysis/state/page-two-name/page-two-name.component.html index 969dc20..34eb310 100644 --- a/src/app/statistic-analysis/state/page-two-name/page-two-name.component.html +++ b/src/app/statistic-analysis/state/page-two-name/page-two-name.component.html @@ -1,4 +1,4 @@ -
+
@@ -30,4 +30,4 @@
- + 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 f318b3e..f568815 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 @@ -64,7 +64,7 @@ export class PageTwoNameComponent implements OnInit { zhiNameData = ["浦东支队","黄埔支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"] zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70] - isTrue = true + //预案新增统计 planAdd () { let _this = this @@ -100,7 +100,7 @@ export class PageTwoNameComponent implements OnInit { addEchart.setOption(option); addEchart.on('click', function (params) { _this.data.statefulInspectionName = '预案新增' - _this.isTrue = !_this.isTrue + _this.data.statefulInspectionToggle = false }); } //预案审核通过 @@ -138,7 +138,7 @@ export class PageTwoNameComponent implements OnInit { passPlanEchart.setOption(option); passPlanEchart.on('click', function (params) { _this.data.statefulInspectionName = '预案审核通过' - _this.isTrue = !_this.isTrue + _this.data.statefulInspectionToggle = false }); } @@ -177,7 +177,7 @@ export class PageTwoNameComponent implements OnInit { passMakeEchart.setOption(option); passMakeEchart.on('click', function (params) { _this.data.statefulInspectionName = '预案编制' - _this.isTrue = !_this.isTrue + _this.data.statefulInspectionToggle = false }); } @@ -216,7 +216,7 @@ export class PageTwoNameComponent implements OnInit { passBackEchart.setOption(option); passBackEchart.on('click', function (params) { _this.data.statefulInspectionName = '预案审核退回' - _this.isTrue = !_this.isTrue + _this.data.statefulInspectionToggle = false }); } @@ -255,7 +255,7 @@ export class PageTwoNameComponent implements OnInit { planAuditEchart.setOption(option); planAuditEchart.on('click', function (params) { _this.data.statefulInspectionName = '预案审核中' - _this.isTrue = !_this.isTrue + _this.data.statefulInspectionToggle = false }); } //预案状态统计 diff --git a/src/app/statistic-analysis/state/page-two-time/echarts.html b/src/app/statistic-analysis/state/page-two-time/echarts.html index 9f63ef7..22d2c00 100644 --- a/src/app/statistic-analysis/state/page-two-time/echarts.html +++ b/src/app/statistic-analysis/state/page-two-time/echarts.html @@ -1,7 +1,9 @@ - -
-
-
-
-
-
\ No newline at end of file + +
+
+
+
+
+
+
+
diff --git a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html index b56df0a..885bdf7 100644 --- a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html +++ b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.html @@ -8,14 +8,14 @@ - +
- +
@@ -32,8 +32,8 @@
- - + +
diff --git a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts index 63958b7..b26dd39 100644 --- a/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts +++ b/src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts @@ -3,6 +3,8 @@ import { MatDatepickerInputEvent } from '@angular/material/datepicker'; import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; import { FormControl } from '@angular/forms'; import { DateAdapter } from '@angular/material/core'; +import { PageTwoNameComponent } from '../page-two-name/page-two-name.component'; +import {EchartsDataService} from '../../echarts-data.service' declare var echarts: any; @Component({ @@ -12,28 +14,34 @@ declare var echarts: any; }) export class PageTwoTimeComponent implements OnInit { - constructor(public snackBar: MatSnackBar,private adapter: DateAdapter,) { } + constructor(public snackBar: MatSnackBar,private adapter: DateAdapter,public echartsData:EchartsDataService) { } - @ViewChild('echarts') echarts:echartsComponent; //父组件中获得子组件的引用 + @ViewChild('appEcharts')appEcharts :echartsComponent; //父组件中获得子组件的引用 + @ViewChild('pageTwoName')pageTwoName :PageTwoNameComponent; //父组件中获得子组件的引用 ngOnInit(): void { - this.startTime = new FormControl( (new Date()).getFullYear()+ '-' + '01' + '-' + '01' ) - this.endTime = new FormControl( new Date() ) + this.startTime = new FormControl( (new Date()).getFullYear()-10 ) + this.endTime = new FormControl( (new Date()).getFullYear() ) this.adapter.setLocale('CH') } isQuery:boolean = true; //横纵向查询 + //查询 query () { - this.echarts.toggleEcharts() + } + //shao toggleTrue () { this.isQuery = true + this.echartsData.statefulInspectionToggle = true } + //chen toggleFalse () { this.isQuery = false + this.echartsData.statefulInspectionToggle = true } startTime:any; //查询开始时间 @@ -95,7 +103,7 @@ export class PageTwoTimeComponent implements OnInit { }) export class echartsComponent implements OnInit { - constructor(public snackBar: MatSnackBar,private adapter: DateAdapter,) { } + constructor(public snackBar: MatSnackBar,private adapter: DateAdapter,public echartsData:EchartsDataService) { } ngOnInit(): void { window.setTimeout(()=>{ @@ -108,11 +116,7 @@ export class echartsComponent implements OnInit { },0) } - toggle:boolean = true;//切换 - toggleEcharts () { - this.toggle = !this.toggle - } oneInit () { var chartQusj = echarts.init(document.getElementById('one'), 'skinUpp'); @@ -191,6 +195,7 @@ export class echartsComponent implements OnInit { } twoInit () { + let that = this var chartQusj = echarts.init(document.getElementById('two'), 'skinUpp'); var option = { grid: { @@ -257,9 +262,14 @@ export class echartsComponent implements OnInit { ], }; chartQusj.setOption(option); + chartQusj.on('click', function (params) { + that.echartsData.statefulInspectionName = '预案新增' + that.echartsData.statefulInspectionToggle = false + }); } threeInit () { + let that = this var chartQusj = echarts.init(document.getElementById('three'), 'skinUpp'); var option = { grid: { @@ -326,9 +336,14 @@ export class echartsComponent implements OnInit { ], }; chartQusj.setOption(option); + chartQusj.on('click', function (params) { + that.echartsData.statefulInspectionName = '预案审核通过' + that.echartsData.statefulInspectionToggle = false + }); } fourInit () { + let that = this var chartQusj = echarts.init(document.getElementById('four'), 'skinUpp'); var option = { grid: { @@ -395,9 +410,14 @@ export class echartsComponent implements OnInit { ], }; chartQusj.setOption(option); + chartQusj.on('click', function (params) { + that.echartsData.statefulInspectionName = '预案编制' + that.echartsData.statefulInspectionToggle = false + }); } fiveInit () { + let that = this var chartQusj = echarts.init(document.getElementById('five'), 'skinUpp'); var option = { grid: { @@ -464,9 +484,14 @@ export class echartsComponent implements OnInit { ], }; chartQusj.setOption(option); + chartQusj.on('click', function (params) { + that.echartsData.statefulInspectionName = '预案审核退回' + that.echartsData.statefulInspectionToggle = false + }); } sixInit () { + let that = this var chartQusj = echarts.init(document.getElementById('six'), 'skinUpp'); var option = { grid: { @@ -533,6 +558,10 @@ export class echartsComponent implements OnInit { ], }; chartQusj.setOption(option); + chartQusj.on('click', function (params) { + that.echartsData.statefulInspectionName = '预案审核中' + that.echartsData.statefulInspectionToggle = false + }); }