Browse Source

[完善]中队页面嵌套在支队页面中,修改传入title方法

master
邵佳豪 4 years ago
parent
commit
36f4e3f25b
  1. 6
      src/app/statistic-analysis/state/page-two-name/page-two-name.component.html
  2. 1
      src/app/statistic-analysis/state/page-two-name/page-two-name.component.scss
  3. 31
      src/app/statistic-analysis/state/page-two-name/page-two-name.component.ts
  4. 20
      src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts

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

@ -1,4 +1,4 @@
<div class="echartsBox"> <div class="echartsBox" [hidden]="!isTrue">
<div id="pie"> <div id="pie">
</div> </div>
@ -28,4 +28,6 @@
</div> </div>
</div> </div>
</div>
</div>
<app-page-zhong-dui-details #zhongDuiChild></app-page-zhong-dui-details>

1
src/app/statistic-analysis/state/page-two-name/page-two-name.component.scss

@ -1,6 +1,7 @@
.echartsBox{ .echartsBox{
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow-y: auto;
#pie{ #pie{
width: 100%; width: 100%;
height: 450px; height: 450px;

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

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router' import { Router,ActivatedRoute } from '@angular/router'
import { PageZhongDuiDetailsComponent } from '../page-zhong-dui-details/page-zhong-dui-details.component';
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-page-two-name', selector: 'app-page-two-name',
@ -7,10 +8,13 @@ declare var echarts: any;
styleUrls: ['./page-two-name.component.scss'] styleUrls: ['./page-two-name.component.scss']
}) })
export class PageTwoNameComponent implements OnInit { export class PageTwoNameComponent implements OnInit {
constructor(private router:Router,private route:ActivatedRoute) { } constructor(private router:Router,private route:ActivatedRoute) { }
@ViewChild('zhongDuiChild') zhongDuiChild:PageZhongDuiDetailsComponent; //父组件中获得子组件的引用
ngOnInit(): void { ngOnInit(): void {
setTimeout(() => { setTimeout(() => {
this.planState() this.planState()
this.planAdd() this.planAdd()
@ -48,6 +52,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
@ -82,10 +87,11 @@ export class PageTwoNameComponent implements OnInit {
}; };
addEchart.setOption(option); addEchart.setOption(option);
addEchart.on('click', function (params) { addEchart.on('click', function (params) {
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案新增"}}) _this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案新增")
}); });
} }
//审核通过 //预案审核通过
passPlanEchart (){ passPlanEchart (){
let _this = this let _this = this
var passPlanEchart = echarts.init(document.getElementById('passPlanEchart')); var passPlanEchart = echarts.init(document.getElementById('passPlanEchart'));
@ -118,7 +124,8 @@ export class PageTwoNameComponent implements OnInit {
}; };
passPlanEchart.setOption(option); passPlanEchart.setOption(option);
passPlanEchart.on('click', function (params) { passPlanEchart.on('click', function (params) {
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案审核通过"}}) _this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案审核通过")
}); });
} }
@ -155,11 +162,12 @@ export class PageTwoNameComponent implements OnInit {
}; };
passMakeEchart.setOption(option); passMakeEchart.setOption(option);
passMakeEchart.on('click', function (params) { passMakeEchart.on('click', function (params) {
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案编制"}}) _this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案编制")
}); });
} }
//预案退回 //预案审核退回
planBack (){ planBack (){
let _this = this let _this = this
var passBackEchart = echarts.init(document.getElementById('planBack')); var passBackEchart = echarts.init(document.getElementById('planBack'));
@ -192,7 +200,8 @@ export class PageTwoNameComponent implements OnInit {
}; };
passBackEchart.setOption(option); passBackEchart.setOption(option);
passBackEchart.on('click', function (params) { passBackEchart.on('click', function (params) {
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案审核退回"}}) _this.isTrue = !_this.isTrue
_this.zhongDuiChild.detailEcharts("预案审核退回")
}); });
} }
@ -229,8 +238,8 @@ export class PageTwoNameComponent implements OnInit {
}; };
planAuditEchart.setOption(option); planAuditEchart.setOption(option);
planAuditEchart.on('click', function (params) { planAuditEchart.on('click', function (params) {
_this.isTrue = !_this.isTrue
_this.router.navigate(['/statisticanalysis/statePageTwo_details'],{queryParams:{'name':"预案审核中"}}) _this.zhongDuiChild.detailEcharts("预案审核中")
}); });
} }
//预案状态统计 //预案状态统计
@ -258,7 +267,7 @@ export class PageTwoNameComponent implements OnInit {
res+='<td style="border:1px solid #000000">总占比</td>' res+='<td style="border:1px solid #000000">总占比</td>'
res+='</tr></thead>' res+='</tr></thead>'
res+='<tbody>'; res+='<tbody>';
console.log(jsonObj) // console.log(jsonObj)
for(var i=0;i<jsonObj.length;i++){ for(var i=0;i<jsonObj.length;i++){
res+='<tr>' res+='<tr>'
res+='<td style="border:1px solid #000000">'+jsonObj[i].name+'</td>' res+='<td style="border:1px solid #000000">'+jsonObj[i].name+'</td>'

20
src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts

@ -9,32 +9,18 @@ declare var echarts: any;
export class PageZhongDuiDetailsComponent implements OnInit { export class PageZhongDuiDetailsComponent implements OnInit {
constructor( public route: ActivatedRoute) { } constructor( public route: ActivatedRoute) { }
title:String
zhongNameData = ["浦东中队","黄埔中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] zhongNameData = ["浦东中队","黄埔中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"]
zhongNumData = [200,190,180,170,160,150,140,130,120,110,100] zhongNumData = [200,190,180,170,160,150,140,130,120,110,100]
setTitle (title:String) {
this.title = title
}
ngOnInit(): void { ngOnInit(): void {
// this.route.queryParams.subscribe(params => {
// this.title = params.name
// })
setTimeout(() => {
this.detailEcharts()
}, 0);
} }
detailEcharts(){ detailEcharts(title){
var detailPlanEchart = echarts.init(document.getElementById('detailBox')); var detailPlanEchart = echarts.init(document.getElementById('detailBox'));
var option = { var option = {
title: { title: {
text: this.title, text: title,
left: "center", left: "center",
textStyle: { textStyle: {
fontSize: 28 fontSize: 28

Loading…
Cancel
Save