Browse Source

[完善]统计分析bug

master
邵佳豪 1 year ago
parent
commit
8fe4e0a875
  1. 2
      proxy.config.json
  2. 443
      src/app/statistic-analysis/addUnit/add-unit-one/add-unit-one.component.ts
  3. 3
      src/app/statistic-analysis/addUnit/add-unit-three-bar-details/add-unit-three-bar-details.component.ts
  4. 403
      src/app/statistic-analysis/addUnit/add-unit-three-line-details/add-unit-three-line-details.component.ts
  5. 733
      src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.ts
  6. 3
      src/app/statistic-analysis/addUnit/add-unit-two-type-details/add-unit-two-type-details.component.ts
  7. 899
      src/app/statistic-analysis/addUnit/add-unit-two-type-statistics/add-unit-two-type-statistics.component.ts
  8. 325
      src/app/statistic-analysis/buildingType/building-type-one/building-type-one.component.ts
  9. 435
      src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.ts
  10. 547
      src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.ts
  11. 719
      src/app/statistic-analysis/buildingType/building-type-two-reverse/building-type-two-reverse.component.ts
  12. 276
      src/app/statistic-analysis/deleteUnit/delete-one/delete-one.component.ts
  13. 413
      src/app/statistic-analysis/deleteUnit/delete-there/delete-there.component.ts
  14. 372
      src/app/statistic-analysis/deleteUnit/delete-two-newadd/delete-two-newadd.component.ts
  15. 585
      src/app/statistic-analysis/deleteUnit/delete-two/delete-two.component.ts
  16. 7
      src/app/statistic-analysis/home/home.component.ts
  17. 513
      src/app/statistic-analysis/real-monitoring/real-monitoring.component.ts
  18. 2713
      src/app/statistic-analysis/scheduled-updates/scheduled-updates.component.ts
  19. 699
      src/app/statistic-analysis/state/page-one/page-one.component.ts
  20. 394
      src/app/statistic-analysis/state/page-there-year/page-there-year.component.ts
  21. 496
      src/app/statistic-analysis/state/page-there/page-there.component.ts
  22. 743
      src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts
  23. 7
      src/app/statistic-analysis/state/page-zhong-dui-details/page-zhong-dui-details.component.ts
  24. 4
      src/index.html

2
proxy.config.json

@ -1,6 +1,6 @@
{ {
"/api": { "/api": {
"target": "http://10.81.73.39:8000/", "target": "http://121.36.37.70:8201/",
"生产": "http://10.81.73.39:8000/", "生产": "http://10.81.73.39:8000/",
"测试": "http://121.36.37.70:8201/", "测试": "http://121.36.37.70:8201/",
"生产2": "http://183.194.244.232:8088/", "生产2": "http://183.194.244.232:8088/",

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

@ -1,111 +1,183 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import {EchartsDataService,} from '../../echarts-data.service'; import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
declare var CryptoJS declare var CryptoJS;
@Component({ @Component({
selector: 'app-add-unit-one', selector: "app-add-unit-one",
templateUrl: './add-unit-one.component.html', templateUrl: "./add-unit-one.component.html",
styleUrls: ['./add-unit-one.component.scss'] styleUrls: ["./add-unit-one.component.scss"],
}) })
export class AddUnitOneComponent implements OnInit { export class AddUnitOneComponent implements OnInit {
constructor(private router: Router, public echartsData: EchartsDataService) {}
constructor(private router: Router,public echartsData:EchartsDataService) { } setTimeoutObj; //延时器需要清除
tabledata;
setTimeoutObj//延时器需要清除 padHw;
tabledata orid; //获取本组织id
padHw
orid//获取本组织id
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.padHw=true this.padHw = true;
//this.padjt= //this.padjt=
}else{ } else {
this.padHw=false this.padHw = false;
} }
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
/* 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`) */
let jwt = sessionStorage.getItem("token"); let jwt = sessionStorage.getItem("token");
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); let rawJwt = CryptoJS.enc.Base64.parse(jwt.split(".")[1]);
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
let identityJsonparse=JSON.parse(identityJson) let identityJsonparse = JSON.parse(identityJson);
this.orid=identityJsonparse.oid this.orid = identityJsonparse.oid;
this.setTimeoutObj = window.setTimeout(()=>{ this.setTimeoutObj = window.setTimeout(() => {
this.getechartsdata() this.getechartsdata();
}) });
this.echartsData.eventEmit.subscribe((value: any) => { this.echartsData.eventEmit.subscribe((value: any) => {
if (value == 'echarts') { if (value == "echarts") {
setTimeout(() => { setTimeout(() => {
this.indexBzt.resize() this.indexBzt.resize();
}, 500); }, 500);
} }
}); });
} }
//更新echarts视图 //更新echarts视图
updateEcharts(){ updateEcharts() {
this.indexBzt.resize() this.indexBzt.resize();
} }
//获取服务层数据 //获取服务层数据
async getechartsdata(){ async getechartsdata() {
await this.echartsData.getData(null,`/api/StatisticsAnalysis/Companies`) await this.echartsData.getData(null, `/api/StatisticsAnalysis/Companies`);
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)
this.initCharts("pieone") this.initCharts("pieone");
this.initCharts("pietwo") this.initCharts("pietwo");
} }
//组件销毁时 //组件销毁时
ngOnDestroy(){ ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
this.indexBzt.clear() if (!this.indexBzt) {
this.indexBzt.dispose() return;
}
this.indexBzt.clear();
this.indexBzt.dispose();
} }
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"] zhiNameData = [
buildingData=["高层","地下","轨道交通","化工生产","储罐类","厂房","古建筑","商市场","医院","学校","宾馆","娱乐场所","餐饮业","影剧院","展览建筑","隧道"] "浦东支队",
indexBzt//首页饼状图实例 "黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
"松江支队",
"金山支队",
"崇明支队",
];
buildingData = [
"高层",
"地下",
"轨道交通",
"化工生产",
"储罐类",
"厂房",
"古建筑",
"商市场",
"医院",
"学校",
"宾馆",
"娱乐场所",
"餐饮业",
"影剧院",
"展览建筑",
"隧道",
];
indexBzt; //首页饼状图实例
/* 首页饼状图 */ /* 首页饼状图 */
lengthBuildData=[] lengthBuildData = [];
lengthOrData=[] lengthOrData = [];
buildData=[] buildData = [];
orData=[] orData = [];
initCharts(tid){ initCharts(tid) {
for(var i=0;i<this.tabledata[0].buildingTypeStatistics.buildingTypes.length;i++){ for (
this.buildData.push(this.tabledata[0].buildingTypeStatistics.buildingTypes[i]) var i = 0;
this.lengthBuildData.push(this.tabledata[0].buildingTypeStatistics.buildingTypes[i].buildingTypeName) 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++){ for (
this.orData.push(this.tabledata[0].organizationStatistics.organizations[i]) var i = 0;
if(this.tabledata[0].organizationStatistics.organizations[i].organizationName.length>5&&this.padHw){ i < this.tabledata[0].organizationStatistics.organizations.length;
this.tabledata[0].organizationStatistics.organizations[i].organizationName=this.tabledata[0].organizationStatistics.organizations[i].organizationName.slice(0, 5) i++
+'\n'+this.tabledata[0].organizationStatistics.organizations[i].organizationName.slice(5) ) {
this.orData.push(
this.tabledata[0].organizationStatistics.organizations[i]
);
if (
this.tabledata[0].organizationStatistics.organizations[i]
.organizationName.length > 5 &&
this.padHw
) {
this.tabledata[0].organizationStatistics.organizations[
i
].organizationName =
this.tabledata[0].organizationStatistics.organizations[
i
].organizationName.slice(0, 5) +
"\n" +
this.tabledata[0].organizationStatistics.organizations[
i
].organizationName.slice(5);
} }
this.lengthOrData.push(this.tabledata[0].organizationStatistics.organizations[i].organizationName) this.lengthOrData.push(
this.tabledata[0].organizationStatistics.organizations[i]
.organizationName
);
} }
this.buildData=this.buildData.map(v=>{return {name: v.buildingTypeName,value:v.count,id:v.buildingTypeId}}) this.buildData = this.buildData.map((v) => {
this.orData=this.orData.map(v=>{return {name: v.organizationName,value:v.count,id:v.organizationId}}) return { name: v.buildingTypeName, value: v.count, id: v.buildingTypeId };
this.indexBzt = echarts.init(document.getElementById(tid),'walden'); });
let options={ this.orData = this.orData.map((v) => {
return { name: v.organizationName, value: v.count, id: v.organizationId };
});
this.indexBzt = echarts.init(document.getElementById(tid), "walden");
let options = {
title: { title: {
text:tid=="pieone"? `组织机构统计(${this.tabledata[0].organizationStatistics.totalCount}家)`:`建筑类型统计(${this.tabledata[0].buildingTypeStatistics.totalCount}家)`, text:
left: 'center', tid == "pieone"
? `组织机构统计(${this.tabledata[0].organizationStatistics.totalCount}家)`
: `建筑类型统计(${this.tabledata[0].buildingTypeStatistics.totalCount}家)`,
left: "center",
//top: "5%", //top: "5%",
//bottom:800, //bottom:800,
textStyle: { textStyle: {
fontSize:28 fontSize: 28,
} },
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
return tid=="pieone"?this.biaogeTishi(params.data,'one'):this.biaogeTishi(params.data,'two') return tid == "pieone"
? this.biaogeTishi(params.data, "one")
: this.biaogeTishi(params.data, "two");
//return this.echartsData.tableTooltip(tid=="pieone"?this.echartsData.buildingType:this.echartsData.tableDataZhi,params.name) //return this.echartsData.tableTooltip(tid=="pieone"?this.echartsData.buildingType:this.echartsData.tableDataZhi,params.name)
}, },
position:this.echartsData.tableTooltipNoShow2 position: this.echartsData.tableTooltipNoShow2,
}, },
legend: { legend: {
//type: tid=="pieone"?'scroll':'', //type: tid=="pieone"?'scroll':'',
@ -115,127 +187,178 @@ export class AddUnitOneComponent implements OnInit {
//top:100, //top:100,
//bottom:tid=="pieone"?600:500, //bottom:tid=="pieone"?600:500,
bottom: 90, bottom: 90,
left: 'center', left: "center",
textStyle:{ textStyle: {
fontSize:14, fontSize: 14,
color:"#000000" color: "#000000",
}, },
data: tid=="pieone"?this.lengthOrData:this.lengthBuildData data: tid == "pieone" ? this.lengthOrData : this.lengthBuildData,
}, },
series: [ series: [
{ {
name: '访问来源', name: "访问来源",
type: 'pie', type: "pie",
radius:this.padHw?'42%':'50%', radius: this.padHw ? "42%" : "50%",
center: ['48%', '53%'], center: ["48%", "53%"],
bottom:130, bottom: 130,
left:30, left: 30,
label:{ label: {
show:true, show: true,
fontSize:16, fontSize: 16,
formatter:'{b}\n{c}家{d|({d}%)}', formatter: "{b}\n{c}家{d|({d}%)}",
rich: { rich: {
d: { d: {
align: 'center', align: "center",
fontSize:16 fontSize: 16,
} },
}, },
}, },
data:tid=="pieone"?this.orData:this.buildData, data: tid == "pieone" ? this.orData : this.buildData,
emphasis: { emphasis: {
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
shadowOffsetX: 0, shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)' shadowColor: "rgba(0, 0, 0, 0.5)",
} },
} },
} },
] ],
}; };
this.indexBzt.on('click', (params) => { this.indexBzt.on("click", (params) => {
tid=="pieone"?this.echartsData.zuzhiorBuilding="zhi":this.echartsData.zuzhiorBuilding="building" tid == "pieone"
if((this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2')&&this.tishiData.length>0){ ? (this.echartsData.zuzhiorBuilding = "zhi")
: (this.echartsData.zuzhiorBuilding = "building");
if (
(this.echartsData.level == "0" ||
this.echartsData.level == "1" ||
this.echartsData.level == "2") &&
this.tishiData.length > 0
) {
//总队,支队,大队跳转 //总队,支队,大队跳转
this.tishiData.forEach((value,index,array) => { this.tishiData.forEach((value, index, array) => {
if(array[index].organizationId==this.orid){ if (array[index].organizationId == this.orid) {
array.splice(index,1) array.splice(index, 1);
} }
if(array.length>0){ if (array.length > 0) {
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':params.name,'id':params.data.id,'type':tid=="pieone"?'zhi':'build'}}); this.router.navigate(
} ["/statisticanalysis/addUnit_one/addUnit_two_type"],
else{ {
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1,'buildid':tid!="pieone"?params.data.id:'','jsid':tid=="pieone"?params.data.id:''}}); queryParams: {
level: params.name,
id: params.data.id,
type: tid == "pieone" ? "zhi" : "build",
},
}
);
} else {
this.router.navigate(["/statisticanalysis/CompangInfo"], {
queryParams: {
name: params.name,
type: 1,
buildid: tid != "pieone" ? params.data.id : "",
jsid: tid == "pieone" ? params.data.id : "",
},
});
} }
}); });
} else {
}else{
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1,'buildid':tid!="pieone"?params.data.id:'','jsid':tid=="pieone"?params.data.id:''}}); this.router.navigate(["/statisticanalysis/CompangInfo"], {
queryParams: {
name: params.name,
type: 1,
buildid: tid != "pieone" ? params.data.id : "",
jsid: tid == "pieone" ? params.data.id : "",
},
});
} }
}); });
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }
res res;
tishiData tishiData;
biaogeTishi(datas,type){ biaogeTishi(datas, type) {
//console.log(datas) //console.log(datas)
this.res='' this.res = "";
this.tishiData='' this.tishiData = "";
if(type=='two'){ if (type == "two") {
for(var a in this.echartsData.obdata[0].buildingTypeStatistics.buildingTypes){ for (var a in this.echartsData.obdata[0].buildingTypeStatistics
if(this.echartsData.obdata[0].buildingTypeStatistics.buildingTypes[a].buildingTypeName==datas.name){ .buildingTypes) {
this.tishiData=this.echartsData.obdata[0].buildingTypeStatistics.buildingTypes[a].organizations if (
this.echartsData.obdata[0].buildingTypeStatistics.buildingTypes[a]
.buildingTypeName == datas.name
) {
this.tishiData =
this.echartsData.obdata[0].buildingTypeStatistics.buildingTypes[
a
].organizations;
} }
} }
}else{ } else {
for(var a in this.echartsData.obdata[0].organizationStatistics.organizations){ for (var a in this.echartsData.obdata[0].organizationStatistics
if(this.echartsData.obdata[0].organizationStatistics.organizations[a].organizationId==datas.id){ .organizations) {
this.tishiData=this.echartsData.obdata[0].organizationStatistics.organizations[a].buildingTypes if (
this.echartsData.obdata[0].organizationStatistics.organizations[a]
.organizationId == datas.id
) {
this.tishiData =
this.echartsData.obdata[0].organizationStatistics.organizations[
a
].buildingTypes;
} }
} }
} }
//console.log(this.tishiData) //console.log(this.tishiData)
var countall=0//总计 var countall = 0; //总计
var countbi=0//站比 var countbi = 0; //站比
var allCountbi=0//总站比 var allCountbi = 0; //总站比
for(var i=0;i<this.tishiData.length;i++){ for (var i = 0; i < this.tishiData.length; i++) {
countall+=this.tishiData[i].count 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:14px; 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.0;
allCountbi = allCountbi + countbi;
this.res += "<tr>";
if (type == "two") {
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= '<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:14px; color:#FFFFFF;border-collapse:collapse;"cellspacing="0"; >'; this.res +=
this.res+='<thead style="font-size:18px;"><tr>'; '<td style="text-align:center;">' + this.tishiData[i].count + "</td>";
this.res+='<td style="text-align:center;width:30%;">名称</td>'; if (countall == 0) {
this.res+='<td style="text-align:center;width:30%;">数量</td>' this.res += '<td style="text-align:center;">0%</td></tr>';
this.res+='<td style="text-align:center;width:30%;">总占比</td>' } else {
this.res+='</tr></thead>' this.res += '<td style="text-align:center;">' + countbi + "%</td></tr>";
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(type=='two'){
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>'
if(countall==0){
this.res+='<td style="text-align:center;">0%</td></tr>'
}else{
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 += "</tbody>";
this.res+='</table></div></div>' this.res +=
return 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;
} }
} }

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

@ -42,6 +42,9 @@ export class AddUnitThreeBarDetailsComponent implements OnInit {
} }
ngOnDestroy(){ ngOnDestroy(){
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
if (!this.detailPlanEchart) {
return;
}
this.detailPlanEchart.clear() this.detailPlanEchart.clear()
this.detailPlanEchart.dispose() this.detailPlanEchart.dispose()
} }

403
src/app/statistic-analysis/addUnit/add-unit-three-line-details/add-unit-three-line-details.component.ts

@ -1,146 +1,193 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import {
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; MatDialog,
import { ActivatedRoute } from '@angular/router'; MatDialogRef,
import { EchartsDataService } from '../../echarts-data.service'; MAT_DIALOG_DATA,
} from "@angular/material/dialog";
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import { ActivatedRoute } from "@angular/router";
import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-add-unit-three-line-details', selector: "app-add-unit-three-line-details",
templateUrl: './add-unit-three-line-details.component.html', templateUrl: "./add-unit-three-line-details.component.html",
styleUrls: ['./add-unit-three-line-details.component.scss'] styleUrls: ["./add-unit-three-line-details.component.scss"],
}) })
export class AddUnitThreeLineDetailsComponent implements OnInit { export class AddUnitThreeLineDetailsComponent implements OnInit {
constructor(
constructor(private router: Router,public dialog: MatDialog,public snackBar: MatSnackBar,private serviceData: EchartsDataService,public route: ActivatedRoute) { } private router: Router,
year:String public dialog: MatDialog,
buildingTypeName:String public snackBar: MatSnackBar,
level:String private serviceData: EchartsDataService,
setTimeoutObj//延时器需要清除 public route: ActivatedRoute
qopao ) {}
lastId year: String;
zhiorbuild buildingTypeName: String;
level: String;
setTimeoutObj; //延时器需要清除
qopao;
lastId;
zhiorbuild;
ngOnInit(): void { ngOnInit(): void {
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
this.serviceData.selectType=0 this.serviceData.selectType = 0;
this.dateInit () this.dateInit();
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe((params) => {
this.year = params['year']; this.year = params["year"];
this.buildingTypeName = params['buildingType']; this.buildingTypeName = params["buildingType"];
this.lastId=params['id'] this.lastId = params["id"];
this.zhiorbuild=params['type'] this.zhiorbuild = params["type"];
});
this.setTimeoutObj = window.setTimeout(() => {
this.getdata();
}); });
this.setTimeoutObj = window.setTimeout(()=>{
this.getdata()
})
} }
ngOnDestroy(){ ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
this.detailPlanEchart.clear() if (!this.detailPlanEchart) {
this.detailPlanEchart.dispose() return;
}
tabledata
zongcount=0
async getdata(){
let parzhi={
objectType:0,
BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType,
TrendYear:this.year||''
} }
let parbuild={ this.detailPlanEchart.clear();
objectType:0, this.detailPlanEchart.dispose();
OrganizationId:this.lastId, }
TrendType:this.serviceData.selectType, tabledata;
TrendYear:this.year||'' zongcount = 0;
} async getdata() {
await this.serviceData.getData(this.zhiorbuild=='zhi'?parbuild:parzhi,`/api/StatisticsAnalysis/Trends`) let parzhi = {
objectType: 0,
BuildingTypeId: this.lastId,
TrendType: this.serviceData.selectType,
TrendYear: this.year || "",
};
let parbuild = {
objectType: 0,
OrganizationId: this.lastId,
TrendType: this.serviceData.selectType,
TrendYear: this.year || "",
};
await this.serviceData.getData(
this.zhiorbuild == "zhi" ? parbuild : parzhi,
`/api/StatisticsAnalysis/Trends`
);
this.setTimeoutObj = window.setTimeout(() => { this.setTimeoutObj = window.setTimeout(() => {
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.tabledata = JSON.parse(JSON.stringify(this.serviceData.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.serviceData.selectStartMonth||this.tabledata[0][i].month<=this.serviceData.selectEndMonth){ if (
this.date.push(this.tabledata[0][i].month) this.tabledata[0][i].month >= this.serviceData.selectStartMonth ||
this.dateNum.push(this.tabledata[0][i].count) this.tabledata[0][i].month <= this.serviceData.selectEndMonth
this.zongcount=this.zongcount+this.tabledata[0][i].count ) {
} this.date.push(this.tabledata[0][i].month);
this.dateNum.push(this.tabledata[0][i].count);
this.zongcount = this.zongcount + this.tabledata[0][i].count;
} }
this.date.forEach((value,index,array)=>{ }
this.date[index]=this.date[index]+'月' this.date.forEach((value, index, array) => {
}) this.date[index] = this.date[index] + "月";
});
//this.oneInit (this.date,this.dateNum) //this.oneInit (this.date,this.dateNum)
this.qopao=this.serviceData.qipao(this.qopao,this.dateNum,this.zhiNameData) this.qopao = this.serviceData.qipao(
this.detailEcharts() this.qopao,
this.dateNum,
this.zhiNameData
);
this.detailEcharts();
}); });
} }
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据 //查询数据
years:any = [] years: any = [];
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];
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
this.years.unshift(i) this.years.unshift(i);
} }
} }
selectOneYear:any = (new Date()).getFullYear() //开始年份 selectOneYear: any = new Date().getFullYear(); //开始年份
selectStartMonth:any = 1 //开始月份 selectStartMonth: any = 1; //开始月份
Submit (e) { Submit(e) {}
selectStartYear: any = new Date().getFullYear(); //开始年份
}
selectStartYear:any = (new Date()).getFullYear() //开始年份
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] }; //柱状图数值顶部显示
zhongNumData = [200,190,180,170,160,150,140,130,120,110,100] zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
];
zhongNumData = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100];
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队"] zhiNameData = [
zhiNumData = [300,290,280,270,260,250,240,230,220,210,200] "浦东支队",
"黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
];
zhiNumData = [300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200];
detailPlanEchart;
option;
date = [];
dateNum = [];
detailPlanEchart detailEcharts() {
option this.detailPlanEchart = echarts.init(
date = [] document.getElementById("barEchart"),
dateNum = [] "skinUpp"
);
detailEcharts(){
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp');
this.option = { this.option = {
grid: { grid: {
top: 90, top: 90,
}, },
// 标题 // 标题
title: { title: {
text: this.buildingTypeName , text: this.buildingTypeName,
top: -4, top: -4,
left: 'center', left: "center",
textStyle:{ textStyle: {
//文字颜色 //文字颜色
color:'#000', color: "#000",
fontSize: 30 fontSize: 30,
} },
}, },
//提示框 //提示框
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
/* formatter: (params)=>{ /* formatter: (params)=>{
if(params[0].seriesName == "year"){ if(params[0].seriesName == "year"){
return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name) return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name)
@ -148,102 +195,138 @@ export class AddUnitThreeLineDetailsComponent implements OnInit {
return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name) return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name)
} }
}, */ }, */
position:this.serviceData.tableTooltipNoShow2 position: this.serviceData.tableTooltipNoShow2,
}, },
// x轴 // x轴
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.date, data: this.date,
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
}, },
color: "#000", //刻度线标签颜色 color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
}, },
}, },
splitLine: {//分割线配置 splitLine: {
show:true, //分割线配置
show: true,
lineStyle: { lineStyle: {
color: '#999', color: "#999",
} },
} },
}, },
// y轴 // y轴
yAxis: { yAxis: {
type: 'value', type: "value",
name: '个', name: "个",
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
}, },
color: "#000" //刻度线标签颜色 color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
} },
} },
}, },
// 数据 // 数据
series: [{ series: [
name: 'xxx', {
type: 'line', name: "xxx",
type: "line",
data: this.dateNum, data: this.dateNum,
barWidth :'38', barWidth: "38",
markPoint: { markPoint: {
symbolSize:[65, 65], symbolSize: [65, 65],
data: this.qopao data: this.qopao,
},
}, },
}
], ],
}; };
this.detailPlanEchart.setOption(this.option); this.detailPlanEchart.setOption(this.option);
this.detailPlanEchart.getZr().on('click',params=>{ this.detailPlanEchart.getZr().on("click", (params) => {
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) { if (this.detailPlanEchart.containPixel("grid", pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = this.detailPlanEchart.convertFromPixel(
{ seriesIndex: 0 },
[params.offsetX, params.offsetY]
)[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':this.buildingTypeName,'id':this.lastId,'type':this.zhiorbuild,'year':this.year,month:this.option.xAxis.data[xIndex]}}) this.router.navigate(
["/statisticanalysis/addUnit_one/addUnit_two_type"],
{
queryParams: {
level: this.buildingTypeName,
id: this.lastId,
type: this.zhiorbuild,
year: this.year,
month: this.option.xAxis.data[xIndex],
},
}
);
//this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'level':'zhidui','time':this.option.xAxis.data[xIndex],'buildingTpye':this.buildingTypeName}}); //this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'level':'zhidui','time':this.option.xAxis.data[xIndex],'buildingTpye':this.buildingTypeName}});
} }
}); });
} }
//返回按钮 //返回按钮
backBtn(){ backBtn() {
sessionStorage.setItem('refresh', 'true'); sessionStorage.setItem("refresh", "true");
history.go(-1); history.go(-1);
} }
tableTooltip(params:any){ tableTooltip(params: any) {
var data = [ var data = [
{name:params.name,number:params.value,zhanbi:(params.value/1340 * 100).toFixed(2) + "%"} {
] name: params.name,
var 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:#000000;font-size:30px;text-align: center;display:block;">'+params.name+'</span></div>' number: params.value,
res+='</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >'; zhanbi: ((params.value / 1340) * 100).toFixed(2) + "%",
res+='<thead><tr>'; },
res+='<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>'; ];
res+='<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>' var res =
res+='<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>' '<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#000000;font-size:30px;text-align: center;display:block;">' +
res+='</tr></thead>' params.name +
res+='<tbody>'; "</span></div>";
for(var i=0;i<data.length;i++){ res +=
res+='<tr>' '</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >';
res+='<td style="text-align:center;border:1px solid #000000">'+data[i].name+'</td>' res += "<thead><tr>";
res+='<td style="text-align:center;border:1px solid #000000">'+data[i].number+'</td>' res +=
res+='<td style="text-align:center;border:1px solid #000000">'+data[i].zhanbi+'</td></tr>' '<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>';
} res +=
'<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>';
res+='</tbody>' res +=
// res+='<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>' '<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>';
res+='</table></div></div>' res += "</tr></thead>";
return res res += "<tbody>";
for (var i = 0; i < data.length; i++) {
res += "<tr>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
data[i].name +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
data[i].number +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
data[i].zhanbi +
"</td></tr>";
}
res += "</tbody>";
// res+='<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>'
res += "</table></div></div>";
return res;
} }
} }

733
src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.ts

@ -1,381 +1,484 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from "@angular/router";
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import {
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; MatDialog,
import { EchartsDataService } from '../../echarts-data.service'; MatDialogRef,
MAT_DIALOG_DATA,
} from "@angular/material/dialog";
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-add-unit-two-time', selector: "app-add-unit-two-time",
templateUrl: './add-unit-two-time.component.html', templateUrl: "./add-unit-two-time.component.html",
styleUrls: ['./add-unit-two-time.component.scss'] styleUrls: ["./add-unit-two-time.component.scss"],
}) })
export class AddUnitTwoTimeComponent implements OnInit { export class AddUnitTwoTimeComponent implements OnInit {
constructor(
constructor(private router: Router,public dialog: MatDialog,public snackBar: MatSnackBar,private serviceData: EchartsDataService,private route:ActivatedRoute) { } private router: Router,
setTimeoutObj//延时器需要清除 public dialog: MatDialog,
headname public snackBar: MatSnackBar,
type=1 private serviceData: EchartsDataService,
lastId private route: ActivatedRoute
tabledata ) {}
zongcount=0 setTimeoutObj; //延时器需要清除
zhiorbuild headname;
type = 1;
lastId;
tabledata;
zongcount = 0;
zhiorbuild;
ngOnInit(): void { ngOnInit(): void {
this.serviceData.selectType=0 this.serviceData.selectType = 0;
this.dateInit () this.dateInit();
this.route.queryParams.subscribe(param=>{ this.route.queryParams.subscribe((param) => {
this.headname=param.level this.headname = param.level;
this.zhiorbuild=param.type this.zhiorbuild = param.type;
this.lastId=param.id this.lastId = param.id;
}); });
this.getdata() this.getdata();
} }
ngOnDestroy(){ ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
this.forArr.forEach(item => { if (this.forArr && this.forArr.length !== 0) {
item.echart.clear() this.forArr.forEach((item) => {
item.echart.dispose() item.echart.clear();
}) item.echart.dispose();
});
}
} }
//获取数据 //获取数据
yeardatee=new Date().getFullYear() yeardatee = new Date().getFullYear();
async getdata(){ async getdata() {
this.date=[] this.date = [];
this.dateNum=[] this.dateNum = [];
this.zongcount=0 this.zongcount = 0;
let parzhi={ let parzhi = {
objectType:0, objectType: 0,
BuildingTypeId:this.lastId, BuildingTypeId: this.lastId,
TrendType:this.serviceData.selectType, TrendType: this.serviceData.selectType,
TrendYear:this.yeardatee||'' TrendYear: this.yeardatee || "",
} };
let parbuild={ let parbuild = {
objectType:0, objectType: 0,
OrganizationId:this.lastId, OrganizationId: this.lastId,
TrendType:this.serviceData.selectType, TrendType: this.serviceData.selectType,
TrendYear:this.yeardatee||'' TrendYear: this.yeardatee || "",
} };
await this.serviceData.getData(this.zhiorbuild=="zhi"?parbuild:parzhi,`/api/StatisticsAnalysis/Trends`) await this.serviceData.getData(
this.zhiorbuild == "zhi" ? parbuild : parzhi,
`/api/StatisticsAnalysis/Trends`
);
this.setTimeoutObj = window.setTimeout(() => { this.setTimeoutObj = window.setTimeout(() => {
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.tabledata = JSON.parse(JSON.stringify(this.serviceData.allDate));
//console.log(this.tabledata[0]) //console.log(this.tabledata[0])
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.serviceData.selectStartMonth||this.tabledata[0][i].month<=this.serviceData.selectEndMonth){ if (
this.date.push(this.tabledata[0][i].month) this.tabledata[0][i].month >= this.serviceData.selectStartMonth ||
this.dateNum.push(this.tabledata[0][i].count) this.tabledata[0][i].month <= this.serviceData.selectEndMonth
this.zongcount=this.zongcount+this.tabledata[0][i].count ) {
} this.date.push(this.tabledata[0][i].month);
this.dateNum.push(this.tabledata[0][i].count);
this.zongcount = this.zongcount + this.tabledata[0][i].count;
} }
this.date.forEach((value,index,array)=>{ }
this.date[index]=this.date[index]+'月' this.date.forEach((value, index, array) => {
}) this.date[index] = this.date[index] + "月";
});
//this.oneInit (this.date,this.dateNum) //this.oneInit (this.date,this.dateNum)
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date) this.tiaoshiPao = this.serviceData.qipao(
this.twoInit (this.date,this.dateNum,'month') this.tiaoshiPao,
this.dateNum,
this.date
);
this.twoInit(this.date, this.dateNum, "month");
}); });
} }
forward(){ forward() {
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':this.headname,'id':this.lastId,'type':this.zhiorbuild=='zhi'?'zhi':'build'}}) this.router.navigate(["/statisticanalysis/addUnit_one/addUnit_two_type"], {
queryParams: {
level: this.headname,
id: this.lastId,
type: this.zhiorbuild == "zhi" ? "zhi" : "build",
},
});
} }
reverse(){ reverse() {
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time'],{queryParams:{'level':this.headname,'id':this.lastId,'type':this.zhiorbuild=='zhi'?'zhi':'build'}}) this.router.navigate(["/statisticanalysis/addUnit_one/addUnit_two_time"], {
queryParams: {
level: this.headname,
id: this.lastId,
type: this.zhiorbuild == "zhi" ? "zhi" : "build",
},
});
} }
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据 //查询数据
years= [] 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];
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
//this.years.unshift(i) //this.years.unshift(i)
} }
} }
selectOneYear:any = (new Date()).getFullYear() //开始年份 selectOneYear: any = new Date().getFullYear(); //开始年份
selectTwoYear:any = (new Date()).getFullYear() //结束年份 selectTwoYear: any = new Date().getFullYear(); //结束年份
selectStartMonth:any = 1 //开始月份 selectStartMonth: any = 1; //开始月份
selectEndMonth:any = (new Date()).getMonth()+1 //结束月份 selectEndMonth: any = new Date().getMonth() + 1; //结束月份
//按月查询 //按月查询
monthSubmit (e) { monthSubmit(e) {
this.serviceData.selectStartMonth=this.selectStartMonth this.serviceData.selectStartMonth = this.selectStartMonth;
this.serviceData.selectEndMonth=this.selectEndMonth this.serviceData.selectEndMonth = this.selectEndMonth;
//console.log(this.selectStartMonth,this.selectEndMonth) //console.log(this.selectStartMonth,this.selectEndMonth)
this.date=[] this.date = [];
this.dateNum=[] this.dateNum = [];
this.zongcount=0 this.zongcount = 0;
if (e.selectEndMonth>=e.selectStartMonth) { if (e.selectEndMonth >= e.selectStartMonth) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime =
let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 e.selectOneYear +
for(var i=0;i<this.tabledata[0].length;i++){ "-" +
if(this.tabledata[0][i].month>=this.serviceData.selectStartMonth&&this.tabledata[0][i].month<=this.serviceData.selectEndMonth){ e.selectStartMonth +
this.date.push(this.tabledata[0][i].month) "-" +
this.dateNum.push(this.tabledata[0][i].count) 1 +
this.zongcount=this.zongcount+this.tabledata[0][i].count " " +
0 +
":" +
0 +
":" +
0;
let endTime =
e.selectTwoYear +
"-" +
e.selectEndMonth +
"-" +
31 +
" " +
23 +
":" +
59 +
":" +
59;
for (var i = 0; i < this.tabledata[0].length; i++) {
if (
this.tabledata[0][i].month >= this.serviceData.selectStartMonth &&
this.tabledata[0][i].month <= this.serviceData.selectEndMonth
) {
this.date.push(this.tabledata[0][i].month);
this.dateNum.push(this.tabledata[0][i].count);
this.zongcount = this.zongcount + this.tabledata[0][i].count;
} }
} }
//this.oneInit (this.date,this.dateNum) //this.oneInit (this.date,this.dateNum)
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date) this.tiaoshiPao = this.serviceData.qipao(
this.twoInit (this.date,this.dateNum,'month') this.tiaoshiPao,
this.dateNum,
this.date
);
this.twoInit(this.date, this.dateNum, "month");
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
this.snackBar.open('请选择正确时间区段','确定',config); this.snackBar.open("请选择正确时间区段", "确定", config);
} }
} }
selectStartYear:any = (new Date()).getFullYear()-1 //开始年份 selectStartYear: any = new Date().getFullYear() - 1; //开始年份
selectEndYear:any = (new Date()).getFullYear() //结束年份 selectEndYear: any = new Date().getFullYear(); //结束年份
//按年查询 //按年查询
yearSubmit (e) { yearSubmit(e) {
this.zongcount=0 this.zongcount = 0;
this.date2=[] this.date2 = [];
this.dateNum2=[] this.dateNum2 = [];
if (e.selectEndYear >= e.selectStartYear) { if (e.selectEndYear >= e.selectStartYear) {
let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime =
let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 e.selectStartYear + "-" + 1 + "-" + 1 + " " + 0 + ":" + 0 + ":" + 0;
for(var i=0;i<this.tabledata[0].length;i++){ let endTime =
if(this.tabledata[0][i].year>=e.selectStartYear&&this.tabledata[0][i].year<=e.selectEndYear){ e.selectEndYear + "-" + 12 + "-" + 31 + " " + 23 + ":" + 59 + ":" + 59;
this.date2.push(this.tabledata[0][i].year) for (var i = 0; i < this.tabledata[0].length; i++) {
this.dateNum2.push(this.tabledata[0][i].count) if (
this.zongcount=this.zongcount+this.tabledata[0][i].count this.tabledata[0][i].year >= e.selectStartYear &&
this.tabledata[0][i].year <= e.selectEndYear
) {
this.date2.push(this.tabledata[0][i].year);
this.dateNum2.push(this.tabledata[0][i].count);
this.zongcount = this.zongcount + this.tabledata[0][i].count;
} }
} }
//this.oneInit (this.date,this.dateNum) //this.oneInit (this.date,this.dateNum)
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2) this.tiaoshiPao = this.serviceData.qipao(
this.twoInit (this.date2,this.dateNum2,'year') this.tiaoshiPao,
this.dateNum2,
this.date2
);
this.twoInit(this.date2, this.dateNum2, "year");
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
this.snackBar.open('结束年份必须大于开始年份','确定',config); this.snackBar.open("结束年份必须大于开始年份", "确定", config);
} }
} }
//年或月点击 //年或月点击
async dateChange(){ async dateChange() {
this.tiaoshiPao=null this.tiaoshiPao = null;
this.forArr.forEach(item => { this.forArr.forEach((item) => {
item.echart.dispose() item.echart.dispose();
}) });
if(this.selectType == "year"){ if (this.selectType == "year") {
this.zongcount=0 this.zongcount = 0;
this.date2=[] this.date2 = [];
this.dateNum2=[] this.dateNum2 = [];
this.years=[] this.years = [];
this.serviceData.selectType=2 this.serviceData.selectType = 2;
let parzhi={ let parzhi = {
objectType:0, objectType: 0,
BuildingTypeId:this.lastId, BuildingTypeId: this.lastId,
TrendType:this.serviceData.selectType, TrendType: this.serviceData.selectType,
} };
let parbuild={ let parbuild = {
objectType:0, objectType: 0,
OrganizationId:this.lastId, OrganizationId: this.lastId,
TrendType:this.serviceData.selectType, TrendType: this.serviceData.selectType,
} };
/* let paramdata={ /* let paramdata={
BuildingTypeId:this.lastId, BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType TrendType:this.serviceData.selectType
} */ } */
await this.serviceData.getData(this.zhiorbuild=="zhi"?parbuild:parzhi,`/api/StatisticsAnalysis/Trends`) await this.serviceData.getData(
this.zhiorbuild == "zhi" ? parbuild : parzhi,
`/api/StatisticsAnalysis/Trends`
);
this.setTimeoutObj = window.setTimeout(() => { this.setTimeoutObj = window.setTimeout(() => {
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.tabledata = JSON.parse(JSON.stringify(this.serviceData.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++) {
this.date2.push(this.tabledata[0][i].year) this.date2.push(this.tabledata[0][i].year);
this.dateNum2.push(this.tabledata[0][i].count) this.dateNum2.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.years.push(this.tabledata[0][i].year) //this.years.push(this.tabledata[0][i].year)
this.years=['2020','2021','2022'] this.years = ["2020", "2021", "2022"];
} }
//this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date) //this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2) this.tiaoshiPao = this.serviceData.qipao(
this.twoInit (this.date2,this.dateNum2,'year') this.tiaoshiPao,
this.dateNum2,
this.date2
);
this.twoInit(this.date2, this.dateNum2, "year");
}); });
/* this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2) /* this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2)
this.twoInit(this.date2,this.dateNum2,'year') */ this.twoInit(this.date2,this.dateNum2,'year') */
} }
if(this.selectType == "month"){ if (this.selectType == "month") {
this.serviceData.selectType=0 this.serviceData.selectType = 0;
this.getdata() this.getdata();
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date) this.tiaoshiPao = this.serviceData.qipao(
this.tiaoshiPao,
this.dateNum,
this.date
);
//this.oneInit(this.date,this.dateNum) //this.oneInit(this.date,this.dateNum)
this.twoInit(this.date,this.dateNum,'month') this.twoInit(this.date, this.dateNum, "month");
} }
} }
chartQusj; //顶部大图实例
forArr =
this.serviceData.zuzhiorBuilding == "zhi"
? [
{ id: "gaoceng", name: "浦东支队", echart: null },
{ id: "dixia", name: "黄浦支队", echart: null },
{ id: "guidao", name: "徐汇支队", echart: null },
{ id: "huagong", name: "长宁支队", echart: null },
{ id: "chuguan", name: "静安支队", echart: null },
{ id: "changfang", name: "普陀支队", echart: null },
{ id: "gujianzhu", name: "虹口支队", echart: null },
{ id: "shichang", name: "杨浦支队", echart: null },
{ id: "yiyuan", name: "闵行支队", echart: null },
{ id: "xuexiao", name: "宝山支队", echart: null },
{ id: "binguan", name: "嘉定支队", echart: null },
{ id: "yule", name: "松江支队", echart: null },
{ id: "canyin", name: "金山支队", echart: null },
{ id: "yingyuan", name: "崇明支队", echart: null },
]
: [
{ id: "gaoceng", name: "高层", echart: null },
{ id: "dixia", name: "地下", echart: null },
{ id: "guidao", name: "轨道交通", echart: null },
{ id: "huagong", name: "化工生产", echart: null },
{ id: "chuguan", name: "储罐类", echart: null },
{ id: "changfang", name: "厂房", echart: null },
{ id: "gujianzhu", name: "古建筑", echart: null },
{ id: "shichang", name: "商市场", echart: null },
{ id: "yiyuan", name: "医院", echart: null },
{ id: "xuexiao", name: "学校", echart: null },
{ id: "binguan", name: "宾馆", echart: null },
{ id: "yule", name: "娱乐场所", echart: null },
{ id: "canyin", name: "餐饮业", echart: null },
{ id: "yingyuan", name: "影剧院", echart: null },
{ id: "zhanlan", name: "展览建筑", echart: null },
{ id: "suidao", name: "隧道", echart: null },
];
chartQusj//顶部大图实例 date = [];
forArr =this.serviceData.zuzhiorBuilding=="zhi"? [{id:'gaoceng',name:'浦东支队',echart:null}, dateNum = [];
{id:'dixia',name:'黄浦支队',echart:null}, tiaoshiPao: any;
{id:'guidao',name:'徐汇支队',echart:null},
{id:'huagong',name:'长宁支队',echart:null},
{id:'chuguan',name:'静安支队',echart:null},
{id:'changfang',name:'普陀支队',echart:null},
{id:'gujianzhu',name:'虹口支队',echart:null},
{id:'shichang',name:'杨浦支队',echart:null},
{id:'yiyuan',name:'闵行支队',echart:null},
{id:'xuexiao',name:'宝山支队',echart:null},
{id:'binguan',name:'嘉定支队',echart:null},
{id:'yule',name:'松江支队',echart:null},
{id:'canyin',name:'金山支队',echart:null},
{id:'yingyuan',name:'崇明支队',echart:null}]:
[{id:'gaoceng',name:'高层',echart:null},
{id:'dixia',name:'地下',echart:null},
{id:'guidao',name:'轨道交通',echart:null},
{id:'huagong',name:'化工生产',echart:null},
{id:'chuguan',name:'储罐类',echart:null},
{id:'changfang',name:'厂房',echart:null},
{id:'gujianzhu',name:'古建筑',echart:null},
{id:'shichang',name:'商市场',echart:null},
{id:'yiyuan',name:'医院',echart:null},
{id:'xuexiao',name:'学校',echart:null},
{id:'binguan',name:'宾馆',echart:null},
{id:'yule',name:'娱乐场所',echart:null},
{id:'canyin',name:'餐饮业',echart:null},
{id:'yingyuan',name:'影剧院',echart:null},
{id:'zhanlan',name:'展览建筑',echart:null},
{id:'suidao',name:'隧道',echart:null}]
date = []
dateNum = []
tiaoshiPao:any
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
var arrshuzu='['; var arrshuzu = "[";
for(var i=0;i<this.dateNum.length;i++){ for (var i = 0; i < this.dateNum.length; i++) {
arrshuzu+='{"value":'+this.dateNum[i]+',"coord":['+i+','+this.dateNum[i]+'],"name":'+'"'+this.date[i]+'"'+'},' arrshuzu +=
'{"value":' +
this.dateNum[i] +
',"coord":[' +
i +
"," +
this.dateNum[i] +
'],"name":' +
'"' +
this.date[i] +
'"' +
"},";
} }
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) //console.log(this.tiaoshiPao)
//return tishiPao //return tishiPao
} }
thisYear=new Date().getFullYear() thisYear = new Date().getFullYear();
date2 = ['2020', '2021','2022'] date2 = ["2020", "2021", "2022"];
dateNum2 = [] dateNum2 = [];
//新增数量统计 //新增数量统计
oneInit (date,dateNum) { oneInit(date, dateNum) {
this.chartQusj = echarts.init(document.getElementById('Line'), 'skinUpp'); this.chartQusj = echarts.init(document.getElementById("Line"), "skinUpp");
var option = { var option = {
grid: { grid: {
top: 70, top: 70,
left:40, left: 40,
right: 20, right: 20,
bottom: 20, bottom: 20,
}, },
// 标题 // 标题
title: { title: {
text: '新增数量统计:总数(1012)', text: "新增数量统计:总数(1012)",
top: -4, top: -4,
left: 'center', left: "center",
textStyle:{ textStyle: {
//文字颜色 //文字颜色
color:'#000', color: "#000",
fontSize: 30, fontSize: 30,
} },
}, },
//提示框 //提示框
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
formatter: (params)=>{ formatter: (params) => {
return this.serviceData.tableTooltip(this.serviceData.zuzhiorBuilding=="zhi"?this.serviceData.tableDataZhi :this.serviceData.buildingType,params[0].name) return this.serviceData.tableTooltip(
this.serviceData.zuzhiorBuilding == "zhi"
? this.serviceData.tableDataZhi
: this.serviceData.buildingType,
params[0].name
);
}, },
position:this.serviceData.tableTooltipNoShowt position: this.serviceData.tableTooltipNoShowt,
}, },
// x轴 // x轴
xAxis: { xAxis: {
type: 'category', type: "category",
data: date, data: date,
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :15, fontSize: 15,
color:'#000000' color: "#000000",
}, },
color: "#000", //刻度线标签颜色 color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
}, },
}, },
splitLine: {//分割线配置 splitLine: {
show:true, //分割线配置
show: true,
lineStyle: { lineStyle: {
color: '#999', color: "#999",
} },
} },
}, },
// y轴 // y轴
yAxis: { yAxis: {
type: 'value', type: "value",
name: '个', name: "个",
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :15, fontSize: 15,
color:'#000000' color: "#000000",
}, },
color: "#000" //刻度线标签颜色 color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
} },
} },
}, },
// 数据 // 数据
series: [{ series: [
name: '新增数量', {
type: 'line', name: "新增数量",
type: "line",
markPoint: { markPoint: {
symbolSize: [65, 65],
symbolSize:[65, 65], data: this.tiaoshiPao,
data: this.tiaoshiPao },
},
data: dateNum, data: dateNum,
} },
], ],
} };
this.chartQusj.setOption(option); this.chartQusj.setOption(option);
} }
//剩余折线图 //剩余折线图
twoInit (date,dateNum,typeName) { twoInit(date, dateNum, typeName) {
this.forArr.forEach((item,key) => { this.forArr.forEach((item, key) => {
let that = this let that = this;
item.echart = echarts.init(document.getElementById('gaoceng'), 'skinUpp'); item.echart = echarts.init(document.getElementById("gaoceng"), "skinUpp");
var option = { var option = {
grid: { grid: {
top: 90, top: 90,
}, },
// 标题 // 标题
title: { title: {
text: this.headname+`:总数(${this.zongcount}`, text: this.headname + `:总数(${this.zongcount}`,
top:-4, top: -4,
left: 'center', left: "center",
textStyle:{ textStyle: {
//文字颜色 //文字颜色
color:'#000', color: "#000",
fontSize:30 fontSize: 30,
} },
}, },
//提示框 //提示框
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
formatter: function (params) { formatter: function (params) {
//console.log(params) //console.log(params)
return '时间:' + params[0].axisValueLabel + '<br>数量: ' + params[0].data; return (
}, "时间:" + params[0].axisValueLabel + "<br>数量: " + params[0].data
);
},
/* formatter: (params)=>{ /* formatter: (params)=>{
if(params[0].seriesName == "year"){ if(params[0].seriesName == "year"){
return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name) return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name)
@ -383,92 +486,120 @@ export class AddUnitTwoTimeComponent implements OnInit {
return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name) return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name)
} }
}, */ }, */
position: this.serviceData.tableTooltipNoShow position: this.serviceData.tableTooltipNoShow,
}, },
// x轴 // x轴
xAxis: { xAxis: {
type: 'category', type: "category",
data: date, data: date,
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :16, fontSize: 16,
color:'#000000' color: "#000000",
}, },
color: "#000", //刻度线标签颜色 color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
}, },
}, },
splitLine: {//分割线配置 splitLine: {
show:true, //分割线配置
show: true,
lineStyle: { lineStyle: {
color: '#999', color: "#999",
} },
} },
}, },
// y轴 // y轴
yAxis: { yAxis: {
//min:10, //min:10,
type: 'value', type: "value",
name: '个', name: "个",
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :16, fontSize: 16,
color:'#000000' color: "#000000",
}, },
color: "#000" //刻度线标签颜色 color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
} },
} },
}, },
// 数据 // 数据
series: [{ series: [
{
name: typeName, name: typeName,
type: 'line', type: "line",
markPoint: { markPoint: {
symbolSize: [65, 65],
symbolSize:[65, 65], data: this.tiaoshiPao,
data: this.tiaoshiPao },
},
data: dateNum, data: dateNum,
} },
], ],
}; };
item.echart.setOption(option,true); item.echart.setOption(option, true);
item.echart.getZr().on('click',params=>{ item.echart.getZr().on("click", (params) => {
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (item.echart.containPixel('grid',pointInPixel)) { if (item.echart.containPixel("grid", pointInPixel)) {
let xIndex=item.echart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = item.echart.convertFromPixel({ seriesIndex: 0 }, [
/*事件处理代码书写位置*/ params.offsetX,
// console.log(option.series[0].data[xIndex],option.xAxis.data[xIndex],option.title.text,option.series[0].name) params.offsetY,
if(option.series[0].name == "year"){ ])[0];
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_lineDetails'],{queryParams:{'year':this.date2[xIndex],'buildingType':this.headname,'id':this.lastId,'type':this.zhiorbuild}}); /*事件处理代码书写位置*/
// console.log(option.series[0].data[xIndex],option.xAxis.data[xIndex],option.title.text,option.series[0].name)
if (option.series[0].name == "year") {
this.router.navigate(
[
"/statisticanalysis/addUnit_one/addUnit_two_time/three_lineDetails",
],
{
queryParams: {
year: this.date2[xIndex],
buildingType: this.headname,
id: this.lastId,
type: this.zhiorbuild,
},
}
);
/* this.selectType="month" /* this.selectType="month"
this.yeardatee=option.xAxis.data[xIndex] this.yeardatee=option.xAxis.data[xIndex]
this.getdata() */ this.getdata() */
} else {
}else{ if (
if(this.serviceData.level=='0'||this.serviceData.level=='1'||this.serviceData.level=='2'){ this.serviceData.level == "0" ||
//this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'level':'zhidui','time':option.xAxis.data[xIndex],'buildingTpye':this.headname}}); this.serviceData.level == "1" ||
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':this.headname,'id':this.lastId,'type':this.zhiorbuild,'year':this.thisYear,'month':option.xAxis.data[xIndex]}}) this.serviceData.level == "2"
} ) {
//this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'level':'zhidui','time':option.xAxis.data[xIndex],'buildingTpye':this.headname}});
this.router.navigate(
["/statisticanalysis/addUnit_one/addUnit_two_type"],
{
queryParams: {
level: this.headname,
id: this.lastId,
type: this.zhiorbuild,
year: this.thisYear,
month: option.xAxis.data[xIndex],
},
}
);
} }
}
} }
}); });
}) });
} }
//返回 //返回
backClick(){ backClick() {
this.router.navigateByUrl('/statisticanalysis/addUnit_one') this.router.navigateByUrl("/statisticanalysis/addUnit_one");
} }
} }

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

@ -93,6 +93,9 @@ export class AddUnitTwoTypeDetailsComponent implements OnInit {
} }
ngOnDestroy(){ ngOnDestroy(){
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
if (!this.detailPlanEchart) {
return;
}
this.detailPlanEchart.clear() this.detailPlanEchart.clear()
this.detailPlanEchart.dispose() this.detailPlanEchart.dispose()
} }

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

File diff suppressed because it is too large Load Diff

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

@ -1,187 +1,230 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import { HttpClient } from '@angular/common/http' import { HttpClient } from "@angular/common/http";
import {EchartsDataService,} from '../../echarts-data.service' import { EchartsDataService } from "../../echarts-data.service";
import { map } from 'rxjs/operators'; import { map } from "rxjs/operators";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-building-type-one', selector: "app-building-type-one",
templateUrl: './building-type-one.component.html', templateUrl: "./building-type-one.component.html",
styleUrls: ['./building-type-one.component.scss'] styleUrls: ["./building-type-one.component.scss"],
}) })
export class BuildingTypeOneComponent implements OnInit { export class BuildingTypeOneComponent implements OnInit {
constructor(
constructor(private http:HttpClient,private router: Router,public echartsData:EchartsDataService) { } private http: HttpClient,
private router: Router,
public echartsData: EchartsDataService
) {}
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.padHw=true this.padHw = true;
//this.padjt= //this.padjt=
}else{ } else {
this.padHw=false this.padHw = false;
} }
window.setTimeout(()=>{ window.setTimeout(() => {
this.getechartsdata() this.getechartsdata();
}) });
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.indexBzt.clear() if (!this.indexBzt) {
this.indexBzt.dispose() return;
}
this.indexBzt.clear();
this.indexBzt.dispose();
} }
async getechartsdata(){ async getechartsdata() {
await this.echartsData.getData(null,`/api/StatisticsAnalysis/BuildingTypes`) await this.echartsData.getData(
this.initCharts() null,
`/api/StatisticsAnalysis/BuildingTypes`
);
this.initCharts();
} }
/* 首页饼状图 */ /* 首页饼状图 */
indexBzt indexBzt;
padHw padHw;
lengthdata=[]//提示数据 lengthdata = []; //提示数据
count=0//总数 count = 0; //总数
indexData=[]//所有数据 indexData = []; //所有数据
tabledata tabledata;
initCharts(){ initCharts() {
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
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)
//console.log(this.echartsData.orid) //console.log(this.echartsData.orid)
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;
this.indexData.push(this.tabledata[0].buildingTypes[i]) this.indexData.push(this.tabledata[0].buildingTypes[i]);
} }
//JSON.parse(JSON.stringify(this.indexData).replace(/buildingTypeName/g, 'name')) //JSON.parse(JSON.stringify(this.indexData).replace(/buildingTypeName/g, 'name'))
this.indexData=this.indexData.map(v=>{return {name: v.buildingTypeName,value:v.count,id:v.buildingTypeId}}) this.indexData = this.indexData.map((v) => {
//console.log(this.indexData) return { name: v.buildingTypeName, value: v.count, id: v.buildingTypeId };
this.indexBzt = echarts.init(document.getElementById('indexBzt'),'walden'); });
let options={ //console.log(this.indexData)
this.indexBzt = echarts.init(document.getElementById("indexBzt"), "walden");
let options = {
title: { title: {
text: `建筑类型统计(${this.count}家)`, text: `建筑类型统计(${this.count}家)`,
left: 'center', left: "center",
top: "7%", top: "7%",
textStyle: { textStyle: {
fontSize:31 fontSize: 31,
} },
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
position: this.echartsData.tableTooltipNoShow2, position: this.echartsData.tableTooltipNoShow2,
formatter: (params)=>{ formatter: (params) => {
this.echartsData.biaogeTishiZhi(params.data) this.echartsData.biaogeTishiZhi(params.data);
return this.echartsData.res return this.echartsData.res;
} },
}, },
legend: { legend: {
orient: 'vertical', orient: "vertical",
//left:this.padHw?50:0, //left:this.padHw?50:0,
right:this.padHw?20:250, right: this.padHw ? 20 : 250,
top:60, top: 60,
textStyle:{ textStyle: {
fontSize:18, fontSize: 18,
color:"#000000" color: "#000000",
}, },
data: this.lengthdata data: this.lengthdata,
}, },
series: [ series: [
{ {
top:this.padHw?'15%':'0', top: this.padHw ? "15%" : "0",
name: '访问来源', name: "访问来源",
type: 'pie', type: "pie",
radius: '60%', radius: "60%",
center: ['50%', '53%'], center: ["50%", "53%"],
label:{ label: {
show:true, show: true,
fontSize:18, fontSize: 18,
formatter:'{b}{c}家\n{d|({d}%)}', formatter: "{b}{c}家\n{d|({d}%)}",
rich: { rich: {
d: { d: {
align: 'center', align: "center",
fontSize:18 fontSize: 18,
} },
}, },
}, },
data:this.indexData, data: this.indexData,
emphasis: { emphasis: {
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
shadowOffsetX: 0, shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)' shadowColor: "rgba(0, 0, 0, 0.5)",
} },
} },
} },
] ],
}; };
this.indexBzt.on('click', (params) => { this.indexBzt.on("click", (params) => {
var index=0 var index = 0;
for(var i=0;i<this.tabledata[0].buildingTypes.length;i++){ for (var i = 0; i < this.tabledata[0].buildingTypes.length; i++) {
if(this.tabledata[0].buildingTypes[i].buildingTypeName==params.name){ if (
if((this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2')&&this.tabledata[0].buildingTypes[i].organizations.length>0){ this.tabledata[0].buildingTypes[i].buildingTypeName == params.name
) {
if (
(this.echartsData.level == "0" ||
this.echartsData.level == "1" ||
this.echartsData.level == "2") &&
this.tabledata[0].buildingTypes[i].organizations.length > 0
) {
//总队,支队,大队跳转 //总队,支队,大队跳转
this.tabledata[0].buildingTypes[i].organizations.forEach((value,index,array) => { this.tabledata[0].buildingTypes[i].organizations.forEach(
if(array[index].organizationId==this.echartsData.orid){ (value, index, array) => {
array.splice(index,1) if (array[index].organizationId == this.echartsData.orid) {
array.splice(index, 1);
}
if (array.length > 0) {
this.router.navigate(
[
"/statisticanalysis/buildingType_one/buildingType_two_reverse",
],
{ queryParams: { level: params.name, id: params.data.id } }
);
} else {
this.router.navigate(["/statisticanalysis/CompangInfo"], {
queryParams: {
name: params.name,
type: 1,
buildid: params.data.id,
},
});
}
} }
if(array.length>0){ );
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_reverse'],{queryParams:{'level':params.name,'id':params.data.id}}); } else {
}else{
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1,'buildid':params.data.id}});
}
});
}else {
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1,'buildid':params.data.id}}); this.router.navigate(["/statisticanalysis/CompangInfo"], {
queryParams: {
name: params.name,
type: 1,
buildid: params.data.id,
},
});
} }
} }
} }
}); });
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }
tishiData tishiData;
res:string res: string;
biaogeTishiZhi(datas){ biaogeTishiZhi(datas) {
for(var a in this.tabledata.buildingTypes){ for (var a in this.tabledata.buildingTypes) {
if(this.tabledata.buildingTypes[a].buildingTypeId==datas.id){ if (this.tabledata.buildingTypes[a].buildingTypeId == datas.id) {
this.tishiData=this.tabledata.buildingTypes[a].organizations this.tishiData = this.tabledata.buildingTypes[a].organizations;
} }
} }
var countall=0//总计 var countall = 0; //总计
var countbi=0//站比 var countbi = 0; //站比
var allCountbi=0//总站比 var allCountbi = 0; //总站比
for(var i=0;i<this.tishiData.length;i++){ for (var i = 0; i < this.tishiData.length; i++) {
countall+=this.tishiData[i].count 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 =
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"; >'; '<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;">' +
this.res+='<thead style="font-size:18px;"><tr>'; datas.name +
this.res+='<td style="text-align:center;width:30%;">名称</td>'; "</span></div>";
this.res+='<td style="text-align:center;width:30%;">数量</td>' this.res +=
this.res+='<td style="text-align:center;width:30%;">总占比</td>' '</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+='</tr></thead>' this.res += '<thead style="font-size:18px;"><tr>';
this.res+='<tbody>'; this.res += '<td style="text-align:center;width:30%;">名称</td>';
//var res='<div class="tishi" style=" width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span >'+biaotou+'</span></div>' this.res += '<td style="text-align:center;width:30%;">数量</td>';
for(var i=0;i<this.tishiData.length;i++){ this.res += '<td style="text-align:center;width:30%;">总占比</td>';
countbi=Math.round(this.tishiData[i].count/countall* 10000)/ 100.00 this.res += "</tr></thead>";
allCountbi=allCountbi+countbi this.res += "<tbody>";
this.res+='<tr>' //var res='<div class="tishi" style=" width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span >'+biaotou+'</span></div>'
this.res+='<td style="text-align:center;">'+this.tishiData[i].organizationName+'</td>' for (var i = 0; i < this.tishiData.length; i++) {
this.res+='<td style="text-align:center;">'+this.tishiData[i].count+'</td>' countbi =
this.res+='<td style="text-align:center;">'+countbi+'%</td></tr>' Math.round((this.tishiData[i].count / countall) * 10000) / 100.0;
} allCountbi = allCountbi + countbi;
this.res += "<tr>";
this.res+='</tbody>' this.res +=
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>' '<td style="text-align:center;">' +
this.res+='</table></div></div>' this.tishiData[i].organizationName +
return this.res "</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;
}
} }

435
src/app/statistic-analysis/buildingType/building-type-three-details/building-type-three-details.component.ts

@ -1,239 +1,316 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from "@angular/router";
import { Local } from 'protractor/built/driverProviders'; import { Local } from "protractor/built/driverProviders";
import {EchartsDataService} from '../../echarts-data.service'; import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-building-type-three-details', selector: "app-building-type-three-details",
templateUrl: './building-type-three-details.component.html', templateUrl: "./building-type-three-details.component.html",
styleUrls: ['./building-type-three-details.component.scss'] styleUrls: ["./building-type-three-details.component.scss"],
}) })
export class BuildingTypeThreeDetailsComponent implements OnInit { export class BuildingTypeThreeDetailsComponent implements OnInit {
constructor(
constructor(public route: ActivatedRoute,private router: Router,public echartsData:EchartsDataService) { } public route: ActivatedRoute,
forward(){ private router: Router,
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_forward']) public echartsData: EchartsDataService
) {}
forward() {
this.router.navigate([
"/statisticanalysis/buildingType_one/buildingType_two_forward",
]);
} }
reverse(){ reverse() {
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_reverse']) this.router.navigate([
"/statisticanalysis/buildingType_one/buildingType_two_reverse",
]);
} }
//返回 //返回
goBack () { goBack() {
sessionStorage.setItem('refresh', 'true'); sessionStorage.setItem("refresh", "true");
history.go(-1); history.go(-1);
this.echartsData.statefulInspectionToggle = true this.echartsData.statefulInspectionToggle = true;
} }
organizationName:String organizationName: String;
listorganizationId//上个页面传过来的组织id listorganizationId; //上个页面传过来的组织id
buildingTypeName:String buildingTypeName: String;
buildingTypeId buildingTypeId;
organizationId=[]//本层id organizationId = []; //本层id
padHw padHw;
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1300px)").matches){ if (window.matchMedia("(max-width: 1300px)").matches) {
this.padHw=true this.padHw = true;
//this.padjt= //this.padjt=
}else{ } else {
this.padHw=false this.padHw = false;
} }
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
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.listorganizationId=params['organizationId']; this.listorganizationId = params["organizationId"];
this.buildingTypeId=params['buildId']; this.buildingTypeId = params["buildId"];
});
window.setTimeout(() => {
this.getechartsdata();
}); });
window.setTimeout(()=>{
this.getechartsdata()
})
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.detailPlanEchart.clear() if (!this.detailPlanEchart) {
this.detailPlanEchart.dispose() return;
}
this.detailPlanEchart.clear();
this.detailPlanEchart.dispose();
} }
async getechartsdata(){ async getechartsdata() {
let paramsdata={ let paramsdata = {
//id:this.buildingTypeId, //id:this.buildingTypeId,
organizationId:this.listorganizationId organizationId: this.listorganizationId,
};
await this.echartsData.getData(
paramsdata,
`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildingTypeId}`
);
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.organizationId.push(
this.tabledata[0].organizations[i].organizationId
);
} }
await this.echartsData.getData(paramsdata,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildingTypeId}`) this.tiaoshiPao = this.echartsData.qipao(
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) this.tiaoshiPao,
//console.log(this.tabledata) this.zhongNumData,
for(var i=0;i<this.tabledata[0].organizations.length;i++){ this.zhongNameData
this.zhongNameData.push(this.tabledata[0].organizations[i].organizationName) );
this.zhongNumData.push(this.tabledata[0].organizations[i].count) this.detailEcharts();
this.organizationId.push(this.tabledata[0].organizations[i].organizationId)
}
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.zhongNumData,this.zhongNameData)
this.detailEcharts()
} }
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
zhongNameData = [] }; //柱状图数值顶部显示
zhongNumData = [] zhongNameData = [];
tiaoshiPao:any zhongNumData = [];
detailPlanEchart tiaoshiPao: any;
tabledata detailPlanEchart;
detailEcharts(){ tabledata;
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'),'walden'); detailEcharts() {
this.detailPlanEchart = echarts.init(
document.getElementById("barEchart"),
"walden"
);
var option = { var option = {
title: { title: {
top:this.padHw?10:0, top: this.padHw ? 10 : 0,
text: this.buildingTypeName + '(' +this.organizationName + ')'+`:总数(${this.tabledata[0].totalCount})`, text:
this.buildingTypeName +
"(" +
this.organizationName +
")" +
`:总数(${this.tabledata[0].totalCount})`,
left: "center", left: "center",
textStyle: { textStyle: {
fontSize: 30 fontSize: 30,
} },
}, },
grid: { grid: {
top:this.padHw?120:110, top: this.padHw ? 120 : 110,
//bottom: 10 //bottom: 10
}, },
xAxis: { xAxis: {
id:this.organizationId, id: this.organizationId,
type: 'category', type: "category",
data: this.zhongNameData, data: this.zhongNameData,
// axisLabel: this.axisLabel // axisLabel: this.axisLabel
axisLabel:{ axisLabel: {
//this.axisLabel, //this.axisLabel,
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
},
}
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel:{ axisLabel: {
//this.axisLabel, //this.axisLabel,
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
},
}
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
return this.tableTooltip(params) return this.tableTooltip(params);
} },
}, },
series: [{ series: [
id:this.organizationId, {
id: this.organizationId,
data: this.zhongNumData, data: this.zhongNumData,
type: 'bar', type: "bar",
barWidth :'38', barWidth: "38",
markPoint: { markPoint: {
symbolSize:[65, 65], symbolSize: [65, 65],
data: this.tiaoshiPao data: this.tiaoshiPao,
}, },
backgroundStyle: { backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)' color: "rgba(220, 220, 220, 0.8)",
}, },
//label: this.topTextlabel //label: this.topTextlabel
}] },
],
}; };
this.detailPlanEchart.setOption(option); this.detailPlanEchart.setOption(option);
this.detailPlanEchart.getZr().on('click', (params) => { this.detailPlanEchart.getZr().on("click", (params) => {
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) { if (this.detailPlanEchart.containPixel("grid", pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = this.detailPlanEchart.convertFromPixel(
{ seriesIndex: 0 },
[params.offsetX, params.offsetY]
)[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
if(this.echartsData.level=="0"&&this.tiao==false&&this.tabledata[0].organizations[xIndex].subOrganizations.length>=1){ if (
this.echartsData.level == "0" &&
this.tiao == false &&
this.tabledata[0].organizations[xIndex].subOrganizations.length >= 1
) {
//总队不跳转 //总队不跳转
this.zhongNameData=[] this.zhongNameData = [];
this.zhongNumData=[] this.zhongNumData = [];
this.organizationId=[] this.organizationId = [];
this.tiaoshiPao='' this.tiaoshiPao = "";
let paramsdatee={ let paramsdatee = {
id:this.buildingTypeId, id: this.buildingTypeId,
organizationId:option.xAxis.id[xIndex] organizationId: option.xAxis.id[xIndex],
} };
this.echartsData.getData(paramsdatee,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildingTypeId}`) this.echartsData.getData(
window.setTimeout(()=>{ paramsdatee,
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) `/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildingTypeId}`
);
window.setTimeout(() => {
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].organizations.length;i++){ for (var i = 0; i < this.tabledata[0].organizations.length; i++) {
this.zhongNameData.push(this.tabledata[0].organizations[i].organizationName) this.zhongNameData.push(
this.zhongNumData.push(this.tabledata[0].organizations[i].count) this.tabledata[0].organizations[i].organizationName
this.organizationId.push(this.tabledata[0].organizations[i].organizationId) );
this.zhongNumData.push(this.tabledata[0].organizations[i].count);
this.organizationId.push(
this.tabledata[0].organizations[i].organizationId
);
} }
option.title.text = this.buildingTypeName + '(' +option.xAxis.data[xIndex]+ ')'+`:总数(${this.tabledata[0].totalCount})` option.title.text =
option.xAxis.data = this.zhongNameData this.buildingTypeName +
option.series[0].data = this.zhongNumData "(" +
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.zhongNumData,this.zhongNameData) option.xAxis.data[xIndex] +
option.series[0].markPoint.data=this.tiaoshiPao ")" +
`:总数(${this.tabledata[0].totalCount})`;
option.xAxis.data = this.zhongNameData;
option.series[0].data = this.zhongNumData;
this.tiaoshiPao = this.echartsData.qipao(
this.tiaoshiPao,
this.zhongNumData,
this.zhongNameData
);
option.series[0].markPoint.data = this.tiaoshiPao;
//option.series[0].id=this.organizationId //option.series[0].id=this.organizationId
option.xAxis.id=this.organizationId option.xAxis.id = this.organizationId;
this.detailPlanEchart.clear() this.detailPlanEchart.clear();
this.detailPlanEchart.setOption(option) this.detailPlanEchart.setOption(option);
//this.detailEcharts() //this.detailEcharts()
},1000) }, 1000);
this.tiao=true this.tiao = true;
} else {
this.router.navigate(["/statisticanalysis/CompangInfo"], {
queryParams: {
name: option.xAxis.data[xIndex],
type: 1,
jsid: option.xAxis.id[xIndex],
buildid: this.buildingTypeId,
},
});
} }
else{
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':option.xAxis.data[xIndex],'type':1,'jsid':option.xAxis.id[xIndex],'buildid':this.buildingTypeId}});
}
} }
}); });
} }
tiao=false tiao = false;
tishiData tishiData;
res res;
tableTooltip(datas:any){ tableTooltip(datas: any) {
for(var a in this.echartsData.obdata[0].organizations){ for (var a in this.echartsData.obdata[0].organizations) {
if(this.echartsData.obdata[0].organizations[a].organizationName==datas.name){ if (
this.tishiData=this.echartsData.obdata[0].organizations[a].subOrganizations this.echartsData.obdata[0].organizations[a].organizationName ==
datas.name
) {
this.tishiData =
this.echartsData.obdata[0].organizations[a].subOrganizations;
} }
} }
var countall=0//总计 var countall = 0; //总计
var countbi=0//站比 var countbi = 0; //站比
var allCountbi=0//总站比 var allCountbi = 0; //总站比
for(var i=0;i<this.tishiData.length;i++){ for (var i = 0; i < this.tishiData.length; i++) {
countall+=this.tishiData[i].count 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 =
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"; >'; '<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;">' +
this.res+='<thead style="font-size:18px;"><tr>'; datas.name +
this.res+='<td style="text-align:center;width:30%;">名称</td>'; "</span></div>";
this.res+='<td style="text-align:center;width:30%;">数量</td>' this.res +=
this.res+='<td style="text-align:center;width:30%;">总占比</td>' '</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+='</tr></thead>' this.res += '<thead style="font-size:18px;"><tr>';
this.res+='<tbody>'; this.res += '<td style="text-align:center;width:30%;">名称</td>';
for(var i=0;i<this.tishiData.length;i++){ this.res += '<td style="text-align:center;width:30%;">数量</td>';
countbi=Math.round(this.tishiData[i].count/countall* 10000)/ 100.00 this.res += '<td style="text-align:center;width:30%;">总占比</td>';
allCountbi=allCountbi+countbi this.res += "</tr></thead>";
this.res+='<tr>' this.res += "<tbody>";
this.res+='<td style="text-align:center;">'+this.tishiData[i].organizationName+'</td>' for (var i = 0; i < this.tishiData.length; i++) {
this.res+='<td style="text-align:center;">'+this.tishiData[i].count+'</td>' countbi =
this.res+='<td style="text-align:center;">'+countbi+'%</td></tr>' Math.round((this.tishiData[i].count / countall) * 10000) / 100.0;
} allCountbi = allCountbi + countbi;
this.res += "<tr>";
this.res+='</tbody>' this.res +=
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>' '<td style="text-align:center;">' +
this.res+='</table></div></div>' this.tishiData[i].organizationName +
return this.res "</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;
} }
} }

547
src/app/statistic-analysis/buildingType/building-type-two-forward/building-type-two-forward.component.ts

@ -1,213 +1,278 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import {EchartsDataService} from '../../echarts-data.service'; import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-building-type-two-forward', selector: "app-building-type-two-forward",
templateUrl: './building-type-two-forward.component.html', templateUrl: "./building-type-two-forward.component.html",
styleUrls: ['./building-type-two-forward.component.scss'] styleUrls: ["./building-type-two-forward.component.scss"],
}) })
export class BuildingTypeTwoForwardComponent implements OnInit { export class BuildingTypeTwoForwardComponent implements OnInit {
constructor(private router: Router, public data: EchartsDataService) {}
constructor(private router: Router,public data:EchartsDataService) { } forward() {
forward(){ this.router.navigate([
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_forward']) "/statisticanalysis/buildingType_one/buildingType_two_forward",
]);
} }
reverse(){ reverse() {
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_reverse']) this.router.navigate([
"/statisticanalysis/buildingType_one/buildingType_two_reverse",
]);
} }
ngOnInit(): void { ngOnInit(): void {
window.setTimeout(()=>{ window.setTimeout(() => {
this.tiaoshiPao=this.data.qipao(this.tiaoshiPao,this.zhiNumData,this.zhiNameData) this.tiaoshiPao = this.data.qipao(
this.initCharts() this.tiaoshiPao,
this.barEcharts() this.zhiNumData,
},0) this.zhiNameData
);
this.initCharts();
this.barEcharts();
}, 0);
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.indexBzt.clear() this.forArr.forEach((item) => {
this.indexBzt.dispose() if (!item.echart) {
this.forArr.forEach(item => { return;
item.echart.clear() }
item.echart.dispose() item.echart.clear();
}) item.echart.dispose();
});
if (!this.indexBzt) {
return;
}
this.indexBzt.clear();
this.indexBzt.dispose();
} }
//返回 //返回
goBack () { goBack() {
sessionStorage.setItem('refresh', 'true'); sessionStorage.setItem("refresh", "true");
history.go(-1); history.go(-1);
this.data.statefulInspectionToggle = true this.data.statefulInspectionToggle = true;
} }
axisLabel = { axisLabel = {
interval: 0, interval: 0,
textStyle:{ textStyle: {
fontSize :16, fontSize: 16,
color:'#000000' color: "#000000",
}, },
formatter:function(value) formatter: function (value) {
{ var ret = ""; //拼接加\n返回的类目项
var ret = "";//拼接加\n返回的类目项 var maxLength = 2; //每项显示文字个数
var maxLength = 2;//每项显示文字个数 var valLength = value.length; //X轴类目项的文字个数
var valLength = value.length;//X轴类目项的文字个数 var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 if (rowN > 1) {
if (rowN > 1)//如果类目项的文字大于3, //如果类目项的文字大于3,
{ for (var i = 0; i < rowN; i++) {
for (var i = 0; i < rowN; i++) { var temp = ""; //每次截取的字符串
var temp = "";//每次截取的字符串 var start = i * maxLength; //开始截取的位置
var start = i * maxLength;//开始截取的位置 var end = start + maxLength; //结束截取的位置
var end = start + maxLength;//结束截取的位置 //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 temp = value.substring(start, end) + "\n";
temp = value.substring(start, end) + "\n"; ret += temp; //凭借最终的字符串
ret += temp; //凭借最终的字符串 }
} return ret;
return ret; } else {
} return value;
else { }
return value; },
} }; //echarts两个字换行
}
}//echarts两个字换行
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
}; //柱状图数值顶部显示
tableDataZhi = [ {name:"浦东支队",number:"156",zhanbi:"3%"}, tableDataZhi = [
{name:"黄浦支队",number:"144",zhanbi:"2.8%"}, { name: "浦东支队", number: "156", zhanbi: "3%" },
{name:"徐汇支队",number:"133",zhanbi:"2.1%"}, { name: "黄浦支队", number: "144", zhanbi: "2.8%" },
{name:"长宁支队",number:"122",zhanbi:"1.6%"}, { name: "徐汇支队", number: "133", zhanbi: "2.1%" },
{name:"静安支队",number:"120",zhanbi:"1.3%"}, { name: "长宁支队", number: "122", zhanbi: "1.6%" },
{name:"普陀支队",number:"100",zhanbi:"1.1%"}, { name: "静安支队", number: "120", zhanbi: "1.3%" },
{name:"虹口支队",number:"95",zhanbi:"1%"}, { name: "普陀支队", number: "100", zhanbi: "1.1%" },
{name:"杨浦支队",number:"90",zhanbi:"0.9%"}, { name: "虹口支队", number: "95", zhanbi: "1%" },
{name:"闵行支队",number:"88",zhanbi:"0.8%"}, { name: "杨浦支队", number: "90", zhanbi: "0.9%" },
{name:"宝山支队",number:"83",zhanbi:"0.7%"}, { name: "闵行支队", number: "88", zhanbi: "0.8%" },
{name:"徐汇支队",number:"133",zhanbi:"2.1%"}, { name: "宝山支队", number: "83", zhanbi: "0.7%" },
{name:"长宁支队",number:"122",zhanbi:"1.6%"}, { name: "徐汇支队", number: "133", zhanbi: "2.1%" },
{name:"嘉定支队",number:"78",zhanbi:"0.6%"}, { name: "长宁支队", number: "122", zhanbi: "1.6%" },
{name:"松江支队",number:"75",zhanbi:"0.5%"}, { name: "嘉定支队", number: "78", zhanbi: "0.6%" },
{name:"金山支队",number:"65",zhanbi:"0.4%"}, { name: "松江支队", number: "75", zhanbi: "0.5%" },
{name:"崇明支队",number:"55",zhanbi:"0.3%"} ] { name: "金山支队", number: "65", zhanbi: "0.4%" },
tableDataZhong = [ {name:"浦东中队",number:"156",zhanbi:"3%"}, { name: "崇明支队", number: "55", zhanbi: "0.3%" },
{name:"黄浦中队",number:"144",zhanbi:"2.8%"}, ];
{name:"徐汇中队",number:"133",zhanbi:"2.1%"}, tableDataZhong = [
{name:"长宁中队",number:"122",zhanbi:"1.6%"}, { name: "浦东中队", number: "156", zhanbi: "3%" },
{name:"静安中队",number:"120",zhanbi:"1.3%"}, { name: "黄浦中队", number: "144", zhanbi: "2.8%" },
{name:"普陀中队",number:"100",zhanbi:"1.1%"}, { name: "徐汇中队", number: "133", zhanbi: "2.1%" },
{name:"虹口中队",number:"95",zhanbi:"1%"}, { name: "长宁中队", number: "122", zhanbi: "1.6%" },
{name:"杨浦中队",number:"90",zhanbi:"0.9%"}, { name: "静安中队", number: "120", zhanbi: "1.3%" },
{name:"闵行中队",number:"88",zhanbi:"0.8%"}, { name: "普陀中队", number: "100", zhanbi: "1.1%" },
{name:"宝山中队",number:"83",zhanbi:"0.7%"}, { name: "虹口中队", number: "95", zhanbi: "1%" },
{name:"徐汇中队",number:"133",zhanbi:"2.1%"}, { name: "杨浦中队", number: "90", zhanbi: "0.9%" },
{name:"长宁中队",number:"122",zhanbi:"1.6%"}, { name: "闵行中队", number: "88", zhanbi: "0.8%" },
{name:"嘉定中队",number:"78",zhanbi:"0.6%"}, { name: "宝山中队", number: "83", zhanbi: "0.7%" },
{name:"松江中队",number:"75",zhanbi:"0.5%"}, { name: "徐汇中队", number: "133", zhanbi: "2.1%" },
{name:"金山中队",number:"65",zhanbi:"0.4%"}, { name: "长宁中队", number: "122", zhanbi: "1.6%" },
{name:"崇明中队",number:"55",zhanbi:"0.3%"} ] { name: "嘉定中队", number: "78", zhanbi: "0.6%" },
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队",'青浦支队'] { name: "松江中队", number: "75", zhanbi: "0.5%" },
zhiNumData = [200,190,180,170,160,150,140,130,120,110,100,90,80,70,60,50] { name: "金山中队", number: "65", zhanbi: "0.4%" },
tiaoshiPao:any { name: "崇明中队", number: "55", zhanbi: "0.3%" },
];
zhiNameData = [
"浦东支队",
"黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
"松江支队",
"金山支队",
"崇明支队",
"青浦支队",
];
zhiNumData = [
200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50,
];
tiaoshiPao: any;
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
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] +
'"' +
"},";
} }
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
} }
pieData = [ pieData = [
{value: 500, name: '浦东支队'}, { value: 500, name: "浦东支队" },
{value: 800, name: '黄浦支队'}, { value: 800, name: "黄浦支队" },
{value: 900, name: '徐汇支队'}, { value: 900, name: "徐汇支队" },
{value: 800, name: '长宁支队'}, { value: 800, name: "长宁支队" },
{value: 1200, name: '静安支队'}, { value: 1200, name: "静安支队" },
{value: 1500, name: '普陀支队'}, { value: 1500, name: "普陀支队" },
{value: 1400, name: '虹口支队'}, { value: 1400, name: "虹口支队" },
{value: 600, name: '杨浦支队'}, { value: 600, name: "杨浦支队" },
{value: 568, name: '闵行支队'}, { value: 568, name: "闵行支队" },
{value: 888, name: '宝山支队'}, { value: 888, name: "宝山支队" },
{value: 485, name: '嘉定支队'}, { value: 485, name: "嘉定支队" },
{value: 966, name: '松江支队'}, { value: 966, name: "松江支队" },
{value: 789, name: '金山支队'}, { value: 789, name: "金山支队" },
{value: 500, name: '崇明支队'}, { value: 500, name: "崇明支队" },
{value: 600, name: '青浦支队'} { value: 600, name: "青浦支队" },
] ];
buildingTypeName = ['高层','地下','轨道交通','化工生产','储罐类','厂房','古建筑','商市场','医院','学校','宾馆','娱乐场所','餐饮业','影剧院','展览建筑','隧道'] buildingTypeName = [
buildingTypeNum = [200,190,180,170,160,150,140,130,120,110,100,90,80,70,60,50] "高层",
forArr = [{id:'gaoceng',name:'浦东支队',echart:null}, "地下",
{id:'dixia',name:'黄浦支队',echart:null}, "轨道交通",
{id:'guidao',name:'徐汇支队',echart:null}, "化工生产",
{id:'huagong',name:'长宁支队',echart:null}, "储罐类",
{id:'chuguan',name:'静安支队',echart:null}, "厂房",
{id:'changfang',name:'普陀支队',echart:null}, "古建筑",
{id:'gujianzhu',name:'虹口支队',echart:null}, "商市场",
{id:'shichang',name:'杨浦支队',echart:null}, "医院",
{id:'yiyuan',name:'闵行支队',echart:null}, "学校",
{id:'xuexiao',name:'宝山支队',echart:null}, "宾馆",
{id:'binguan',name:'嘉定支队',echart:null}, "娱乐场所",
{id:'yule',name:'松江支队',echart:null}, "餐饮业",
{id:'canyin',name:'金山支队',echart:null}, "影剧院",
{id:'yingyuan',name:'崇明支队',echart:null}, "展览建筑",
{id:'zhanlan',name:'青浦支队',echart:null}, "隧道",
] ];
buildingTypeNum = [
200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100, 90, 80, 70, 60, 50,
];
forArr = [
{ id: "gaoceng", name: "浦东支队", echart: null },
{ id: "dixia", name: "黄浦支队", echart: null },
{ id: "guidao", name: "徐汇支队", echart: null },
{ id: "huagong", name: "长宁支队", echart: null },
{ id: "chuguan", name: "静安支队", echart: null },
{ id: "changfang", name: "普陀支队", echart: null },
{ id: "gujianzhu", name: "虹口支队", echart: null },
{ id: "shichang", name: "杨浦支队", echart: null },
{ id: "yiyuan", name: "闵行支队", echart: null },
{ id: "xuexiao", name: "宝山支队", echart: null },
{ id: "binguan", name: "嘉定支队", echart: null },
{ id: "yule", name: "松江支队", echart: null },
{ id: "canyin", name: "金山支队", echart: null },
{ id: "yingyuan", name: "崇明支队", echart: null },
{ id: "zhanlan", name: "青浦支队", echart: null },
];
/* 顶部饼状图 */ /* 顶部饼状图 */
indexBzt indexBzt;
initCharts(){ initCharts() {
this.indexBzt = echarts.init(document.getElementById('pie'),'walden'); this.indexBzt = echarts.init(document.getElementById("pie"), "walden");
let options={ let options = {
title: { title: {
text: '组织机构统计(5500家)', text: "组织机构统计(5500家)",
left: 'center', left: "center",
top: "7%", top: "7%",
textStyle: { textStyle: {
fontSize:26 fontSize: 26,
} },
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
return this.data.biaogeTishi(params.name) return this.data.biaogeTishi(params.name);
}, },
/* backgroundColor:'rgba(255,255,255,1)',//rgba调节背景颜色与透明度 /* backgroundColor:'rgba(255,255,255,1)',//rgba调节背景颜色与透明度
borderWidth:'1', borderWidth:'1',
borderRadius :'0', */ borderRadius :'0', */
position: this.data.tableTooltipNoShow2 position: this.data.tableTooltipNoShow2,
}, },
legend: { legend: {
orient: 'vertical', orient: "vertical",
right: 150, right: 150,
top:80, top: 80,
textStyle:{ textStyle: {
fontSize:18, fontSize: 18,
color:"#000000" color: "#000000",
}, },
data:this.zhiNameData data: this.zhiNameData,
}, },
series: [ series: [
{ {
name: '访问来源', name: "访问来源",
type: 'pie', type: "pie",
radius: '70%', radius: "70%",
center: ['50%', '60%'], center: ["50%", "60%"],
label:{ label: {
show:true, show: true,
fontSize:16, fontSize: 16,
formatter:'{b}{c}家\n{d|({d}%)}', formatter: "{b}{c}家\n{d|({d}%)}",
rich: { rich: {
d: { d: {
align: 'center', align: "center",
fontSize:16 fontSize: 16,
} },
}, },
}, },
data: this.pieData, data: this.pieData,
@ -215,97 +280,117 @@ export class BuildingTypeTwoForwardComponent implements OnInit {
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
shadowOffsetX: 0, shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)' shadowColor: "rgba(0, 0, 0, 0.5)",
} },
} },
} },
] ],
}; };
this.indexBzt.on('click', (params) => { this.indexBzt.on("click", (params) => {
// this.router.navigateByUrl('/statisticanalysis/buildingType_two_forward'); // this.router.navigateByUrl('/statisticanalysis/buildingType_two_forward');
}); });
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }
//柱状图 //柱状图
barEcharts(){ barEcharts() {
this.forArr.forEach(item=>{ this.forArr.forEach((item) => {
let _this = this let _this = this;
item.echart = echarts.init(document.getElementById(item.id),'walden'); item.echart = echarts.init(document.getElementById(item.id), "walden");
let option = { let option = {
color: ['#3398DB'], color: ["#3398DB"],
title: { title: {
text: item.name+':总数(1024)', text: item.name + ":总数(1024)",
left: "center", left: "center",
top: "0", top: "0",
//bottom: '80', //bottom: '80',
textStyle: { textStyle: {
fontSize: 23 fontSize: 23,
} },
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.buildingTypeName, data: this.buildingTypeName,
axisLabel: this.axisLabel axisLabel: this.axisLabel,
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel:{ axisLabel: {
//this.axisLabel, //this.axisLabel,
textStyle:{ textStyle: {
fontSize :16, fontSize: 16,
color:'#000000' color: "#000000",
} },
},
}
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
return this.data.tableTooltip(this.tableDataZhong,params.name) return this.data.tableTooltip(this.tableDataZhong, params.name);
} },
}, },
series: [{ series: [
{
data: this.buildingTypeNum, data: this.buildingTypeNum,
type: 'bar', type: "bar",
markPoint: { markPoint: {
data: this.tiaoshiPao data: this.tiaoshiPao,
}, },
backgroundStyle: { backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)' color: "rgba(220, 220, 220, 0.8)",
}, },
barWidth :'28', barWidth: "28",
//label: this.topTextlabel //label: this.topTextlabel
}] },
],
}; };
item.echart.setOption(option); item.echart.setOption(option);
item.echart.on('click', (params) => { item.echart.on("click", (params) => {
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_three_details'],{queryParams:{'organizationName':item.name,'buildingTypeName':params.name}}) this.router.navigate(
["/statisticanalysis/buildingType_one/buildingType_three_details"],
{
queryParams: {
organizationName: item.name,
buildingTypeName: params.name,
},
}
);
}); });
}) });
} }
//提示框表格 //提示框表格
tableTooltip(dataArr,title:string){ tableTooltip(dataArr, title: string) {
let data = dataArr let data = dataArr;
var 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;">'+title+'</span></div>' var res =
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"; >'; '<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;">' +
res+='<thead style="font-size:18px;"><tr>'; title +
res+='<td style="text-align:center;width:30%;">名称</td>'; "</span></div>";
res+='<td style="text-align:center;width:30%;">数量</td>' res +=
res+='<td style="text-align:center;width:30%;">总占比</td>' '</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"; >';
res+='</tr></thead>' res += '<thead style="font-size:18px;"><tr>';
res+='<tbody>'; res += '<td style="text-align:center;width:30%;">名称</td>';
//var res='<div class="tishi" style=" width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span >'+biaotou+'</span></div>' res += '<td style="text-align:center;width:30%;">数量</td>';
for(var i=0;i<this.tableDataZhi.length;i++){ res += '<td style="text-align:center;width:30%;">总占比</td>';
res+='<tr>' res += "</tr></thead>";
res+='<td style="text-align:center;">'+this.tableDataZhi[i].name+'</td>' res += "<tbody>";
res+='<td style="text-align:center;">'+this.tableDataZhi[i].number+'</td>' //var res='<div class="tishi" style=" width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span >'+biaotou+'</span></div>'
res+='<td style="text-align:center;">'+this.tableDataZhi[i].zhanbi+'</td></tr>' for (var i = 0; i < this.tableDataZhi.length; i++) {
} res += "<tr>";
res +=
res+='</tbody>' '<td style="text-align:center;">' + this.tableDataZhi[i].name + "</td>";
res+='<tfoot style="font-size:18px;"><td style="text-align:center;">总计</td><td style="text-align:center;">1356</td><td style="text-align:center;">19%</td></tfoot>' res +=
res+='</table></div></div>' '<td style="text-align:center;">' +
return res this.tableDataZhi[i].number +
"</td>";
res +=
'<td style="text-align:center;">' +
this.tableDataZhi[i].zhanbi +
"</td></tr>";
}
res += "</tbody>";
res +=
'<tfoot style="font-size:18px;"><td style="text-align:center;">总计</td><td style="text-align:center;">1356</td><td style="text-align:center;">19%</td></tfoot>';
res += "</table></div></div>";
return res;
} }
} }

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

@ -1,393 +1,478 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from "@angular/router";
import {EchartsDataService} from '../../echarts-data.service'; import { EchartsDataService } from "../../echarts-data.service";
import { HttpClient } from '@angular/common/http' import { HttpClient } from "@angular/common/http";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-building-type-two-reverse', selector: "app-building-type-two-reverse",
templateUrl: './building-type-two-reverse.component.html', templateUrl: "./building-type-two-reverse.component.html",
styleUrls: ['./building-type-two-reverse.component.scss'] styleUrls: ["./building-type-two-reverse.component.scss"],
}) })
export class BuildingTypeTwoReverseComponent implements OnInit { export class BuildingTypeTwoReverseComponent implements OnInit {
constructor(
private http: HttpClient,
private router: Router,
public data: EchartsDataService,
private route: ActivatedRoute
) {}
constructor(private http:HttpClient,private router: Router,public data:EchartsDataService,private route:ActivatedRoute) { } forward() {
this.router.navigate([
forward(){ "/statisticanalysis/buildingType_one/buildingType_two_forward",
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_forward']) ]);
} }
reverse(){ reverse() {
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_two_reverse']) this.router.navigate([
"/statisticanalysis/buildingType_one/buildingType_two_reverse",
]);
} }
headname//标题 headname; //标题
buildId//建筑id buildId; //建筑id
padHw//是否是华为pad padHw; //是否是华为pad
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1300px)").matches&&window.matchMedia("(max-height: 700px)").matches){ if (
this.padHw=true window.matchMedia("(max-width: 1300px)").matches &&
window.matchMedia("(max-height: 700px)").matches
) {
this.padHw = true;
//this.padjt= //this.padjt=
}else{ } else {
this.padHw=false this.padHw = false;
} }
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
this.route.queryParams.subscribe(param=>{ this.route.queryParams.subscribe((param) => {
this.headname=param.level this.headname = param.level;
this.buildId=param.id this.buildId = param.id;
}); });
let paramsdata:any = { let paramsdata: any = {
id:this.buildId, id: this.buildId,
//organizationId:'1' //organizationId:'1'
} };
window.setTimeout(()=>{ window.setTimeout(() => {
this.getechartsdata() this.getechartsdata();
}); });
} }
ngOnDestroy(): void { ngOnDestroy(): void {
/* this.indexBzt.clear() if (this.forArr && this.forArr.length !== 0) {
this.indexBzt.dispose() */ this.forArr.forEach((item) => {
this.forArr.forEach(item => { item.echart.clear();
item.echart.clear() item.echart.dispose();
item.echart.dispose() });
}) }
} }
async getechartsdata(){ async getechartsdata() {
await this.data.getData(null,`/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildId}`) await this.data.getData(
this.tabledata=JSON.parse(JSON.stringify(this.data.allDate)) null,
for(var i=0;i<this.tabledata[0].organizations.length;i++){ `/api/StatisticsAnalysis/Companies/BuildingTypes/${this.buildId}`
this.zhiNameData.push(this.tabledata[0].organizations[i].organizationName) );
this.zhiNumData.push(this.tabledata[0].organizations[i].count) this.tabledata = JSON.parse(JSON.stringify(this.data.allDate));
this.organizationId.push(this.tabledata[0].organizations[i].organizationId) for (var i = 0; i < this.tabledata[0].organizations.length; i++) {
} this.zhiNameData.push(
this.tiaoshiPao=this.data.qipao(this.tiaoshiPao,this.zhiNumData,this.zhiNameData) this.tabledata[0].organizations[i].organizationName
this.barEcharts() );
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.zhiNumData,
this.zhiNameData
);
this.barEcharts();
} }
axisLabel = { axisLabel = {
interval: 0, interval: 0,
rotate:38, rotate: 38,
textStyle:{ textStyle: {
fontSize :16, fontSize: 16,
color:'#000000' color: "#000000",
}, },
formatter:function(value) formatter: function (value) {
{ var ret = ""; //拼接加\n返回的类目项
var ret = "";//拼接加\n返回的类目项 var maxLength = 2; //每项显示文字个数
var maxLength = 2;//每项显示文字个数 var valLength = value.length; //X轴类目项的文字个数
var valLength = value.length;//X轴类目项的文字个数 var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 if (rowN > 1) {
if (rowN > 1)//如果类目项的文字大于3, //如果类目项的文字大于3,
{ for (var i = 0; i < rowN; i++) {
for (var i = 0; i < rowN; i++) { var temp = ""; //每次截取的字符串
var temp = "";//每次截取的字符串 var start = i * maxLength; //开始截取的位置
var start = i * maxLength;//开始截取的位置 var end = start + maxLength; //结束截取的位置
var end = start + maxLength;//结束截取的位置 //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 temp = value.substring(start, end) + "\n";
temp = value.substring(start, end) + "\n"; ret += temp; //凭借最终的字符串
ret += temp; //凭借最终的字符串 }
} return ret;
return ret; } else {
} return value;
else { }
return value; },
} }; //echarts两个字换行
}
}//echarts两个字换行
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
}; //柱状图数值顶部显示
tableDataZhi = [ {name:"浦东支队",number:"156",zhanbi:"3%"}, tableDataZhi = [
{name:"黄浦支队",number:"144",zhanbi:"2.8%"}, { name: "浦东支队", number: "156", zhanbi: "3%" },
{name:"徐汇支队",number:"133",zhanbi:"2.1%"}, { name: "黄浦支队", number: "144", zhanbi: "2.8%" },
{name:"长宁支队",number:"122",zhanbi:"1.6%"}, { name: "徐汇支队", number: "133", zhanbi: "2.1%" },
{name:"静安支队",number:"120",zhanbi:"1.3%"}, { name: "长宁支队", number: "122", zhanbi: "1.6%" },
{name:"普陀支队",number:"100",zhanbi:"1.1%"}, { name: "静安支队", number: "120", zhanbi: "1.3%" },
{name:"虹口支队",number:"95",zhanbi:"1%"}, { name: "普陀支队", number: "100", zhanbi: "1.1%" },
{name:"杨浦支队",number:"90",zhanbi:"0.9%"}, { name: "虹口支队", number: "95", zhanbi: "1%" },
{name:"闵行支队",number:"88",zhanbi:"0.8%"}, { name: "杨浦支队", number: "90", zhanbi: "0.9%" },
{name:"宝山支队",number:"83",zhanbi:"0.7%"}, { name: "闵行支队", number: "88", zhanbi: "0.8%" },
{name:"徐汇支队",number:"133",zhanbi:"2.1%"}, { name: "宝山支队", number: "83", zhanbi: "0.7%" },
{name:"长宁支队",number:"122",zhanbi:"1.6%"}, { name: "徐汇支队", number: "133", zhanbi: "2.1%" },
{name:"嘉定支队",number:"78",zhanbi:"0.6%"}, { name: "长宁支队", number: "122", zhanbi: "1.6%" },
{name:"松江支队",number:"75",zhanbi:"0.5%"}, { name: "嘉定支队", number: "78", zhanbi: "0.6%" },
{name:"金山支队",number:"65",zhanbi:"0.4%"}, { name: "松江支队", number: "75", zhanbi: "0.5%" },
{name:"崇明支队",number:"55",zhanbi:"0.3%"} ] { name: "金山支队", number: "65", zhanbi: "0.4%" },
tableDataZhong = [ {name:"浦东中队",number:"156",zhanbi:"3%"}, { name: "崇明支队", number: "55", zhanbi: "0.3%" },
{name:"黄浦中队",number:"144",zhanbi:"2.8%"}, ];
{name:"徐汇中队",number:"133",zhanbi:"2.1%"}, tableDataZhong = [
{name:"长宁中队",number:"122",zhanbi:"1.6%"}, { name: "浦东中队", number: "156", zhanbi: "3%" },
{name:"静安中队",number:"120",zhanbi:"1.3%"}, { name: "黄浦中队", number: "144", zhanbi: "2.8%" },
{name:"普陀中队",number:"100",zhanbi:"1.1%"}, { name: "徐汇中队", number: "133", zhanbi: "2.1%" },
{name:"虹口中队",number:"95",zhanbi:"1%"}, { name: "长宁中队", number: "122", zhanbi: "1.6%" },
{name:"杨浦中队",number:"90",zhanbi:"0.9%"}, { name: "静安中队", number: "120", zhanbi: "1.3%" },
{name:"闵行中队",number:"88",zhanbi:"0.8%"}, { name: "普陀中队", number: "100", zhanbi: "1.1%" },
{name:"宝山中队",number:"83",zhanbi:"0.7%"}, { name: "虹口中队", number: "95", zhanbi: "1%" },
{name:"徐汇中队",number:"133",zhanbi:"2.1%"}, { name: "杨浦中队", number: "90", zhanbi: "0.9%" },
{name:"长宁中队",number:"122",zhanbi:"1.6%"}, { name: "闵行中队", number: "88", zhanbi: "0.8%" },
{name:"嘉定中队",number:"78",zhanbi:"0.6%"}, { name: "宝山中队", number: "83", zhanbi: "0.7%" },
{name:"松江中队",number:"75",zhanbi:"0.5%"}, { name: "徐汇中队", number: "133", zhanbi: "2.1%" },
{name:"金山中队",number:"65",zhanbi:"0.4%"}, { name: "长宁中队", number: "122", zhanbi: "1.6%" },
{name:"崇明中队",number:"55",zhanbi:"0.3%"} ] { name: "嘉定中队", number: "78", zhanbi: "0.6%" },
zhiNameData = [] { name: "松江中队", number: "75", zhanbi: "0.5%" },
zhiNumData = [] { name: "金山中队", number: "65", zhanbi: "0.4%" },
tiaoshiPao:any { name: "崇明中队", number: "55", zhanbi: "0.3%" },
];
zhiNameData = [];
zhiNumData = [];
tiaoshiPao: any;
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
if(this.zhiNumData.length>=1){ 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":' +
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1) this.zhiNumData[i] +
arrshuzu+=']' ',"coord":[' +
this.tiaoshiPao=JSON.parse(arrshuzu) i +
"," +
this.zhiNumData[i] +
'],"name":' +
'"' +
this.zhiNameData[i] +
'"' +
"},";
}
arrshuzu = arrshuzu.substring(0, arrshuzu.length - 1);
arrshuzu += "]";
this.tiaoshiPao = JSON.parse(arrshuzu);
} }
} }
forArr = [{id:'gaoceng',name:'高层',echart:null}, forArr = [
{id:'dixia',name:'地下',echart:null}, { id: "gaoceng", name: "高层", echart: null },
{id:'guidao',name:'轨道交通',echart:null}, { id: "dixia", name: "地下", echart: null },
{id:'huagong',name:'化工生产',echart:null}, { id: "guidao", name: "轨道交通", echart: null },
{id:'chuguan',name:'储罐类',echart:null}, { id: "huagong", name: "化工生产", echart: null },
{id:'changfang',name:'厂房',echart:null}, { id: "chuguan", name: "储罐类", echart: null },
{id:'gujianzhu',name:'古建筑',echart:null}, { id: "changfang", name: "厂房", echart: null },
{id:'shichang',name:'商市场',echart:null}, { id: "gujianzhu", name: "古建筑", echart: null },
{id:'yiyuan',name:'医院',echart:null}, { id: "shichang", name: "商市场", echart: null },
{id:'xuexiao',name:'学校',echart:null}, { id: "yiyuan", name: "医院", echart: null },
{id:'binguan',name:'宾馆',echart:null}, { id: "xuexiao", name: "学校", echart: null },
{id:'yule',name:'娱乐场所',echart:null}, { id: "binguan", name: "宾馆", echart: null },
{id:'canyin',name:'餐饮业',echart:null}, { id: "yule", name: "娱乐场所", echart: null },
{id:'yingyuan',name:'影剧院',echart:null}, { id: "canyin", name: "餐饮业", echart: null },
{id:'zhanlan',name:'展览建筑',echart:null}, { id: "yingyuan", name: "影剧院", echart: null },
{id:'suidao',name:'隧道',echart:null}] { id: "zhanlan", name: "展览建筑", echart: null },
{ id: "suidao", name: "隧道", echart: null },
];
//返回 //返回
goback(){ goback() {
sessionStorage.setItem('refresh', 'true'); sessionStorage.setItem("refresh", "true");
history.go(-1); history.go(-1);
} }
/* 顶部饼状图 */ /* 顶部饼状图 */
indexBzt indexBzt;
initCharts(){ initCharts() {
this.indexBzt = echarts.init(document.getElementById("pie"), "walden");
this.indexBzt = echarts.init(document.getElementById('pie'),'walden'); let options = {
let options={
title: { title: {
text: '建筑类型统计(8900家)', text: "建筑类型统计(8900家)",
left: 'center', left: "center",
top: "7%", top: "7%",
textStyle: { textStyle: {
fontSize:26 fontSize: 26,
} },
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
return this.data.tableTooltip(this.tableDataZhi,params.name) return this.data.tableTooltip(this.tableDataZhi, params.name);
}, },
position: this.data.tableTooltipNoShow2 position: this.data.tableTooltipNoShow2,
}, },
legend: { legend: {
orient: 'vertical', orient: "vertical",
right: 150, right: 150,
top:80, top: 80,
textStyle:{ textStyle: {
fontSize:18, fontSize: 18,
color:"#000000" color: "#000000",
}, },
data: ['高层', '地下', '轨道交通', '化工生产', '储罐类' , '厂房','古建筑', '商市场', '医院', '学校', '宾馆' , '娱乐场所','餐饮业', '影剧院', '展览建筑' , '隧道'] data: [
"高层",
"地下",
"轨道交通",
"化工生产",
"储罐类",
"厂房",
"古建筑",
"商市场",
"医院",
"学校",
"宾馆",
"娱乐场所",
"餐饮业",
"影剧院",
"展览建筑",
"隧道",
],
}, },
series: [ series: [
{ {
name: '访问来源', name: "访问来源",
type: 'pie', type: "pie",
radius: '70%', radius: "70%",
center: ['50%', '60%'], center: ["50%", "60%"],
label:{ label: {
show:true, show: true,
fontSize:16, fontSize: 16,
formatter:'{b}{c}家\n{d|({d}%)}', formatter: "{b}{c}家\n{d|({d}%)}",
rich: { rich: {
d: { d: {
align: 'center', align: "center",
fontSize:16 fontSize: 16,
} },
}, },
}, },
data: [ data: [
{value: 500, name: '高层'}, { value: 500, name: "高层" },
{value: 800, name: '地下'}, { value: 800, name: "地下" },
{value: 900, name: '轨道交通'}, { value: 900, name: "轨道交通" },
{value: 800, name: '化工生产'}, { value: 800, name: "化工生产" },
{value: 1200, name: '储罐类'}, { value: 1200, name: "储罐类" },
{value: 1500, name: '厂房'}, { value: 1500, name: "厂房" },
{value: 1400, name: '古建筑'}, { value: 1400, name: "古建筑" },
{value: 600, name: '商市场'}, { value: 600, name: "商市场" },
{value: 568, name: '医院'}, { value: 568, name: "医院" },
{value: 888, name: '学校'}, { value: 888, name: "学校" },
{value: 485, name: '宾馆'}, { value: 485, name: "宾馆" },
{value: 966, name: '娱乐场所'}, { value: 966, name: "娱乐场所" },
{value: 789, name: '餐饮业'}, { value: 789, name: "餐饮业" },
{value: 500, name: '影剧院'}, { value: 500, name: "影剧院" },
{value: 1025, name: '展览建筑'}, { value: 1025, name: "展览建筑" },
{value: 600, name: '隧道'} { value: 600, name: "隧道" },
], ],
emphasis: { emphasis: {
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
shadowOffsetX: 0, shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)' shadowColor: "rgba(0, 0, 0, 0.5)",
} },
} },
} },
] ],
}; };
this.indexBzt.on('click', (params) => { this.indexBzt.on("click", (params) => {
// this.router.navigateByUrl('/statisticanalysis/buildingType_two_forward'); // this.router.navigateByUrl('/statisticanalysis/buildingType_two_forward');
}); });
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }
//柱状图 //柱状图
lengthdata=[]//提示数据 lengthdata = []; //提示数据
count=0//总数 count = 0; //总数
indexData=[]//所有数据 indexData = []; //所有数据
organizationId=[] organizationId = [];
tabledata 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+this.tabledata[0].totalCount, text: this.headname + this.tabledata[0].totalCount,
left: "center", left: "center",
top:this.padHw?"18":"0", top: this.padHw ? "18" : "0",
bottom:this.padHw?"0":'510', bottom: this.padHw ? "0" : "510",
textStyle: {
fontSize: 30,
},
},
grid: {
//top: 90,
bottom: "18%",
},
xAxis: {
id: this.organizationId,
type: "category",
data: this.zhiNameData,
axisLabel: {
//this.axisLabel,
interval: 0,
rotate: 28,
textStyle: { textStyle: {
fontSize: 30 fontSize: 16,
} color: "#000000",
},
}, },
grid: {
//top: 90,
bottom: '18%',
}, },
xAxis: { yAxis: {
id:this.organizationId, type: "value",
type: 'category', axisLabel: {
data: this.zhiNameData, //this.axisLabel,
axisLabel:{ textStyle: {
//this.axisLabel, fontSize: 16,
interval: 0, color: "#000000",
rotate:28, },
textStyle:{
fontSize :16,
color:'#000000'
}
}
}, },
yAxis: { },
type: 'value', tooltip: {
axisLabel:{ trigger: "item",
//this.axisLabel, formatter: (params) => {
textStyle:{ return this.tableTooltip(params);
fontSize :16,
color:'#000000'
}
}
}, },
tooltip: { position: this.data.tableTooltipNoShow2,
trigger: 'item', },
formatter: (params)=>{ series: [
return this.tableTooltip(params) {
data: this.zhiNumData,
type: "bar",
markPoint: {
data: this.tiaoshiPao,
}, },
position: this.data.tableTooltipNoShow2 //showBackground: true,
}, backgroundStyle: {
series: [{ color: "rgba(220, 220, 220, 0.8)",
data: this.zhiNumData,
type: 'bar',
markPoint: {
data:this.tiaoshiPao
}, },
//showBackground: true, barWidth: "38",
backgroundStyle: { //label: this.topTextlabel
color: 'rgba(220, 220, 220, 0.8)' },
],
};
item.echart.setOption(option);
item.echart.getZr().on("click", (params) => {
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.tabledata[0].organizations[xIndex].subOrganizations.length >= 1
) {
//总队,支队跳转
this.router.navigate(
[
"/statisticanalysis/buildingType_one/buildingType_three_details",
],
{
queryParams: {
organizationName: option.xAxis.data[xIndex],
buildingTypeName: this.headname,
buildId: this.buildId,
organizationId: option.xAxis.id[xIndex],
},
}
);
} else {
this.router.navigate(["/statisticanalysis/CompangInfo"], {
queryParams: {
name: option.xAxis.data[xIndex],
type: 1,
jsid: option.xAxis.id[xIndex],
buildid: this.buildId,
}, },
barWidth :'38', });
//label: this.topTextlabel }
}] //this.router.navigate(['/statisticanalysis/delete_one/delete_four'],{queryParams:{'level':this.option.xAxis.data[xIndex]+headName}});
};
item.echart.setOption(option);
item.echart.getZr().on('click', (params) => {
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.tabledata[0].organizations[xIndex].subOrganizations.length>=1){
//总队,支队跳转
this.router.navigate(['/statisticanalysis/buildingType_one/buildingType_three_details'],{queryParams:{'organizationName':option.xAxis.data[xIndex],'buildingTypeName':this.headname,'buildId':this.buildId,'organizationId':option.xAxis.id[xIndex]}})
}
else{
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':option.xAxis.data[xIndex],'type':1,'jsid':option.xAxis.id[xIndex],'buildid':this.buildId}});
} }
//this.router.navigate(['/statisticanalysis/delete_one/delete_four'],{queryParams:{'level':this.option.xAxis.data[xIndex]+headName}}); });
} });
});
})
} }
//提示框表格 //提示框表格
res res;
tishiData tishiData;
tableTooltip(datas){ tableTooltip(datas) {
for(var a in this.data.obdata[0].organizations){ for (var a in this.data.obdata[0].organizations) {
if(this.data.obdata[0].organizations[a].organizationName==datas.name){ if (this.data.obdata[0].organizations[a].organizationName == datas.name) {
this.tishiData=this.data.obdata[0].organizations[a].subOrganizations this.tishiData = this.data.obdata[0].organizations[a].subOrganizations;
} }
} }
var countall=0//总计 var countall = 0; //总计
var countbi=0//站比 var countbi = 0; //站比
var allCountbi=0//总站比 var allCountbi = 0; //总站比
for(var i=0;i<this.tishiData.length;i++){ for (var i = 0; i < this.tishiData.length; i++) {
countall+=this.tishiData[i].count 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 =
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"; >'; '<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;">' +
this.res+='<thead style="font-size:18px;"><tr>'; datas.name +
this.res+='<td style="text-align:center;width:30%;">名称</td>'; "</span></div>";
this.res+='<td style="text-align:center;width:30%;">数量</td>' this.res +=
this.res+='<td style="text-align:center;width:30%;">总占比</td>' '</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+='</tr></thead>' this.res += '<thead style="font-size:18px;"><tr>';
this.res+='<tbody>'; this.res += '<td style="text-align:center;width:30%;">名称</td>';
for(var i=0;i<this.tishiData.length;i++){ this.res += '<td style="text-align:center;width:30%;">数量</td>';
countbi=Math.round(this.tishiData[i].count/countall* 10000)/ 100.00 this.res += '<td style="text-align:center;width:30%;">总占比</td>';
allCountbi=allCountbi+countbi this.res += "</tr></thead>";
this.res+='<tr>' this.res += "<tbody>";
this.res+='<td style="text-align:center;">'+this.tishiData[i].organizationName+'</td>' for (var i = 0; i < this.tishiData.length; i++) {
this.res+='<td style="text-align:center;">'+this.tishiData[i].count+'</td>' countbi =
this.res+='<td style="text-align:center;">'+countbi+'%</td></tr>' Math.round((this.tishiData[i].count / countall) * 10000) / 100.0;
} allCountbi = allCountbi + countbi;
this.res += "<tr>";
this.res+='</tbody>' this.res +=
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>' '<td style="text-align:center;">' +
this.res+='</table></div></div>' this.tishiData[i].organizationName +
return this.res "</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;
} }
} }

276
src/app/statistic-analysis/deleteUnit/delete-one/delete-one.component.ts

@ -1,153 +1,195 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import {EchartsDataService,} from '../../echarts-data.service' import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-delete-one', selector: "app-delete-one",
templateUrl: './delete-one.component.html', templateUrl: "./delete-one.component.html",
styleUrls: ['./delete-one.component.scss'] styleUrls: ["./delete-one.component.scss"],
}) })
export class DeleteOneComponent implements OnInit { export class DeleteOneComponent implements OnInit {
options:any; options: any;
indexBzt//echarts实例 indexBzt; //echarts实例
constructor(private router: Router,public echartsData:EchartsDataService) { } constructor(private router: Router, public echartsData: EchartsDataService) {}
ngOnInit() { ngOnInit() {
window.setTimeout(()=>{ window.setTimeout(() => {
this.initCharts() this.initCharts();
},0) }, 0);
} }
ngOnDestroy():void{ ngOnDestroy(): void {
this.indexBzt.clear() if (this.indexBzt) {
this.indexBzt.dispose() this.indexBzt.clear();
this.indexBzt.dispose();
}
} }
/* 首页饼状图 */ /* 首页饼状图 */
initCharts(){ initCharts() {
//console.log(document.getElementById('indexBzt')) //console.log(document.getElementById('indexBzt'))
var ec = echarts as any; var ec = echarts as any;
this.indexBzt = ec.init(document.getElementById('indexBzt'),'walden'); this.indexBzt = ec.init(document.getElementById("indexBzt"), "walden");
var options={ var options = {
title: { title: {
text: '删除单位统计(8900家)', text: "删除单位统计(8900家)",
left: 'center', left: "center",
top: "7%", top: "7%",
textStyle:{ textStyle: {
fontSize:31 fontSize: 31,
} },
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
//position: this.echartsData.tableTooltipNoShow2, //position: this.echartsData.tableTooltipNoShow2,
formatter: (params)=>{ formatter: (params) => {
//return this.biaogeTishi(params.name) //return this.biaogeTishi(params.name)
return this.echartsData.biaogeTishiZhi(params.name) return this.echartsData.biaogeTishiZhi(params.name);
} },
}, },
legend: { legend: {
orient: 'vertical', orient: "vertical",
right: 150, right: 150,
top:80, top: 80,
//padding:20, //padding:20,
// itemWidth:60, // itemWidth:60,
// itemHeight:25, // itemHeight:25,
textStyle:{ textStyle: {
fontSize:18, fontSize: 18,
color:"#000000" color: "#000000",
}, },
data: ['高层', '地下', '轨道交通', '化工生产', '储罐类', '厂房', '古建筑', '商市场', '医院', '学校', '宾馆', '娱乐场所', '餐饮业', '影剧院', '展览建筑', '隧道'] data: [
"高层",
"地下",
"轨道交通",
"化工生产",
"储罐类",
"厂房",
"古建筑",
"商市场",
"医院",
"学校",
"宾馆",
"娱乐场所",
"餐饮业",
"影剧院",
"展览建筑",
"隧道",
],
}, },
series: [ series: [
{ {
name: '访问来源', name: "访问来源",
type: 'pie', type: "pie",
radius: '65%', radius: "65%",
center: ['50%', '60%'], center: ["50%", "60%"],
label:{ label: {
show:true, show: true,
fontSize:18, fontSize: 18,
formatter:'{b}{c}家\n{d|({d}%)}', formatter: "{b}{c}家\n{d|({d}%)}",
rich: { rich: {
d: { d: {
align: 'center', align: "center",
fontSize:18 fontSize: 18,
}
},
}, },
data: [ },
{value: 500, name: '高层'}, },
{value: 1300, name: '地下',itemStyle:{color:'#02A7F0'}}, data: [
{value: 1500, name: '轨道交通'}, { value: 500, name: "高层" },
{value: 1500, name: '化工生产'}, { value: 1300, name: "地下", itemStyle: { color: "#02A7F0" } },
{value: 1700, name: '储罐类'}, { value: 1500, name: "轨道交通" },
{value: 800, name: '厂房'}, { value: 1500, name: "化工生产" },
{value: 1500, name: '古建筑'}, { value: 1700, name: "储罐类" },
{value: 1500, name: '商市场'}, { value: 800, name: "厂房" },
{value: 1700, name: '医院'}, { value: 1500, name: "古建筑" },
{value: 1700, name: '学校'}, { value: 1500, name: "商市场" },
{value: 1700, name: '宾馆'}, { value: 1700, name: "医院" },
{value: 1700, name: '娱乐场所'}, { value: 1700, name: "学校" },
{value: 1700, name: '餐饮业'}, { value: 1700, name: "宾馆" },
{value: 1700, name: '影剧院'}, { value: 1700, name: "娱乐场所" },
{value: 1700, name: '展览建筑'}, { value: 1700, name: "餐饮业" },
{value: 1700, name: '隧道'} { value: 1700, name: "影剧院" },
], { value: 1700, name: "展览建筑" },
emphasis: { { value: 1700, name: "隧道" },
itemStyle: { ],
shadowBlur: 10, emphasis: {
shadowOffsetX: 0, itemStyle: {
shadowColor: 'rgba(0, 0, 0, 0.5)' shadowBlur: 10,
} shadowOffsetX: 0,
} shadowColor: "rgba(0, 0, 0, 0.5)",
} },
] },
},
],
}; };
this.indexBzt.on('click', (params) => { this.indexBzt.on("click", (params) => {
this.router.navigateByUrl('/statisticanalysis/delete_one/delete_two'); this.router.navigateByUrl("/statisticanalysis/delete_one/delete_two");
}); });
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }
/** /**
* @name: * @name:
* @test: test font * @test: test font
* @msg: * @msg:
* @param {string()} * @param {string()}
* @return {type} * @return {type}
*/ */
biaogeTishi(biaotou:string){ biaogeTishi(biaotou: string) {
var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},' var shuju =
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' '[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},';
shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},' shuju +=
shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},' '{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},' shuju +=
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' '{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},';
shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},' shuju +=
shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]' '{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},';
var jsonObj = JSON.parse(shuju); shuju +=
var 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:#000000;font-size:30px;text-align: center;display:block;">'+biaotou+'</span></div>' '{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},';
res+='</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >'; shuju +=
res+='<thead><tr>'; '{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>'; shuju +=
res+='<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>' '{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>' shuju +=
res+='</tr></thead>' '{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]';
res+='<tbody>'; var jsonObj = JSON.parse(shuju);
for(var i=0;i<jsonObj.length;i++){ var res =
res+='<tr>' '<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#000000;font-size:30px;text-align: center;display:block;">' +
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].name+'</td>' biaotou +
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].number+'</td>' "</span></div>";
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].zhanbi+'</td></tr>' res +=
} '</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >';
res += "<thead><tr>";
res+='</tbody>' res +=
res+='<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>' '<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>';
res+='</table></div></div>' res +=
return res '<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>';
} res +=
'<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>';
res += "</tr></thead>";
res += "<tbody>";
for (var i = 0; i < jsonObj.length; i++) {
res += "<tr>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].name +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].number +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].zhanbi +
"</td></tr>";
}
res += "</tbody>";
res +=
'<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>';
res += "</table></div></div>";
return res;
}
} }

413
src/app/statistic-analysis/deleteUnit/delete-there/delete-there.component.ts

@ -1,210 +1,272 @@
/* /*
* @Descripttion: * @Descripttion:
* @version: * @version:
* @Author: sueRimn * @Author: sueRimn
* @Date: 2020-09-02 16:22:35 * @Date: 2020-09-02 16:22:35
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2020-11-16 09:40:04 * @LastEditTime: 2020-11-16 09:40:04
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router,ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from "@angular/router";
import {EchartsDataService} from '../../echarts-data.service'; import { EchartsDataService } from "../../echarts-data.service";
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBarConfig, MatSnackBar } from "@angular/material/snack-bar";
import { DateAdapter } from '@angular/material/core'; import { DateAdapter } from "@angular/material/core";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-delete-there', selector: "app-delete-there",
templateUrl: './delete-there.component.html', templateUrl: "./delete-there.component.html",
styleUrls: ['./delete-there.component.scss'] styleUrls: ["./delete-there.component.scss"],
}) })
export class DeleteThereComponent implements OnInit { export class DeleteThereComponent implements OnInit {
constructor(
constructor(private router: Router,private activatedRoute: ActivatedRoute,public echartsData:EchartsDataService,public snackBar: MatSnackBar,private adapter: DateAdapter<any>) { } private router: Router,
zhutu//echarts实例 private activatedRoute: ActivatedRoute,
option public echartsData: EchartsDataService,
time:String public snackBar: MatSnackBar,
buildingTypeName:String private adapter: DateAdapter<any>
setTimeoutObj//延时器需要清除 ) {}
headtext:string; zhutu; //echarts实例
zhong:string option;
ngOnDestroy():void{ time: String;
this.zhutu.clear() buildingTypeName: String;
this.zhutu.dispose() setTimeoutObj; //延时器需要清除
headtext: string;
zhong: string;
ngOnDestroy(): void {
if (this.zhutu) {
this.zhutu.clear();
this.zhutu.dispose();
}
} }
ngOnInit(): void { ngOnInit(): void {
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.zhiNumData,this.zhiNameData) this.tiaoshiPao = this.echartsData.qipao(
this.tiaoshiPao,
this.zhiNumData,
this.zhiNameData
);
this.dateInit(); this.dateInit();
//let headtext:string; //let headtext:string;
let datayuex:string; let datayuex: string;
let headName:string; let headName: string;
// console.log(this.activatedRoute.queryParams.subscribe) // console.log(this.activatedRoute.queryParams.subscribe)
//headtext=this.activatedRoute.queryParams["headtext"]; //headtext=this.activatedRoute.queryParams["headtext"];
this.activatedRoute.queryParams.subscribe(param=>{ this.activatedRoute.queryParams.subscribe((param) => {
this.headtext=param.headtext this.headtext = param.headtext;
datayuex=param.level datayuex = param.level;
this.zhong=param.zhong this.zhong = param.zhong;
headName=this.headtext+''+datayuex; headName = this.headtext + "" + datayuex;
//console.log(headName) //console.log(headName)
}); });
window.setTimeout(()=>{ window.setTimeout(() => {
this.zhuzhuangtu(headName) this.zhuzhuangtu(headName);
},0) }, 0);
} }
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据 //查询数据
years:any = [] years: any = [];
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];
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
this.years.unshift(i) this.years.unshift(i);
} }
// console.log(this.years) // console.log(this.years)
} }
selectOneYear:any = (new Date()).getFullYear() //开始年份
selectStartMonth:any = 1 //开始月份
Submit (e) {
}
selectStartYear:any = (new Date()).getFullYear() //开始年份
selectOneYear: any = new Date().getFullYear(); //开始年份
selectStartMonth: any = 1; //开始月份
Submit(e) {}
selectStartYear: any = new Date().getFullYear(); //开始年份
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"] }; //柱状图数值顶部显示
zhiNumData = [0,0,0,0,0,0,0,0,0,0,0,0,0,0] zhiNameData = [
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队","松江中队","金山中队","崇明中队"] "浦东支队",
tiaoshiPao:any "黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
"松江支队",
"金山支队",
"崇明支队",
];
zhiNumData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
"松江中队",
"金山中队",
"崇明中队",
];
tiaoshiPao: any;
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
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] +
'"' +
"},";
} }
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
} }
date = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月','九月'] date = [
dateNum = [0, 0, 0, 0, 0, 0, 0, 0,0] "一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
];
dateNum = [0, 0, 0, 0, 0, 0, 0, 0, 0];
//返回 //返回
goBack () { goBack() {
history.go(-1) history.go(-1);
this.echartsData.statefulInspectionToggle = true this.echartsData.statefulInspectionToggle = true;
} }
axisLabel = { axisLabel = {
interval: 0, interval: 0,
formatter:function(value) formatter: function (value) {
{ var ret = ""; //拼接加\n返回的类目项
var ret = "";//拼接加\n返回的类目项 var maxLength = 2; //每项显示文字个数
var maxLength = 2;//每项显示文字个数 var valLength = value.length; //X轴类目项的文字个数
var valLength = value.length;//X轴类目项的文字个数 var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 if (rowN > 1) {
if (rowN > 1)//如果类目项的文字大于3, //如果类目项的文字大于3,
{ for (var i = 0; i < rowN; i++) {
for (var i = 0; i < rowN; i++) { var temp = ""; //每次截取的字符串
var temp = "";//每次截取的字符串 var start = i * maxLength; //开始截取的位置
var start = i * maxLength;//开始截取的位置 var end = start + maxLength; //结束截取的位置
var end = start + maxLength;//结束截取的位置 //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 temp = value.substring(start, end) + "\n";
temp = value.substring(start, end) + "\n"; ret += temp; //凭借最终的字符串
ret += temp; //凭借最终的字符串 }
} return ret;
return ret; } else {
} return value;
else { }
return value; },
} }; //echarts两个字换行
}
}//echarts两个字换行
/* 柱状图 */ /* 柱状图 */
zhuzhuangtu(headName:string){ zhuzhuangtu(headName: string) {
var ec = echarts as any; var ec = echarts as any;
this.zhutu = ec.init(document.getElementById('zhidui'),'walden'); this.zhutu = ec.init(document.getElementById("zhidui"), "walden");
this.option = { this.option = {
title: { title: {
text: headName+':总数(0)', text: headName + ":总数(0)",
left: "center", left: "center",
top: "0", top: "0",
textStyle: { textStyle: {
fontSize: 30 fontSize: 30,
} },
}, },
/* grid: { /* grid: {
left: '5%', left: '5%',
bottom:'35%' bottom:'35%'
}, */ }, */
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.zhiNameData, data: this.zhiNameData,
//axisLabel: this.axisLabel, //axisLabel: this.axisLabel,
axisLabel:{ axisLabel: {
//this.axisLabel, //this.axisLabel,
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
},
}
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel:{ axisLabel: {
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
},
}
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
return this.echartsData.tableTooltip('',headName) return this.echartsData.tableTooltip("", headName);
}, },
position: this.echartsData.tableTooltipNoShowq position: this.echartsData.tableTooltipNoShowq,
/* backgroundColor:'rgba(255,255,255,1)', /* backgroundColor:'rgba(255,255,255,1)',
borderWidth:'1', borderWidth:'1',
borderRadius :'0' */ borderRadius :'0' */
}, },
series: [{ series: [
{
data: this.zhiNumData, data: this.zhiNumData,
type: 'bar', type: "bar",
markPoint: { markPoint: {
symbolSize:[65, 65], symbolSize: [65, 65],
data: this.tiaoshiPao data: this.tiaoshiPao,
}, },
backgroundStyle: { backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)' color: "rgba(220, 220, 220, 0.8)",
}, },
barWidth :'38', barWidth: "38",
//label: this.topTextlabel //label: this.topTextlabel
}] },
],
}; };
this.zhutu.getZr().on('click',params=>{ this.zhutu.getZr().on("click", (params) => {
// console.log(params.name) // console.log(params.name)
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (this.zhutu.containPixel('grid',pointInPixel)) { if (this.zhutu.containPixel("grid", pointInPixel)) {
let xIndex=this.zhutu.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = this.zhutu.convertFromPixel({ seriesIndex: 0 }, [
params.offsetX,
params.offsetY,
])[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
this.router.navigate(['/statisticanalysis/delete_one/delete_four'],{queryParams:{'level':this.option.xAxis.data[xIndex]+headName}}); this.router.navigate(["/statisticanalysis/delete_one/delete_four"], {
queryParams: { level: this.option.xAxis.data[xIndex] + headName },
});
} }
}); });
/* this.zhutu.on('click', (params) => { /* this.zhutu.on('click', (params) => {
@ -215,37 +277,50 @@ export class DeleteThereComponent implements OnInit {
this.zhutu.setOption(this.option); this.zhutu.setOption(this.option);
} }
/* 鼠标悬停提示 */ /* 鼠标悬停提示 */
tableTooltip2(biaotou:string){ tableTooltip2(biaotou: string) {
var shuju='[{"name":"浦东中队","number":"156","zhanbi":"3%"},{"name":"黄浦中队","number":"144","zhanbi":"2.8%"},' var shuju =
shuju+='{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},' '[{"name":"浦东中队","number":"156","zhanbi":"3%"},{"name":"黄浦中队","number":"144","zhanbi":"2.8%"},';
shuju+='{"name":"静安中队","number":"120","zhanbi":"1.3%"},{"name":"普陀中队","number":"100","zhanbi":"1.1%"},' shuju +=
shuju+='{"name":"虹口中队","number":"95","zhanbi":"1%"},{"name":"杨浦中队","number":"90","zhanbi":"0.9%"},' '{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},';
shuju+='{"name":"闵行中队","number":"88","zhanbi":"0.8%"},{"name":"宝山中队","number":"83","zhanbi":"0.7%"},' shuju +=
shuju+='{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},' '{"name":"静安中队","number":"120","zhanbi":"1.3%"},{"name":"普陀中队","number":"100","zhanbi":"1.1%"},';
shuju+='{"name":"嘉定中队","number":"78","zhanbi":"0.6%"},{"name":"松江中队","number":"75","zhanbi":"0.5%"},' shuju +=
shuju+='{"name":"金山中队","number":"65","zhanbi":"0.4%"},{"name":"崇明中队","number":"55","zhanbi":"0.3%"}]' '{"name":"虹口中队","number":"95","zhanbi":"1%"},{"name":"杨浦中队","number":"90","zhanbi":"0.9%"},';
var jsonObj = JSON.parse(shuju); shuju +=
var 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;">'+biaotou+'</span></div>' '{"name":"闵行中队","number":"88","zhanbi":"0.8%"},{"name":"宝山中队","number":"83","zhanbi":"0.7%"},';
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"; >'; shuju +=
res+='<thead style="font-size:18px;"><tr>'; '{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},';
res+='<td style="text-align:center;width:30%;">名称</td>'; shuju +=
res+='<td style="text-align:center;width:30%;">数量</td>' '{"name":"嘉定中队","number":"78","zhanbi":"0.6%"},{"name":"松江中队","number":"75","zhanbi":"0.5%"},';
res+='<td style="text-align:center;width:30%;">总占比</td>' shuju +=
res+='</tr></thead>' '{"name":"金山中队","number":"65","zhanbi":"0.4%"},{"name":"崇明中队","number":"55","zhanbi":"0.3%"}]';
res+='<tbody>'; var jsonObj = JSON.parse(shuju);
//var res='<div class="tishi" style=" width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span >'+biaotou+'</span></div>' var res =
for(var i=0;i<jsonObj.length;i++){ '<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;">' +
res+='<tr>' biaotou +
res+='<td style="text-align:center;">'+jsonObj[i].name+'</td>' "</span></div>";
res+='<td style="text-align:center;">'+jsonObj[i].number+'</td>' res +=
res+='<td style="text-align:center;">'+jsonObj[i].zhanbi+'</td></tr>' '</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"; >';
} res += '<thead style="font-size:18px;"><tr>';
res += '<td style="text-align:center;width:30%;">名称</td>';
res+='</tbody>' res += '<td style="text-align:center;width:30%;">数量</td>';
res+='<tfoot style="font-size:18px;"><td style="text-align:center;">总计</td><td style="text-align:center;">1356</td><td style="text-align:center;">19%</td></tfoot>' res += '<td style="text-align:center;width:30%;">总占比</td>';
res+='</table></div></div>' res += "</tr></thead>";
return res res += "<tbody>";
} //var res='<div class="tishi" style=" width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span >'+biaotou+'</span></div>'
for (var i = 0; i < jsonObj.length; i++) {
res += "<tr>";
res += '<td style="text-align:center;">' + jsonObj[i].name + "</td>";
res += '<td style="text-align:center;">' + jsonObj[i].number + "</td>";
res +=
'<td style="text-align:center;">' + jsonObj[i].zhanbi + "</td></tr>";
}
res += "</tbody>";
res +=
'<tfoot style="font-size:18px;"><td style="text-align:center;">总计</td><td style="text-align:center;">1356</td><td style="text-align:center;">19%</td></tfoot>';
res += "</table></div></div>";
return res;
}
} }

372
src/app/statistic-analysis/deleteUnit/delete-two-newadd/delete-two-newadd.component.ts

@ -1,227 +1,311 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import {
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; MatDialog,
import { ActivatedRoute } from '@angular/router'; MatDialogRef,
import { EchartsDataService } from '../../echarts-data.service'; MAT_DIALOG_DATA,
} from "@angular/material/dialog";
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import { ActivatedRoute } from "@angular/router";
import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-delete-two-newadd', selector: "app-delete-two-newadd",
templateUrl: './delete-two-newadd.component.html', templateUrl: "./delete-two-newadd.component.html",
styleUrls: ['./delete-two-newadd.component.scss'] styleUrls: ["./delete-two-newadd.component.scss"],
}) })
export class DeleteTwoNewaddComponent implements OnInit { export class DeleteTwoNewaddComponent 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) { } year: String;
buildingTypeName: String;
year:String level: String;
buildingTypeName:String setTimeoutObj; //延时器需要清除
level:String
setTimeoutObj//延时器需要清除
ngOnInit(): void { ngOnInit(): void {
this.dateInit () this.dateInit();
this.bianli() this.bianli();
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe((params) => {
this.year = params['level']; this.year = params["level"];
this.buildingTypeName = params['headtext']; this.buildingTypeName = params["headtext"];
});
this.setTimeoutObj = window.setTimeout(() => {
this.detailEcharts();
}); });
this.setTimeoutObj = window.setTimeout(()=>{
this.detailEcharts()
})
} }
ngOnDestroy(){ ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
this.detailPlanEchart.clear() if (this.detailPlanEchart) {
this.detailPlanEchart.dispose() this.detailPlanEchart.clear();
this.detailPlanEchart.dispose();
}
} }
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据 //查询数据
years:any = [] years: any = [];
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];
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
this.years.unshift(i) this.years.unshift(i);
} }
} }
selectOneYear:any = (new Date()).getFullYear() //开始年份 selectOneYear: any = new Date().getFullYear(); //开始年份
selectStartMonth:any = 1 //开始月份 selectStartMonth: any = 1; //开始月份
Submit (e) { Submit(e) {}
selectStartYear: any = new Date().getFullYear(); //开始年份
}
selectStartYear:any = (new Date()).getFullYear() //开始年份
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] }; //柱状图数值顶部显示
zhongNumData = [0,0,0,0,0,0,0,0,0,0,0] zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
];
zhongNumData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队"] zhiNameData = [
zhiNumData = [0,0,0,0,0,0,0,0,0,0,0] "浦东支队",
tiaoshiPao:any "黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
];
zhiNumData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
tiaoshiPao: any;
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
var arrshuzu='['; var arrshuzu = "[";
for(var i=0;i<this.dateNum.length;i++){ for (var i = 0; i < this.dateNum.length; i++) {
arrshuzu+='{"value":'+this.dateNum[i]+',"coord":['+i+','+this.dateNum[i]+'],"name":'+'"'+this.date[i]+'"'+'},' arrshuzu +=
'{"value":' +
this.dateNum[i] +
',"coord":[' +
i +
"," +
this.dateNum[i] +
'],"name":' +
'"' +
this.date[i] +
'"' +
"},";
} }
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
} }
//返回 //返回
goBack () { goBack() {
history.go(-1) history.go(-1);
//this.echartsData.statefulInspectionToggle = true //this.echartsData.statefulInspectionToggle = true
} }
detailPlanEchart detailPlanEchart;
option option;
date = ['高层', '轨道交通', '储罐类', '古建筑', '地下', '化工生产', '厂房', '商市场'] date = [
dateNum = [0, 0, 0, 0, 0, 0, 0, 0] "高层",
"轨道交通",
"储罐类",
"古建筑",
"地下",
"化工生产",
"厂房",
"商市场",
];
dateNum = [0, 0, 0, 0, 0, 0, 0, 0];
detailEcharts(){ detailEcharts() {
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp'); this.detailPlanEchart = echarts.init(
document.getElementById("barEchart"),
"skinUpp"
);
this.option = { this.option = {
grid: { grid: {
top: 90, top: 90,
left:40, left: 40,
right: 20, right: 20,
//bottom: 20, //bottom: 20,
}, },
// 标题 // 标题
title: { title: {
text: this.buildingTypeName + '(' + this.year + ')', text: this.buildingTypeName + "(" + this.year + ")",
top: -4, top: -4,
left: 'center', left: "center",
textStyle:{ textStyle: {
//文字颜色 //文字颜色
color:'#000', color: "#000",
fontSize: 30 fontSize: 30,
} },
}, },
//提示框 //提示框
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
formatter: (params)=>{ formatter: (params) => {
if(params[0].seriesName == "year"){ if (params[0].seriesName == "year") {
return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name) return this.serviceData.tableTooltip(
}else{ this.serviceData.monthTooltip,
return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name) params[0].name
);
} else {
return this.serviceData.tableTooltip(
this.serviceData.tableDataZhi,
params[0].name
);
} }
}, },
position:this.serviceData.tableTooltipNoShow2 position: this.serviceData.tableTooltipNoShow2,
}, },
// x轴 // x轴
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.date, data: this.date,
axisLabel: { axisLabel: {
color: "#000", //刻度线标签颜色 color: "#000", //刻度线标签颜色
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
}, },
}, },
splitLine: {//分割线配置 splitLine: {
show:true, //分割线配置
show: true,
lineStyle: { lineStyle: {
color: '#999', color: "#999",
} },
} },
}, },
// y轴 // y轴
yAxis: { yAxis: {
type: 'value', type: "value",
name: '个', name: "个",
axisLabel: { axisLabel: {
//color: "#000", //刻度线标签颜色 //color: "#000", //刻度线标签颜色
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
} },
} },
}, },
// 数据 // 数据
series: [{ series: [
name: 'xxx', {
type: 'line', name: "xxx",
type: "line",
markPoint: { markPoint: {
symbolSize:[65, 65], symbolSize: [65, 65],
data: this.tiaoshiPao data: this.tiaoshiPao,
}, },
data: this.dateNum, data: this.dateNum,
} },
], ],
}; };
this.detailPlanEchart.setOption(this.option); this.detailPlanEchart.setOption(this.option);
this.detailPlanEchart.getZr().on('click',params=>{ this.detailPlanEchart.getZr().on("click", (params) => {
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) { if (this.detailPlanEchart.containPixel("grid", pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = this.detailPlanEchart.convertFromPixel(
{ seriesIndex: 0 },
[params.offsetX, params.offsetY]
)[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
if(this.serviceData.level=='0'){ if (this.serviceData.level == "0") {
this.router.navigate(['/statisticanalysis/delete_one/delete_there'],{queryParams:{'level':this.option.xAxis.data[xIndex],'headtext':this.buildingTypeName,'zhong':'1'}}); this.router.navigate(["/statisticanalysis/delete_one/delete_there"], {
}else if(this.serviceData.level=='1'){ queryParams: {
this.router.navigate(['/statisticanalysis/delete_one/delete_four'],{queryParams:{'level':this.option.xAxis.data[xIndex]+this.buildingTypeName}}); level: this.option.xAxis.data[xIndex],
headtext: this.buildingTypeName,
zhong: "1",
},
});
} else if (this.serviceData.level == "1") {
this.router.navigate(["/statisticanalysis/delete_one/delete_four"], {
queryParams: {
level: this.option.xAxis.data[xIndex] + this.buildingTypeName,
},
});
} }
} }
}); });
} }
//返回按钮 //返回按钮
backBtn(){ backBtn() {
window.history.go(-1) window.history.go(-1);
}
tableTooltip(params:any){
var data = [
{name:params.name,number:params.value,zhanbi:(params.value/1340 * 100).toFixed(2) + "%"}
]
var 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;">'+params.name+'</span></div>'
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"; >';
res+='<thead style="font-size:18px;"><tr>';
res+='<td style="text-align:center;width:30%;">名称</td>';
res+='<td style="text-align:center;width:30%;">数量</td>'
res+='<td style="text-align:center;width:30%;">总占比</td>'
res+='</tr></thead>'
res+='<tbody>';
for(var i=0;i<data.length;i++){
res+='<tr>'
res+='<td style="text-align:center;">'+data[i].name+'</td>'
res+='<td style="text-align:center;">'+data[i].number+'</td>'
res+='<td style="text-align:center;">'+data[i].zhanbi+'</td></tr>'
}
res+='</tbody>'
// res+='<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>'
res+='</table></div></div>'
return res
} }
tableTooltip(params: any) {
var data = [
{
name: params.name,
number: params.value,
zhanbi: ((params.value / 1340) * 100).toFixed(2) + "%",
},
];
var 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;">' +
params.name +
"</span></div>";
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"; >';
res += '<thead style="font-size:18px;"><tr>';
res += '<td style="text-align:center;width:30%;">名称</td>';
res += '<td style="text-align:center;width:30%;">数量</td>';
res += '<td style="text-align:center;width:30%;">总占比</td>';
res += "</tr></thead>";
res += "<tbody>";
for (var i = 0; i < data.length; i++) {
res += "<tr>";
res += '<td style="text-align:center;">' + data[i].name + "</td>";
res += '<td style="text-align:center;">' + data[i].number + "</td>";
res += '<td style="text-align:center;">' + data[i].zhanbi + "</td></tr>";
}
res += "</tbody>";
// res+='<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>'
res += "</table></div></div>";
return res;
}
} }

585
src/app/statistic-analysis/deleteUnit/delete-two/delete-two.component.ts

@ -1,123 +1,209 @@
/* /*
* @Descripttion: * @Descripttion:
* @version: * @version:
* @Author: sueRimn * @Author: sueRimn
* @Date: 2020-09-02 16:21:18 * @Date: 2020-09-02 16:21:18
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2021-06-24 15:27:13 * @LastEditTime: 2021-06-24 15:27:13
*/ */
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from "@angular/core";
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from "@angular/router";
import { MatDatepickerInputEvent } from '@angular/material/datepicker'; import { MatDatepickerInputEvent } from "@angular/material/datepicker";
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBarConfig, MatSnackBar } from "@angular/material/snack-bar";
import { DateAdapter } from '@angular/material/core'; import { DateAdapter } from "@angular/material/core";
import {EchartsDataService,} from '../../echarts-data.service' import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-delete-two', selector: "app-delete-two",
templateUrl: './delete-two.component.html', templateUrl: "./delete-two.component.html",
styleUrls: ['./delete-two.component.scss'] styleUrls: ["./delete-two.component.scss"],
}) })
export class DeleteTwoComponent implements OnInit { export class DeleteTwoComponent implements OnInit {
options:any; options: any;
datayuex=['一月', '二月', '三月', '四月', '五月', '六月', '七月','八月','九月']; datayuex = [
datayuey=[0, 0, 0, 0, 0, 0, 0,0,0]; "一月",
datanianx=[2020,2021]; "二月",
dataniany=[0,0] "三月",
tiaoshiPao:any//气泡 "四月",
"五月",
"六月",
"七月",
"八月",
"九月",
];
datayuey = [0, 0, 0, 0, 0, 0, 0, 0, 0];
datanianx = [2020, 2021];
dataniany = [0, 0];
tiaoshiPao: any; //气泡
constructor(private router: Router,public snackBar: MatSnackBar,private adapter: DateAdapter<any>,public echartsData:EchartsDataService, private route: ActivatedRoute) { } constructor(
private router: Router,
public snackBar: MatSnackBar,
private adapter: DateAdapter<any>,
public echartsData: EchartsDataService,
private route: ActivatedRoute
) {}
/* @ViewChild('appEcharts')appEcharts :echartsComponent; // /* @ViewChild('appEcharts')appEcharts :echartsComponent; //
@ViewChild('pageTwoName')pageTwoName :PageTwoNameComponent; //父组件中获得子组件的引用 */ @ViewChild('pageTwoName')pageTwoName :PageTwoNameComponent; //父组件中获得子组件的引用 */
ngOnInit(): void { ngOnInit(): void {
this.echartsData.statefulInspectionToggle=true this.echartsData.statefulInspectionToggle = true;
this.dateInit() this.dateInit();
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) this.tiaoshiPao = this.echartsData.qipao(
this.tiaoshiPao,
this.datayuey,
this.datayuex
);
//this.bianli() //this.bianli()
window.setTimeout(()=>{ window.setTimeout(() => {
this.getechartsdata() this.getechartsdata();
},0) }, 0);
} }
ngOnDestroy():void{ ngOnDestroy(): void {
this.headZx.clear() if (this.headZx) {
this.headZx.dispose() this.headZx.clear();
this.headZx.dispose();
}
} }
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
headZx//echarts实例 headZx; //echarts实例
zhiNameData = [
"浦东支队",
"黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
"松江支队",
"金山支队",
"崇明支队",
];
zhiNumData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"]
zhiNumData = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
//查询数据 //查询数据
years:any = [] years: any = [];
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];
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
this.years.unshift(i) this.years.unshift(i);
} }
} }
TimeType=0//按月查询还是按年查询 TimeType = 0; //按月查询还是按年查询
selectOneYear:any = (new Date()).getFullYear() //开始年份 selectOneYear: any = new Date().getFullYear(); //开始年份
selectTwoYear:any = (new Date()).getFullYear() //结束年份 selectTwoYear: any = new Date().getFullYear(); //结束年份
selectStartMonth:any = 1 //开始月份 selectStartMonth: any = 1; //开始月份
selectEndMonth:any = (new Date()).getMonth()+1 //结束月份 selectEndMonth: any = new Date().getMonth() + 1; //结束月份
//点击月 //点击月
monthClick(){ monthClick() {
this.TimeType=0 this.TimeType = 0;
this.tiaoshiPao=null this.tiaoshiPao = null;
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) this.tiaoshiPao = this.echartsData.qipao(
this.headZhexian('Line','删除数量总统计',this.datayuex,this.datayuey) this.tiaoshiPao,
this.datayuey,
this.datayuex
);
this.headZhexian("Line", "删除数量总统计", this.datayuex, this.datayuey);
} }
//按月查询 //按月查询
monthSubmit (e) { monthSubmit(e) {
this.headZhexian('Line','删除数量总统计',this.datayuex,this.datayuey) this.headZhexian("Line", "删除数量总统计", this.datayuex, this.datayuey);
if (e.selectTwoYear > e.selectOneYear) { if (e.selectTwoYear > e.selectOneYear) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime =
let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 e.selectOneYear +
"-" +
e.selectStartMonth +
"-" +
1 +
" " +
0 +
":" +
0 +
":" +
0;
let endTime =
e.selectTwoYear +
"-" +
e.selectEndMonth +
"-" +
31 +
" " +
23 +
":" +
59 +
":" +
59;
// console.log(startTime) // console.log(startTime)
// console.log(endTime) // console.log(endTime)
} else if (e.selectTwoYear === e.selectOneYear) { } else if (e.selectTwoYear === e.selectOneYear) {
if(e.selectEndMonth >= e.selectStartMonth) { if (e.selectEndMonth >= e.selectStartMonth) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime =
let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 e.selectOneYear +
"-" +
e.selectStartMonth +
"-" +
1 +
" " +
0 +
":" +
0 +
":" +
0;
let endTime =
e.selectTwoYear +
"-" +
e.selectEndMonth +
"-" +
31 +
" " +
23 +
":" +
59 +
":" +
59;
// console.log(startTime) // console.log(startTime)
// console.log(endTime) // console.log(endTime)
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
this.snackBar.open('请选择正确时间区段','确定',config); this.snackBar.open("请选择正确时间区段", "确定", config);
} }
}else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
this.snackBar.open('请选择正确时间区段','确定',config); this.snackBar.open("请选择正确时间区段", "确定", config);
} }
} }
selectStartYear: any = new Date().getFullYear(); //开始年份
selectEndYear: any = new Date().getFullYear(); //结束年份
selectStartYear:any = (new Date()).getFullYear() //开始年份
selectEndYear:any = (new Date()).getFullYear() //结束年份
//点击年 //点击年
yearClick(){ yearClick() {
this.TimeType=1 this.TimeType = 1;
this.tiaoshiPao=null this.tiaoshiPao = null;
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataniany,this.datanianx) this.tiaoshiPao = this.echartsData.qipao(
this.headZhexian('Line','删除数量总统计',this.datanianx,this.dataniany) this.tiaoshiPao,
this.dataniany,
this.datanianx
);
this.headZhexian("Line", "删除数量总统计", this.datanianx, this.dataniany);
} }
//按年查询 //按年查询
yearSubmit (e) { yearSubmit(e) {
//console.log(this.selectType) //console.log(this.selectType)
this.headZhexian('Line','删除数量总统计',this.datanianx,this.dataniany) this.headZhexian("Line", "删除数量总统计", this.datanianx, this.dataniany);
/* this.headZhexian('leftOne','',this.datanianx,this.dataniany) /* this.headZhexian('leftOne','',this.datanianx,this.dataniany)
this.headZhexian('leftTwo','轨道交通',this.datanianx,this.dataniany) this.headZhexian('leftTwo','轨道交通',this.datanianx,this.dataniany)
this.headZhexian('leftThere','储罐类',this.datanianx,this.dataniany) this.headZhexian('leftThere','储罐类',this.datanianx,this.dataniany)
@ -127,215 +213,288 @@ export class DeleteTwoComponent implements OnInit {
this.headZhexian('rightThree','厂房',this.datanianx,this.dataniany) this.headZhexian('rightThree','厂房',this.datanianx,this.dataniany)
this.headZhexian('rightFour','商市场',this.datanianx,this.dataniany) */ this.headZhexian('rightFour','商市场',this.datanianx,this.dataniany) */
if (e.selectEndYear >= e.selectStartYear) { if (e.selectEndYear >= e.selectStartYear) {
let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime =
let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 e.selectStartYear + "-" + 1 + "-" + 1 + " " + 0 + ":" + 0 + ":" + 0;
let endTime =
e.selectEndYear + "-" + 12 + "-" + 31 + " " + 23 + ":" + 59 + ":" + 59;
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
this.snackBar.open('请选择正确时间区段','确定',config); this.snackBar.open("请选择正确时间区段", "确定", config);
} }
} }
//支队查询 //支队查询
zhiFind(){ zhiFind() {
this.echartsData.dezhiorBuinding="zhi" this.echartsData.dezhiorBuinding = "zhi";
} }
//建筑类型查询 //建筑类型查询
buildingFind(){ buildingFind() {
this.echartsData.dezhiorBuinding="building" this.echartsData.dezhiorBuinding = "building";
} }
//返回 //返回
goBack(){ goBack() {
history.go(-1) history.go(-1);
} }
//获取数据 //获取数据
tabledata tabledata;
async getechartsdata(){ async getechartsdata() {
let Parameters={ let Parameters = {
MaintainedState:this.route.snapshot.queryParams.type, MaintainedState: this.route.snapshot.queryParams.type,
TimeType:this.TimeType, TimeType: this.TimeType,
TimeStart:this.TimeType==0?this.selectStartYear+'-'+this.selectStartMonth:this.selectStartYear, TimeStart:
TimeEnd:this.TimeType==0?this.selectEndYear+'-'+this.selectEndMonth:this.selectEndYear, this.TimeType == 0
? this.selectStartYear + "-" + this.selectStartMonth
: this.selectStartYear,
TimeEnd:
this.TimeType == 0
? this.selectEndYear + "-" + this.selectEndMonth
: this.selectEndYear,
//OrganizationId //OrganizationId
} };
await this.echartsData.getData(Parameters,`/api/StatisticsAnalysis/Companies/Maintained/OrganizationTrend`) await this.echartsData.getData(
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) Parameters,
console.log(this.tabledata) `/api/StatisticsAnalysis/Companies/Maintained/OrganizationTrend`
this.headZhexian('Line','删除数量总统计',this.datayuex,this.datayuey) );
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
console.log(this.tabledata);
this.headZhexian("Line", "删除数量总统计", this.datayuex, this.datayuey);
} }
/** /**
* @name: 线 * @name: 线
* @test: test font * @test: test font
* @msg: * @msg:
* @param {divid(div),headtext()} * @param {divid(div),headtext()}
* @return {type} * @return {type}
*/ */
headZhexian(divid:string,headtext:string,datayuex,datayuey){ headZhexian(divid: string, headtext: string, datayuex, datayuey) {
var dianji:boolean=headtext=="删除数量总统计" ? false:true; var dianji: boolean = headtext == "删除数量总统计" ? false : true;
var divsiaze={contentSize: [350, 496], viewSize: [831, 380]} var divsiaze = { contentSize: [350, 496], viewSize: [831, 380] };
var pagex var pagex;
var pagey var pagey;
var boxsize=[pagex,pagey] var boxsize = [pagex, pagey];
/* document.onmouseover=function(e){ /* document.onmouseover=function(e){
console.log("000") console.log("000")
pagex=e.pageX pagex=e.pageX
pagey=e.pageY pagey=e.pageY
} */ } */
var ec = echarts as any; var ec = echarts as any;
this.headZx = ec.init(document.getElementById(`${divid}`),'skinUpp'); this.headZx = ec.init(document.getElementById(`${divid}`), "skinUpp");
this.options = { this.options = {
grid: { grid: {
top: 50, top: 50,
left:40, left: 40,
right: 20, right: 20,
bottom: 20, bottom: 20,
}, },
// 标题 // 标题
title: { title: {
text: `${headtext}`+`:总数(${this.tabledata[0].totalCount}`, text: `${headtext}` + `:总数(${this.tabledata[0].totalCount}`,
left:'center', left: "center",
top: -4, top: -4,
//副标题文本样式 //副标题文本样式
 subtextStyle:{ subtextStyle: {
color:'#999', color: "#999",
fontWeight:'bold', fontWeight: "bold",
}, },
textStyle:{ textStyle: {
//文字颜色 //文字颜色
color:'#000', color: "#000",
fontSize:divid=='Line'?30: 22, fontSize: divid == "Line" ? 30 : 22,
} },
}, },
//提示框 //提示框
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
formatter: (params)=>{ formatter: (params) => {
return this.echartsData.dezhiorBuinding=="zhi"?this.echartsData.tableTooltip(this.echartsData.tableDataZhi,`${headtext}`):this.echartsData.tableTooltip(this.echartsData.buildingType,`${headtext}`) return this.echartsData.dezhiorBuinding == "zhi"
? this.echartsData.tableTooltip(
this.echartsData.tableDataZhi,
`${headtext}`
)
: this.echartsData.tableTooltip(
this.echartsData.buildingType,
`${headtext}`
);
}, },
/* backgroundColor:'rgba(255,255,255,1)',//rgba调节背景颜色与透明度 /* backgroundColor:'rgba(255,255,255,1)',//rgba调节背景颜色与透明度
borderWidth:'1', borderWidth:'1',
borderRadius :'0', */ borderRadius :'0', */
position: this.echartsData.tableTooltipNoShow2 position: this.echartsData.tableTooltipNoShow2,
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
boundaryGap:true, boundaryGap: true,
data: datayuex, data: datayuex,
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :15, fontSize: 15,
color:'#000000' color: "#000000",
},
color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 color: "#000", //刻度线标签颜色
axisLine: { },
lineStyle: { //设置坐标轴字体颜色和宽度
color: "#000", axisLine: {
}, lineStyle: {
color: "#000",
}, },
splitLine: {//分割线配置 },
show:true, splitLine: {
lineStyle: { //分割线配置
color: '#999', show: true,
} lineStyle: {
} color: "#999",
},
},
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :15, fontSize: 15,
color:'#000000' color: "#000000",
},
color: "#000" //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 color: "#000", //刻度线标签颜色
axisLine: { },
lineStyle: { //设置坐标轴字体颜色和宽度
color: "#000", axisLine: {
} lineStyle: {
} color: "#000",
},
},
}, },
series: [{ series: [
{
data: datayuey, data: datayuey,
type: 'line', type: "line",
markPoint: { markPoint: {
symbolSize:[65, 65], symbolSize: [65, 65],
data: this.tiaoshiPao data: this.tiaoshiPao,
},
clickable: false,
}, },
clickable:false, ],
}]
}; };
this.headZx.getZr().on('click', (params) => { this.headZx.getZr().on("click", (params) => {
// console.log(params.name) // console.log(params.name)
/* this.echartsData.statefulInspectionName =params.name+headtext; /* this.echartsData.statefulInspectionName =params.name+headtext;
this.router.navigateByUrl(`/statisticanalysis/delete_one/delete_there`); */ this.router.navigateByUrl(`/statisticanalysis/delete_one/delete_there`); */
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (this.headZx.containPixel('grid',pointInPixel)) { if (this.headZx.containPixel("grid", pointInPixel)) {
let xIndex=this.headZx.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = this.headZx.convertFromPixel({ seriesIndex: 0 }, [
if(this.options.xAxis.data[xIndex]=='2019'||this.options.xAxis.data[xIndex]=='2020'){ params.offsetX,
this.router.navigate(['/statisticanalysis/delete_thereLineDetails'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}}); params.offsetY,
])[0];
if (
this.options.xAxis.data[xIndex] == "2019" ||
this.options.xAxis.data[xIndex] == "2020"
) {
this.router.navigate(["/statisticanalysis/delete_thereLineDetails"], {
queryParams: {
level: this.options.xAxis.data[xIndex],
headtext: headtext,
},
});
//this.router.navigate(['/statisticanalysis/delete_two_newadd'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}}); //this.router.navigate(['/statisticanalysis/delete_two_newadd'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}});
}else{ } else {
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
//this.router.navigate(['/statisticanalysis/delete_one/delete_there'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}}); //this.router.navigate(['/statisticanalysis/delete_one/delete_there'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}});
if(this.echartsData.dezhiorBuinding=="zhi"){ if (this.echartsData.dezhiorBuinding == "zhi") {
if(this.echartsData.level=='0'){ if (this.echartsData.level == "0") {
this.router.navigate(['/statisticanalysis/delete_one/delete_there'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}}); this.router.navigate(
}else if(this.echartsData.level=='1'){ ["/statisticanalysis/delete_one/delete_there"],
this.router.navigate(['/statisticanalysis/delete_one/delete_four'],{queryParams:{'level':this.options.xAxis.data[xIndex]+headtext}}); {
queryParams: {
level: this.options.xAxis.data[xIndex],
headtext: headtext,
},
}
);
} else if (this.echartsData.level == "1") {
this.router.navigate(
["/statisticanalysis/delete_one/delete_four"],
{
queryParams: {
level: this.options.xAxis.data[xIndex] + headtext,
},
}
);
} }
} else {
}else{ this.router.navigate(["/statisticanalysis/delete_two_newadd"], {
this.router.navigate(['/statisticanalysis/delete_two_newadd'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}}); queryParams: {
level: this.options.xAxis.data[xIndex],
headtext: headtext,
},
});
} }
} }
} }
}); });
this.headZx.setOption(this.options); this.headZx.setOption(this.options);
} }
/** /**
* @name: * @name:
* @test: test font * @test: test font
* @msg: * @msg:
* @param {string()} * @param {string()}
* @return {type} * @return {type}
*/ */
biaogeTishi(biaotou:string){ biaogeTishi(biaotou: string) {
var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},' var shuju =
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' '[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},';
shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},' shuju +=
shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},' '{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},' shuju +=
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' '{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},';
shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},' shuju +=
shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]' '{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},';
var jsonObj = JSON.parse(shuju); shuju +=
var 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:#000000;font-size:30px;text-align: center;display:block;">'+biaotou+'</span></div>' '{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},';
res+='</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >'; shuju +=
res+='<thead><tr>'; '{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>'; shuju +=
res+='<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>' '{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>' shuju +=
res+='</tr></thead>' '{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]';
res+='<tbody>'; var jsonObj = JSON.parse(shuju);
for(var i=0;i<jsonObj.length;i++){ var res =
res+='<tr>' '<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#000000;font-size:30px;text-align: center;display:block;">' +
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].name+'</td>' biaotou +
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].number+'</td>' "</span></div>";
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].zhanbi+'</td></tr>' res +=
} '</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >';
res += "<thead><tr>";
res+='</tbody>' res +=
res+='<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>' '<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>';
res+='</table></div></div>' res +=
return res '<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>';
res +=
'<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>';
res += "</tr></thead>";
res += "<tbody>";
for (var i = 0; i < jsonObj.length; i++) {
res += "<tr>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].name +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].number +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].zhanbi +
"</td></tr>";
}
res += "</tbody>";
res +=
'<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>';
res += "</table></div></div>";
return res;
} }
} }

7
src/app/statistic-analysis/home/home.component.ts

@ -102,12 +102,7 @@ export class HomeComponent implements OnInit {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
/* this.planState.clear()
this.planState.dispose()
this.chartDwsjcj.clear()
this.chartDwsjcj.dispose()
this.chartZdgzqy.clear()
this.chartZdgzqy.dispose() */
} }
//初始化地图 //初始化地图

513
src/app/statistic-analysis/real-monitoring/real-monitoring.component.ts

@ -1,39 +1,47 @@
/* /*
* @Descripttion: * @Descripttion:
* @version: * @version:
* @Author: sueRimn * @Author: sueRimn
* @Date: 2021-05-08 09:42:43 * @Date: 2021-05-08 09:42:43
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2021-05-19 14:46:30 * @LastEditTime: 2021-05-19 14:46:30
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from "@angular/router";
//import {Foimport { FormGroup, FormControl } from '@angular/forms'; //import {Foimport { FormGroup, FormControl } from '@angular/forms';
import { EchartsDataService } from '../echarts-data.service'; import { EchartsDataService } from "../echarts-data.service";
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
} from "@angular/material/core";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-real-monitoring', selector: "app-real-monitoring",
templateUrl: './real-monitoring.component.html', templateUrl: "./real-monitoring.component.html",
styleUrls: ['./real-monitoring.component.scss'], styleUrls: ["./real-monitoring.component.scss"],
}) })
export class RealMonitoringComponent implements OnInit { export class RealMonitoringComponent implements OnInit {
/* campaignOne: FormGroup; /* campaignOne: FormGroup;
campaignTwo: FormGroup; */ campaignTwo: FormGroup; */
constructor(private router: Router, public EchartsData: EchartsDataService, private route: ActivatedRoute, public snackBar: MatSnackBar) { } constructor(
private router: Router,
public EchartsData: EchartsDataService,
private route: ActivatedRoute,
public snackBar: MatSnackBar
) {}
addtime = String(new Date().getFullYear()) + '-01'//添加时间 addtime = String(new Date().getFullYear()) + "-01"; //添加时间
endtime = String(new Date().getFullYear()) + '-0' + String(new Date().getMonth() + 1) endtime =
String(new Date().getFullYear()) + "-0" + String(new Date().getMonth() + 1);
/* addtime=String(new Date().getFullYear()+new Date().getMonth()) /* addtime=String(new Date().getFullYear()+new Date().getMonth())
endtime=String(new Date().getFullYear()+new Date().getMonth()) */ endtime=String(new Date().getFullYear()+new Date().getMonth()) */
ngOnInit(): void { ngOnInit(): void {
window.setTimeout(() => { window.setTimeout(() => {
this.getechartsdata(true) this.getechartsdata(true);
}, 0) }, 0);
} }
//获取echarts数据 //获取echarts数据
async getechartsdata(chushi: boolean) { async getechartsdata(chushi: boolean) {
@ -60,162 +68,178 @@ export class RealMonitoringComponent implements OnInit {
}); });
} */ } */
for (var i = Number(this.addtime.split('-')[0]); i <= Number(this.endtime.split('-')[0]); i++) { for (
var i = Number(this.addtime.split("-")[0]);
i <= Number(this.endtime.split("-")[0]);
i++
) {
let paramdataleft = { let paramdataleft = {
objectType: 3, objectType: 3,
TrendYear: i TrendYear: i,
} };
//获取左侧柱状图的数据 //获取左侧柱状图的数据
await this.EchartsData.getData(paramdataleft, '/api/StatisticsAnalysis/Trends') await this.EchartsData.getData(
this.leftzhuTable = JSON.parse(JSON.stringify(this.EchartsData.allDate)) paramdataleft,
"/api/StatisticsAnalysis/Trends"
);
this.leftzhuTable = JSON.parse(JSON.stringify(this.EchartsData.allDate));
//console.log(this.leftzhuTable) //console.log(this.leftzhuTable)
this.leftzhuTable[0].forEach((value, index, array) => { this.leftzhuTable[0].forEach((value, index, array) => {
if (this.addtime.split('-')[0] != this.endtime.split('-')[0]) { if (this.addtime.split("-")[0] != this.endtime.split("-")[0]) {
if ((array[index].year == Number(this.addtime.split('-')[0]) && array[index].month >= Number(this.addtime.split('-')[1])) || (array[index].year == Number(this.endtime.split('-')[0]) && array[index].month <= Number(this.endtime.split('-')[1]))) { if (
this.dateNum.push(array[index].count) (array[index].year == Number(this.addtime.split("-")[0]) &&
this.dateyue.push(array[index].year + '-' + array[index].month) array[index].month >= Number(this.addtime.split("-")[1])) ||
(array[index].year == Number(this.endtime.split("-")[0]) &&
array[index].month <= Number(this.endtime.split("-")[1]))
) {
this.dateNum.push(array[index].count);
this.dateyue.push(array[index].year + "-" + array[index].month);
} }
} else { } else {
if (array[index].month >= this.addtime.split('-')[1] && array[index].month <= this.endtime.split('-')[1]) { if (
this.dateNum.push(array[index].count) array[index].month >= this.addtime.split("-")[1] &&
this.dateyue.push(array[index].year + '-' + array[index].month) array[index].month <= this.endtime.split("-")[1]
) {
this.dateNum.push(array[index].count);
this.dateyue.push(array[index].year + "-" + array[index].month);
} }
} }
}); });
} }
//获取底端柱状图数据 //获取底端柱状图数据
let paramBottom = { let paramBottom = {
TimeIntervalStart: this.addtime == '0' ? '' : this.endtime, TimeIntervalStart: this.addtime == "0" ? "" : this.endtime,
TimeIntervalEnd: this.endtime == '0' ? '' : this.endtime TimeIntervalEnd: this.endtime == "0" ? "" : this.endtime,
} };
if (chushi) { if (chushi) {
await this.EchartsData.getData(paramBottom, '/api/StatisticsAnalysis/Plans/AuditApproved/Organizations') await this.EchartsData.getData(
this.bottomTable = JSON.parse(JSON.stringify(this.EchartsData.allDate)) paramBottom,
this.addNum = this.bottomTable[0].totalCount "/api/StatisticsAnalysis/Plans/AuditApproved/Organizations"
);
this.bottomTable = JSON.parse(JSON.stringify(this.EchartsData.allDate));
this.addNum = this.bottomTable[0].totalCount;
this.bottomTable[0].organizations.forEach((value, index, array) => { this.bottomTable[0].organizations.forEach((value, index, array) => {
this.zhiNameData.push(array[index].organizationName) this.zhiNameData.push(array[index].organizationName);
this.zhiNumData.push(array[index].count) this.zhiNumData.push(array[index].count);
if (index > 0 && index < 4) { if (index > 0 && index < 4) {
this.addyuan.push(array[index].organizationName) this.addyuan.push(array[index].organizationName);
} }
}); });
this.bottomzhutu() this.bottomzhutu();
} }
//右侧饼状图数据 //右侧饼状图数据
let param = { let param = {
TimeIntervalStart: this.addtime == '0' ? '' : this.addtime, TimeIntervalStart: this.addtime == "0" ? "" : this.addtime,
TimeIntervalEnd: this.endtime == '0' ? '' : this.endtime TimeIntervalEnd: this.endtime == "0" ? "" : this.endtime,
} };
await this.EchartsData.getData(param, '/api/StatisticsAnalysis/Plans/AuditApproved/PlanTypes') await this.EchartsData.getData(
this.rightbTable = JSON.parse(JSON.stringify(this.EchartsData.allDate)) param,
console.log(this.rightbTable) "/api/StatisticsAnalysis/Plans/AuditApproved/PlanTypes"
this.rightbTable[0].planTypeStatistics.planTypes.forEach((value,index,array) => { );
if(array[index].planTypeName=='Plan2D'){ this.rightbTable = JSON.parse(JSON.stringify(this.EchartsData.allDate));
this.indexData.push({name:'二维预案',value:array[index].count}) console.log(this.rightbTable);
}else if(array[index].planTypeName=='Plan3D'){ this.rightbTable[0].planTypeStatistics.planTypes.forEach(
//array[index].planTypeName=='三维预案' (value, index, array) => {
this.indexData.push({name:'三维预案',value:array[index].count}) if (array[index].planTypeName == "Plan2D") {
}else if(array[index].planTypeName=='Other'){ this.indexData.push({ name: "二维预案", value: array[index].count });
//array[index].planTypeName=='其他预案' } else if (array[index].planTypeName == "Plan3D") {
this.indexData.push({name:'其他预案',value:array[index].count}) //array[index].planTypeName=='三维预案'
}else if(array[index].planTypeName=='PlanText'){ this.indexData.push({ name: "三维预案", value: array[index].count });
//array[index].planTypeName=='文本预案' } else if (array[index].planTypeName == "Other") {
this.indexData.push({name:'文本预案',value:array[index].count}) //array[index].planTypeName=='其他预案'
this.indexData.push({ name: "其他预案", value: array[index].count });
} else if (array[index].planTypeName == "PlanText") {
//array[index].planTypeName=='文本预案'
this.indexData.push({ name: "文本预案", value: array[index].count });
}
} }
}); );
console.log(this.indexData) console.log(this.indexData);
this.leftzhuzhuangtu() this.leftzhuzhuangtu();
this.rightbingtu() this.rightbingtu();
} }
//查询按钮 //查询按钮
findClick() { findClick() {
console.log(this.addtime, this.endtime) console.log(this.addtime, this.endtime);
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
if (this.addtime == '0' || this.endtime == '0') { if (this.addtime == "0" || this.endtime == "0") {
this.snackBar.open('结束时间或者开始时间不能为空!', '确定', config); this.snackBar.open("结束时间或者开始时间不能为空!", "确定", config);
} else { } else {
if (this.endtime < this.addtime) { if (this.endtime < this.addtime) {
this.snackBar.open('结束时间不能大于开始时间!', '确定', config); this.snackBar.open("结束时间不能大于开始时间!", "确定", config);
} else { } else {
this.leftzhutu.clear() if (this.leftzhutu) {
this.leftzhutu.dispose() this.leftzhutu.clear();
this.dateyue = [] this.leftzhutu.dispose();
this.dateNum = [] }
this.dateyue = [];
this.dateNum = [];
//this.zhiNameData = [] //this.zhiNameData = []
//this.zhiNumData = [] //this.zhiNumData = []
//this.addyuan = [] //this.addyuan = []
this.getechartsdata(false) this.getechartsdata(false);
} }
} }
} }
addNum = 0//新增预案个数 addNum = 0; //新增预案个数
addyuan = [] addyuan = [];
leftzhuTable//左侧柱状图数据 leftzhuTable; //左侧柱状图数据
rightbTable//右侧饼图数据 rightbTable; //右侧饼图数据
bottomTable//最低端柱状图数据 bottomTable; //最低端柱状图数据
leftzhutu leftzhutu;
optionLeftzhu//中间左侧柱状图实例 optionLeftzhu; //中间左侧柱状图实例
dateyue = [] dateyue = [];
dateNum = [] dateNum = [];
zhiNameData = [] zhiNameData = [];
zhiNumData = [] zhiNumData = [];
rightbing rightbing;
optionRightbing//中间右侧柱状图 optionRightbing; //中间右侧柱状图
bottomzhu//底部柱状图实例 bottomzhu; //底部柱状图实例
bottomZhuoption bottomZhuoption;
tiaoshiPao: any tiaoshiPao: any;
//中间左侧柱状图 //中间左侧柱状图
async leftzhuzhuangtu() { async leftzhuzhuangtu() {
var ec = echarts as any; var ec = echarts as any;
this.leftzhutu = ec.init(document.getElementById(`leftecharts`), 'walden'); this.leftzhutu = ec.init(document.getElementById(`leftecharts`), "walden");
this.optionLeftzhu = { this.optionLeftzhu = {
grid: { grid: {
//top: 10, //top: 10,
containLabel: true, containLabel: true,
bottom: 10, bottom: 10,
left: 50 left: 50,
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
axisPointer: { axisPointer: {
type: 'none' type: "none",
} },
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.dateyue, data: this.dateyue,
//axisLabel: this.axisLabel, //axisLabel: this.axisLabel,
axisLabel:{ axisLabel: {
//this.axisLabel, //this.axisLabel,
textStyle:{ textStyle: {
fontSize :14, fontSize: 14,
color:'#000000' color: "#000000",
} },
},
}
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel:{ axisLabel: {
textStyle:{ textStyle: {
fontSize :14, fontSize: 14,
color:'#000000' color: "#000000",
} },
},
}
}, },
/* tooltip: { /* tooltip: {
trigger: 'item', trigger: 'item',
@ -226,24 +250,30 @@ export class RealMonitoringComponent implements OnInit {
}, */ }, */
dataZoom: [ dataZoom: [
{ {
type: 'slider', type: "slider",
bottom:2 bottom: 2,
}
],
series: [{
name: '数量',
data: this.dateNum,
type: 'bar',
markPoint: {
symbolSize: [65, 65],
data: this.EchartsData.qipao(this.tiaoshiPao, this.dateNum, this.dateyue)
}, },
backgroundStyle: { ],
color: 'rgba(220, 220, 220, 0.8)' series: [
{
name: "数量",
data: this.dateNum,
type: "bar",
markPoint: {
symbolSize: [65, 65],
data: this.EchartsData.qipao(
this.tiaoshiPao,
this.dateNum,
this.dateyue
),
},
backgroundStyle: {
color: "rgba(220, 220, 220, 0.8)",
},
barWidth: "38",
//label: this.topTextlabel
}, },
barWidth: '38', ],
//label: this.topTextlabel
}]
}; };
this.leftzhutu.setOption(this.optionLeftzhu); this.leftzhutu.setOption(this.optionLeftzhu);
/* this.leftzhutu.getZr().on('click', async (params)=>{ /* this.leftzhutu.getZr().on('click', async (params)=>{
@ -282,14 +312,15 @@ export class RealMonitoringComponent implements OnInit {
}); */ }); */
} }
//中间右侧饼图 //中间右侧饼图
indexData = []//所有数据 indexData = []; //所有数据
lengthdata = ['二维预案', '三维预案', '文本预案', '其他预案'] lengthdata = ["二维预案", "三维预案", "文本预案", "其他预案"];
rightbingtu() { rightbingtu() {
this.rightbing = echarts.init(document.getElementById('rightecharts'), 'walden'); this.rightbing = echarts.init(
document.getElementById("rightecharts"),
"walden"
);
this.optionRightbing = { this.optionRightbing = {
/* title: { /* title: {
text: `建筑类型统计(${this.count}家)`, text: `建筑类型统计(${this.count}家)`,
@ -308,39 +339,39 @@ export class RealMonitoringComponent implements OnInit {
} }
}, */ }, */
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
axisPointer: { axisPointer: {
type: 'shadow' type: "shadow",
} },
}, },
legend: { legend: {
orient: 'vertical', orient: "vertical",
//left:this.padHw?50:0, //left:this.padHw?50:0,
//right:this.padHw?20:250, //right:this.padHw?20:250,
top: 20, top: 20,
right: 30, right: 30,
textStyle: { textStyle: {
fontSize: 16, fontSize: 16,
color: "#000000" color: "#000000",
}, },
data: this.lengthdata data: this.lengthdata,
}, },
series: [ series: [
{ {
top: '0', top: "0",
name: '预案类型', name: "预案类型",
type: 'pie', type: "pie",
radius: '60%', radius: "60%",
center: ['50%', '53%'], center: ["50%", "53%"],
label: { label: {
show: true, show: true,
fontSize: 16, fontSize: 16,
formatter: '{b}{c}家\n{d|({d}%)}', formatter: "{b}{c}家\n{d|({d}%)}",
rich: { rich: {
d: { d: {
align: 'center', align: "center",
fontSize: 18 fontSize: 18,
} },
}, },
}, },
/* data: [ /* data: [
@ -349,110 +380,116 @@ export class RealMonitoringComponent implements OnInit {
{ value: this.rightbTable[0].planTypeStatistics.planTypes[2] != undefined ? this.rightbTable[0].planTypeStatistics.planTypes[2].count : 0, name: '其他预案' }, { value: this.rightbTable[0].planTypeStatistics.planTypes[2] != undefined ? this.rightbTable[0].planTypeStatistics.planTypes[2].count : 0, name: '其他预案' },
{ value: this.rightbTable[0].planTypeStatistics.planTypes[3] != undefined ? this.rightbTable[0].planTypeStatistics.planTypes[3].count : 0, name: '文本预案' } { value: this.rightbTable[0].planTypeStatistics.planTypes[3] != undefined ? this.rightbTable[0].planTypeStatistics.planTypes[3].count : 0, name: '文本预案' }
], */ ], */
data:this.indexData, data: this.indexData,
emphasis: { emphasis: {
itemStyle: { itemStyle: {
shadowBlur: 10, shadowBlur: 10,
shadowOffsetX: 0, shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)' shadowColor: "rgba(0, 0, 0, 0.5)",
} },
} },
} },
] ],
}; };
this.rightbing.setOption(this.optionRightbing) this.rightbing.setOption(this.optionRightbing);
} }
//最底部柱状图 //最底部柱状图
bottomzhutu() { bottomzhutu() {
var ec = echarts as any; var ec = echarts as any;
this.bottomzhu = ec.init(document.getElementById(`bottomEcharts`), 'walden'); this.bottomzhu = ec.init(
document.getElementById(`bottomEcharts`),
"walden"
);
this.bottomZhuoption = { this.bottomZhuoption = {
grid: { grid: {
//top: 10, //top: 10,
containLabel:true, containLabel: true,
bottom:2, bottom: 2,
left:50 left: 50,
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
axisPointer: { axisPointer: {
type: 'none' type: "none",
} },
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.zhiNameData, data: this.zhiNameData,
//axisLabel: this.axisLabel, //axisLabel: this.axisLabel,
axisLabel:{ axisLabel: {
//this.axisLabel, //this.axisLabel,
textStyle:{ textStyle: {
fontSize :14, fontSize: 14,
color:'#000000' color: "#000000",
}, },
interval: 0, interval: 0,
//rotate:38 //rotate:38
formatter:function(value){ formatter: function (value) {
var ret = "";//拼接加\n返回的类目项 var ret = ""; //拼接加\n返回的类目项
var maxLength = 3;//每项显示文字个数 var maxLength = 3; //每项显示文字个数
var valLength = value.length;//X轴类目项的文字个数 var valLength = value.length; //X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1) { //如果类目项的文字大于3, if (rowN > 1) {
for (var i = 0; i < rowN; i++) { //如果类目项的文字大于3,
var temp = "";//每次截取的字符串 for (var i = 0; i < rowN; i++) {
var start = i * maxLength;//开始截取的位置 var temp = ""; //每次截取的字符串
var end = start + maxLength;//结束截取的位置 var start = i * maxLength; //开始截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 var end = start + maxLength; //结束截取的位置
temp = value.substring(start, end) + "\n"; //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
ret += temp; temp = value.substring(start, end) + "\n";
} //凭借最终的字符串 ret += temp;
return ret; } //凭借最终的字符串
}else { return ret;
return value; } else {
} return value;
} //function }
} }, //function
},
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel:{ axisLabel: {
textStyle:{ textStyle: {
fontSize :14, fontSize: 14,
color:'#000000' color: "#000000",
} },
},
}
}, },
dataZoom: [ dataZoom: [
{ {
type: 'slider', type: "slider",
bottom:90, bottom: 90,
//backgroundColor:'rgba(47,69,84,-0.2)', //backgroundColor:'rgba(47,69,84,-0.2)',
dataBackground:{ dataBackground: {
areaStyle:{ areaStyle: {
opacity:0 opacity: 0,
} },
} },
}
],
series: [{
name: '数量',
data: this.zhiNumData,
type: 'bar',
markPoint: {
symbolSize: [65, 65],
data: this.EchartsData.qipao(this.tiaoshiPao, this.zhiNumData, this.zhiNameData)
}, },
],
barWidth :'38', series: [
{
name: "数量",
data: this.zhiNumData,
type: "bar",
markPoint: {
symbolSize: [65, 65],
data: this.EchartsData.qipao(
this.tiaoshiPao,
this.zhiNumData,
this.zhiNameData
),
},
barWidth: "38",
//label: this.topTextlabel //label: this.topTextlabel
}] },
}; ],
this.bottomzhu.setOption(this.bottomZhuoption); };
/* this.bottomzhu.getZr().on('click',(params)=>{ this.bottomzhu.setOption(this.bottomZhuoption);
/* this.bottomzhu.getZr().on('click',(params)=>{
console.log(params) console.log(params)
}) */ }) */
}
} }
}

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

File diff suppressed because it is too large Load Diff

699
src/app/statistic-analysis/state/page-one/page-one.component.ts

@ -1,310 +1,543 @@
/* /*
* @Descripttion: * @Descripttion:
* @version: * @version:
* @Author: sueRimn * @Author: sueRimn
* @Date: 2020-09-01 15:24:39 * @Date: 2020-09-01 15:24:39
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2021-07-21 08:54:04 * @LastEditTime: 2021-07-21 08:54:04
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import {EchartsDataService,} from '../../echarts-data.service' import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
declare var CryptoJS declare var CryptoJS;
@Component({ @Component({
selector: 'app-page-one', selector: "app-page-one",
templateUrl: './page-one.component.html', templateUrl: "./page-one.component.html",
styleUrls: ['./page-one.component.scss'] styleUrls: ["./page-one.component.scss"],
}) })
export class PageOneComponent implements OnInit { export class PageOneComponent implements OnInit {
options:any; options: any;
constructor(private router: Router,public echartsData:EchartsDataService) { }
padHw constructor(private router: Router, public echartsData: EchartsDataService) {}
orid
padHw;
orid;
ngOnInit() { ngOnInit() {
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.padHw=true this.padHw = true;
//this.padjt= //this.padjt=
}else{ } else {
this.padHw=false this.padHw = false;
} }
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
window.setTimeout(()=>{ window.setTimeout(() => {
this.getechartsdata() this.getechartsdata();
}) });
let jwt = sessionStorage.getItem("token"); let jwt = sessionStorage.getItem("token");
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); let rawJwt = CryptoJS.enc.Base64.parse(jwt.split(".")[1]);
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
let identityJsonparse=JSON.parse(identityJson) let identityJsonparse = JSON.parse(identityJson);
this.orid=identityJsonparse.oid this.orid = identityJsonparse.oid;
//console.log(identityJsonparse) //console.log(identityJsonparse)
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.indexBzt.clear() if (!this.indexBzt) {
this.indexBzt.dispose() return;
}
this.indexBzt.clear();
this.indexBzt.dispose();
} }
async getechartsdata(){ async getechartsdata() {
await this.echartsData.getData(null,`/api/StatisticsAnalysis/Plans`) await this.echartsData.getData(null, `/api/StatisticsAnalysis/Plans`);
this.initCharts("pieone") this.initCharts("pieone");
this.initCharts("pietwo") this.initCharts("pietwo");
} }
//级别和类型转换 //级别和类型转换
pieonetype=true//级别 pieonetype = true; //级别
clickhuan(){ clickhuan() {
this.pieonetype=!this.pieonetype this.pieonetype = !this.pieonetype;
this.initCharts("pieone") this.initCharts("pieone");
} }
/* 首页饼状图 */ /* 首页饼状图 */
indexBzt indexBzt;
tabledata tabledata;
count count;
indexData indexData;
planCategoriesData=[]//预案级别 planCategoriesData = []; //预案级别
planStatusesData=[]//预案状态 planStatusesData = []; //预案状态
planTypeStatisticsdata=[]//预案类型 planTypeStatisticsdata = []; //预案类型
initCharts(tid){ initCharts(tid) {
this.planTypeStatisticsdata=[] this.planTypeStatisticsdata = [];
this.planCategoriesData=[] this.planCategoriesData = [];
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
if(tid=='pieone') if (tid == "pieone") {
{ if (this.pieonetype) {
if(this.pieonetype){ this.tabledata[0].planCategoryStatistics.planCategories.forEach(
this.tabledata[0].planCategoryStatistics.planCategories.forEach((value,index,array) => { (value, index, array) => {
if(array[index].planCategoryName=='LevelOne'){ if (array[index].planCategoryName == "LevelOne") {
this.planCategoriesData.push({name:'Ⅰ级预案',value:array[index].count,planStatusName:array[index].planCategoryName,type:1}) this.planCategoriesData.push({
}else if(array[index].planCategoryName=='LevelTwo'){ name: "Ⅰ级预案",
this.planCategoriesData.push({name:'Ⅱ级预案',value:array[index].count,planStatusName:array[index].planCategoryName,type:2}) value: array[index].count,
}else if(array[index].planCategoryName=='LevelThree'){ planStatusName: array[index].planCategoryName,
this.planCategoriesData.push({name:'Ⅲ级预案',value:array[index].count,planStatusName:array[index].planCategoryName,type:3}) type: 1,
}else if(array[index].planCategoryName=='LevelFour'){ });
this.planCategoriesData.push({name:'Ⅳ级预案',value:array[index].count,planStatusName:array[index].planCategoryName,type:4}) } else if (array[index].planCategoryName == "LevelTwo") {
}else if(array[index].planCategoryName=='LevelFive'){ this.planCategoriesData.push({
this.planCategoriesData.push({name:'Ⅴ级预案',value:array[index].count,planStatusName:array[index].planCategoryName,type:5}) name: "Ⅱ级预案",
value: array[index].count,
planStatusName: array[index].planCategoryName,
type: 2,
});
} else if (array[index].planCategoryName == "LevelThree") {
this.planCategoriesData.push({
name: "Ⅲ级预案",
value: array[index].count,
planStatusName: array[index].planCategoryName,
type: 3,
});
} else if (array[index].planCategoryName == "LevelFour") {
this.planCategoriesData.push({
name: "Ⅳ级预案",
value: array[index].count,
planStatusName: array[index].planCategoryName,
type: 4,
});
} else if (array[index].planCategoryName == "LevelFive") {
this.planCategoriesData.push({
name: "Ⅴ级预案",
value: array[index].count,
planStatusName: array[index].planCategoryName,
type: 5,
});
}
} }
}); );
}else{ } else {
this.tabledata[0].planTypeStatistics.planTypes.forEach((value,index,array) => { this.tabledata[0].planTypeStatistics.planTypes.forEach(
if(array[index].planTypeName=='Plan2D'){ (value, index, array) => {
this.planTypeStatisticsdata.push({name:'二维预案',value:array[index].count,planStatusName:array[index].planTypeName,type:1}) if (array[index].planTypeName == "Plan2D") {
}else if(array[index].planTypeName=='Plan3D'){ this.planTypeStatisticsdata.push({
this.planTypeStatisticsdata.push({name:'三维预案',value:array[index].count,planStatusName:array[index].planTypeName,type:2}) name: "二维预案",
}else if(array[index].planTypeName=='Other'){ value: array[index].count,
this.planTypeStatisticsdata.push({name:'其它预案',value:array[index].count,planStatusName:array[index].planTypeName,type:3}) planStatusName: array[index].planTypeName,
}else if(array[index].planTypeName=='PlanText'){ type: 1,
this.planTypeStatisticsdata.push({name:'文本预案',value:array[index].count,planStatusName:array[index].planTypeName,type:4}) });
} else if (array[index].planTypeName == "Plan3D") {
this.planTypeStatisticsdata.push({
name: "三维预案",
value: array[index].count,
planStatusName: array[index].planTypeName,
type: 2,
});
} else if (array[index].planTypeName == "Other") {
this.planTypeStatisticsdata.push({
name: "其它预案",
value: array[index].count,
planStatusName: array[index].planTypeName,
type: 3,
});
} else if (array[index].planTypeName == "PlanText") {
this.planTypeStatisticsdata.push({
name: "文本预案",
value: array[index].count,
planStatusName: array[index].planTypeName,
type: 4,
});
}
} }
}); );
} }
} else {
}else{ this.tabledata[0].planStatusStatistics.planStatuses.forEach(
this.tabledata[0].planStatusStatistics.planStatuses.forEach((value,index,array) => { (value, index, array) => {
if(array[index].planStatusName=='New'){ if (array[index].planStatusName == "New") {
this.planStatusesData.push({name:'预案新增',value:array[index].count,type:1,planStatusName:array[index].planStatusName}) this.planStatusesData.push({
}else if(array[index].planStatusName=='Auditing'){ name: "预案新增",
this.planStatusesData.push({name:'预案审核中',value:array[index].count,type:2,planStatusName:array[index].planStatusName}) value: array[index].count,
}else if(array[index].planStatusName=='Approved'){ type: 1,
this.planStatusesData.push({name:'预案审核通过',value:array[index].count,type:3,planStatusName:array[index].planStatusName}) planStatusName: array[index].planStatusName,
}else if(array[index].planStatusName=='Rejected'){ });
this.planStatusesData.push({name:'预案审核退回',value:array[index].count,type:4,planStatusName:array[index].planStatusName}) } else if (array[index].planStatusName == "Auditing") {
}else if(array[index].planStatusName=='Editing'){ this.planStatusesData.push({
this.planStatusesData.push({name:'预案编制',value:array[index].count,type:5,planStatusName:array[index].planStatusName}) name: "预案审核中",
value: array[index].count,
type: 2,
planStatusName: array[index].planStatusName,
});
} else if (array[index].planStatusName == "Approved") {
this.planStatusesData.push({
name: "预案审核通过",
value: array[index].count,
type: 3,
planStatusName: array[index].planStatusName,
});
} else if (array[index].planStatusName == "Rejected") {
this.planStatusesData.push({
name: "预案审核退回",
value: array[index].count,
type: 4,
planStatusName: array[index].planStatusName,
});
} else if (array[index].planStatusName == "Editing") {
this.planStatusesData.push({
name: "预案编制",
value: array[index].count,
type: 5,
planStatusName: array[index].planStatusName,
});
}
} }
}); );
} }
var ec = echarts as any; var ec = echarts as any;
this.indexBzt = ec.init(document.getElementById(tid),'walden'); this.indexBzt = ec.init(document.getElementById(tid), "walden");
var options={ var options = {
title: { title: {
text:tid=='pieone'&&this.pieonetype?`预案级别统计(${this.tabledata[0].planCategoryStatistics.totalCount}份)` :tid=='pieone'&&!this.pieonetype?`预案类型统计(${this.tabledata[0].planTypeStatistics.totalCount}份)`:`预案状态统计(${this.tabledata[0].planStatusStatistics.totalCount}份)`, text:
top: "7%", tid == "pieone" && this.pieonetype
left: 'center', ? `预案级别统计(${this.tabledata[0].planCategoryStatistics.totalCount}份)`
textStyle:{ : tid == "pieone" && !this.pieonetype
fontSize:this.padHw?25: 31 ? `预案类型统计(${this.tabledata[0].planTypeStatistics.totalCount}份)`
} : `预案状态统计(${this.tabledata[0].planStatusStatistics.totalCount}份)`,
top: "7%",
left: "center",
textStyle: {
fontSize: this.padHw ? 25 : 31,
},
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
this.echartsData.biaogeTishiyuan(params.data,tid,this.pieonetype) this.echartsData.biaogeTishiyuan(params.data, tid, this.pieonetype);
return this.echartsData.res return this.echartsData.res;
} },
}, },
legend: { legend: {
bottom: 50, bottom: 50,
left: 'center', left: "center",
//padding:20, //padding:20,
// itemWidth:60, // itemWidth:60,
// itemHeight:25, // itemHeight:25,
textStyle:{ textStyle: {
fontSize:this.padHw?15: 18, fontSize: this.padHw ? 15 : 18,
color:"#000000" color: "#000000",
}, },
data:tid=='pieone'&&this.pieonetype?['Ⅰ级预案', 'Ⅱ级预案', 'Ⅲ级预案', 'Ⅳ级预案', 'Ⅴ级预案']:tid=='pieone'&&!this.pieonetype?['二维预案', '三维预案', '其它预案', '文本预案'] :['预案新增', '预案审核通过', '预案编制', '预案审核退回', '预案审核中'] data:
tid == "pieone" && this.pieonetype
? ["Ⅰ级预案", "Ⅱ级预案", "Ⅲ级预案", "Ⅳ级预案", "Ⅴ级预案"]
: tid == "pieone" && !this.pieonetype
? ["二维预案", "三维预案", "其它预案", "文本预案"]
: [
"预案新增",
"预案审核通过",
"预案编制",
"预案审核退回",
"预案审核中",
],
}, },
series: [ series: [
{ {
name: '访问来源', name: "访问来源",
type: 'pie', type: "pie",
radius: '50%', radius: "50%",
center: ['50%', '45%'], center: ["50%", "45%"],
label:{ label: {
normal:{ normal: {
show:true, show: true,
// position: 'inner', // position: 'inner',
fontSize:this.padHw?14: 18, fontSize: this.padHw ? 14 : 18,
formatter:this.padHw?'{b} \n{c}份({d}%)' :'{b} {c}份\n({d}%)', formatter: this.padHw ? "{b} \n{c}份({d}%)" : "{b} {c}份\n({d}%)",
}, },
rich: { rich: {
d: { d: {
align: 'center', align: "center",
}
},
}, },
data:tid=='pieone'&&this.pieonetype?this.planCategoriesData:tid=='pieone'&&!this.pieonetype?this.planTypeStatisticsdata:this.planStatusesData, },
emphasis: { },
itemStyle: { data:
shadowBlur: 10, tid == "pieone" && this.pieonetype
shadowOffsetX: 0, ? this.planCategoriesData
shadowColor: 'rgba(0, 0, 0, 0.5)' : tid == "pieone" && !this.pieonetype
} ? this.planTypeStatisticsdata
} : this.planStatusesData,
} emphasis: {
] itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
}; };
this.indexBzt.on('click', (params) => { this.indexBzt.on("click", (params) => {
// console.log(params) // console.log(params)
if(tid=='pieone'){ if (tid == "pieone") {
if(this.pieonetype){ if (this.pieonetype) {
for(var i=0;i<this.tabledata[0].planCategoryStatistics.planCategories.length;i++){ for (
if(this.tabledata[0].planCategoryStatistics.planCategories[i].planCategoryName==params.data.planStatusName){ var i = 0;
if((this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2')&&this.tabledata[0].planCategoryStatistics.planCategories[i].organizations.length>0){ i < this.tabledata[0].planCategoryStatistics.planCategories.length;
this.tabledata[0].planCategoryStatistics.planCategories[i].organizations.forEach((element,index,array) => { i++
if(array[index].organizationId==this.orid){ ) {
array.splice(index,1) if (
this.tabledata[0].planCategoryStatistics.planCategories[i]
.planCategoryName == params.data.planStatusName
) {
if (
(this.echartsData.level == "0" ||
this.echartsData.level == "1" ||
this.echartsData.level == "2") &&
this.tabledata[0].planCategoryStatistics.planCategories[i]
.organizations.length > 0
) {
this.tabledata[0].planCategoryStatistics.planCategories[
i
].organizations.forEach((element, index, array) => {
if (array[index].organizationId == this.orid) {
array.splice(index, 1);
} }
window.setTimeout(()=>{ window.setTimeout(() => {
if(array.length>0){ if (array.length > 0) {
this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'level':params.name,'type':params.data.type,'tid':'pieone','pieonetype':this.pieonetype}}); this.router.navigate(
} ["/statisticanalysis/statePageOne/time"],
else{ {
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'xname':params.name,'name':params.name,'id':null,'type':params.data.type,'tid':'pieone','pieonetype':this.pieonetype}}); queryParams: {
level: params.name,
type: params.data.type,
tid: "pieone",
pieonetype: this.pieonetype,
},
}
);
} else {
this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
xname: params.name,
name: params.name,
id: null,
type: params.data.type,
tid: "pieone",
pieonetype: this.pieonetype,
},
});
} }
}) });
}); });
} else if (this.echartsData.level == "3") {
}
else if(this.echartsData.level=='3'){
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'xname':params.name,'name':params.name,'id':null,'type':params.data.type,'tid':'pieone','pieonetype':this.pieonetype}}); this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
xname: params.name,
name: params.name,
id: null,
type: params.data.type,
tid: "pieone",
pieonetype: this.pieonetype,
},
});
} }
} }
} }
}else{ } else {
for(var i=0;i<this.tabledata[0].planTypeStatistics.planTypes.length;i++){ for (
if(this.tabledata[0].planTypeStatistics.planTypes[i].planTypeName==params.data.planStatusName){ var i = 0;
if((this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2')&&this.tabledata[0].planCategoryStatistics.planCategories[i].organizations.length>0){ i < this.tabledata[0].planTypeStatistics.planTypes.length;
this.tabledata[0].planTypeStatistics.planTypes[i].organizations.forEach((element,index,array) => { i++
if(array[index].organizationId==this.orid){ ) {
array.splice(index,1) if (
this.tabledata[0].planTypeStatistics.planTypes[i].planTypeName ==
params.data.planStatusName
) {
if (
(this.echartsData.level == "0" ||
this.echartsData.level == "1" ||
this.echartsData.level == "2") &&
this.tabledata[0].planCategoryStatistics.planCategories[i]
.organizations.length > 0
) {
this.tabledata[0].planTypeStatistics.planTypes[
i
].organizations.forEach((element, index, array) => {
if (array[index].organizationId == this.orid) {
array.splice(index, 1);
} }
window.setTimeout(()=>{ window.setTimeout(() => {
if(array.length>0){ if (array.length > 0) {
this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'level':params.name,'type':params.data.type,'tid':'pieone','pieonetype':this.pieonetype}}); this.router.navigate(
} ["/statisticanalysis/statePageOne/time"],
else{ {
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'xname':params.name,'name':params.name,'id':null,'type':params.data.type,'tid':'pieone','pieonetype':this.pieonetype}}); queryParams: {
level: params.name,
type: params.data.type,
tid: "pieone",
pieonetype: this.pieonetype,
},
}
);
} else {
this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
xname: params.name,
name: params.name,
id: null,
type: params.data.type,
tid: "pieone",
pieonetype: this.pieonetype,
},
});
} }
}) });
}); });
} else if (this.echartsData.level == "3") {
}
else if(this.echartsData.level=='3'){
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'xname':params.name,'name':params.name,'id':null,'type':params.data.type,'tid':'pieone','pieonetype':this.pieonetype}}); this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
xname: params.name,
name: params.name,
id: null,
type: params.data.type,
tid: "pieone",
pieonetype: this.pieonetype,
},
});
} }
} }
} }
} }
} else {
}else{ for (
for(var i=0;i<this.tabledata[0].planStatusStatistics.planStatuses.length;i++){ var i = 0;
if(this.tabledata[0].planStatusStatistics.planStatuses[i].planStatusName==params.data.planStatusName){ i < this.tabledata[0].planStatusStatistics.planStatuses.length;
if((this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2')&&this.tabledata[0].planStatusStatistics.planStatuses[i].organizations.length>0){ i++
this.tabledata[0].planStatusStatistics.planStatuses[i].organizations.forEach((element,index,array) => { ) {
if(array[index].organizationId==this.orid){ if (
array.splice(index,1) this.tabledata[0].planStatusStatistics.planStatuses[i]
.planStatusName == params.data.planStatusName
) {
if (
(this.echartsData.level == "0" ||
this.echartsData.level == "1" ||
this.echartsData.level == "2") &&
this.tabledata[0].planStatusStatistics.planStatuses[i]
.organizations.length > 0
) {
this.tabledata[0].planStatusStatistics.planStatuses[
i
].organizations.forEach((element, index, array) => {
if (array[index].organizationId == this.orid) {
array.splice(index, 1);
} }
window.setTimeout(()=>{ window.setTimeout(() => {
if(array.length>0){ if (array.length > 0) {
this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'level':params.name,'type':params.data.type,'tid':'pietwo'}}); this.router.navigate(
} ["/statisticanalysis/statePageOne/time"],
else{ {
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'xname':params.name,'name':params.name,'id':null,'type':params.data.type,'tid':'pietwo'}}); queryParams: {
level: params.name,
type: params.data.type,
tid: "pietwo",
},
}
);
} else {
this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
xname: params.name,
name: params.name,
id: null,
type: params.data.type,
tid: "pietwo",
},
});
} }
}) });
}); });
} else if (this.echartsData.level == "3") {
}
else if(this.echartsData.level=='3'){
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'xname':params.name,'name':params.name,'id':null,'type':params.data.type,'tid':'pietwo'}}); this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
xname: params.name,
name: params.name,
id: null,
type: params.data.type,
tid: "pietwo",
},
});
} }
} }
} }
} }
}); });
this.indexBzt.setOption(options); this.indexBzt.setOption(options);
} }
/** /**
* @name: * @name:
* @test: test font * @test: test font
* @msg: * @msg:
* @param {string()} * @param {string()}
* @return {type} * @return {type}
*/ */
biaogeTishi(biaotou:string){ biaogeTishi(biaotou: string) {
var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},' var shuju =
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' '[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},';
shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},' shuju +=
shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},' '{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},' shuju +=
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},' '{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},';
shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},' shuju +=
shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]' '{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},';
var jsonObj = JSON.parse(shuju); shuju +=
var 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:#000000;font-size:30px;text-align: center;display:block;">'+biaotou+'</span></div>' '{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},';
res+='</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >'; shuju +=
res+='<thead><tr>'; '{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>'; shuju +=
res+='<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>' '{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},';
res+='<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>' shuju +=
res+='</tr></thead>' '{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]';
res+='<tbody>'; var jsonObj = JSON.parse(shuju);
for(var i=0;i<jsonObj.length;i++){ var res =
res+='<tr>' '<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#000000;font-size:30px;text-align: center;display:block;">' +
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].name+'</td>' biaotou +
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].number+'</td>' "</span></div>";
res+='<td style="text-align:center;border:1px solid #000000">'+jsonObj[i].zhanbi+'</td></tr>' res +=
} '</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >';
res += "<thead><tr>";
res+='</tbody>' res +=
res+='<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>' '<td style="text-align:center;width:30%;border:1px solid #000000">名称</td>';
res+='</table></div></div>' res +=
return res '<td style="text-align:center;width:30%;border:1px solid #000000">数量</td>';
} res +=
'<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>';
res += "</tr></thead>";
res += "<tbody>";
for (var i = 0; i < jsonObj.length; i++) {
res += "<tr>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].name +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].number +
"</td>";
res +=
'<td style="text-align:center;border:1px solid #000000">' +
jsonObj[i].zhanbi +
"</td></tr>";
}
res += "</tbody>";
res +=
'<tfoot><td style="text-align:center;border:1px solid #000000">总计</td><td style="text-align:center;border:1px solid #000000">1356</td><td style="text-align:center;border:1px solid #000000">19%</td></tfoot>';
res += "</table></div></div>";
return res;
}
} }

394
src/app/statistic-analysis/state/page-there-year/page-there-year.component.ts

@ -1,160 +1,218 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import {
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; MatDialog,
import { ActivatedRoute } from '@angular/router'; MatDialogRef,
import { EchartsDataService } from '../../echarts-data.service'; MAT_DIALOG_DATA,
} from "@angular/material/dialog";
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import { ActivatedRoute } from "@angular/router";
import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-page-there-year', selector: "app-page-there-year",
templateUrl: './page-there-year.component.html', templateUrl: "./page-there-year.component.html",
styleUrls: ['./page-there-year.component.scss'] styleUrls: ["./page-there-year.component.scss"],
}) })
export class PageThereYearComponent implements OnInit { export class PageThereYearComponent 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) { } tid;
year: String;
tid buildingTypeName: String;
year:String level: String;
buildingTypeName:String setTimeoutObj; //延时器需要清除
level:String type;
setTimeoutObj//延时器需要清除 tabledata; //获取所有数据
type lastyears; //上个页面传过来的年份
tabledata//获取所有数据 count = 0; //总数
lastyears//上个页面传过来的年份 pieonetype; //判断是级别还是类型,上个页面传过来的参数
count=0//总数 planType; //预案类型
pieonetype//判断是级别还是类型,上个页面传过来的参数
planType//预案类型
ngOnInit(): void { ngOnInit(): void {
this.dateInit () this.dateInit();
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe((params) => {
this.year = params['level']; this.year = params["level"];
this.buildingTypeName = params['headtext']; this.buildingTypeName = params["headtext"];
this.type=params['type'] this.type = params["type"];
this.lastyears=params['headtext'].substring(0,4) this.lastyears = params["headtext"].substring(0, 4);
this.tid=params.tid this.tid = params.tid;
this.pieonetype=params.pieonetype this.pieonetype = params.pieonetype;
}); });
if(this.year=='二维预案'){ if (this.year == "二维预案") {
this.planType=1 this.planType = 1;
}else if(this.year=='三维预案'){ } else if (this.year == "三维预案") {
this.planType=2 this.planType = 2;
}else if(this.year=='其他预案'){ } else if (this.year == "其他预案") {
this.planType=4 this.planType = 4;
}else if(this.year=='文本预案'){ } else if (this.year == "文本预案") {
this.planType=16 this.planType = 16;
} }
this.setTimeoutObj = window.setTimeout(()=>{ this.setTimeoutObj = window.setTimeout(() => {
this.getechartsData() this.getechartsData();
}) });
} }
ngOnDestroy(){ ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
this.detailPlanEchart.clear() if (!this.detailPlanEchart) {
this.detailPlanEchart.dispose() return;
}
this.detailPlanEchart.clear();
this.detailPlanEchart.dispose();
} }
async getechartsData(){ async getechartsData() {
let paramdata={ let paramdata = {
planStatus:this.tid=='pieone'?'': this.type, planStatus: this.tid == "pieone" ? "" : this.type,
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', PlanCategory:
objectType:this.tid=='pieone'&&this.pieonetype=='true'?2:this.tid=='pieone'&&this.pieonetype=='false'?5: 1, this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
TrendYear:this.lastyears||'', objectType:
TrendType:0 this.tid == "pieone" && this.pieonetype == "true"
? 2
: this.tid == "pieone" && this.pieonetype == "false"
? 5
: 1,
TrendYear: this.lastyears || "",
TrendType: 0,
};
await this.serviceData.getData(paramdata, `/api/StatisticsAnalysis/Trends`);
this.tabledata = JSON.parse(JSON.stringify(this.serviceData.allDate));
// console.log(this.tabledata)
for (var i = 0; i < this.tabledata[0].length; i++) {
this.date.push(this.tabledata[0][i].month);
this.dateNum.push(this.tabledata[0][i].count);
this.count += this.tabledata[0][i].count;
} }
await this.serviceData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) this.date.forEach((value, index, array) => {
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.date[index] = this.date[index] + "月";
// console.log(this.tabledata) });
for(var i=0;i<this.tabledata[0].length;i++){ this.tiaoshiPao = this.serviceData.qipao(
this.date.push(this.tabledata[0][i].month) this.tiaoshiPao,
this.dateNum.push(this.tabledata[0][i].count) this.dateNum,
this.count+=this.tabledata[0][i].count this.date
} );
this.date.forEach((value,index,array)=>{ this.detailEcharts();
this.date[index]=this.date[index]+'月'
})
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.detailEcharts()
} }
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据 //查询数据
years:any = [] years: any = [];
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];
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
this.years.unshift(i) this.years.unshift(i);
} }
} }
selectOneYear:any = (new Date()).getFullYear() //开始年份 selectOneYear: any = new Date().getFullYear(); //开始年份
selectStartMonth:any = 1 //开始月份 selectStartMonth: any = 1; //开始月份
Submit (e) { Submit(e) {}
selectStartYear: any = new Date().getFullYear(); //开始年份
}
selectStartYear:any = (new Date()).getFullYear() //开始年份
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"] }; //柱状图数值顶部显示
zhongNumData = [200,190,180,170,160,150,140,130,120,110,100] zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
];
zhongNumData = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100];
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队"] zhiNameData = [
zhiNumData = [300,290,280,270,260,250,240,230,220,210,200] "浦东支队",
tiaoshiPao:any "黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
];
zhiNumData = [300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200];
tiaoshiPao: any;
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
var arrshuzu='['; var arrshuzu = "[";
for(var i=0;i<this.dateNum.length;i++){ for (var i = 0; i < this.dateNum.length; i++) {
arrshuzu+='{"value":'+this.dateNum[i]+',"coord":['+i+','+this.dateNum[i]+'],"name":'+'"'+this.date[i]+'"'+'},' arrshuzu +=
'{"value":' +
this.dateNum[i] +
',"coord":[' +
i +
"," +
this.dateNum[i] +
'],"name":' +
'"' +
this.date[i] +
'"' +
"},";
} }
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
} }
//返回 //返回
goBack () { goBack() {
history.go(-1) history.go(-1);
//this.echartsData.statefulInspectionToggle = true //this.echartsData.statefulInspectionToggle = true
} }
detailPlanEchart detailPlanEchart;
option option;
date = [] date = [];
dateNum = [] dateNum = [];
detailEcharts(){ detailEcharts() {
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp'); this.detailPlanEchart = echarts.init(
document.getElementById("barEchart"),
"skinUpp"
);
this.option = { this.option = {
grid: { grid: {
top: 110, top: 110,
}, },
// 标题 // 标题
title: { title: {
text: `${this.year}${this.buildingTypeName}总数(${this.count}`, text: `${this.year}${this.buildingTypeName}总数(${this.count}`,
//top: -14, //top: -14,
left: 'center', left: "center",
textStyle:{ textStyle: {
//文字颜色 //文字颜色
color:'#000', color: "#000",
fontSize: 30 fontSize: 30,
} },
}, },
//提示框 //提示框
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
/* formatter: (params)=>{ /* formatter: (params)=>{
if(params[0].seriesName == "year"){ if(params[0].seriesName == "year"){
return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name) return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name)
@ -162,89 +220,111 @@ export class PageThereYearComponent implements OnInit {
return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name) return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name)
} }
}, */ }, */
position:this.serviceData.tableTooltipNoShow2 position: this.serviceData.tableTooltipNoShow2,
}, },
// x轴 // x轴
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.date, data: this.date,
axisLabel: { axisLabel: {
color: "#000", //刻度线标签颜色 color: "#000", //刻度线标签颜色
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
}, },
}, },
splitLine: {//分割线配置 splitLine: {
show:true, //分割线配置
show: true,
lineStyle: { lineStyle: {
color: '#999', color: "#999",
} },
} },
}, },
// y轴 // y轴
yAxis: { yAxis: {
type: 'value', type: "value",
name: '个', name: "个",
axisLabel: { axisLabel: {
//color: "#000", //刻度线标签颜色 //color: "#000", //刻度线标签颜色
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
} },
} },
}, },
// 数据 // 数据
series: [{ series: [
name: 'xxx', {
type: 'line', name: "xxx",
type: "line",
markPoint: { markPoint: {
symbolSize:[65, 65], symbolSize: [65, 65],
data: this.tiaoshiPao data: this.tiaoshiPao,
}, },
data: this.dateNum, data: this.dateNum,
} },
], ],
}; };
this.detailPlanEchart.setOption(this.option); this.detailPlanEchart.setOption(this.option);
this.detailPlanEchart.getZr().on('click',params=>{ this.detailPlanEchart.getZr().on("click", (params) => {
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) { if (this.detailPlanEchart.containPixel("grid", pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = this.detailPlanEchart.convertFromPixel(
{ seriesIndex: 0 },
[params.offsetX, params.offsetY]
)[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
if(this.serviceData.level=='0'||this.serviceData.level=='1'||this.serviceData.level=='2'){ if (
this.serviceData.isQuery=true this.serviceData.level == "0" ||
this.serviceData.planMonth=this.option.xAxis.data[xIndex].substring(0,1) this.serviceData.level == "1" ||
this.serviceData.planYear=this.lastyears this.serviceData.level == "2"
) {
this.serviceData.isQuery = true;
this.serviceData.planMonth = this.option.xAxis.data[xIndex].substring(
0,
1
);
this.serviceData.planYear = this.lastyears;
/* if(!this.serviceData.isQuery){ /* if(!this.serviceData.isQuery){
this.serviceData.planYear=this.lastyears this.serviceData.planYear=this.lastyears
} */ } */
//this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'level':this.option.xAxis.data[xIndex],'headtext':this.buildingTypeName,'zhong':'1','type':this.type}}); //this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'level':this.option.xAxis.data[xIndex],'headtext':this.buildingTypeName,'zhong':'1','type':this.type}});
this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'level':this.year,'headtext':this.buildingTypeName,'zhong':'1','type':this.type,'pieonetype':this.pieonetype,'tid':this.tid,'month':this.option.xAxis.data[xIndex]}}); this.router.navigate(["/statisticanalysis/statePageOne/time"], {
} queryParams: {
else if(this.serviceData.level=='3'){ level: this.year,
headtext: this.buildingTypeName,
zhong: "1",
type: this.type,
pieonetype: this.pieonetype,
tid: this.tid,
month: this.option.xAxis.data[xIndex],
},
});
} else if (this.serviceData.level == "3") {
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':this.type}}); this.router.navigate(["/statisticanalysis/CompangInfo"], {
queryParams: { name: params.name, type: this.type },
});
} }
} }
}); });
} }
//返回按钮 //返回按钮
backBtn(){ backBtn() {
window.history.go(-1) window.history.go(-1);
} }
} }

496
src/app/statistic-analysis/state/page-there/page-there.component.ts

@ -1,286 +1,372 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router,ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from "@angular/router";
import {EchartsDataService} from '../../echarts-data.service'; import { EchartsDataService } from "../../echarts-data.service";
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBarConfig, MatSnackBar } from "@angular/material/snack-bar";
import { DateAdapter } from '@angular/material/core'; import { DateAdapter } from "@angular/material/core";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-page-there', selector: "app-page-there",
templateUrl: './page-there.component.html', templateUrl: "./page-there.component.html",
styleUrls: ['./page-there.component.scss'] styleUrls: ["./page-there.component.scss"],
}) })
export class PageThereComponent implements OnInit { export class PageThereComponent implements OnInit {
constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
public echartsData: EchartsDataService,
public snackBar: MatSnackBar,
private adapter: DateAdapter<any>
) {}
constructor(private router: Router,private activatedRoute: ActivatedRoute,public echartsData:EchartsDataService,public snackBar: MatSnackBar,private adapter: DateAdapter<any>) { } zhutu; //echarts实例
option;
time: String;
buildingTypeName: String;
setTimeoutObj; //延时器需要清除
headtext: string;
zhong: string;
type;
tabledata;
organizationId = [];
lastid;
tid;
zhutu//echarts实例 ngOnDestroy(): void {
option if (!this.zhutu) {
time:String return;
buildingTypeName:String }
setTimeoutObj//延时器需要清除 this.zhutu.clear();
headtext:string; this.zhutu.dispose();
zhong:string
type
tabledata
organizationId=[]
lastid
tid
ngOnDestroy():void{
this.zhutu.clear()
this.zhutu.dispose()
} }
ngOnInit(): void { ngOnInit(): void {
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.padHw=true this.padHw = true;
//this.padjt= //this.padjt=
}else{ } else {
this.padHw=false this.padHw = false;
} }
this.dateInit(); this.dateInit();
let datayuex:string; let datayuex: string;
this.activatedRoute.queryParams.subscribe(param=>{ this.activatedRoute.queryParams.subscribe((param) => {
this.lastid=param.id this.lastid = param.id;
this.type=param.type this.type = param.type;
this.headtext=param.headtext this.headtext = param.headtext;
datayuex=param.level datayuex = param.level;
this.zhong=param.zhong this.zhong = param.zhong;
this.headName=datayuex+this.headtext; this.headName = datayuex + this.headtext;
this.tid=param.tid this.tid = param.tid;
this.pieonetype=param.pieonetype this.pieonetype = param.pieonetype;
if(this.headtext=='二维预案'){ if (this.headtext == "二维预案") {
this.planType=1 this.planType = 1;
}else if(this.headtext=='三维预案'){ } else if (this.headtext == "三维预案") {
this.planType=2 this.planType = 2;
}else if(this.headtext=='其他预案'){ } else if (this.headtext == "其他预案") {
this.planType=4 this.planType = 4;
}else if(this.headtext=='文本预案'){ } else if (this.headtext == "文本预案") {
this.planType=16 this.planType = 16;
} }
//console.log(headName) //console.log(headName)
}); });
window.setTimeout(()=>{ window.setTimeout(() => {
this.getechartsdata() this.getechartsdata();
}) });
} }
pieonetype//判断是级别还是类型,上个页面传过来的参数 pieonetype; //判断是级别还是类型,上个页面传过来的参数
planType//预案类型 planType; //预案类型
padHw padHw;
headName headName;
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
async getechartsdata(){ async getechartsdata() {
let paramdata/* ={ let paramdata; /* ={
planStatus:this.tid=='pieone'?'': this.type, planStatus:this.tid=='pieone'?'': this.type,
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'',
OrganizationId:this.lastid, OrganizationId:this.lastid,
PlanType:this.tid=='pieone'&&this.pieonetype=='false'?this.planType:'' PlanType:this.tid=='pieone'&&this.pieonetype=='false'?this.planType:''
} */ } */
if(this.echartsData.planYear==undefined&&this.echartsData.planMonth!=undefined){ if (
this.echartsData.planYear=new Date().getFullYear() this.echartsData.planYear == undefined &&
paramdata={ this.echartsData.planMonth != undefined
planStatus:this.tid=='pieone'?'': this.type, ) {
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', this.echartsData.planYear = new Date().getFullYear();
OrganizationId:this.lastid, paramdata = {
PlanType:this.tid=='pieone'&&this.pieonetype=='false'?this.planType:'', planStatus: this.tid == "pieone" ? "" : this.type,
TimeIntervalStart:this.echartsData.planYear+'-'+this.echartsData.planMonth, PlanCategory:
TimeIntervalEnd:this.echartsData.planYear+'-'+this.echartsData.planMonth, this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
} OrganizationId: this.lastid,
PlanType:
}else if(this.echartsData.planYear==undefined&&this.echartsData.planMonth==undefined){ this.tid == "pieone" && this.pieonetype == "false"
paramdata={ ? this.planType
planStatus:this.tid=='pieone'?'': this.type, : "",
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', TimeIntervalStart:
OrganizationId:this.lastid, this.echartsData.planYear + "-" + this.echartsData.planMonth,
PlanType:this.tid=='pieone'&&this.pieonetype=='false'?this.planType:'', TimeIntervalEnd:
} this.echartsData.planYear + "-" + this.echartsData.planMonth,
}else{ };
paramdata={ } else if (
planStatus:this.tid=='pieone'?'': this.type, this.echartsData.planYear == undefined &&
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', this.echartsData.planMonth == undefined
OrganizationId:this.lastid, ) {
PlanType:this.tid=='pieone'&&this.pieonetype=='false'?this.planType:'', paramdata = {
TimeIntervalStart:this.echartsData.planYear+'-'+this.echartsData.planMonth, planStatus: this.tid == "pieone" ? "" : this.type,
TimeIntervalEnd:this.echartsData.planYear+'-'+this.echartsData.planMonth, PlanCategory:
} this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
OrganizationId: this.lastid,
PlanType:
this.tid == "pieone" && this.pieonetype == "false"
? this.planType
: "",
};
} else {
paramdata = {
planStatus: this.tid == "pieone" ? "" : this.type,
PlanCategory:
this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
OrganizationId: this.lastid,
PlanType:
this.tid == "pieone" && this.pieonetype == "false"
? this.planType
: "",
TimeIntervalStart:
this.echartsData.planYear + "-" + this.echartsData.planMonth,
TimeIntervalEnd:
this.echartsData.planYear + "-" + this.echartsData.planMonth,
};
} }
await this.echartsData.getData(paramdata,this.tid=='pieone'&&this.pieonetype=='true'?'/api/StatisticsAnalysis/Plans/Category':this.tid=='pieone'&&this.pieonetype=='false'?'/api/StatisticsAnalysis/Plans/Type': `/api/StatisticsAnalysis/Plans/Status`) await this.echartsData.getData(
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) paramdata,
// console.log(this.tabledata) this.tid == "pieone" && this.pieonetype == "true"
for(var i=0;i<this.tabledata[0].organizations.length;i++){ ? "/api/StatisticsAnalysis/Plans/Category"
this.zhiNameData.push(this.tabledata[0].organizations[i].organizationName) : this.tid == "pieone" && this.pieonetype == "false"
this.zhiNumData.push(this.tabledata[0].organizations[i].count) ? "/api/StatisticsAnalysis/Plans/Type"
this.organizationId.push(this.tabledata[0].organizations[i].organizationId) : `/api/StatisticsAnalysis/Plans/Status`
);
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.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.echartsData.qipao(this.tiaoshiPao,this.zhiNumData,this.zhiNameData) this.tiaoshiPao = this.echartsData.qipao(
this.zhuzhuangtu(this.headName) this.tiaoshiPao,
this.zhiNumData,
this.zhiNameData
);
this.zhuzhuangtu(this.headName);
} }
//查询数据 //查询数据
years:any = [] years: any = [];
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];
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
this.years.unshift(i) this.years.unshift(i);
} }
// console.log(this.years) // console.log(this.years)
} }
selectOneYear:any = (new Date()).getFullYear() //开始年份
selectStartMonth:any = 1 //开始月份
Submit (e) {
}
selectStartYear:any = (new Date()).getFullYear() //开始年份
selectOneYear: any = new Date().getFullYear(); //开始年份
selectStartMonth: any = 1; //开始月份
Submit(e) {}
selectStartYear: any = new Date().getFullYear(); //开始年份
topTextlabel = { topTextlabel = {
show: true, // 开启显示 show: true, // 开启显示
position: 'top', // 在上方显示 position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。 distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle', verticalAlign: "middle",
textStyle: { // 数值样式 textStyle: {
color: 'black', // 数值样式
fontSize: 12 color: "black",
} fontSize: 12,
}//柱状图数值顶部显示 },
zhiNameData = [] }; //柱状图数值顶部显示
zhiNumData = [] zhiNameData = [];
tiaoshiPao:any zhiNumData = [];
tiaoshiPao: any;
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
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] +
'"' +
"},";
} }
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
} }
date = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月','九月'] date = [
dateNum = [270, 253, 244, 199, 189, 173, 160, 198,200] "一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
];
dateNum = [270, 253, 244, 199, 189, 173, 160, 198, 200];
//返回 //返回
goBack () { goBack() {
//this.zhutu.clear() //this.zhutu.clear()
this.zhutu.dispose() this.zhutu ? this.zhutu.dispose() : null;
history.go(-1) history.go(-1);
this.echartsData.statefulInspectionToggle = true this.echartsData.statefulInspectionToggle = true;
} }
axisLabel = { axisLabel = {
interval: 0, interval: 0,
//rotate:-30, //rotate:-30,
textStyle:{ textStyle: {
fontSize :15, fontSize: 15,
color:'#000000' color: "#000000",
}, },
formatter:function(value) formatter: function (value) {
{ var ret = ""; //拼接加\n返回的类目项
var ret = "";//拼接加\n返回的类目项 var maxLength = 2; //每项显示文字个数
var maxLength = 2;//每项显示文字个数 var valLength = value.length; //X轴类目项的文字个数
var valLength = value.length;//X轴类目项的文字个数 var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数 if (rowN > 1) {
if (rowN > 1)//如果类目项的文字大于3, //如果类目项的文字大于3,
{ for (var i = 0; i < rowN; i++) {
for (var i = 0; i < rowN; i++) { var temp = ""; //每次截取的字符串
var temp = "";//每次截取的字符串 var start = i * maxLength; //开始截取的位置
var start = i * maxLength;//开始截取的位置 var end = start + maxLength; //结束截取的位置
var end = start + maxLength;//结束截取的位置 //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧 temp = value.substring(start, end) + "\n";
temp = value.substring(start, end) + "\n"; ret += temp; //凭借最终的字符串
ret += temp; //凭借最终的字符串 }
} return ret;
return ret; } else {
} return value;
else {
return value;
}
} }
}//echarts两个字换行 },
}; //echarts两个字换行
/* 柱状图 */ /* 柱状图 */
zhuzhuangtu(headName:string){ zhuzhuangtu(headName: string) {
var ec = echarts as any; var ec = echarts as any;
this.zhutu = ec.init(document.getElementById('zhidui'),'walden'); this.zhutu = ec.init(document.getElementById("zhidui"), "walden");
this.option = { this.option = {
title: { title: {
text: headName+`总数(${this.tabledata[0].totalCount})`, text: headName + `总数(${this.tabledata[0].totalCount})`,
left: "center", left: "center",
top:0, top: 0,
//bottom: "540", //bottom: "540",
textStyle: { textStyle: {
fontSize: 30 fontSize: 30,
} },
}, },
grid: { grid: {
top: this.padHw?90:110, top: this.padHw ? 90 : 110,
containLabel:true, containLabel: true,
//bottom: 10 //bottom: 10
}, },
xAxis: { xAxis: {
id:this.organizationId, id: this.organizationId,
type: 'category', type: "category",
data: this.zhiNameData, data: this.zhiNameData,
axisLabel: this.axisLabel, axisLabel: this.axisLabel,
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel:{ axisLabel: {
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
} },
},
}
}, },
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: (params)=>{ formatter: (params) => {
return this.echartsData.biaogeTishida(params) return this.echartsData.biaogeTishida(params);
}, },
position: this.echartsData.tableTooltipNoShowq position: this.echartsData.tableTooltipNoShowq,
/* backgroundColor:'rgba(255,255,255,1)', /* backgroundColor:'rgba(255,255,255,1)',
borderWidth:'1', borderWidth:'1',
borderRadius :'0' */ borderRadius :'0' */
}, },
series: [{ series: [
{
data: this.zhiNumData, data: this.zhiNumData,
type: 'bar', type: "bar",
markPoint: { markPoint: {
symbolSize:[65, 65], symbolSize: [65, 65],
data: this.tiaoshiPao data: this.tiaoshiPao,
}, },
backgroundStyle: { backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)' color: "rgba(220, 220, 220, 0.8)",
}, },
barWidth :'38', barWidth: "38",
//label: this.topTextlabel //label: this.topTextlabel
}] },
],
}; };
this.zhutu.getZr().on('click',params=>{ this.zhutu.getZr().on("click", (params) => {
// console.log(params.name) // console.log(params.name)
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
if (this.zhutu.containPixel('grid',pointInPixel)) { if (this.zhutu.containPixel("grid", pointInPixel)) {
let xIndex=this.zhutu.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex = this.zhutu.convertFromPixel({ seriesIndex: 0 }, [
params.offsetX,
params.offsetY,
])[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
this.echartsData.isQuery==false? this.echartsData.planYear=this.option.xAxis.data[xIndex]:this.echartsData.planYear==undefined this.echartsData.isQuery == false
console.log(this.echartsData.planYear) ? (this.echartsData.planYear = this.option.xAxis.data[xIndex])
if((this.echartsData.level=='0'||this.echartsData.level=='1')&&this.tabledata[0].organizations[xIndex].subOrganizations.length>=1){ : this.echartsData.planYear == undefined;
this.router.navigate(['/statisticanalysis/PageZhongDuiDetails'],{queryParams:{'level':this.option.xAxis.data[xIndex],'name':this.headtext,'id':this.option.xAxis.id[xIndex],'type':this.type,'tid':this.tid,'pieonetype':this.pieonetype}}); console.log(this.echartsData.planYear);
}else{ if (
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'xname':this.option.xAxis.data[xIndex],'name':this.headtext,'id':this.option.xAxis.id[xIndex],'type':this.type,'tid':this.tid,'pieonetype':this.pieonetype}}); (this.echartsData.level == "0" || this.echartsData.level == "1") &&
this.tabledata[0].organizations[xIndex].subOrganizations.length >= 1
) {
this.router.navigate(["/statisticanalysis/PageZhongDuiDetails"], {
queryParams: {
level: this.option.xAxis.data[xIndex],
name: this.headtext,
id: this.option.xAxis.id[xIndex],
type: this.type,
tid: this.tid,
pieonetype: this.pieonetype,
},
});
} else {
this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
xname: this.option.xAxis.data[xIndex],
name: this.headtext,
id: this.option.xAxis.id[xIndex],
type: this.type,
tid: this.tid,
pieonetype: this.pieonetype,
},
});
} }
} }
}); });
/* this.zhutu.on('click', (params) => { /* this.zhutu.on('click', (params) => {

743
src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts

@ -1,75 +1,76 @@
import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { Component, Input, OnInit, ViewChild } from "@angular/core";
import { MatDatepickerInputEvent } from '@angular/material/datepicker'; import { MatDatepickerInputEvent } from "@angular/material/datepicker";
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from "@angular/router";
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBarConfig, MatSnackBar } from "@angular/material/snack-bar";
import { FormControl } from '@angular/forms'; 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'; import { resolve } from "dns";
declare var echarts: any; declare var echarts: any;
@Component({ @Component({
selector: 'app-page-two-time', selector: "app-page-two-time",
templateUrl: './page-two-time.component.html', templateUrl: "./page-two-time.component.html",
styleUrls: ['./page-two-time.component.scss'] styleUrls: ["./page-two-time.component.scss"],
}) })
export class PageTwoTimeComponent implements OnInit { export class PageTwoTimeComponent implements OnInit {
constructor(
private router: Router,
public snackBar: MatSnackBar,
private adapter: DateAdapter<any>,
public echartsData: EchartsDataService,
private activatedRoute: ActivatedRoute
) {}
constructor(private router: Router,public snackBar: MatSnackBar,private adapter: DateAdapter<any>,public echartsData:EchartsDataService,private activatedRoute: ActivatedRoute) { } @ViewChild("appEcharts") appEcharts: echartsComponent; //父组件中获得子组件的引用
@ViewChild("pageTwoName") pageTwoName: PageTwoNameComponent; //父组件中获得子组件的引用
@ViewChild('appEcharts')appEcharts :echartsComponent; //父组件中获得子组件的引用 @ViewChild("echartsComponent") echartsComponent: echartsComponent; //父组件中获得子组件的引用
@ViewChild('pageTwoName')pageTwoName :PageTwoNameComponent; //父组件中获得子组件的引用
@ViewChild('echartsComponent')echartsComponent :echartsComponent; //父组件中获得子组件的引用
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.queryParams.subscribe(param=>{ this.activatedRoute.queryParams.subscribe((param) => {
this.type=param.type this.type = param.type;
}); });
this.echartsData.statefulInspectionToggle = true this.echartsData.statefulInspectionToggle = true;
this.dateInit() this.dateInit();
this.bianli() this.bianli();
}
ngOnDestroy(): void {
} }
ngOnDestroy(): void {}
isQuery:boolean = true; //横纵向查询 isQuery: boolean = true; //横纵向查询
type type;
//shao //shao
toggleTrue () { toggleTrue() {
//this.isQuery = true //this.isQuery = true
this.echartsData.isQuery=true this.echartsData.isQuery = true;
this.echartsData.statefulInspectionToggle = true this.echartsData.statefulInspectionToggle = true;
} }
//chen //chen
toggleFalse () { toggleFalse() {
//this.isQuery = false //this.isQuery = false
this.echartsData.isQuery=false this.echartsData.isQuery = false;
this.echartsData.statefulInspectionToggle = true this.echartsData.statefulInspectionToggle = true;
this.selectType = 'month' this.selectType = "month";
} }
//返回 //返回
goBack () { goBack() {
//this.echartsComponent.twoExample.clear() this.echartsData.statefulInspectionToggle = true;
//this.echartsComponent.dispose() sessionStorage.setItem("refresh", "true");
this.echartsData.statefulInspectionToggle = true
sessionStorage.setItem('refresh', 'true');
history.go(-1); history.go(-1);
} }
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType: string = "month"; //选择当前的 查询类型 按月/年
async changeTime (e) { async changeTime(e) {
let data = e.value let data = e.value;
await 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 = [2020, 2021, 2022];
this.years=[2020,2021,2022] this.echartsData.selectType = 2;
this.echartsData.selectType=2
/* console.log(this.appEcharts.tabledata) /* console.log(this.appEcharts.tabledata)
this.appEcharts.tabledata[0].forEach((value,index,array) => { this.appEcharts.tabledata[0].forEach((value,index,array) => {
this.years.push(array[index].year) this.years.push(array[index].year)
@ -80,288 +81,390 @@ export class PageTwoTimeComponent implements OnInit {
} }
//查询数据 //查询数据
years= [] 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];
datayuex=['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月','9月'] datayuex = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月"];
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli() {
var arrshuzu='['; var arrshuzu = "[";
for(var i=0;i<this.datayuey.length;i++){ for (var i = 0; i < this.datayuey.length; i++) {
arrshuzu+='{"value":'+this.datayuey[i]+',"coord":['+i+','+this.datayuey[i]+'],"name":'+'"'+this.datayuex[i]+'"'+'},' arrshuzu +=
'{"value":' +
this.datayuey[i] +
',"coord":[' +
i +
"," +
this.datayuey[i] +
'],"name":' +
'"' +
this.datayuex[i] +
'"' +
"},";
} }
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);
} }
//日期初始化 //日期初始化
dateInit () { dateInit() {
let date = (new Date()).getFullYear() let date = new Date().getFullYear();
for (let i=date; i>=date-10;i--) { for (let i = date; i >= date - 10; i--) {
//this.years.unshift(i) //this.years.unshift(i)
} }
} }
selectOneYear:any = (new Date()).getFullYear() //开始年份 selectOneYear: any = new Date().getFullYear(); //开始年份
selectTwoYear:any = (new Date()).getFullYear() //结束年份 selectTwoYear: any = new Date().getFullYear(); //结束年份
selectStartMonth:any = 1 //开始月份 selectStartMonth: any = 1; //开始月份
selectEndMonth:any = 12 //结束月份 selectEndMonth: any = 12; //结束月份
//按月查询 //按月查询
monthSubmit (e) { monthSubmit(e) {
if(e.selectEndMonth >= e.selectStartMonth) { if (e.selectEndMonth >= e.selectStartMonth) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime =
let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 e.selectOneYear +
this.echartsData.selectStartMonth=e.selectStartMonth "-" +
this.echartsData.selectEndMonth=e.selectEndMonth e.selectStartMonth +
this.appEcharts.findYue() "-" +
1 +
" " +
0 +
":" +
0 +
":" +
0;
let endTime =
e.selectTwoYear +
"-" +
e.selectEndMonth +
"-" +
31 +
" " +
23 +
":" +
59 +
":" +
59;
this.echartsData.selectStartMonth = e.selectStartMonth;
this.echartsData.selectEndMonth = e.selectEndMonth;
this.appEcharts.findYue();
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
this.snackBar.open('请选择正确时间区段','确定',config); this.snackBar.open("请选择正确时间区段", "确定", config);
} }
} }
selectStartYear: any = new Date().getFullYear() - 1; //开始年份
selectEndYear: any = new Date().getFullYear(); //结束年份
selectStartYear:any = (new Date()).getFullYear()-1 //开始年份
selectEndYear:any = (new Date()).getFullYear() //结束年份
//按年查询 //按年查询
yearSubmit (e) { yearSubmit(e) {
if (e.selectEndYear >= e.selectStartYear) { if (e.selectEndYear >= e.selectStartYear) {
let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime =
let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 e.selectStartYear + "-" + 1 + "-" + 1 + " " + 0 + ":" + 0 + ":" + 0;
this.echartsData.selectOneYear=e.selectStartYear let endTime =
this.echartsData.selectTwoYear=e.selectEndYear e.selectEndYear + "-" + 12 + "-" + 31 + " " + 23 + ":" + 59 + ":" + 59;
this.appEcharts.findyear() this.echartsData.selectOneYear = e.selectStartYear;
this.echartsData.selectTwoYear = e.selectEndYear;
this.appEcharts.findyear();
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = "top";
config.duration = 3000 config.duration = 3000;
this.snackBar.open('结束时间必须大于开始时间','确定',config); this.snackBar.open("结束时间必须大于开始时间", "确定", config);
} }
} }
} }
@Component({ @Component({
selector: 'app-echarts', selector: "app-echarts",
templateUrl: './echarts.html', templateUrl: "./echarts.html",
styleUrls: ['./page-two-time.component.scss'] styleUrls: ["./page-two-time.component.scss"],
}) })
export class echartsComponent implements OnInit { 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;
tid type;
zongcount=0 organizationId = [];
type tiaoshiPao: any;
organizationId=[] datayuey = [];
tiaoshiPao:any datayuex = [];
datayuey=[] dataYearX = [];
datayuex=[] dataYearY = [];
dataYearX = [] pieonetype; //判断是级别还是类型,上个页面传过来的参数
dataYearY = [] planType; //预案类型
pieonetype//判断是级别还是类型,上个页面传过来的参数 toggleTrue() {}
planType//预案类型 //气泡提示数据获取
toggleTrue (){} bianli() {
//气泡提示数据获取 var arrshuzu = "[";
bianli(){ for (var i = 0; i < this.datayuey.length; i++) {
var arrshuzu='['; arrshuzu +=
for(var i=0;i<this.datayuey.length;i++){ '{"value":' +
arrshuzu+='{"value":'+this.datayuey[i]+',"coord":['+i+','+this.datayuey[i]+'],"name":'+'"'+this.datayuex[i]+'"'+'},' this.datayuey[i] +
',"coord":[' +
i +
"," +
this.datayuey[i] +
'],"name":' +
'"' +
this.datayuex[i] +
'"' +
"},";
} }
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);
} }
ngOnInit(): void { ngOnInit(): void {
if(sessionStorage.getItem('refresh') === 'true') { if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem("refresh");
location.reload(); location.reload();
} }
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 this.tid = param.tid;
this.pieonetype=param.pieonetype this.pieonetype = param.pieonetype;
}); });
if(this.headtext=='二维预案'){ if (this.headtext == "二维预案") {
this.planType=1 this.planType = 1;
}else if(this.headtext=='三维预案'){ } else if (this.headtext == "三维预案") {
this.planType=2 this.planType = 2;
}else if(this.headtext=='其他预案'){ } else if (this.headtext == "其他预案") {
this.planType=4 this.planType = 4;
}else if(this.headtext=='文本预案'){ } else if (this.headtext == "文本预案") {
this.planType=16 this.planType = 16;
} }
window.setTimeout(()=>{ window.setTimeout(() => {
this.getechartsData() this.getechartsData();
}) });
} }
ngOnDestroy () { ngOnDestroy() {
this.twoExample.clear() this.twoExample.clear();
this.twoExample.dispose() this.twoExample.dispose();
} }
//获取数据 //获取数据
async getechartsData(){ async getechartsData() {
this.datayuex=[] this.datayuex = [];
this.datayuey=[] this.datayuey = [];
this.zongcount=0 this.zongcount = 0;
let paramdata={ let paramdata = {
planStatus:this.tid=='pieone'?'': this.type, planStatus: this.tid == "pieone" ? "" : this.type,
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', PlanCategory:
objectType:this.tid=='pieone'&&this.pieonetype=='true'?2:this.tid=='pieone'&&this.pieonetype=='false'?5: 1, this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
TrendType:0 objectType:
this.tid == "pieone" && this.pieonetype == "true"
? 2
: this.tid == "pieone" && this.pieonetype == "false"
? 5
: 1,
TrendType: 0,
};
await this.echartsData.getData(paramdata, `/api/StatisticsAnalysis/Trends`);
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
//console.log(this.tabledata)
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
) {
this.datayuex.push(this.tabledata[0][i].month);
this.datayuey.push(this.tabledata[0][i].count);
this.zongcount = this.zongcount + this.tabledata[0][i].count;
}
} }
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) this.datayuex.forEach((value, index, array) => {
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) array[index] = array[index] + "月";
//console.log(this.tabledata) });
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){ this.tiaoshiPao = this.echartsData.qipao(
this.datayuex.push(this.tabledata[0][i].month) this.tiaoshiPao,
this.datayuey.push(this.tabledata[0][i].count) this.datayuey,
this.zongcount=this.zongcount+this.tabledata[0][i].count this.datayuex
} );
} //this.oneInit()
this.datayuex.forEach((value,index,array)=>{ this.twoInit(this.datayuex, this.datayuey);
array[index]=array[index]+'月'
})
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
//this.oneInit()
this.twoInit(this.datayuex,this.datayuey)
} }
async changeTime (e) { async changeTime(e) {
this.twoExample.clear() if (this.twoExample) {
this.twoExample.dispose() this.twoExample.clear();
if (e=='year') { this.twoExample.dispose();
}
if (e == "year") {
//this.oneInit(this.dataYearX,this.dataYearY) //this.oneInit(this.dataYearX,this.dataYearY)
this.dataYearX=[] this.dataYearX = [];
this.dataYearY=[] this.dataYearY = [];
this.echartsData.selectType=2 this.echartsData.selectType = 2;
this.zongcount=0 this.zongcount = 0;
let paramdata={ let paramdata = {
planStatus:this.tid=='pieone'?'': this.type, planStatus: this.tid == "pieone" ? "" : this.type,
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', PlanCategory:
objectType:this.tid=='pieone'&&this.pieonetype=='true'?2:this.tid=='pieone'&&this.pieonetype=='false'?5: 1, this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
TrendType:this.echartsData.selectType objectType:
} this.tid == "pieone" && this.pieonetype == "true"
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) ? 2
window.setTimeout(()=>{ : this.tid == "pieone" && this.pieonetype == "false"
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) ? 5
console.log(this.tabledata) : 1,
TrendType: this.echartsData.selectType,
};
await this.echartsData.getData(
paramdata,
`/api/StatisticsAnalysis/Trends`
);
window.setTimeout(() => {
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
console.log(this.tabledata);
//resolve(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.forEach((value, index, array) => {
this.dataYearX[index]=this.dataYearX[index]+'年' 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.twoInit(this.dataYearX,this.dataYearY) this.tiaoshiPao,
}) this.dataYearY,
this.dataYearX
);
this.twoInit(this.dataYearX, this.dataYearY);
});
//this.twoInit(this.dataYearX,this.dataYearY) //this.twoInit(this.dataYearX,this.dataYearY)
} else { } else {
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.getechartsData() this.getechartsData();
this.twoInit(this.datayuex,this.datayuey) this.twoInit(this.datayuex, this.datayuey);
} }
} }
//按月查询 //按月查询
async findYue(){ async findYue() {
this.twoExample.clear() this.twoExample.clear();
this.datayuex=[] this.datayuex = [];
this.datayuey=[] this.datayuey = [];
let paramdata={ let paramdata = {
planStatus:this.tid=='pieone'?'': this.type, planStatus: this.tid == "pieone" ? "" : this.type,
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', PlanCategory:
objectType:this.tid=='pieone'&&this.pieonetype=='true'?2:this.tid=='pieone'&&this.pieonetype=='false'?5: 1, this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
TrendType:this.echartsData.selectType objectType:
} this.tid == "pieone" && this.pieonetype == "true"
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) ? 2
window.setTimeout(()=>{ : this.tid == "pieone" && this.pieonetype == "false"
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) ? 5
: 1,
TrendType: this.echartsData.selectType,
};
await this.echartsData.getData(paramdata, `/api/StatisticsAnalysis/Trends`);
window.setTimeout(() => {
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
//console.log(this.tabledata[0].companyStatistics.trendStatistics.added) //console.log(this.tabledata[0].companyStatistics.trendStatistics.added)
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.datayuex.push(this.tabledata[0][i].month) this.tabledata[0][i].month >= this.echartsData.selectStartMonth &&
this.datayuey.push(this.tabledata[0][i].count) this.tabledata[0][i].month <= this.echartsData.selectEndMonth
} ) {
this.datayuex.push(this.tabledata[0][i].month);
this.datayuey.push(this.tabledata[0][i].count);
} }
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) }
this.twoInit(this.datayuex,this.datayuey) this.tiaoshiPao = this.echartsData.qipao(
}) this.tiaoshiPao,
this.datayuey,
this.datayuex
);
this.twoInit(this.datayuex, this.datayuey);
});
} }
//按年查询 //按年查询
async findyear(){ async findyear() {
this.twoExample.clear() this.twoExample.clear();
this.dataYearX=[] this.dataYearX = [];
this.dataYearY=[] this.dataYearY = [];
let paramdata={ let paramdata = {
planStatus:this.tid=='pieone'?'': this.type, planStatus: this.tid == "pieone" ? "" : this.type,
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'', PlanCategory:
objectType:this.tid=='pieone'&&this.pieonetype=='true'?2:this.tid=='pieone'&&this.pieonetype=='false'?5: 1, this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
TrendType:this.echartsData.selectType objectType:
} this.tid == "pieone" && this.pieonetype == "true"
await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`) ? 2
window.setTimeout(()=>{ : this.tid == "pieone" && this.pieonetype == "false"
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) ? 5
: 1,
TrendType: this.echartsData.selectType,
};
await this.echartsData.getData(paramdata, `/api/StatisticsAnalysis/Trends`);
window.setTimeout(() => {
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
//console.log(this.tabledata[0].companyStatistics.trendStatistics.added) //console.log(this.tabledata[0].companyStatistics.trendStatistics.added)
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].year>=this.echartsData.selectOneYear&&this.tabledata[0][i].year<=this.echartsData.selectTwoYear){ if (
this.dataYearX.push(this.tabledata[0][i].year) this.tabledata[0][i].year >= this.echartsData.selectOneYear &&
this.dataYearY.push(this.tabledata[0][i].count) this.tabledata[0][i].year <= this.echartsData.selectTwoYear
} ) {
this.dataYearX.push(this.tabledata[0][i].year);
this.dataYearY.push(this.tabledata[0][i].count);
} }
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataYearY,this.dataYearX) }
this.twoInit(this.dataYearX,this.dataYearY) this.tiaoshiPao = this.echartsData.qipao(
}) this.tiaoshiPao,
this.dataYearY,
this.dataYearX
);
this.twoInit(this.dataYearX, this.dataYearY);
});
} }
headtext headtext;
twoExample:any; twoExample: any;
tabledata tabledata;
thisYear=new Date().getFullYear() thisYear = new Date().getFullYear();
twoInit (X, Y) { twoInit(X, Y) {
/* X.forEach((element,index,array) => { /* X.forEach((element,index,array) => {
array[index]=array[index]+'月' 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 = {
// 标题 // 标题
title: { title: {
text: this.headtext+`:总数(${this.zongcount}`, text: this.headtext + `:总数(${this.zongcount}`,
top: -4, top: -4,
left: 'center', left: "center",
bottom: 100, bottom: 100,
textStyle:{ textStyle: {
//文字颜色 //文字颜色
fontSize: 30, fontSize: 30,
color:'#000', color: "#000",
} },
}, },
grid: { grid: {
top: 90, top: 90,
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
position: this.echartsData.tableTooltipNoShowq, position: this.echartsData.tableTooltipNoShowq,
/* formatter: (params)=>{ /* formatter: (params)=>{
return this.echartsData.tableTooltip(this.echartsData.tableDataZhi,'预案新增') return this.echartsData.tableTooltip(this.echartsData.tableDataZhi,'预案新增')
@ -369,95 +472,117 @@ export class echartsComponent implements OnInit {
}, },
// x轴 // x轴
xAxis: { xAxis: {
type: 'category', type: "category",
data: X, data: X,
boundaryGap: true, boundaryGap: true,
axisLabel: { axisLabel: {
color: "#000", //刻度线标签颜色 color: "#000", //刻度线标签颜色
textStyle:{ textStyle: {
fontSize :18, fontSize: 18,
color:'#000000' color: "#000000",
}, },
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
}, },
}, },
splitLine: {//分割线配置 splitLine: {
show:true, //分割线配置
show: true,
lineStyle: { lineStyle: {
color: '#999', color: "#999",
} },
} },
}, },
// y轴 // y轴
yAxis: { yAxis: {
type: 'value', type: "value",
name: '个', name: "个",
axisLabel: { axisLabel: {
textStyle:{ textStyle: {
fontSize :15, fontSize: 15,
color:'#000000' color: "#000000",
}, },
color: "#000" //刻度线标签颜色 color: "#000", //刻度线标签颜色
}, },
//设置坐标轴字体颜色和宽度 //设置坐标轴字体颜色和宽度
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: "#000", color: "#000",
} },
} },
}, },
// 数据 // 数据
series: [{ series: [
name: '单位预案编制数量', {
type: 'line', name: "单位预案编制数量",
type: "line",
markPoint: { markPoint: {
symbolSize: [65, 65],
symbolSize:[65, 65], data: this.tiaoshiPao,
data: this.tiaoshiPao },
},
data: Y, data: Y,
} },
], ],
}; };
this.twoExample.setOption(option); this.twoExample.setOption(option);
this.twoExample.getZr().on('click', (params) => { this.twoExample.getZr().on("click", (params) => {
// console.log(params.name) // console.log(params.name)
/* this.echartsData.statefulInspectionName =params.name+headtext; /* this.echartsData.statefulInspectionName =params.name+headtext;
this.router.navigateByUrl(`/statisticanalysis/delete_one/delete_there`); */ this.router.navigateByUrl(`/statisticanalysis/delete_one/delete_there`); */
const pointInPixel= [params.offsetX, params.offsetY]; const pointInPixel = [params.offsetX, params.offsetY];
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 }, [
if(this.echartsData.selectType==2){ params.offsetX,
this.echartsData.planYear=X[xIndex].substring(0,4) params.offsetY,
this.router.navigate(['/statisticanalysis/stataPageThereYearComponent'],{queryParams:{'level':this.headtext,'headtext':X[xIndex],'type':this.type,'tid':this.tid,'pieonetype':this.pieonetype}}); ])[0];
}else{ if (this.echartsData.selectType == 2) {
this.echartsData.planYear = X[xIndex].substring(0, 4);
this.router.navigate(
["/statisticanalysis/stataPageThereYearComponent"],
{
queryParams: {
level: this.headtext,
headtext: X[xIndex],
type: this.type,
tid: this.tid,
pieonetype: this.pieonetype,
},
}
);
} else {
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
if(this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2'){ if (
this.twoExample.clear() this.echartsData.level == "0" ||
this.echartsData.isQuery=true this.echartsData.level == "1" ||
this.echartsData.level == "2"
) {
this.twoExample.clear();
this.echartsData.isQuery = true;
this.twoExample.setOption(option); this.twoExample.setOption(option);
this.echartsData.planMonth=option.xAxis.data[xIndex].substring(0,1) this.echartsData.planMonth = option.xAxis.data[xIndex].substring(
0,
1
);
//this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'zhong':'1','type':this.type,'pieonetype':this.pieonetype,'tid':this.tid,'month':option.xAxis.data[xIndex]}}); //this.router.navigate(['/statisticanalysis/statePageOne/time'],{queryParams:{'zhong':'1','type':this.type,'pieonetype':this.pieonetype,'tid':this.tid,'month':option.xAxis.data[xIndex]}});
//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,'tid':this.tid,'pieonetype':this.pieonetype}}); this.router.navigate(["/statisticanalysis/AllPlan"], {
queryParams: {
name: params.name,
type: this.type,
tid: this.tid,
pieonetype: this.pieonetype,
},
});
} }
} }
} }
}); });
} }
threeExample:any; threeExample: any;
} }

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

@ -69,8 +69,11 @@ export class PageZhongDuiDetailsComponent implements OnInit {
}) })
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.detailPlanEchart.clear() if (this.detailPlanEchart) {
this.detailPlanEchart.dispose() this.detailPlanEchart.clear()
this.detailPlanEchart.dispose()
}
} }
async getechartsdata(){ async getechartsdata(){
let paramdata={ let paramdata={

4
src/index.html

@ -27,9 +27,9 @@
<!-- <script <!-- <script
src="http://10.81.73.39:8000/webapi/maps?v=2.0&key=17bb9b27e49451cde8f2e6655b11ff1a&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script> src="http://10.81.73.39:8000/webapi/maps?v=2.0&key=17bb9b27e49451cde8f2e6655b11ff1a&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>
<script src="http://10.81.73.39:8000/webapi/ui/1.1/main.js"></script> --> <script src="http://10.81.73.39:8000/webapi/ui/1.1/main.js"></script> -->
<script <!-- <script
src="https://webapi.amap.com/maps?v=2.0&key=17bb9b27e49451cde8f2e6655b11ff1a&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script> src="https://webapi.amap.com/maps?v=2.0&key=17bb9b27e49451cde8f2e6655b11ff1a&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>
<script src="https://webapi.amap.com/ui/1.1/main.js"></script> <script src="https://webapi.amap.com/ui/1.1/main.js"></script> -->
<script src="/assets/html2canvas.js"></script> <script src="/assets/html2canvas.js"></script>
<script type="text/javascript" src="/assets/wordexport/jquery.js"></script> <script type="text/javascript" src="/assets/wordexport/jquery.js"></script>
<script type="text/javascript" src="/assets/wordexport/FileSaver.js"></script> <script type="text/javascript" src="/assets/wordexport/FileSaver.js"></script>

Loading…
Cancel
Save