Browse Source

[新增]维护更新统计右侧饼状图下钻对接后端接口

tangshan
陈敬瑜 3 years ago
parent
commit
e323530c1e
  1. 2
      src/app/plan-management/entry-plan/entry-plan.component.html
  2. 45
      src/app/statistic-analysis/echarts-data.service.ts
  3. 4
      src/app/statistic-analysis/scheduled-updates/publicEcharts.html
  4. 186
      src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.ts

2
src/app/plan-management/entry-plan/entry-plan.component.html

@ -140,7 +140,7 @@
<table mat-table [dataSource]="tabledataSource" class="mat-elevation-z8">
<ng-container matColumnDef="state">
<th mat-header-cell *matHeaderCellDef style="width: 10%;">预案状态</th>
<th mat-header-cell *matHeaderCellDef style="width: 10%;">单位状态</th>
<td mat-cell *matCellDef="let element">
<span class="add" *ngIf="element.company.isNewData">新增</span>
<span class="weihu" *ngIf="!element.company.isNewData">维护更新</span>

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

@ -563,7 +563,7 @@ export class EchartsDataService {
this.tishiData=this.obdata[0].updatedCount.organizationCounts
}
console.log(this.tishiData)
//console.log(this.tishiData)
var countall=0//总计
var countbi=0//站比
var allCountbi=0//总站比
@ -592,7 +592,7 @@ export class EchartsDataService {
return this.res
}
//维护更新内部提示框
//维护更新左侧内部提示框
weihuTooltip(datas){
this.tishiData=this.obdata[0].items[0].organizations
var countall=0//总计
@ -626,6 +626,47 @@ export class EchartsDataService {
this.res+='</table></div></div>'
return this.res
}
//维护更新右侧内部提示框
weihuTooltipRight(datas,type){
if(type=='1'){
this.tishiData=this.obdata[0].unMaintainCount.organizationCounts
}else if(type=='2'){
this.tishiData=this.obdata[0].maintainedCount.organizationCounts
}else if(type=='3'){
this.tishiData=this.obdata[0].maintainingCount.organizationCounts
}
var countall=0//总计
var countbi=0//站比
var allCountbi=0//总站比
for(var i=0;i<this.tishiData.length;i++){
countall+=this.tishiData[i].count
}
this.res= '<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#FFFFFF;font-size:27px;text-align: center;display:block;">'+datas[0].axisValue+'</span></div>'
this.res+='</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px;font-size:16px; color:#FFFFFF;border-collapse:collapse;"cellspacing="0"; >';
this.res+='<thead style="font-size:18px;"><tr>';
this.res+='<td style="text-align:center;width:30%;">名称</td>';
this.res+='<td style="text-align:center;width:30%;">数量</td>'
this.res+='<td style="text-align:center;width:30%;">总占比</td>'
this.res+='</tr></thead>'
this.res+='<tbody>';
for(var i=0;i<this.tishiData.length;i++){
countbi=Math.round(this.tishiData[i].count/countall* 10000)/ 100.00
allCountbi=allCountbi+countbi
this.res+='<tr>'
if(this.zhiorBuinding=='zhi'){
this.res+='<td style="text-align:center;">'+ this.tishiData[i].organizationName+'</td>'
}else{
this.res+='<td style="text-align:center;">'+ this.tishiData[i].buildingTypeName+'</td>'
}
this.res+='<td style="text-align:center;">'+this.tishiData[i].count+'</td>'
this.res+='<td style="text-align:center;">'+countbi+'%</td></tr>'
}
this.res+='</tbody>'
this.res+='<tfoot style="font-size:18px;"><td style="text-align:center;">总计</td><td style="text-align:center;">'+countall+'</td><td style="text-align:center;">100%</td></tfoot>'
this.res+='</table></div></div>'
return this.res
}
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"]
zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70]

4
src/app/statistic-analysis/scheduled-updates/publicEcharts.html

@ -76,8 +76,8 @@
<div class="fixedCss">
<button mat-raised-button (click)='goBack()' >返回</button>
<button mat-raised-button (click)='verified()' [ngClass]="{'selectButton': isToggle}" style="margin:0 10px;" *ngIf="echartsData.scheduledUpdatesToggle!=3">已核查</button>
<button mat-raised-button (click)='notVerified()' [ngClass]="{'selectButton': !isToggle}" *ngIf="echartsData.scheduledUpdatesToggle!=3">未核查</button>
<!-- <button mat-raised-button (click)='verified()' [ngClass]="{'selectButton': isToggle}" style="margin:0 10px;" *ngIf="echartsData.scheduledUpdatesToggle!=3">已核查</button>
<button mat-raised-button (click)='notVerified()' [ngClass]="{'selectButton': !isToggle}" *ngIf="echartsData.scheduledUpdatesToggle!=3">未核查</button> -->
</div>
</div>

186
src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.ts

@ -152,18 +152,17 @@ export class ScheduledUpdatesComponent implements OnInit {
this.example.setOption(options);
this.example.on('click', (params) => {
this.echartsData.findShow=true
if(params.name=="维护删除"){this.router.navigateByUrl(`/statisticanalysis/delete_one/delete_two?dwOryuan=${this.dwOryuan}&type=3`);}
else{
//if(params.name=="维护删除"){this.router.navigateByUrl(`/statisticanalysis/delete_one/delete_two?dwOryuan=${this.dwOryuan}&type=3`);}
if(pieid=="pie"){
this.echartsData.scheduledUpdatesToggle = 1
this.echartsData.zhuXname=["平均值","维护无需修改","维护修改","维护删除"]
this.router.navigateByUrl(`/statisticanalysis/scheduledUpdates/PublicEcharts?type=${params.data.name=='维护修改'?2:1}&dwOryuan=${this.dwOryuan}`);
//this.echartsData.zhuXname=["平均值","维护无需修改","维护修改","维护删除"]
this.router.navigateByUrl(`/statisticanalysis/scheduledUpdates/PublicEcharts?type=${params.data.name=='维护修改'?2:params.data.name=='维护无需修改'?1:3}&dwOryuan=${this.dwOryuan}&pieid=pie`);
}else{
this.echartsData.zhuXname=["平均值","维护中","维护通过审核","未维护"]
//this.echartsData.zhuXname=["平均值","维护中","维护通过审核","未维护"]
//this.router.navigateByUrl('/statisticanalysis/scheduledUpdates/PublicEcharts');
if(this.echartsData.level=='0'){
//总队跳转
/* if(this.echartsData.level=='0'){
this.echartsData.scheduledUpdatesToggle = 2
this.router.navigateByUrl('/statisticanalysis/scheduledUpdates/PublicEcharts');
this.echartsData.findShow=false
@ -171,10 +170,14 @@ export class ScheduledUpdatesComponent implements OnInit {
this.echartsData.scheduledUpdatesToggle = 3
this.echartsData.findShow=false
this.router.navigateByUrl('/statisticanalysis/scheduledUpdates/PublicEcharts');
}
} */
this.echartsData.scheduledUpdatesToggle = 2
this.router.navigateByUrl(`/statisticanalysis/scheduledUpdates/PublicEcharts?pieid=pieTwo&type=${params.data.name=='维护通过审核'?2:params.data.name=='未维护'?1:3}&dwOryuan=${this.dwOryuan}`);
this.echartsData.findShow=false
}
}
//console.log(this.echartsData.scheduledUpdatesToggle)
});
}
@ -385,7 +388,13 @@ export class publicEchartsComponent implements OnInit {
//this.router.navigateByUrl('/statisticanalysis/scheduledUpdates');
}
} */
window.history.go(-1)
if(this.verifieds.pieid=='pie'&& this.echartsData.scheduledUpdatesToggle>1){
this.echartsData.scheduledUpdatesToggle--
}else{
this.router.navigateByUrl('/statisticanalysis/scheduledUpdates');
//window.history.go(-1)
}
}
//更多 窗口
@ -398,14 +407,14 @@ export class publicEchartsComponent implements OnInit {
this.verifieds.oneEcharts.clear()
this.verifieds.oneEcharts.dispose()
this.echartsData.zhiorBuinding="zhi"
this.verifieds.getechartsdata('2021','1','2022','12')
this.verifieds.getechartsdata(this.echartsData.time,'1',this.echartsData.time,'12')
}
//建筑类型查询
buildingFind(){
this.verifieds.oneEcharts.clear()
this.verifieds.oneEcharts.dispose()
this.echartsData.zhiorBuinding="building"
this.verifieds.getechartsdata('2021','1','2022','12')
this.verifieds.getechartsdata(this.echartsData.time,'1',this.echartsData.time,'12')
}
@ -426,18 +435,20 @@ export class verifiedComponent implements OnInit {
ngOnInit(): void {
window.setTimeout(()=>{
this.getechartsdata('2021','1','2022','12')
if(this.echartsData.scheduledUpdatesToggle==1){
this.getechartsdata('2021','1','2022','12')
}
},0)
console.log(this.echartsData.scheduledUpdatesToggle)
this.pieid=this.route.snapshot.queryParams.pieid
}
/* ngOnDestroy () {
this.oneEcharts.dispose()
this.oneEcharts.clear()
this.items.forEach((element,index) => {
element.echart.dispose()
element.echart.clear()
});
} */
ngOnDestroy () {
//this.oneEcharts.dispose()
//this.oneEcharts.clear()
}
pieid=this.route.snapshot.queryParams.pieid
//TimeType=0//按月查询还是按年查询
async changeTime (e,selectOneYear,nselectStartMoth,selectTwoYear,selectEndMonth){
console.log(e)
@ -486,7 +497,8 @@ export class verifiedComponent implements OnInit {
this.ydatayue.push(element.count)
});
}else{
await this.echartsData.getData(Parameters,`/api/StatisticsAnalysis/Companies/Maintained/BuildingTypeTrend`)
await this.echartsData.getData(Parameters,this.route.snapshot.queryParams.dwOryuan=='danwei'?
`/api/StatisticsAnalysis/Companies/Maintained/BuildingTypeTrend`:`/api/StatisticsAnalysis/Plans/Maintained/BuildingTypeTrend`)
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
this.xdatayue=[]
@ -634,17 +646,19 @@ export class verifiedComponent implements OnInit {
let xIndex=this.oneEcharts.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
/*事件处理代码书写位置*/
this.echartsData.scheduledUpdatesType = 0
this.echartsData.scheduledUpdatesToggle = 2
//this.echartsData.scheduledUpdatesName = "ff"
this.echartsData.zhiorBuinding!="zhi"?this.echartsData.scheduledUpdatesToggle = -2:this.echartsData.level=='0'? this.echartsData.scheduledUpdatesToggle = 2:this.echartsData.level=='1'?this.echartsData.scheduledUpdatesToggle = 3:''
//this.echartsData.zhiorBuinding!="zhi"?this.echartsData.scheduledUpdatesToggle = -2:this.echartsData.level=='0'? this.echartsData.scheduledUpdatesToggle = 2:this.echartsData.level=='1'?this.echartsData.scheduledUpdatesToggle = 3:''
if(this.echartsData.zhiorBuinding!="zhi"){
this.echartsData.findShow=false
this.echartsData.scheduledUpdatesToggle = -2
//this.echartsData.scheduledUpdatesToggle = -2
if(this.echartsData.level=='0'&&this.tabledata[0].items[xIndex].organizations.length>=1){
this.echartsData.scheduledUpdatesToggle = 2
//this.echartsData.time=xIndex
//this.router.navigateByUrl(`/statisticanalysis/scheduledUpdates/PublicEcharts?type=${this.route.snapshot.queryParams.type}&TimeType=${this.TimeType}`);
}else if(this.echartsData.level=='1' &&this.tabledata[0].items[xIndex].organizations.length>=1){
this.echartsData.scheduledUpdatesToggle = 3
this.echartsData.scheduledUpdatesToggle = 2//原来是3
}
}else{
this.echartsData.findShow=true
@ -810,6 +824,7 @@ export class yueDateComponent implements OnInit {
level:string;
ngOnInit(): void {
//console.log(this.echartsData.scheduledUpdatesToggle)
this.router.queryParams.subscribe(param=>{
this.level=param.level
});
@ -833,32 +848,64 @@ export class yueDateComponent implements OnInit {
ynum=[]
OrganizationIds=''//点击的组织
async getechartsdata(){
let Parameters={
MaintainedState:this.router.snapshot.queryParams.type,
TimeType:this.echartsData.TimeType,
TimeStart:this.echartsData.scheduledUpdatesXName,
//TimeEnd:this.echartsData.TimeType==0?selectEndYear+'-'+selectEndMonth:selectEndYear,
OrganizationId:this.OrganizationIds
if(this.router.snapshot.queryParams.pieid!='pieTwo'){
let Parameters={
MaintainedState:this.router.snapshot.queryParams.type,
TimeType:this.echartsData.TimeType,
TimeStart:this.echartsData.scheduledUpdatesXName,
//TimeEnd:this.echartsData.TimeType==0?selectEndYear+'-'+selectEndMonth:selectEndYear,
OrganizationId:this.OrganizationIds
}
//console.log(this.echartsData.zhiorBuinding)
await this.echartsData.getData(Parameters,this.echartsData.zhiorBuinding=='zhi'? `/api/StatisticsAnalysis/Companies/Maintained/OrganizationTrend`:`/api/StatisticsAnalysis/Companies/Maintained/BuildingTypeTrend`)
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
this.zhiNameData=[]
this.tabledata[0].items[0].organizations.forEach(element => {
this.zhiNameData.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationName:element.buildingTypeName)
this.ynum.push(element.count)
this.organizationId.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationId:element.buildingTypeId)
//this.ydatayue.push(element.count)
});
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.ynum,this.zhiNameData)
this.twoInit()
}else{
let Parameters={
MaintenanceState:this.router.snapshot.queryParams.type,
//TimeEnd:this.echartsData.TimeType==0?selectEndYear+'-'+selectEndMonth:selectEndYear,
OrganizationId:this.OrganizationIds
}
await this.echartsData.getData(Parameters,this.echartsData.zhiorBuinding=='zhi'? `/api/StatisticsAnalysis/Companies/Maintenance`:`/api/StatisticsAnalysis/Plans/Maintenance`)
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
this.zhiNameData=[]
if(this.router.snapshot.queryParams.type=='1'){
this.tabledata[0].unMaintainCount.organizationCounts.forEach(element => {
this.zhiNameData.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationName:element.buildingTypeName)
this.ynum.push(element.count)
this.organizationId.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationId:element.buildingTypeId)
//this.ydatayue.push(element.count)
});
}else if(this.router.snapshot.queryParams.type=='2'){
this.tabledata[0].maintainedCount.organizationCounts.forEach(element => {
this.zhiNameData.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationName:element.buildingTypeName)
this.ynum.push(element.count)
this.organizationId.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationId:element.buildingTypeId)
//this.ydatayue.push(element.count)
});
}else if(this.router.snapshot.queryParams.type=='3'){
this.tabledata[0].maintainingCount.organizationCounts.forEach(element => {
this.zhiNameData.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationName:element.buildingTypeName)
this.ynum.push(element.count)
this.organizationId.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationId:element.buildingTypeId)
//this.ydatayue.push(element.count)
});
}
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.ynum,this.zhiNameData)
this.twoInit()
}
console.log(this.echartsData.zhiorBuinding)
await this.echartsData.getData(Parameters,this.echartsData.zhiorBuinding=='zhi'? `/api/StatisticsAnalysis/Companies/Maintained/OrganizationTrend`:`/api/StatisticsAnalysis/Companies/Maintained/BuildingTypeTrend`)
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
this.zhiNameData=[]
this.tabledata[0].items[0].organizations.forEach(element => {
this.zhiNameData.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationName:element.buildingTypeName)
this.ynum.push(element.count)
this.organizationId.push(this.echartsData.zhiorBuinding=='zhi'? element.organizationId:element.buildingTypeId)
//this.ydatayue.push(element.count)
});
/* this.ydatayue=[]
this.tabledata[0].items.forEach(element => {
this.zhiNameData.push(element.date)
this.ydatayue.push(element.count)
}); */
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.ynum,this.zhiNameData)
this.twoInit()
//this.oneInit(this.xdatayue,this.ydatayue)
}
tiaoshiPao:any
//气泡提示数据获取
@ -879,7 +926,7 @@ export class yueDateComponent implements OnInit {
this.oneEcharts = echarts.init(document.getElementById("center"), 'skinUpp');
var option = {
title: {
text: this.echartsData.scheduledUpdatesXName+`已核查总数:(${this.tabledata[0].totalCount})`,
text:this.router.snapshot.queryParams.pieid=='pieTwo'?'': this.echartsData.scheduledUpdatesXName+`已核查总数:(${this.tabledata[0].totalCount})`,
top: -4,
left: '35%',
textStyle:{
@ -899,7 +946,12 @@ export class yueDateComponent implements OnInit {
fontSize :18
},
formatter: (params)=>{
return this.echartsData.zhiorBuinding=='zhi'? this.echartsData.weihuTooltip(params):''
if(this.router.snapshot.queryParams.pieid=='pieTwo'){
return this.echartsData.zhiorBuinding=='zhi'? this.echartsData.weihuTooltipRight(params,this.router.snapshot.queryParams.type):''
}else{
return this.echartsData.zhiorBuinding=='zhi'? this.echartsData.weihuTooltip(params):''
}
//return this.echartsData.zhiorBuinding=="zhi"?this.echartsData.tableTooltip(this.echartsData.tableDataZhi,params[0].name):this.echartsData.tableTooltip(this.echartsData.buildingType,params[0].name)
},
position:this.echartsData.tableTooltipNoShow2
@ -991,17 +1043,31 @@ export class yueDateComponent implements OnInit {
if (this.oneEcharts.containPixel('grid',pointInPixel)) {
let xIndex=this.oneEcharts.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
/*事件处理代码书写位置*/
if(this.echartsData.zhiorBuinding=='zhi'){
if(this.echartsData.zhiorBuinding=='zhi'&&this.router.snapshot.queryParams.pieid=='pie'){
this.OrganizationIds=option.xAxis.id[xIndex]
this.getechartsdata()
this.getechartsdata()
if(this.tabledata[0].items.length>=1){
this.oneEcharts.dispose()
this.oneEcharts.clear()
//this.getechartsdata()
}
this.echartsData.scheduledUpdatesType = 0
//console.log(option.xAxis)
this.echartsData.scheduledUpdatesName = option.xAxis.data[xIndex]
this.echartsData.scheduledUpdatesToggle = 3
console.log(option.xAxis.id[xIndex])
/* this.echartsData.scheduledUpdatesType = 0
this.echartsData.scheduledUpdatesName = option.xAxis.data[xIndex]
this.echartsData.scheduledUpdatesToggle = 3
console.log(option.xAxis.id[xIndex]) */
}else if(this.echartsData.zhiorBuinding=='zhi'&&this.router.snapshot.queryParams.pieid=='pieTwo'){
this.OrganizationIds=option.xAxis.id[xIndex]
this.getechartsdata()
if((this.router.snapshot.queryParams.type=='1'&&this.tabledata[0].unMaintainCount.organizationCounts.length>=1)
||(this.router.snapshot.queryParams.type=='2'&&this.tabledata[0].maintainedCount.organizationCounts.length>=1)
||(this.router.snapshot.queryParams.type=='3'&&this.tabledata[0].maintainingCount.organizationCounts.length>=1)){
this.oneEcharts.dispose()
this.oneEcharts.clear()
//this.getechartsdata()
}
}
}

Loading…
Cancel
Save