Browse Source

[完善] echarts预案状态分析基本完成

master
陈鹏飞 4 years ago
parent
commit
d82433cadb
  1. 3
      src/app/statistic-analysis/echarts-data.service.ts
  2. 4
      src/app/statistic-analysis/state/page-two-name/page-two-name.component.html
  3. 12
      src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts
  4. 16
      src/app/statistic-analysis/state/page-two-time/echarts.html
  5. 8
      src/app/statistic-analysis/state/page-two-time/page-two-time.component.html
  6. 49
      src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts

3
src/app/statistic-analysis/echarts-data.service.ts

@ -9,7 +9,8 @@ export class EchartsDataService {
//预案状态分析 //预案状态分析
statefulInspectionName:string; statefulInspectionName:string;
statefulInspectionToggle:boolean = true; // true=显示所有柱状图 flase=显示当前点击柱状图
} }

4
src/app/statistic-analysis/state/page-two-name/page-two-name.component.html

@ -1,4 +1,4 @@
<div class="echartsBox" [hidden]="!isTrue"> <div class="echartsBox" [hidden]="!data.statefulInspectionToggle">
<div id="pie"> <div id="pie">
</div> </div>
@ -30,4 +30,4 @@
</div> </div>
</div> </div>
<app-page-zhong-dui-details #zhongDuiChild *ngIf="!isTrue"></app-page-zhong-dui-details> <app-page-zhong-dui-details #zhongDuiChild *ngIf="!data.statefulInspectionToggle"></app-page-zhong-dui-details>

12
src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts

@ -53,7 +53,7 @@ export class PageTwoNameComponent implements OnInit {
}//echarts两个字换行 }//echarts两个字换行
zhiNameData = ["浦东支队","黄埔支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"] zhiNameData = ["浦东支队","黄埔支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"]
zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70] zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70]
isTrue = true
//预案新增统计 //预案新增统计
planAdd () { planAdd () {
let _this = this let _this = this
@ -89,7 +89,7 @@ export class PageTwoNameComponent implements OnInit {
addEchart.setOption(option); addEchart.setOption(option);
addEchart.on('click', function (params) { addEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案新增' _this.data.statefulInspectionName = '预案新增'
_this.isTrue = !_this.isTrue _this.data.statefulInspectionToggle = false
}); });
} }
//预案审核通过 //预案审核通过
@ -126,7 +126,7 @@ export class PageTwoNameComponent implements OnInit {
passPlanEchart.setOption(option); passPlanEchart.setOption(option);
passPlanEchart.on('click', function (params) { passPlanEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案审核通过' _this.data.statefulInspectionName = '预案审核通过'
_this.isTrue = !_this.isTrue _this.data.statefulInspectionToggle = false
}); });
} }
@ -164,7 +164,7 @@ export class PageTwoNameComponent implements OnInit {
passMakeEchart.setOption(option); passMakeEchart.setOption(option);
passMakeEchart.on('click', function (params) { passMakeEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案编制' _this.data.statefulInspectionName = '预案编制'
_this.isTrue = !_this.isTrue _this.data.statefulInspectionToggle = false
}); });
} }
@ -202,7 +202,7 @@ export class PageTwoNameComponent implements OnInit {
passBackEchart.setOption(option); passBackEchart.setOption(option);
passBackEchart.on('click', function (params) { passBackEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案审核退回' _this.data.statefulInspectionName = '预案审核退回'
_this.isTrue = !_this.isTrue _this.data.statefulInspectionToggle = false
}); });
} }
@ -240,7 +240,7 @@ export class PageTwoNameComponent implements OnInit {
planAuditEchart.setOption(option); planAuditEchart.setOption(option);
planAuditEchart.on('click', function (params) { planAuditEchart.on('click', function (params) {
_this.data.statefulInspectionName = '预案审核中' _this.data.statefulInspectionName = '预案审核中'
_this.isTrue = !_this.isTrue _this.data.statefulInspectionToggle = false
}); });
} }
//预案状态统计 //预案状态统计

16
src/app/statistic-analysis/state/page-two-time/echarts.html

@ -1,7 +1,9 @@
<app-page-zhong-dui-details *ngIf="!toggle"></app-page-zhong-dui-details> <app-page-zhong-dui-details *ngIf="!echartsData.statefulInspectionToggle"></app-page-zhong-dui-details>
<div style="height: 450px;width: 50%;margin: 0 auto;" id="one" [hidden]="!toggle"></div> <div [hidden]="!echartsData.statefulInspectionToggle">
<div class="publicCss" id="two" [hidden]="!toggle"></div> <div style="height: 450px;width: 50%;margin: 0 auto;" id="one"></div>
<div class="publicCss" id="three" [hidden]="!toggle"></div> <div class="publicCss" id="two"></div>
<div class="publicCss" id="four" [hidden]="!toggle"></div> <div class="publicCss" id="three"></div>
<div class="publicCss" id="five" [hidden]="!toggle"></div> <div class="publicCss" id="four"></div>
<div class="publicCss" id="six" [hidden]="!toggle"></div> <div class="publicCss" id="five"></div>
<div class="publicCss" id="six"></div>
</div>

8
src/app/statistic-analysis/state/page-two-time/page-two-time.component.html

@ -8,14 +8,14 @@
<label style="margin-right: 10px;">开始时间:</label> <label style="margin-right: 10px;">开始时间:</label>
<input matInput [matDatepicker]="start" placeholder="请选择开始时间" readonly (dateChange)="startEvent($event)" [formControl]='startTime'> <input matInput [matDatepicker]="start" placeholder="请选择开始时间" readonly (dateChange)="startEvent($event)" [formControl]='startTime'>
<mat-datepicker-toggle matSuffix [for]="start"></mat-datepicker-toggle> <mat-datepicker-toggle matSuffix [for]="start"></mat-datepicker-toggle>
<mat-datepicker #start></mat-datepicker> <mat-datepicker #start startView="multi-year"></mat-datepicker>
</div> </div>
<div class="queryField"> <div class="queryField">
<label style="margin-right: 10px;">结束时间:</label> <label style="margin-right: 10px;">结束时间:</label>
<input matInput [matDatepicker]="end" placeholder="请选择结束时间" readonly (dateChange)="endEvent($event)" [formControl]='endTime'> <input matInput [matDatepicker]="end" placeholder="请选择结束时间" readonly (dateChange)="endEvent($event)" [formControl]='endTime'>
<mat-datepicker-toggle matSuffix [for]="end"></mat-datepicker-toggle> <mat-datepicker-toggle matSuffix [for]="end"></mat-datepicker-toggle>
<mat-datepicker #end></mat-datepicker> <mat-datepicker #end startView="multi-year"></mat-datepicker>
</div> </div>
<div class="btnbox" style="margin-left: 30px;"> <div class="btnbox" style="margin-left: 30px;">
@ -32,8 +32,8 @@
<div class="echarts"> <div class="echarts">
<div class="center"> <div class="center">
<app-echarts *ngIf="!isQuery" #echarts></app-echarts> <app-echarts *ngIf="!isQuery" #appEcharts></app-echarts>
<app-page-two-name *ngIf="isQuery"></app-page-two-name> <app-page-two-name *ngIf="isQuery" #pageTwoName></app-page-two-name>
</div> </div>
</div> </div>

49
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 { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { DateAdapter } from '@angular/material/core'; 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; declare var echarts: any;
@Component({ @Component({
@ -12,28 +14,34 @@ declare var echarts: any;
}) })
export class PageTwoTimeComponent implements OnInit { export class PageTwoTimeComponent implements OnInit {
constructor(public snackBar: MatSnackBar,private adapter: DateAdapter<any>,) { } constructor(public snackBar: MatSnackBar,private adapter: DateAdapter<any>,public echartsData:EchartsDataService) { }
@ViewChild('echarts') echarts:echartsComponent; //父组件中获得子组件的引用 @ViewChild('appEcharts')appEcharts :echartsComponent; //父组件中获得子组件的引用
@ViewChild('pageTwoName')pageTwoName :PageTwoNameComponent; //父组件中获得子组件的引用
ngOnInit(): void { ngOnInit(): void {
this.startTime = new FormControl( (new Date()).getFullYear()+ '-' + '01' + '-' + '01' ) this.startTime = new FormControl( (new Date()).getFullYear()-10 )
this.endTime = new FormControl( new Date() ) this.endTime = new FormControl( (new Date()).getFullYear() )
this.adapter.setLocale('CH') this.adapter.setLocale('CH')
} }
isQuery:boolean = true; //横纵向查询 isQuery:boolean = true; //横纵向查询
//查询
query () { query () {
this.echarts.toggleEcharts()
} }
//shao
toggleTrue () { toggleTrue () {
this.isQuery = true this.isQuery = true
this.echartsData.statefulInspectionToggle = true
} }
//chen
toggleFalse () { toggleFalse () {
this.isQuery = false this.isQuery = false
this.echartsData.statefulInspectionToggle = true
} }
startTime:any; //查询开始时间 startTime:any; //查询开始时间
@ -95,7 +103,7 @@ export class PageTwoTimeComponent implements OnInit {
}) })
export class echartsComponent implements OnInit { export class echartsComponent implements OnInit {
constructor(public snackBar: MatSnackBar,private adapter: DateAdapter<any>,) { } constructor(public snackBar: MatSnackBar,private adapter: DateAdapter<any>,public echartsData:EchartsDataService) { }
ngOnInit(): void { ngOnInit(): void {
window.setTimeout(()=>{ window.setTimeout(()=>{
@ -108,11 +116,7 @@ export class echartsComponent implements OnInit {
},0) },0)
} }
toggle:boolean = true;//切换
toggleEcharts () {
this.toggle = !this.toggle
}
oneInit () { oneInit () {
var chartQusj = echarts.init(document.getElementById('one'), 'skinUpp'); var chartQusj = echarts.init(document.getElementById('one'), 'skinUpp');
@ -191,6 +195,7 @@ export class echartsComponent implements OnInit {
} }
twoInit () { twoInit () {
let that = this
var chartQusj = echarts.init(document.getElementById('two'), 'skinUpp'); var chartQusj = echarts.init(document.getElementById('two'), 'skinUpp');
var option = { var option = {
grid: { grid: {
@ -257,9 +262,14 @@ export class echartsComponent implements OnInit {
], ],
}; };
chartQusj.setOption(option); chartQusj.setOption(option);
chartQusj.on('click', function (params) {
that.echartsData.statefulInspectionName = '预案新增'
that.echartsData.statefulInspectionToggle = false
});
} }
threeInit () { threeInit () {
let that = this
var chartQusj = echarts.init(document.getElementById('three'), 'skinUpp'); var chartQusj = echarts.init(document.getElementById('three'), 'skinUpp');
var option = { var option = {
grid: { grid: {
@ -326,9 +336,14 @@ export class echartsComponent implements OnInit {
], ],
}; };
chartQusj.setOption(option); chartQusj.setOption(option);
chartQusj.on('click', function (params) {
that.echartsData.statefulInspectionName = '预案审核通过'
that.echartsData.statefulInspectionToggle = false
});
} }
fourInit () { fourInit () {
let that = this
var chartQusj = echarts.init(document.getElementById('four'), 'skinUpp'); var chartQusj = echarts.init(document.getElementById('four'), 'skinUpp');
var option = { var option = {
grid: { grid: {
@ -395,9 +410,14 @@ export class echartsComponent implements OnInit {
], ],
}; };
chartQusj.setOption(option); chartQusj.setOption(option);
chartQusj.on('click', function (params) {
that.echartsData.statefulInspectionName = '预案编制'
that.echartsData.statefulInspectionToggle = false
});
} }
fiveInit () { fiveInit () {
let that = this
var chartQusj = echarts.init(document.getElementById('five'), 'skinUpp'); var chartQusj = echarts.init(document.getElementById('five'), 'skinUpp');
var option = { var option = {
grid: { grid: {
@ -464,9 +484,14 @@ export class echartsComponent implements OnInit {
], ],
}; };
chartQusj.setOption(option); chartQusj.setOption(option);
chartQusj.on('click', function (params) {
that.echartsData.statefulInspectionName = '预案审核退回'
that.echartsData.statefulInspectionToggle = false
});
} }
sixInit () { sixInit () {
let that = this
var chartQusj = echarts.init(document.getElementById('six'), 'skinUpp'); var chartQusj = echarts.init(document.getElementById('six'), 'skinUpp');
var option = { var option = {
grid: { grid: {
@ -533,6 +558,10 @@ export class echartsComponent implements OnInit {
], ],
}; };
chartQusj.setOption(option); chartQusj.setOption(option);
chartQusj.on('click', function (params) {
that.echartsData.statefulInspectionName = '预案审核中'
that.echartsData.statefulInspectionToggle = false
});
} }

Loading…
Cancel
Save