|
|
@ -6,6 +6,7 @@ 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 { PageTwoNameComponent } from '../page-two-name/page-two-name.component'; |
|
|
|
import {EchartsDataService} from '../../echarts-data.service' |
|
|
|
import {EchartsDataService} from '../../echarts-data.service' |
|
|
|
|
|
|
|
import { resolve } from 'dns'; |
|
|
|
declare var echarts: any; |
|
|
|
declare var echarts: any; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
@ -60,19 +61,25 @@ export class PageTwoTimeComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
selectType:string = 'month'; //选择当前的 查询类型 按月/年
|
|
|
|
selectType:string = 'month'; //选择当前的 查询类型 按月/年
|
|
|
|
|
|
|
|
|
|
|
|
changeTime (e) { |
|
|
|
async changeTime (e) { |
|
|
|
let data = e.value |
|
|
|
let data = e.value |
|
|
|
this.appEcharts.changeTime(data) |
|
|
|
await this.appEcharts.changeTime(data) |
|
|
|
if(e.value=='month'){ |
|
|
|
if(e.value=='month'){ |
|
|
|
this.echartsData.selectType=0 |
|
|
|
this.echartsData.selectType=0 |
|
|
|
} |
|
|
|
} |
|
|
|
else if(e.value=='year'){ |
|
|
|
else if(e.value=='year'){ |
|
|
|
|
|
|
|
this.years=[] |
|
|
|
this.echartsData.selectType=2 |
|
|
|
this.echartsData.selectType=2 |
|
|
|
|
|
|
|
this.appEcharts.tabledata[0].forEach((value,index,array) => { |
|
|
|
|
|
|
|
this.years.push(array[index].year) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.years=Array.from(new Set(this.years)) |
|
|
|
|
|
|
|
//console.log()
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询数据
|
|
|
|
//查询数据
|
|
|
|
years:any = [2020,2021] |
|
|
|
years= [] |
|
|
|
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12] |
|
|
|
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12] |
|
|
|
tiaoshiPao:any |
|
|
|
tiaoshiPao:any |
|
|
|
datayuey=[270, 253, 244, 199, 189, 173, 160, 198,200] |
|
|
|
datayuey=[270, 253, 244, 199, 189, 173, 160, 198,200] |
|
|
@ -150,6 +157,7 @@ export class echartsComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
constructor(private router: Router,private activatedRoute: ActivatedRoute,public snackBar: MatSnackBar,private adapter: DateAdapter<any>,public echartsData:EchartsDataService) { } |
|
|
|
constructor(private router: Router,private activatedRoute: ActivatedRoute,public snackBar: MatSnackBar,private adapter: DateAdapter<any>,public echartsData:EchartsDataService) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tid |
|
|
|
zongcount=0 |
|
|
|
zongcount=0 |
|
|
|
type |
|
|
|
type |
|
|
|
organizationId=[] |
|
|
|
organizationId=[] |
|
|
@ -177,6 +185,7 @@ export class echartsComponent implements OnInit { |
|
|
|
this.activatedRoute.queryParams.subscribe(param=>{ |
|
|
|
this.activatedRoute.queryParams.subscribe(param=>{ |
|
|
|
this.headtext=param.level |
|
|
|
this.headtext=param.level |
|
|
|
this.type=param.type |
|
|
|
this.type=param.type |
|
|
|
|
|
|
|
this.tid=param.tid |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
window.setTimeout(()=>{ |
|
|
|
window.setTimeout(()=>{ |
|
|
@ -192,13 +201,14 @@ export class echartsComponent implements OnInit { |
|
|
|
//获取数据
|
|
|
|
//获取数据
|
|
|
|
async getechartsData(){ |
|
|
|
async getechartsData(){ |
|
|
|
let paramdata={ |
|
|
|
let paramdata={ |
|
|
|
planStatus:this.type, |
|
|
|
planStatus:this.tid=='pieone'?'': this.type, |
|
|
|
objectType:1, |
|
|
|
PlanCategory:this.tid=='pieone'?this.type:'', |
|
|
|
|
|
|
|
objectType:this.tid=='pieone'?2: 1, |
|
|
|
TrendType:0 |
|
|
|
TrendType:0 |
|
|
|
} |
|
|
|
} |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
|
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) |
|
|
|
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) |
|
|
|
// console.log(this.tabledata)
|
|
|
|
console.log(this.tabledata) |
|
|
|
for(var i=0;i<this.tabledata[0].length;i++){ |
|
|
|
for(var i=0;i<this.tabledata[0].length;i++){ |
|
|
|
if(this.tabledata[0][i].month>=this.echartsData.selectStartMonth||this.tabledata[0][i].month<=this.echartsData.selectEndMonth){ |
|
|
|
if(this.tabledata[0][i].month>=this.echartsData.selectStartMonth||this.tabledata[0][i].month<=this.echartsData.selectEndMonth){ |
|
|
|
this.datayuex.push(this.tabledata[0][i].month) |
|
|
|
this.datayuex.push(this.tabledata[0][i].month) |
|
|
@ -206,11 +216,13 @@ export class echartsComponent implements OnInit { |
|
|
|
this.zongcount=this.zongcount+this.tabledata[0][i].count |
|
|
|
this.zongcount=this.zongcount+this.tabledata[0][i].count |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.datayuex.forEach((value,index,array)=>{ |
|
|
|
|
|
|
|
array[index]=array[index]+'月' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
|
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
|
|
|
|
//this.oneInit()
|
|
|
|
//this.oneInit()
|
|
|
|
this.twoInit() |
|
|
|
this.twoInit(this.datayuex,this.datayuey) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async changeTime (e) { |
|
|
|
async changeTime (e) { |
|
|
@ -222,20 +234,24 @@ export class echartsComponent implements OnInit { |
|
|
|
this.echartsData.selectType=2 |
|
|
|
this.echartsData.selectType=2 |
|
|
|
this.zongcount=0 |
|
|
|
this.zongcount=0 |
|
|
|
let paramdata={ |
|
|
|
let paramdata={ |
|
|
|
objectType:1, |
|
|
|
objectType:this.tid=='pieone'?2: 1, |
|
|
|
planStatus:this.type, |
|
|
|
planStatus:this.tid=='pieone'?'': this.type, |
|
|
|
|
|
|
|
PlanCategory:this.tid=='pieone'?this.type:'', |
|
|
|
TrendType:this.echartsData.selectType |
|
|
|
TrendType:this.echartsData.selectType |
|
|
|
} |
|
|
|
} |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
|
window.setTimeout(()=>{ |
|
|
|
window.setTimeout(()=>{ |
|
|
|
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) |
|
|
|
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) |
|
|
|
// console.log(this.tabledata)
|
|
|
|
console.log(this.tabledata) |
|
|
|
|
|
|
|
//resolve(this.tabledata)
|
|
|
|
for(var i=0;i<this.tabledata[0].length;i++){ |
|
|
|
for(var i=0;i<this.tabledata[0].length;i++){ |
|
|
|
this.dataYearX.push(this.tabledata[0][i].year) |
|
|
|
this.dataYearX.push(this.tabledata[0][i].year) |
|
|
|
this.dataYearY.push(this.tabledata[0][i].count) |
|
|
|
this.dataYearY.push(this.tabledata[0][i].count) |
|
|
|
this.zongcount=this.zongcount+this.tabledata[0][i].count |
|
|
|
this.zongcount=this.zongcount+this.tabledata[0][i].count |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.dataYearX.forEach((value,index,array)=>{ |
|
|
|
|
|
|
|
this.dataYearX[index]=this.dataYearX[index]+'年' |
|
|
|
|
|
|
|
}) |
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
|
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
|
|
|
|
//this.oneInit()
|
|
|
|
//this.oneInit()
|
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataYearY,this.dataYearX) |
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataYearY,this.dataYearX) |
|
|
@ -247,7 +263,7 @@ export class echartsComponent implements OnInit { |
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) |
|
|
|
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) |
|
|
|
//this.oneInit()
|
|
|
|
//this.oneInit()
|
|
|
|
this.echartsData.selectType=0 |
|
|
|
this.echartsData.selectType=0 |
|
|
|
this.twoInit() |
|
|
|
this.twoInit(this.datayuex,this.datayuey) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -257,8 +273,9 @@ export class echartsComponent implements OnInit { |
|
|
|
this.datayuex=[] |
|
|
|
this.datayuex=[] |
|
|
|
this.datayuey=[] |
|
|
|
this.datayuey=[] |
|
|
|
let paramdata={ |
|
|
|
let paramdata={ |
|
|
|
objectType:1, |
|
|
|
objectType:this.tid=='pieone'?2: 1, |
|
|
|
planStatus:this.type, |
|
|
|
planStatus:this.tid=='pieone'?'': this.type, |
|
|
|
|
|
|
|
PlanCategory:this.tid=='pieone'?this.type:'', |
|
|
|
TrendType:this.echartsData.selectType |
|
|
|
TrendType:this.echartsData.selectType |
|
|
|
} |
|
|
|
} |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
@ -281,8 +298,9 @@ export class echartsComponent implements OnInit { |
|
|
|
this.dataYearX=[] |
|
|
|
this.dataYearX=[] |
|
|
|
this.dataYearY=[] |
|
|
|
this.dataYearY=[] |
|
|
|
let paramdata={ |
|
|
|
let paramdata={ |
|
|
|
objectType:1, |
|
|
|
objectType:this.tid=='pieone'?2: 1, |
|
|
|
planStatus:this.type, |
|
|
|
planStatus:this.tid=='pieone'?'': this.type, |
|
|
|
|
|
|
|
PlanCategory:this.tid=='pieone'?this.type:'', |
|
|
|
TrendType:this.echartsData.selectType |
|
|
|
TrendType:this.echartsData.selectType |
|
|
|
} |
|
|
|
} |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
|
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) |
|
|
@ -302,7 +320,10 @@ export class echartsComponent implements OnInit { |
|
|
|
headtext |
|
|
|
headtext |
|
|
|
twoExample:any; |
|
|
|
twoExample:any; |
|
|
|
tabledata |
|
|
|
tabledata |
|
|
|
twoInit (X=this.datayuex, Y=this.datayuey) { |
|
|
|
twoInit (X, Y) { |
|
|
|
|
|
|
|
/* X.forEach((element,index,array) => { |
|
|
|
|
|
|
|
array[index]=array[index]+'月' |
|
|
|
|
|
|
|
}); */ |
|
|
|
let that = this |
|
|
|
let that = this |
|
|
|
this.twoExample = echarts.init(document.getElementById('two'), 'skinUpp'); |
|
|
|
this.twoExample = echarts.init(document.getElementById('two'), 'skinUpp'); |
|
|
|
var option = { |
|
|
|
var option = { |
|
|
@ -393,7 +414,7 @@ export class echartsComponent implements OnInit { |
|
|
|
if (this.twoExample.containPixel('grid',pointInPixel)) { |
|
|
|
if (this.twoExample.containPixel('grid',pointInPixel)) { |
|
|
|
let xIndex=this.twoExample.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; |
|
|
|
let xIndex=this.twoExample.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; |
|
|
|
if(this.echartsData.selectType==2){ |
|
|
|
if(this.echartsData.selectType==2){ |
|
|
|
this.router.navigate(['/statisticanalysis/stataPageThereYearComponent'],{queryParams:{'level':this.headtext,'headtext':option.title.text,'type':this.type,'year':X[xIndex]}}); |
|
|
|
this.router.navigate(['/statisticanalysis/stataPageThereYearComponent'],{queryParams:{'level':this.headtext,'headtext':X[xIndex],'type':this.type,'tid':this.tid}}); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
/*事件处理代码书写位置*/ |
|
|
|
/*事件处理代码书写位置*/ |
|
|
|
if(this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2'){ |
|
|
|
if(this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2'){ |
|
|
@ -403,7 +424,7 @@ export class echartsComponent implements OnInit { |
|
|
|
//this.router.navigate(['/statisticanalysis/statePageOne/name'],{queryParams:{'level':option.xAxis.data[xIndex],'headtext':this.headtext,'type':this.type}});
|
|
|
|
//this.router.navigate(['/statisticanalysis/statePageOne/name'],{queryParams:{'level':option.xAxis.data[xIndex],'headtext':this.headtext,'type':this.type}});
|
|
|
|
} else if(this.echartsData.level=='3'){ |
|
|
|
} else if(this.echartsData.level=='3'){ |
|
|
|
//中队跳转
|
|
|
|
//中队跳转
|
|
|
|
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'name':params.name,'type':this.type}}); |
|
|
|
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'name':params.name,'type':this.type,'tid':this.tid}}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|