Browse Source

[新增]建筑类型统计对接接口

zhuzhou
chenjingyu 4 years ago
parent
commit
eedf099e18
  1. 79
      src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts
  2. 100
      src/app/statistic-analysis/addUnit/add-unit-three-bar-details/add-unit-three-bar-details.component.ts
  3. 48
      src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.ts
  4. 59
      src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.ts
  5. 3
      src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.ts
  6. 9
      src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.ts
  7. 4
      src/app/statistic-analysis/compang-info/compang-info.component.ts
  8. 45
      src/app/statistic-analysis/echarts-data.service.ts

79
src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts

@ -12,13 +12,15 @@ export class AddUnitOneComponent implements OnInit {
constructor(private router: Router,public echartsData:EchartsDataService) { } constructor(private router: Router,public echartsData:EchartsDataService) { }
setTimeoutObj//延时器需要清除 setTimeoutObj//延时器需要清除
buildData=[] tabledata
orData
ngOnInit(): void { ngOnInit(): void {
/* this.buildData.push(this.echartsData.getData(null,`/api/StatisticsAnalysis/BuildingTypes`)) /* this.buildData.push(this.echartsData.getData(null,`/api/StatisticsAnalysis/BuildingTypes`))
this.orData=this.echartsData.getData(null,`/api/StatisticsAnalysis/Companies`) */ this.orData=this.echartsData.getData(null,`/api/StatisticsAnalysis/Companies`) */
this.echartsData.getData(null,`/api/StatisticsAnalysis/Companies`)
this.setTimeoutObj = window.setTimeout(()=>{ this.setTimeoutObj = window.setTimeout(()=>{
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
this.initCharts("pieone") this.initCharts("pieone")
this.initCharts("pietwo") this.initCharts("pietwo")
},1000) },1000)
@ -45,12 +47,27 @@ export class AddUnitOneComponent implements OnInit {
buildingData=["高层","地下","轨道交通","化工生产","储罐类","厂房","古建筑","商市场","医院","学校","宾馆","娱乐场所","餐饮业","影剧院","展览建筑","隧道"] buildingData=["高层","地下","轨道交通","化工生产","储罐类","厂房","古建筑","商市场","医院","学校","宾馆","娱乐场所","餐饮业","影剧院","展览建筑","隧道"]
indexBzt//首页饼状图实例 indexBzt//首页饼状图实例
/* 首页饼状图 */ /* 首页饼状图 */
initCharts(id){ lengthBuildData=[]
lengthOrData=[]
this.indexBzt = echarts.init(document.getElementById(id),'walden'); buildData=[]
orData=[]
initCharts(tid){
for(var i=0;i<this.tabledata[0].buildingTypeStatistics.buildingTypes.length;i++){
this.buildData.push(this.tabledata[0].buildingTypeStatistics.buildingTypes[i])
this.lengthBuildData.push(this.tabledata[0].buildingTypeStatistics.buildingTypes[i].buildingTypeName)
}
for(var i=0;i<this.tabledata[0].organizationStatistics.organizations.length;i++){
this.orData.push(this.tabledata[0].organizationStatistics.organizations[i])
this.lengthOrData.push(this.tabledata[0].organizationStatistics.organizations[i].organizationName)
}
console.log(this.buildData)
this.buildData=this.buildData.map(v=>{return {name: v.buildingTypeName,value:v.count,id:v.buildingTypeId}})
this.orData=this.orData.map(v=>{return {name: v.organizationName,value:v.count,id:v.organizationId}})
console.log(this.buildData)
this.indexBzt = echarts.init(document.getElementById(tid),'walden');
let options={ let options={
title: { title: {
text:id=="pieone"? '组织机构统计(8900家)':'建筑类型统计(8900家)', text:tid=="pieone"? `组织机构统计(${this.tabledata[0].organizationStatistics.totalCount}家)`:`建筑类型统计(${this.tabledata[0].buildingTypeStatistics.totalCount}家)`,
left: 'center', left: 'center',
top: "5%", top: "5%",
textStyle: { textStyle: {
@ -60,7 +77,8 @@ export class AddUnitOneComponent implements OnInit {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
formatter: (params)=>{ formatter: (params)=>{
return this.echartsData.tableTooltip(id=="pieone"?this.echartsData.buildingType:this.echartsData.tableDataZhi,params.name) console.log(params)
return this.echartsData.tableTooltip(tid=="pieone"?this.echartsData.buildingType:this.echartsData.tableDataZhi,params.name)
}, },
position:this.echartsData.tableTooltipNoShow2 position:this.echartsData.tableTooltipNoShow2
}, },
@ -72,7 +90,7 @@ export class AddUnitOneComponent implements OnInit {
fontSize:14, fontSize:14,
color:"#000000" color:"#000000"
}, },
data: id=="pieone"?this.zhiNameData:this.buildingData data: tid=="pieone"?this.lengthOrData:this.lengthBuildData
}, },
series: [ series: [
{ {
@ -91,39 +109,7 @@ export class AddUnitOneComponent implements OnInit {
} }
}, },
}, },
data:id=="pieone"?[ data:tid=="pieone"?this.orData:this.buildData,
{value: 500, name: this.zhiNameData[0]},
{value: 800, name: this.zhiNameData[1]},
{value: 900, name: this.zhiNameData[2]},
{value: 800, name: this.zhiNameData[3]},
{value: 1200, name: this.zhiNameData[4]},
{value: 1500, name: this.zhiNameData[5]},
{value: 1400, name: this.zhiNameData[6]},
{value: 600, name: this.zhiNameData[7]},
{value: 568, name: this.zhiNameData[8]},
{value: 888, name: this.zhiNameData[9]},
{value: 485, name: this.zhiNameData[10]},
{value: 966, name: this.zhiNameData[11]},
{value: 789, name: this.zhiNameData[12]},
{value: 500, name: this.zhiNameData[13]},
]:[
{value: 500, name: '高层'},
{value: 800, name: '地下'},
{value: 900, name: '轨道交通'},
{value: 800, name: '化工生产'},
{value: 1200, name: '储罐类'},
{value: 1500, name: '厂房'},
{value: 1400, name: '古建筑'},
{value: 600, name: '商市场'},
{value: 568, name: '医院'},
{value: 888, name: '学校'},
{value: 485, name: '宾馆'},
{value: 966, name: '娱乐场所'},
{value: 789, name: '餐饮业'},
{value: 500, name: '影剧院'},
{value: 1025, name: '展览建筑'},
{value: 600, name: '隧道'}],
emphasis: { emphasis: {
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
@ -135,8 +121,15 @@ export class AddUnitOneComponent implements OnInit {
] ]
}; };
this.indexBzt.on('click', (params) => { this.indexBzt.on('click', (params) => {
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':params.name}}); if(this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2'){
id=="pieone"?this.echartsData.zuzhiorBuilding="zhi":this.echartsData.zuzhiorBuilding="building" //总队,支队,大队跳转
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':params.name,'id':params.data.id}});
}else{
//中队跳转
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1}});
}
tid=="pieone"?this.echartsData.zuzhiorBuilding="zhi":this.echartsData.zuzhiorBuilding="building"
}); });
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }

100
src/app/statistic-analysis/addUnit/add-unit-three-bar-details/add-unit-three-bar-details.component.ts

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

48
src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.ts

@ -28,15 +28,33 @@ export class AddUnitTwoTypeDetailsComponent implements OnInit {
organizationName:String organizationName:String
buildingTypeName:String buildingTypeName:String
setTimeoutObj//延时器需要清除 setTimeoutObj//延时器需要清除
lastId
canshuId
tabledata
thisorId=[]
ngOnInit(): void { ngOnInit(): void {
this.bianli()
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.organizationName = params['organizationName']; this.organizationName = params['organizationName'];
this.buildingTypeName = params['buildingTypeName']; this.buildingTypeName = params['buildingTypeName'];
this.lastId=params['id']
this.canshuId=params['zhuId']
}); });
let paramsdata:any = {
id:this.echartsData.zuzhiorBuilding=='zhi'? this.canshuId:this.lastId,
organizationId:this.echartsData.zuzhiorBuilding=='zhi'?this.lastId:this.canshuId
}
this.echartsData.getData(paramsdata,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.canshuId}`)
this.setTimeoutObj = window.setTimeout(()=>{ this.setTimeoutObj = window.setTimeout(()=>{
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
for(var i=0;i<this.tabledata[0].organizations.length;i++){
this.zhongNameData.push(this.tabledata[0].organizations[i].organizationName)
this.zhongNumData.push(this.tabledata[0].organizations[i].count)
this.thisorId.push(this.tabledata[0].organizations[i].organizationId)
}
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.zhongNumData,this.zhongNameData)
this.detailEcharts() this.detailEcharts()
}) },1000)
} }
ngOnDestroy(){ ngOnDestroy(){
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
@ -53,11 +71,13 @@ export class AddUnitTwoTypeDetailsComponent implements OnInit {
fontSize: 12 fontSize: 12
} }
}//柱状图数值顶部显示 }//柱状图数值顶部显示
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] zhongNameData = []
zhongNumData = [200,190,180,170,160,150,140,130,120,110,100] zhongNumData = []
tiaoshiPao:any tiaoshiPao:any
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli(){
console.log(this.zhongNumData)
if(this.zhongNumData.length>=1){
var arrshuzu='['; var arrshuzu='[';
for(var i=0;i<this.zhongNumData.length;i++){ for(var i=0;i<this.zhongNumData.length;i++){
arrshuzu+='{"value":'+this.zhongNumData[i]+',"coord":['+i+','+this.zhongNumData[i]+'],"name":'+'"'+this.zhongNameData[i]+'"'+'},' arrshuzu+='{"value":'+this.zhongNumData[i]+',"coord":['+i+','+this.zhongNumData[i]+'],"name":'+'"'+this.zhongNameData[i]+'"'+'},'
@ -65,6 +85,8 @@ export class AddUnitTwoTypeDetailsComponent implements OnInit {
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1) arrshuzu=arrshuzu.substring(0,arrshuzu.length-1)
arrshuzu+=']' arrshuzu+=']'
this.tiaoshiPao=JSON.parse(arrshuzu) this.tiaoshiPao=JSON.parse(arrshuzu)
}
//return tishiPao //return tishiPao
} }
@ -73,7 +95,7 @@ export class AddUnitTwoTypeDetailsComponent implements OnInit {
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'),'walden'); this.detailPlanEchart = echarts.init(document.getElementById('barEchart'),'walden');
var option = { var option = {
title: { title: {
text: this.buildingTypeName + '(' +this.organizationName + ')'+':总数(666)', text: this.buildingTypeName + '(' +this.organizationName + ')'+`:总数(${this.tabledata[0].totalCount})`,
left: "center", left: "center",
bottom: "500", bottom: "500",
textStyle: { textStyle: {
@ -81,6 +103,7 @@ export class AddUnitTwoTypeDetailsComponent implements OnInit {
} }
}, },
xAxis: { xAxis: {
id:this.thisorId,
type: 'category', type: 'category',
data: this.zhongNameData, data: this.zhongNameData,
axisLabel:{ axisLabel:{
@ -124,11 +147,18 @@ export class AddUnitTwoTypeDetailsComponent implements OnInit {
}] }]
}; };
this.detailPlanEchart.setOption(option); this.detailPlanEchart.setOption(option);
this.detailPlanEchart.on('click', (params) => { 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];
if(this.echartsData.level=='0'||this.echartsData.level=='1'){
//总队和支队跳转
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'time':'','buildingTpye':option.xAxis.data[xIndex]+this.organizationName,'zhuid':option.xAxis.id[xIndex],'id':this.canshuId}});
}else{
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1}}); this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1}});
/* const dialogRef = this.dialog.open(CompangInfoComponent, { }
width:"400px", }
}); */
}); });
} }

59
src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.ts

@ -20,15 +20,41 @@ export class AddUnitTwoTypeStatisticsComponent implements OnInit {
url = "/statisticanalysis/addUnit_one/addUnit_two_type" //当前路由地址 url = "/statisticanalysis/addUnit_one/addUnit_two_type" //当前路由地址
setTimeoutObj//延时器需要清除 setTimeoutObj//延时器需要清除
headname headname
lastId
organizationId=[]
buildingTypeId=[]
ngOnInit(): void { ngOnInit(): void {
//this.data.zuzhiorBuilding=="zhi"
this.route.queryParams.subscribe(param=>{ this.route.queryParams.subscribe(param=>{
this.headname=param.level this.headname=param.level
this.lastId=param.id
}); });
let paramsdata:any = {
id:this.lastId,
//organizationId:'1'
}
this.data.getData(paramsdata,this.data.zuzhiorBuilding=="zhi"?`/api/StatisticsAnalysis/Companies/Organizations/${this.lastId}`:`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.lastId}`)
this.setTimeoutObj = window.setTimeout(()=>{ this.setTimeoutObj = window.setTimeout(()=>{
this.bianli() this.tabledata=JSON.parse(JSON.stringify(this.data.allDate))
console.log(this.tabledata)
if(this.data.zuzhiorBuilding=="zhi"){
for(var i=0;i<this.tabledata[0].buildingTypes.length;i++){
this.buildingData.push(this.tabledata[0].buildingTypes[i].buildingTypeName)
this.buildnumData.push(this.tabledata[0].buildingTypes[i].count)
this.buildingTypeId.push(this.tabledata[0].buildingTypes[i].buildingTypeId)
}
}else{
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.data.qipao(this.tiaoshiPao,this.data.zuzhiorBuilding=="zhi"?this.buildnumData:this.zhiNumData,this.data.zuzhiorBuilding=="zhi"?this.buildingData:this.zhiNameData)
//this.initCharts() //this.initCharts()
this.barEcharts() this.barEcharts()
},0) },1000)
} }
ngOnDestroy(){ ngOnDestroy(){
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
@ -112,8 +138,8 @@ export class AddUnitTwoTypeStatisticsComponent implements OnInit {
{name:"松江中队",number:"75",zhanbi:"0.5%"}, {name:"松江中队",number:"75",zhanbi:"0.5%"},
{name:"金山中队",number:"65",zhanbi:"0.4%"}, {name:"金山中队",number:"65",zhanbi:"0.4%"},
{name:"崇明中队",number:"55",zhanbi:"0.3%"} ] {name:"崇明中队",number:"55",zhanbi:"0.3%"} ]
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"] zhiNameData = []
zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70] zhiNumData = []
tiaoshiPao:any tiaoshiPao:any
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli(){
@ -163,8 +189,8 @@ export class AddUnitTwoTypeStatisticsComponent implements OnInit {
{id:'yingyuan',name:'影剧院',echart:null}, {id:'yingyuan',name:'影剧院',echart:null},
{id:'zhanlan',name:'展览建筑',echart:null}, {id:'zhanlan',name:'展览建筑',echart:null},
{id:'suidao',name:'隧道',echart:null}] {id:'suidao',name:'隧道',echart:null}]
buildingData=["高层","地下","轨道交通","化工生产","储罐类","厂房","古建筑","商市场","医院","学校","宾馆","娱乐场所","餐饮业","影剧院","展览建筑","隧道"] buildingData=[]
buildnumData=[200,190,180,170,160,150,140,130,120,110,100,90,80,70,60,50,40] buildnumData=[]
indexBzt //顶部饼状图 indexBzt //顶部饼状图
/* 顶部饼状图 */ /* 顶部饼状图 */
initCharts(){ initCharts(){
@ -261,13 +287,15 @@ export class AddUnitTwoTypeStatisticsComponent implements OnInit {
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }
//柱状图 //柱状图
tabledata
barEcharts(){ barEcharts(){
this.forArr.forEach(item=>{ this.forArr.forEach(item=>{
let _this = this let _this = this
item.echart = echarts.init(document.getElementById('gaoceng'),'walden'); item.echart = echarts.init(document.getElementById('gaoceng'),'walden');
let option = { let option = {
title: { title: {
text: this.headname+':总数(1024)', text: this.headname+`:总数(${this.tabledata[0].totalCount}`,
left: "center", left: "center",
top: "0", top: "0",
//bottom: '80%', //bottom: '80%',
@ -276,6 +304,7 @@ export class AddUnitTwoTypeStatisticsComponent implements OnInit {
} }
}, },
xAxis: { xAxis: {
id:this.data.zuzhiorBuilding=="zhi"?this.buildingTypeId:this.organizationId,
type: 'category', type: 'category',
data:this.data.zuzhiorBuilding=="zhi"?this.buildingData: this.zhiNameData, data:this.data.zuzhiorBuilding=="zhi"?this.buildingData: this.zhiNameData,
axisLabel:{ axisLabel:{
@ -320,8 +349,20 @@ export class AddUnitTwoTypeStatisticsComponent implements OnInit {
}] }]
}; };
item.echart.setOption(option); item.echart.setOption(option);
item.echart.on('click', (params) => { item.echart.getZr().on('click', (params) => {
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_typeDetails'],{queryParams:{'organizationName':params.name,'buildingTypeName':this.headname}}) const pointInPixel= [params.offsetX, params.offsetY];
if (item.echart.containPixel('grid',pointInPixel)){
let xIndex=item.echart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
if(this.data.level=='0'||this.data.level=='1'){
//总队,支队跳转
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_typeDetails'],{queryParams:{'organizationName':option.xAxis.data[xIndex],'buildingTypeName':this.headname,'id':this.lastId,'zhuId':option.xAxis.id[xIndex]}})
}
else{
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1}});
}
}
}); });
}) })

3
src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.ts

@ -14,6 +14,7 @@ export class BuildingTypeOneComponent implements OnInit {
constructor(private http:HttpClient,private router: Router,public echartsData:EchartsDataService) { } constructor(private http:HttpClient,private router: Router,public echartsData:EchartsDataService) { }
ngOnInit(): void { ngOnInit(): void {
this.echartsData.getData(null,`/api/StatisticsAnalysis/BuildingTypes`) this.echartsData.getData(null,`/api/StatisticsAnalysis/BuildingTypes`)
window.setTimeout(()=>{ window.setTimeout(()=>{
this.initCharts() this.initCharts()
@ -30,8 +31,8 @@ export class BuildingTypeOneComponent implements OnInit {
indexData=[]//所有数据 indexData=[]//所有数据
tabledata tabledata
initCharts(){ initCharts(){
console.log(this.echartsData.obdata)
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
for(var i=0;i<this.tabledata[0].buildingTypes.length;i++){ for(var i=0;i<this.tabledata[0].buildingTypes.length;i++){
this.lengthdata.push(this.tabledata[0].buildingTypes[i].buildingTypeName) this.lengthdata.push(this.tabledata[0].buildingTypes[i].buildingTypeName)
this.count=this.count+this.tabledata[0].buildingTypes[i].count this.count=this.count+this.tabledata[0].buildingTypes[i].count

9
src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.ts

@ -27,7 +27,7 @@ export class BuildingTypeTwoReverseComponent implements OnInit {
}); });
let paramsdata:any = { let paramsdata:any = {
id:this.buildId, id:this.buildId,
organizationId:'1' //organizationId:'1'
} }
this.data.getData(paramsdata,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildId}`) this.data.getData(paramsdata,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildId}`)
window.setTimeout(()=>{ window.setTimeout(()=>{
@ -37,7 +37,7 @@ export class BuildingTypeTwoReverseComponent implements OnInit {
this.zhiNumData.push(this.tabledata[0].organizations[i].count) this.zhiNumData.push(this.tabledata[0].organizations[i].count)
this.organizationId.push(this.tabledata[0].organizations[i].organizationId) this.organizationId.push(this.tabledata[0].organizations[i].organizationId)
} }
this.bianli() this.tiaoshiPao=this.data.qipao(this.tiaoshiPao,this.zhiNumData,this.zhiNameData)
this.barEcharts() this.barEcharts()
},1000); },1000);
@ -129,7 +129,7 @@ export class BuildingTypeTwoReverseComponent implements OnInit {
tiaoshiPao:any tiaoshiPao:any
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli(){
console.log(this.zhiNameData,this.zhiNumData) if(this.zhiNumData.length>=1){
var arrshuzu='['; var arrshuzu='[';
for(var i=0;i<this.zhiNumData.length;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+='{"value":'+this.zhiNumData[i]+',"coord":['+i+','+this.zhiNumData[i]+'],"name":'+'"'+this.zhiNameData[i]+'"'+'},'
@ -137,7 +137,8 @@ export class BuildingTypeTwoReverseComponent implements OnInit {
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1) arrshuzu=arrshuzu.substring(0,arrshuzu.length-1)
arrshuzu+=']' arrshuzu+=']'
this.tiaoshiPao=JSON.parse(arrshuzu) this.tiaoshiPao=JSON.parse(arrshuzu)
console.log(this.tiaoshiPao) }
} }
forArr = [{id:'gaoceng',name:'高层',echart:null}, forArr = [{id:'gaoceng',name:'高层',echart:null},
{id:'dixia',name:'地下',echart:null}, {id:'dixia',name:'地下',echart:null},

4
src/app/statistic-analysis/compang-info/compang-info.component.ts

@ -4,7 +4,7 @@
* @Author: sueRimn * @Author: sueRimn
* @Date: 2021-03-05 15:57:08 * @Date: 2021-03-05 15:57:08
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2021-03-10 17:02:33 * @LastEditTime: 2021-03-11 16:59:01
*/ */
import { Component, OnInit, ViewChild, Inject } from '@angular/core'; import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
@ -66,7 +66,7 @@ export class CompangInfoComponent implements OnInit{
if(this.type==1){ if(this.type==1){
//重点单位 //重点单位
let paramsdata:any = { let paramsdata:any = {
OrganizationId: this.jsId || '', //OrganizationId: this.jsId || '',
PageNumber: this.PageNumber || '1', PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0], PageSize: this.pageSizeOptions[0],
IntegrityScoreMin:0, IntegrityScoreMin:0,

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

@ -397,7 +397,7 @@ export class EchartsDataService {
return res return res
} }
/** /**
* @name: * @name: ()
* @test: test font * @test: test font
* @msg: * @msg:
* @param {string()} * @param {string()}
@ -441,6 +441,46 @@ export class EchartsDataService {
return this.res return this.res
} }
//支队表格提示
biaogeTishida(datas){
this.tishiData=''
for(var a in this.obdata[0].organizations){
if(this.obdata[0].organizations[a].organizationId==datas.id){
this.tishiData=this.obdata[0].organizations[a].subOrganizations
}
}
console.log(this.tishiData)
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.name+'</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>'
this.res+='<td style="text-align:center;">'+this.tishiData[i].organizationName+'</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;">'+allCountbi.toFixed(2)+'%</td></tfoot>'
this.res+='</table></div></div>'
return this.res
}
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]
@ -454,6 +494,7 @@ export class EchartsDataService {
* @return {json对象} * @return {json对象}
*/ */
qipao(tiaoshiPao:any,yData,xData):any{ qipao(tiaoshiPao:any,yData,xData):any{
if(yData.length>=1){
var arrshuzu='['; var arrshuzu='[';
for(var i=0;i<yData.length;i++){ for(var i=0;i<yData.length;i++){
arrshuzu+='{"value":'+yData[i]+',"coord":['+i+','+yData[i]+'],"name":'+'"'+xData[i]+'"'+'},' arrshuzu+='{"value":'+yData[i]+',"coord":['+i+','+yData[i]+'],"name":'+'"'+xData[i]+'"'+'},'
@ -466,6 +507,8 @@ export class EchartsDataService {
return tiaoshiPao return tiaoshiPao
} }
}
//获取所有数据 //获取所有数据
allDate=[] allDate=[]

Loading…
Cancel
Save