|
|
|
@ -15,22 +15,38 @@ export class AddUnitThreeBarDetailsComponent implements OnInit {
|
|
|
|
|
constructor(private router: Router,public dialog: MatDialog,public snackBar: MatSnackBar,private serviceData: EchartsDataService,public route: ActivatedRoute) { } |
|
|
|
|
time:String |
|
|
|
|
buildingTypeName:String |
|
|
|
|
level:String |
|
|
|
|
//level:String
|
|
|
|
|
orId//上个页面传过来的组织id
|
|
|
|
|
buildId//上个页面传过来的建筑id
|
|
|
|
|
|
|
|
|
|
setTimeoutObj//延时器需要清除
|
|
|
|
|
tabledata |
|
|
|
|
organizationId=[] |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.dateInit () |
|
|
|
|
|
|
|
|
|
this.route.queryParams.subscribe(params => { |
|
|
|
|
this.time = params['time']; |
|
|
|
|
this.buildingTypeName = params['buildingTpye']; |
|
|
|
|
this.level = params['level']; |
|
|
|
|
this.bianli() |
|
|
|
|
this.buildId=params['id'] |
|
|
|
|
this.orId=params['zhuid'] |
|
|
|
|
}); |
|
|
|
|
let paramsdata={ |
|
|
|
|
id:this.buildId, |
|
|
|
|
organizationId:this.orId |
|
|
|
|
} |
|
|
|
|
this.serviceData.getData(paramsdata,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildId}`) |
|
|
|
|
this.setTimeoutObj = window.setTimeout(()=>{ |
|
|
|
|
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) |
|
|
|
|
console.log(this.tabledata) |
|
|
|
|
for(var i=0;i<this.tabledata[0].organizations.length;i++){ |
|
|
|
|
this.zhiNameData.push(this.tabledata[0].organizations[i].organizationName) |
|
|
|
|
this.zhiNumData.push(this.tabledata[0].organizations[i].count) |
|
|
|
|
this.organizationId.push(this.tabledata[0].organizations[i].organizationId) |
|
|
|
|
} |
|
|
|
|
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.zhiNumData,this.zhiNameData) |
|
|
|
|
this.detailEcharts() |
|
|
|
|
},0) |
|
|
|
|
},1000) |
|
|
|
|
} |
|
|
|
|
ngOnDestroy(){ |
|
|
|
|
window.clearTimeout(this.setTimeoutObj); |
|
|
|
@ -72,22 +88,15 @@ export class AddUnitThreeBarDetailsComponent implements OnInit {
|
|
|
|
|
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] |
|
|
|
|
zhongNumData = [300,290,280,270,260,250,240,230,220,210,200] |
|
|
|
|
|
|
|
|
|
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队"] |
|
|
|
|
zhiNumData = [300,290,280,270,260,250,240,230,220,210,200] |
|
|
|
|
zhiNameData = [] |
|
|
|
|
zhiNumData = [] |
|
|
|
|
tiaoshiPao:any |
|
|
|
|
//气泡提示数据获取
|
|
|
|
|
bianli(){ |
|
|
|
|
this.tiaoshiPao=null |
|
|
|
|
var arrshuzu='['; |
|
|
|
|
if(this.level == 'zhidui'){ |
|
|
|
|
for(var i=0;i<this.zhiNumData.length;i++){ |
|
|
|
|
arrshuzu+='{"value":'+this.zhiNumData[i]+',"coord":['+i+','+this.zhiNumData[i]+'],"name":'+'"'+this.zhiNameData[i]+'"'+'},' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
for(var i=0;i<this.zhongNumData.length;i++){ |
|
|
|
|
arrshuzu+='{"value":'+this.zhongNumData[i]+',"coord":['+i+','+this.zhongNumData[i]+'],"name":'+'"'+this.zhongNameData[i]+'"'+'},' |
|
|
|
|
} |
|
|
|
|
for(var i=0;i<this.zhiNumData.length;i++){ |
|
|
|
|
arrshuzu+='{"value":'+this.zhiNumData[i]+',"coord":['+i+','+this.zhiNumData[i]+'],"name":'+'"'+this.zhiNameData[i]+'"'+'},' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1) |
|
|
|
@ -102,15 +111,20 @@ export class AddUnitThreeBarDetailsComponent implements OnInit {
|
|
|
|
|
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'),'walden');
|
|
|
|
|
this.option = { |
|
|
|
|
title: { |
|
|
|
|
text: this.time + '(' +this.buildingTypeName + ')'+':总数(666)', |
|
|
|
|
text: this.time + '' +this.buildingTypeName +`:总数(${this.tabledata[0].totalCount})`, |
|
|
|
|
left: "center", |
|
|
|
|
textStyle: { |
|
|
|
|
fontSize: 30 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
grid: { |
|
|
|
|
top: 110, |
|
|
|
|
//bottom: 10
|
|
|
|
|
}, |
|
|
|
|
xAxis: { |
|
|
|
|
id:this.organizationId, |
|
|
|
|
type: 'category', |
|
|
|
|
data:this.level=="zhidui"? this.zhiNameData:this.zhongNameData, |
|
|
|
|
data:this.zhiNameData, |
|
|
|
|
axisLabel:{ |
|
|
|
|
//this.axisLabel,
|
|
|
|
|
textStyle:{ |
|
|
|
@ -154,35 +168,69 @@ export class AddUnitThreeBarDetailsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
this.detailPlanEchart.setOption(this.option); |
|
|
|
|
this.detailPlanEchart.on("click",(params)=>{ |
|
|
|
|
if(this.level == "zhidui"){//如果是支队则跳转
|
|
|
|
|
// this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'level':'zhongdui','time':params.name,'buildingTpye':this.buildingTypeName}});
|
|
|
|
|
this.level = "zhongdui" |
|
|
|
|
this.detailPlanEchart.getZr().on("click",(params)=>{ |
|
|
|
|
const pointInPixel= [params.offsetX, params.offsetY]; |
|
|
|
|
if (this.detailPlanEchart.containPixel('grid',pointInPixel)){ |
|
|
|
|
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; |
|
|
|
|
console.log(this.organizationId,this.option.xAxis.id) |
|
|
|
|
if(this.serviceData.level=="0"&&this.tiao==false&&this.tabledata[0].organizations.length>=1){ |
|
|
|
|
//总队不跳
|
|
|
|
|
console.log(params) |
|
|
|
|
this.zhiNameData=[] |
|
|
|
|
this.zhiNumData=[] |
|
|
|
|
this.organizationId=[] |
|
|
|
|
this.tiaoshiPao='' |
|
|
|
|
let paramsdata={ |
|
|
|
|
id:this.buildId, |
|
|
|
|
organizationId:this.option.xAxis.id[xIndex] |
|
|
|
|
} |
|
|
|
|
this.serviceData.getData(paramsdata,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildId}`) |
|
|
|
|
this.setTimeoutObj = window.setTimeout(()=>{ |
|
|
|
|
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) |
|
|
|
|
console.log(this.tabledata) |
|
|
|
|
for(var i=0;i<this.tabledata[0].organizations.length;i++){ |
|
|
|
|
this.zhiNameData.push(this.tabledata[0].organizations[i].organizationName) |
|
|
|
|
this.zhiNumData.push(this.tabledata[0].organizations[i].count) |
|
|
|
|
this.organizationId.push(this.tabledata[0].organizations[i].organizationId) |
|
|
|
|
} |
|
|
|
|
this.option.xAxis.data = this.zhiNameData |
|
|
|
|
this.option.series[0].data = this.zhiNumData |
|
|
|
|
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.zhiNumData,this.zhiNameData) |
|
|
|
|
this.option.series[0].markPoint.data=this.tiaoshiPao |
|
|
|
|
this.detailPlanEchart.setOption(this.option) |
|
|
|
|
},1000) |
|
|
|
|
this.tiao=true |
|
|
|
|
}else{ |
|
|
|
|
console.log(this.organizationId,this.option.xAxis.id) |
|
|
|
|
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1,'jsid':this.option.xAxis.id[xIndex]}}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/* if(this.serviceData.level == "1"){//如果是支队则跳转 |
|
|
|
|
this.option.title.text = params.name + '(' +this.buildingTypeName + ')' |
|
|
|
|
this.option.xAxis.data = this.zhongNameData |
|
|
|
|
this.option.series[0].data = this.zhongNumData |
|
|
|
|
this.detailPlanEchart.setOption(this.option) |
|
|
|
|
}else{ |
|
|
|
|
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1}}); |
|
|
|
|
} |
|
|
|
|
} */ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
tiao=false |
|
|
|
|
//返回按钮
|
|
|
|
|
backBtn(){ |
|
|
|
|
if(this.level == "zhongdui"){ |
|
|
|
|
/* if(this.level == "zhongdui"){ |
|
|
|
|
this.level = "zhidui" |
|
|
|
|
this.option.title.text = this.time + '(' +this.buildingTypeName + ')' |
|
|
|
|
this.option.xAxis.data = this.zhiNameData |
|
|
|
|
this.option.series[0].data = this.zhiNumData |
|
|
|
|
this.detailPlanEchart.setOption(this.option) |
|
|
|
|
}else{ |
|
|
|
|
window.history.go(-1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} */ |
|
|
|
|
window.history.go(-1) |
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tableTooltip(params:any){ |
|
|
|
|
var data |
|
|
|
|
if(this.level == "zhidui"){ |
|
|
|
|
if(this.serviceData.level == "1"){ |
|
|
|
|
data = this.serviceData.tableDataZhong |
|
|
|
|
}else{ |
|
|
|
|
data = [ |
|
|
|
|