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

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(){
window.clearTimeout(this.setTimeoutObj);
if (!this.detailPlanEchart) {
return;
}
this.detailPlanEchart.clear()
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 { Router } from '@angular/router';
import {MatDialog, MatDialogRef, 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';
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import {
MatDialog,
MatDialogRef,
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;
@Component({
selector: 'app-add-unit-three-line-details',
templateUrl: './add-unit-three-line-details.component.html',
styleUrls: ['./add-unit-three-line-details.component.scss']
selector: "app-add-unit-three-line-details",
templateUrl: "./add-unit-three-line-details.component.html",
styleUrls: ["./add-unit-three-line-details.component.scss"],
})
export class AddUnitThreeLineDetailsComponent implements OnInit {
constructor(private router: Router,public dialog: MatDialog,public snackBar: MatSnackBar,private serviceData: EchartsDataService,public route: ActivatedRoute) { }
year:String
buildingTypeName:String
level:String
setTimeoutObj//延时器需要清除
qopao
lastId
zhiorbuild
constructor(
private router: Router,
public dialog: MatDialog,
public snackBar: MatSnackBar,
private serviceData: EchartsDataService,
public route: ActivatedRoute
) {}
year: String;
buildingTypeName: String;
level: String;
setTimeoutObj; //延时器需要清除
qopao;
lastId;
zhiorbuild;
ngOnInit(): void {
if(sessionStorage.getItem('refresh') === 'true') {
sessionStorage.removeItem('refresh');
if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem("refresh");
location.reload();
}
this.serviceData.selectType=0
this.dateInit ()
this.route.queryParams.subscribe(params => {
this.year = params['year'];
this.buildingTypeName = params['buildingType'];
this.lastId=params['id']
this.zhiorbuild=params['type']
}
this.serviceData.selectType = 0;
this.dateInit();
this.route.queryParams.subscribe((params) => {
this.year = params["year"];
this.buildingTypeName = params["buildingType"];
this.lastId = params["id"];
this.zhiorbuild = params["type"];
});
this.setTimeoutObj = window.setTimeout(() => {
this.getdata();
});
this.setTimeoutObj = window.setTimeout(()=>{
this.getdata()
})
}
ngOnDestroy(){
ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj);
this.detailPlanEchart.clear()
this.detailPlanEchart.dispose()
}
tabledata
zongcount=0
async getdata(){
let parzhi={
objectType:0,
BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType,
TrendYear:this.year||''
if (!this.detailPlanEchart) {
return;
}
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.detailPlanEchart.clear();
this.detailPlanEchart.dispose();
}
tabledata;
zongcount = 0;
async getdata() {
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.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate))
this.tabledata = JSON.parse(JSON.stringify(this.serviceData.allDate));
//console.log(this.tabledata)
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
}
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.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.qopao=this.serviceData.qipao(this.qopao,this.dateNum,this.zhiNameData)
this.detailEcharts()
this.qopao = this.serviceData.qipao(
this.qopao,
this.dateNum,
this.zhiNameData
);
this.detailEcharts();
});
}
selectType:string = 'month'; //选择当前的 查询类型 按月/年
selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据
years:any = []
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12]
years: any = [];
selectMonth: any = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
//日期初始化
dateInit () {
let date = (new Date()).getFullYear()
for (let i=date; i>=date-10;i--) {
this.years.unshift(i)
dateInit() {
let date = new Date().getFullYear();
for (let i = date; i >= date - 10; i--) {
this.years.unshift(i);
}
}
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 = {
show: true, // 开启显示
position: 'top', // 在上方显示
position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle',
textStyle: { // 数值样式
color: 'black',
fontSize: 12
}
}//柱状图数值顶部显示
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"]
zhongNumData = [200,190,180,170,160,150,140,130,120,110,100]
verticalAlign: "middle",
textStyle: {
// 数值样式
color: "black",
fontSize: 12,
},
}; //柱状图数值顶部显示
zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
];
zhongNumData = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100];
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队"]
zhiNumData = [300,290,280,270,260,250,240,230,220,210,200]
zhiNameData = [
"浦东支队",
"黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
];
zhiNumData = [300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200];
detailPlanEchart;
option;
date = [];
dateNum = [];
detailPlanEchart
option
date = []
dateNum = []
detailEcharts(){
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp');
detailEcharts() {
this.detailPlanEchart = echarts.init(
document.getElementById("barEchart"),
"skinUpp"
);
this.option = {
grid: {
top: 90,
},
// 标题
title: {
text: this.buildingTypeName ,
text: this.buildingTypeName,
top: -4,
left: 'center',
textStyle:{
left: "center",
textStyle: {
//文字颜色
color:'#000',
fontSize: 30
}
color: "#000",
fontSize: 30,
},
},
//提示框
tooltip: {
trigger: 'axis',
trigger: "axis",
/* formatter: (params)=>{
if(params[0].seriesName == "year"){
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)
}
}, */
position:this.serviceData.tableTooltipNoShow2
position: this.serviceData.tableTooltipNoShow2,
},
// x轴
xAxis: {
type: 'category',
type: "category",
data: this.date,
axisLabel: {
textStyle:{
fontSize :18,
color:'#000000'
textStyle: {
fontSize: 18,
color: "#000000",
},
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
axisLine: {
lineStyle: {
color: "#000",
},
},
splitLine: {//分割线配置
show:true,
splitLine: {
//分割线配置
show: true,
lineStyle: {
color: '#999',
}
}
color: "#999",
},
},
},
// y轴
yAxis: {
type: 'value',
name: '个',
type: "value",
name: "个",
axisLabel: {
textStyle:{
fontSize :18,
color:'#000000'
textStyle: {
fontSize: 18,
color: "#000000",
},
color: "#000" //刻度线标签颜色
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
}
}
},
},
},
// 数据
series: [{
name: 'xxx',
type: 'line',
series: [
{
name: "xxx",
type: "line",
data: this.dateNum,
barWidth :'38',
barWidth: "38",
markPoint: {
symbolSize:[65, 65],
data: this.qopao
symbolSize: [65, 65],
data: this.qopao,
},
},
}
],
};
this.detailPlanEchart.setOption(this.option);
this.detailPlanEchart.getZr().on('click',params=>{
const pointInPixel= [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
this.detailPlanEchart.getZr().on("click", (params) => {
const pointInPixel = [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel("grid", pointInPixel)) {
let xIndex = this.detailPlanEchart.convertFromPixel(
{ seriesIndex: 0 },
[params.offsetX, params.offsetY]
)[0];
/*事件处理代码书写位置*/
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}});
}
});
}
//返回按钮
backBtn(){
sessionStorage.setItem('refresh', 'true');
backBtn() {
sessionStorage.setItem("refresh", "true");
history.go(-1);
}
tableTooltip(params:any){
}
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:#000000;font-size:30px;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; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >';
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>'
res+='<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>'
res+='</tr></thead>'
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
{
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:#000000;font-size:30px;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; background:#FFFFFF; color:#000000;border-collapse:collapse;"cellspacing="0"; >';
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>';
res +=
'<td style="text-align:center;width:30%;border:1px solid #000000">总占比</td>';
res += "</tr></thead>";
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 { ActivatedRoute, Router } from '@angular/router';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { EchartsDataService } from '../../echarts-data.service';
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import {
MatDialog,
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;
@Component({
selector: 'app-add-unit-two-time',
templateUrl: './add-unit-two-time.component.html',
styleUrls: ['./add-unit-two-time.component.scss']
selector: "app-add-unit-two-time",
templateUrl: "./add-unit-two-time.component.html",
styleUrls: ["./add-unit-two-time.component.scss"],
})
export class AddUnitTwoTimeComponent implements OnInit {
constructor(private router: Router,public dialog: MatDialog,public snackBar: MatSnackBar,private serviceData: EchartsDataService,private route:ActivatedRoute) { }
setTimeoutObj//延时器需要清除
headname
type=1
lastId
tabledata
zongcount=0
zhiorbuild
constructor(
private router: Router,
public dialog: MatDialog,
public snackBar: MatSnackBar,
private serviceData: EchartsDataService,
private route: ActivatedRoute
) {}
setTimeoutObj; //延时器需要清除
headname;
type = 1;
lastId;
tabledata;
zongcount = 0;
zhiorbuild;
ngOnInit(): void {
this.serviceData.selectType=0
this.dateInit ()
this.route.queryParams.subscribe(param=>{
this.headname=param.level
this.zhiorbuild=param.type
this.lastId=param.id
this.serviceData.selectType = 0;
this.dateInit();
this.route.queryParams.subscribe((param) => {
this.headname = param.level;
this.zhiorbuild = param.type;
this.lastId = param.id;
});
this.getdata()
this.getdata();
}
ngOnDestroy(){
ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj);
this.forArr.forEach(item => {
item.echart.clear()
item.echart.dispose()
})
if (this.forArr && this.forArr.length !== 0) {
this.forArr.forEach((item) => {
item.echart.clear();
item.echart.dispose();
});
}
}
//获取数据
yeardatee=new Date().getFullYear()
async getdata(){
this.date=[]
this.dateNum=[]
this.zongcount=0
let parzhi={
objectType:0,
BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType,
TrendYear:this.yeardatee||''
}
let parbuild={
objectType:0,
OrganizationId:this.lastId,
TrendType:this.serviceData.selectType,
TrendYear:this.yeardatee||''
}
await this.serviceData.getData(this.zhiorbuild=="zhi"?parbuild:parzhi,`/api/StatisticsAnalysis/Trends`)
yeardatee = new Date().getFullYear();
async getdata() {
this.date = [];
this.dateNum = [];
this.zongcount = 0;
let parzhi = {
objectType: 0,
BuildingTypeId: this.lastId,
TrendType: this.serviceData.selectType,
TrendYear: this.yeardatee || "",
};
let parbuild = {
objectType: 0,
OrganizationId: this.lastId,
TrendType: this.serviceData.selectType,
TrendYear: this.yeardatee || "",
};
await this.serviceData.getData(
this.zhiorbuild == "zhi" ? parbuild : parzhi,
`/api/StatisticsAnalysis/Trends`
);
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])
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
}
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.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.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.twoInit (this.date,this.dateNum,'month')
this.tiaoshiPao = this.serviceData.qipao(
this.tiaoshiPao,
this.dateNum,
this.date
);
this.twoInit(this.date, this.dateNum, "month");
});
}
forward(){
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':this.headname,'id':this.lastId,'type':this.zhiorbuild=='zhi'?'zhi':'build'}})
forward() {
this.router.navigate(["/statisticanalysis/addUnit_one/addUnit_two_type"], {
queryParams: {
level: this.headname,
id: this.lastId,
type: this.zhiorbuild == "zhi" ? "zhi" : "build",
},
});
}
reverse(){
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time'],{queryParams:{'level':this.headname,'id':this.lastId,'type':this.zhiorbuild=='zhi'?'zhi':'build'}})
reverse() {
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= []
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12]
years = [];
selectMonth: any = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
//日期初始化
dateInit () {
let date = (new Date()).getFullYear()
for (let i=date; i>=date-10;i--) {
dateInit() {
let date = new Date().getFullYear();
for (let i = date; i >= date - 10; i--) {
//this.years.unshift(i)
}
}
selectOneYear:any = (new Date()).getFullYear() //开始年份
selectTwoYear:any = (new Date()).getFullYear() //结束年份
selectStartMonth:any = 1 //开始月份
selectEndMonth:any = (new Date()).getMonth()+1 //结束月份
selectOneYear: any = new Date().getFullYear(); //开始年份
selectTwoYear: any = new Date().getFullYear(); //结束年份
selectStartMonth: any = 1; //开始月份
selectEndMonth: any = new Date().getMonth() + 1; //结束月份
//按月查询
monthSubmit (e) {
this.serviceData.selectStartMonth=this.selectStartMonth
this.serviceData.selectEndMonth=this.selectEndMonth
monthSubmit(e) {
this.serviceData.selectStartMonth = this.selectStartMonth;
this.serviceData.selectEndMonth = this.selectEndMonth;
//console.log(this.selectStartMonth,this.selectEndMonth)
this.date=[]
this.dateNum=[]
this.zongcount=0
if (e.selectEndMonth>=e.selectStartMonth) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 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.date = [];
this.dateNum = [];
this.zongcount = 0;
if (e.selectEndMonth >= e.selectStartMonth) {
let startTime =
e.selectOneYear +
"-" +
e.selectStartMonth +
"-" +
1 +
" " +
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.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.twoInit (this.date,this.dateNum,'month')
this.tiaoshiPao = this.serviceData.qipao(
this.tiaoshiPao,
this.dateNum,
this.date
);
this.twoInit(this.date, this.dateNum, "month");
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择正确时间区段','确定',config);
config.verticalPosition = "top";
config.duration = 3000;
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) {
this.zongcount=0
this.date2=[]
this.dateNum2=[]
yearSubmit(e) {
this.zongcount = 0;
this.date2 = [];
this.dateNum2 = [];
if (e.selectEndYear >= e.selectStartYear) {
let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0
let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59
for(var i=0;i<this.tabledata[0].length;i++){
if(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
let startTime =
e.selectStartYear + "-" + 1 + "-" + 1 + " " + 0 + ":" + 0 + ":" + 0;
let endTime =
e.selectEndYear + "-" + 12 + "-" + 31 + " " + 23 + ":" + 59 + ":" + 59;
for (var i = 0; i < this.tabledata[0].length; i++) {
if (
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.tiaoshiPao=this.serviceData.qipao(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.twoInit(this.date2, this.dateNum2, "year");
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('结束年份必须大于开始年份','确定',config);
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("结束年份必须大于开始年份", "确定", config);
}
}
//年或月点击
async dateChange(){
this.tiaoshiPao=null
this.forArr.forEach(item => {
item.echart.dispose()
})
if(this.selectType == "year"){
this.zongcount=0
this.date2=[]
this.dateNum2=[]
this.years=[]
this.serviceData.selectType=2
let parzhi={
objectType:0,
BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType,
}
let parbuild={
objectType:0,
OrganizationId:this.lastId,
TrendType:this.serviceData.selectType,
}
async dateChange() {
this.tiaoshiPao = null;
this.forArr.forEach((item) => {
item.echart.dispose();
});
if (this.selectType == "year") {
this.zongcount = 0;
this.date2 = [];
this.dateNum2 = [];
this.years = [];
this.serviceData.selectType = 2;
let parzhi = {
objectType: 0,
BuildingTypeId: this.lastId,
TrendType: this.serviceData.selectType,
};
let parbuild = {
objectType: 0,
OrganizationId: this.lastId,
TrendType: this.serviceData.selectType,
};
/* let paramdata={
BuildingTypeId:this.lastId,
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.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate))
console.log(this.tabledata)
for(var i=0;i<this.tabledata[0].length;i++){
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.tabledata = JSON.parse(JSON.stringify(this.serviceData.allDate));
console.log(this.tabledata);
for (var i = 0; i < this.tabledata[0].length; i++) {
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.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.dateNum2,this.date2)
this.twoInit (this.date2,this.dateNum2,'year')
this.tiaoshiPao = this.serviceData.qipao(
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.twoInit(this.date2,this.dateNum2,'year') */
}
if(this.selectType == "month"){
this.serviceData.selectType=0
this.getdata()
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
if (this.selectType == "month") {
this.serviceData.selectType = 0;
this.getdata();
this.tiaoshiPao = this.serviceData.qipao(
this.tiaoshiPao,
this.dateNum,
this.date
);
//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//顶部大图实例
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}]
date = []
dateNum = []
tiaoshiPao:any
date = [];
dateNum = [];
tiaoshiPao: any;
//气泡提示数据获取
bianli(){
var arrshuzu='[';
for(var i=0;i<this.dateNum.length;i++){
arrshuzu+='{"value":'+this.dateNum[i]+',"coord":['+i+','+this.dateNum[i]+'],"name":'+'"'+this.date[i]+'"'+'},'
bianli() {
var arrshuzu = "[";
for (var i = 0; i < this.dateNum.length; i++) {
arrshuzu +=
'{"value":' +
this.dateNum[i] +
',"coord":[' +
i +
"," +
this.dateNum[i] +
'],"name":' +
'"' +
this.date[i] +
'"' +
"},";
}
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1)
arrshuzu+=']'
this.tiaoshiPao=JSON.parse(arrshuzu)
arrshuzu = arrshuzu.substring(0, arrshuzu.length - 1);
arrshuzu += "]";
this.tiaoshiPao = JSON.parse(arrshuzu);
//console.log(this.tiaoshiPao)
//return tishiPao
}
thisYear=new Date().getFullYear()
date2 = ['2020', '2021','2022']
dateNum2 = []
thisYear = new Date().getFullYear();
date2 = ["2020", "2021", "2022"];
dateNum2 = [];
//新增数量统计
oneInit (date,dateNum) {
this.chartQusj = echarts.init(document.getElementById('Line'), 'skinUpp');
oneInit(date, dateNum) {
this.chartQusj = echarts.init(document.getElementById("Line"), "skinUpp");
var option = {
grid: {
top: 70,
left:40,
left: 40,
right: 20,
bottom: 20,
},
// 标题
title: {
text: '新增数量统计:总数(1012)',
text: "新增数量统计:总数(1012)",
top: -4,
left: 'center',
textStyle:{
left: "center",
textStyle: {
//文字颜色
color:'#000',
color: "#000",
fontSize: 30,
}
},
},
//提示框
tooltip: {
trigger: 'axis',
formatter: (params)=>{
return this.serviceData.tableTooltip(this.serviceData.zuzhiorBuilding=="zhi"?this.serviceData.tableDataZhi :this.serviceData.buildingType,params[0].name)
trigger: "axis",
formatter: (params) => {
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轴
xAxis: {
type: 'category',
type: "category",
data: date,
axisLabel: {
textStyle:{
fontSize :15,
color:'#000000'
textStyle: {
fontSize: 15,
color: "#000000",
},
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
axisLine: {
lineStyle: {
color: "#000",
},
},
splitLine: {//分割线配置
show:true,
splitLine: {
//分割线配置
show: true,
lineStyle: {
color: '#999',
}
}
color: "#999",
},
},
},
// y轴
yAxis: {
type: 'value',
name: '个',
type: "value",
name: "个",
axisLabel: {
textStyle:{
fontSize :15,
color:'#000000'
textStyle: {
fontSize: 15,
color: "#000000",
},
color: "#000" //刻度线标签颜色
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
}
}
},
},
},
// 数据
series: [{
name: '新增数量',
type: 'line',
series: [
{
name: "新增数量",
type: "line",
markPoint: {
symbolSize:[65, 65],
data: this.tiaoshiPao
},
symbolSize: [65, 65],
data: this.tiaoshiPao,
},
data: dateNum,
}
},
],
}
};
this.chartQusj.setOption(option);
}
//剩余折线图
twoInit (date,dateNum,typeName) {
this.forArr.forEach((item,key) => {
let that = this
item.echart = echarts.init(document.getElementById('gaoceng'), 'skinUpp');
twoInit(date, dateNum, typeName) {
this.forArr.forEach((item, key) => {
let that = this;
item.echart = echarts.init(document.getElementById("gaoceng"), "skinUpp");
var option = {
grid: {
top: 90,
},
// 标题
title: {
text: this.headname+`:总数(${this.zongcount}`,
top:-4,
left: 'center',
textStyle:{
text: this.headname + `:总数(${this.zongcount}`,
top: -4,
left: "center",
textStyle: {
//文字颜色
color:'#000',
fontSize:30
}
color: "#000",
fontSize: 30,
},
},
//提示框
tooltip: {
trigger: 'axis',
trigger: "axis",
formatter: function (params) {
//console.log(params)
return '时间:' + params[0].axisValueLabel + '<br>数量: ' + params[0].data;
},
return (
"时间:" + params[0].axisValueLabel + "<br>数量: " + params[0].data
);
},
/* formatter: (params)=>{
if(params[0].seriesName == "year"){
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)
}
}, */
position: this.serviceData.tableTooltipNoShow
position: this.serviceData.tableTooltipNoShow,
},
// x轴
xAxis: {
type: 'category',
type: "category",
data: date,
axisLabel: {
textStyle:{
fontSize :16,
color:'#000000'
textStyle: {
fontSize: 16,
color: "#000000",
},
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
axisLine: {
lineStyle: {
color: "#000",
},
},
splitLine: {//分割线配置
show:true,
splitLine: {
//分割线配置
show: true,
lineStyle: {
color: '#999',
}
}
color: "#999",
},
},
},
// y轴
yAxis: {
//min:10,
type: 'value',
name: '个',
type: "value",
name: "个",
axisLabel: {
textStyle:{
fontSize :16,
color:'#000000'
textStyle: {
fontSize: 16,
color: "#000000",
},
color: "#000" //刻度线标签颜色
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
}
}
},
},
},
// 数据
series: [{
series: [
{
name: typeName,
type: 'line',
type: "line",
markPoint: {
symbolSize:[65, 65],
data: this.tiaoshiPao
},
symbolSize: [65, 65],
data: this.tiaoshiPao,
},
data: dateNum,
}
},
],
};
item.echart.setOption(option,true);
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];
/*事件处理代码书写位置*/
// 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}});
item.echart.setOption(option, true);
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];
/*事件处理代码书写位置*/
// 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.getdata() */
}else{
if(this.serviceData.level=='0'||this.serviceData.level=='1'||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]}})
}
} else {
if (
this.serviceData.level == "0" ||
this.serviceData.level == "1" ||
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(){
this.router.navigateByUrl('/statisticanalysis/addUnit_one')
backClick() {
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(){
window.clearTimeout(this.setTimeoutObj);
if (!this.detailPlanEchart) {
return;
}
this.detailPlanEchart.clear()
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 { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http'
import {EchartsDataService,} from '../../echarts-data.service'
import { map } from 'rxjs/operators';
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { HttpClient } from "@angular/common/http";
import { EchartsDataService } from "../../echarts-data.service";
import { map } from "rxjs/operators";
declare var echarts: any;
@Component({
selector: 'app-building-type-one',
templateUrl: './building-type-one.component.html',
styleUrls: ['./building-type-one.component.scss']
selector: "app-building-type-one",
templateUrl: "./building-type-one.component.html",
styleUrls: ["./building-type-one.component.scss"],
})
export class BuildingTypeOneComponent implements OnInit {
constructor(private http:HttpClient,private router: Router,public echartsData:EchartsDataService) { }
constructor(
private http: HttpClient,
private router: Router,
public echartsData: EchartsDataService
) {}
ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){
this.padHw=true
if (window.matchMedia("(max-width: 1400px)").matches) {
this.padHw = true;
//this.padjt=
}else{
this.padHw=false
} else {
this.padHw = false;
}
window.setTimeout(()=>{
this.getechartsdata()
})
window.setTimeout(() => {
this.getechartsdata();
});
}
ngOnDestroy(): void {
this.indexBzt.clear()
this.indexBzt.dispose()
if (!this.indexBzt) {
return;
}
this.indexBzt.clear();
this.indexBzt.dispose();
}
async getechartsdata(){
await this.echartsData.getData(null,`/api/StatisticsAnalysis/BuildingTypes`)
this.initCharts()
async getechartsdata() {
await this.echartsData.getData(
null,
`/api/StatisticsAnalysis/BuildingTypes`
);
this.initCharts();
}
/* 首页饼状图 */
indexBzt
padHw
lengthdata=[]//提示数据
count=0//总数
indexData=[]//所有数据
tabledata
initCharts(){
if(sessionStorage.getItem('refresh') === 'true') {
sessionStorage.removeItem('refresh');
indexBzt;
padHw;
lengthdata = []; //提示数据
count = 0; //总数
indexData = []; //所有数据
tabledata;
initCharts() {
if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem("refresh");
location.reload();
}
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
// console.log(this.tabledata)
//console.log(this.echartsData.orid)
for(var i=0;i<this.tabledata[0].buildingTypes.length;i++){
this.lengthdata.push(this.tabledata[0].buildingTypes[i].buildingTypeName)
this.count=this.count+this.tabledata[0].buildingTypes[i].count
this.indexData.push(this.tabledata[0].buildingTypes[i])
}
//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}})
//console.log(this.indexData)
this.indexBzt = echarts.init(document.getElementById('indexBzt'),'walden');
let options={
}
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
// console.log(this.tabledata)
//console.log(this.echartsData.orid)
for (var i = 0; i < this.tabledata[0].buildingTypes.length; i++) {
this.lengthdata.push(this.tabledata[0].buildingTypes[i].buildingTypeName);
this.count = this.count + this.tabledata[0].buildingTypes[i].count;
this.indexData.push(this.tabledata[0].buildingTypes[i]);
}
//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 };
});
//console.log(this.indexData)
this.indexBzt = echarts.init(document.getElementById("indexBzt"), "walden");
let options = {
title: {
text: `建筑类型统计(${this.count}家)`,
left: 'center',
top: "7%",
textStyle: {
fontSize:31
}
left: "center",
top: "7%",
textStyle: {
fontSize: 31,
},
},
tooltip: {
trigger: 'item',
trigger: "item",
position: this.echartsData.tableTooltipNoShow2,
formatter: (params)=>{
this.echartsData.biaogeTishiZhi(params.data)
return this.echartsData.res
}
formatter: (params) => {
this.echartsData.biaogeTishiZhi(params.data);
return this.echartsData.res;
},
},
legend: {
orient: 'vertical',
orient: "vertical",
//left:this.padHw?50:0,
right:this.padHw?20:250,
top:60,
textStyle:{
fontSize:18,
color:"#000000"
},
data: this.lengthdata
right: this.padHw ? 20 : 250,
top: 60,
textStyle: {
fontSize: 18,
color: "#000000",
},
data: this.lengthdata,
},
series: [
{
top:this.padHw?'15%':'0',
name: '访问来源',
type: 'pie',
radius: '60%',
center: ['50%', '53%'],
label:{
show:true,
fontSize:18,
formatter:'{b}{c}家\n{d|({d}%)}',
top: this.padHw ? "15%" : "0",
name: "访问来源",
type: "pie",
radius: "60%",
center: ["50%", "53%"],
label: {
show: true,
fontSize: 18,
formatter: "{b}{c}家\n{d|({d}%)}",
rich: {
d: {
align: 'center',
fontSize:18
}
align: "center",
fontSize: 18,
},
},
},
data:this.indexData,
data: this.indexData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
this.indexBzt.on('click', (params) => {
var index=0
for(var i=0;i<this.tabledata[0].buildingTypes.length;i++){
if(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.indexBzt.on("click", (params) => {
var index = 0;
for (var i = 0; i < this.tabledata[0].buildingTypes.length; i++) {
if (
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) => {
if(array[index].organizationId==this.echartsData.orid){
array.splice(index,1)
this.tabledata[0].buildingTypes[i].organizations.forEach(
(value, index, array) => {
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{
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1,'buildid':params.data.id}});
}
});
}else {
);
} 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);
}
tishiData
res:string
biaogeTishiZhi(datas){
for(var a in this.tabledata.buildingTypes){
if(this.tabledata.buildingTypes[a].buildingTypeId==datas.id){
this.tishiData=this.tabledata.buildingTypes[a].organizations
tishiData;
res: string;
biaogeTishiZhi(datas) {
for (var a in this.tabledata.buildingTypes) {
if (this.tabledata.buildingTypes[a].buildingTypeId == datas.id) {
this.tishiData = this.tabledata.buildingTypes[a].organizations;
}
}
var countall=0//总计
var countbi=0//站比
var allCountbi=0//总站比
for(var i=0;i<this.tishiData.length;i++){
countall+=this.tishiData[i].count
}
this.res= '<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#FFFFFF;font-size:27px;text-align: center;display:block;">'+datas.name+'</span></div>'
this.res+='</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px;font-size:16px; color:#FFFFFF;border-collapse:collapse;"cellspacing="0"; >';
this.res+='<thead style="font-size:18px;"><tr>';
this.res+='<td style="text-align:center;width:30%;">名称</td>';
this.res+='<td style="text-align:center;width:30%;">数量</td>'
this.res+='<td style="text-align:center;width:30%;">总占比</td>'
this.res+='</tr></thead>'
this.res+='<tbody>';
//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<this.tishiData.length;i++){
countbi=Math.round(this.tishiData[i].count/countall* 10000)/ 100.00
allCountbi=allCountbi+countbi
this.res+='<tr>'
this.res+='<td style="text-align:center;">'+this.tishiData[i].organizationName+'</td>'
this.res+='<td style="text-align:center;">'+this.tishiData[i].count+'</td>'
this.res+='<td style="text-align:center;">'+countbi+'%</td></tr>'
}
this.res+='</tbody>'
this.res+='<tfoot style="font-size:18px;"><td style="text-align:center;">总计</td><td style="text-align:center;">'+countall+'</td><td style="text-align:center;">'+allCountbi.toFixed(2)+'%</td></tfoot>'
this.res+='</table></div></div>'
return this.res
}
var countall = 0; //总计
var countbi = 0; //站比
var allCountbi = 0; //总站比
for (var i = 0; i < this.tishiData.length; i++) {
countall += this.tishiData[i].count;
}
this.res =
'<div class="tishi" style=" backgroundColor:rgba(255,255,255,1);width:100%;height:100%;"><div style="padding:10px 0 5px 0"><span style="color:#FFFFFF;font-size:27px;text-align: center;display:block;">' +
datas.name +
"</span></div>";
this.res +=
'</br><div style="width:300px;height:100%;padding:0 20px 15px 20px"><table style="width:300px;font-size:16px; color:#FFFFFF;border-collapse:collapse;"cellspacing="0"; >';
this.res += '<thead style="font-size:18px;"><tr>';
this.res += '<td style="text-align:center;width:30%;">名称</td>';
this.res += '<td style="text-align:center;width:30%;">数量</td>';
this.res += '<td style="text-align:center;width:30%;">总占比</td>';
this.res += "</tr></thead>";
this.res += "<tbody>";
//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 < this.tishiData.length; i++) {
countbi =
Math.round((this.tishiData[i].count / countall) * 10000) / 100.0;
allCountbi = allCountbi + countbi;
this.res += "<tr>";
this.res +=
'<td style="text-align:center;">' +
this.tishiData[i].organizationName +
"</td>";
this.res +=
'<td style="text-align:center;">' + this.tishiData[i].count + "</td>";
this.res += '<td style="text-align:center;">' + countbi + "%</td></tr>";
}
this.res += "</tbody>";
this.res +=
'<tfoot style="font-size:18px;"><td style="text-align:center;">总计</td><td style="text-align:center;">' +
countall +
'</td><td style="text-align:center;">' +
allCountbi.toFixed(2) +
"%</td></tfoot>";
this.res += "</table></div></div>";
return this.res;
}
}

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

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

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

@ -1,153 +1,195 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import {EchartsDataService,} from '../../echarts-data.service'
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any;
@Component({
selector: 'app-delete-one',
templateUrl: './delete-one.component.html',
styleUrls: ['./delete-one.component.scss']
selector: "app-delete-one",
templateUrl: "./delete-one.component.html",
styleUrls: ["./delete-one.component.scss"],
})
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() {
window.setTimeout(()=>{
this.initCharts()
},0)
window.setTimeout(() => {
this.initCharts();
}, 0);
}
ngOnDestroy():void{
this.indexBzt.clear()
this.indexBzt.dispose()
ngOnDestroy(): void {
if (this.indexBzt) {
this.indexBzt.clear();
this.indexBzt.dispose();
}
}
/* 首页饼状图 */
initCharts(){
initCharts() {
//console.log(document.getElementById('indexBzt'))
var ec = echarts as any;
this.indexBzt = ec.init(document.getElementById('indexBzt'),'walden');
var options={
this.indexBzt = ec.init(document.getElementById("indexBzt"), "walden");
var options = {
title: {
text: '删除单位统计(8900家)',
left: 'center',
top: "7%",
textStyle:{
fontSize:31
}
text: "删除单位统计(8900家)",
left: "center",
top: "7%",
textStyle: {
fontSize: 31,
},
},
tooltip: {
trigger: 'item',
//position: this.echartsData.tableTooltipNoShow2,
formatter: (params)=>{
//return this.biaogeTishi(params.name)
return this.echartsData.biaogeTishiZhi(params.name)
}
trigger: "item",
//position: this.echartsData.tableTooltipNoShow2,
formatter: (params) => {
//return this.biaogeTishi(params.name)
return this.echartsData.biaogeTishiZhi(params.name);
},
},
legend: {
orient: 'vertical',
right: 150,
top:80,
//padding:20,
// itemWidth:60,
// itemHeight:25,
textStyle:{
fontSize:18,
color:"#000000"
},
data: ['高层', '地下', '轨道交通', '化工生产', '储罐类', '厂房', '古建筑', '商市场', '医院', '学校', '宾馆', '娱乐场所', '餐饮业', '影剧院', '展览建筑', '隧道']
orient: "vertical",
right: 150,
top: 80,
//padding:20,
// itemWidth:60,
// itemHeight:25,
textStyle: {
fontSize: 18,
color: "#000000",
},
data: [
"高层",
"地下",
"轨道交通",
"化工生产",
"储罐类",
"厂房",
"古建筑",
"商市场",
"医院",
"学校",
"宾馆",
"娱乐场所",
"餐饮业",
"影剧院",
"展览建筑",
"隧道",
],
},
series: [
{
name: '访问来源',
type: 'pie',
radius: '65%',
center: ['50%', '60%'],
label:{
show:true,
fontSize:18,
formatter:'{b}{c}家\n{d|({d}%)}',
{
name: "访问来源",
type: "pie",
radius: "65%",
center: ["50%", "60%"],
label: {
show: true,
fontSize: 18,
formatter: "{b}{c}家\n{d|({d}%)}",
rich: {
d: {
align: 'center',
fontSize:18
}
},
align: "center",
fontSize: 18,
},
data: [
{value: 500, name: '高层'},
{value: 1300, name: '地下',itemStyle:{color:'#02A7F0'}},
{value: 1500, name: '轨道交通'},
{value: 1500, name: '化工生产'},
{value: 1700, name: '储罐类'},
{value: 800, name: '厂房'},
{value: 1500, 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: '隧道'}
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
},
},
data: [
{ value: 500, name: "高层" },
{ value: 1300, name: "地下", itemStyle: { color: "#02A7F0" } },
{ value: 1500, name: "轨道交通" },
{ value: 1500, name: "化工生产" },
{ value: 1700, name: "储罐类" },
{ value: 800, name: "厂房" },
{ value: 1500, 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: "隧道" },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
this.indexBzt.on('click', (params) => {
this.router.navigateByUrl('/statisticanalysis/delete_one/delete_two');
this.indexBzt.on("click", (params) => {
this.router.navigateByUrl("/statisticanalysis/delete_one/delete_two");
});
this.indexBzt.setOption(options);
}
/**
* @name:
* @test: test font
* @msg:
* @msg:
* @param {string()}
* @return {type}
* @return {type}
*/
biaogeTishi(biaotou:string){
var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},'
shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},'
shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},'
shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]'
var jsonObj = JSON.parse(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>'
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+='<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+='<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
}
biaogeTishi(biaotou: string) {
var shuju =
'[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},';
shuju +=
'{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},';
shuju +=
'{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},';
shuju +=
'{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},';
shuju +=
'{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},';
shuju +=
'{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]';
var jsonObj = JSON.parse(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>";
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 +=
'<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 +=
'<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:
* @version:
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2020-09-02 16:22:35
* @LastEditors: sueRimn
* @LastEditTime: 2020-11-16 09:40:04
*/
import { Component, OnInit } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router';
import {EchartsDataService} from '../../echarts-data.service';
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
import { DateAdapter } from '@angular/material/core';
import { Component, OnInit } from "@angular/core";
import { Router, ActivatedRoute } from "@angular/router";
import { EchartsDataService } from "../../echarts-data.service";
import { MatSnackBarConfig, MatSnackBar } from "@angular/material/snack-bar";
import { DateAdapter } from "@angular/material/core";
declare var echarts: any;
@Component({
selector: 'app-delete-there',
templateUrl: './delete-there.component.html',
styleUrls: ['./delete-there.component.scss']
selector: "app-delete-there",
templateUrl: "./delete-there.component.html",
styleUrls: ["./delete-there.component.scss"],
})
export class DeleteThereComponent implements OnInit {
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
ngOnDestroy():void{
this.zhutu.clear()
this.zhutu.dispose()
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;
ngOnDestroy(): void {
if (this.zhutu) {
this.zhutu.clear();
this.zhutu.dispose();
}
}
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();
//let headtext:string;
let datayuex:string;
let headName:string;
let datayuex: string;
let headName: string;
// console.log(this.activatedRoute.queryParams.subscribe)
//headtext=this.activatedRoute.queryParams["headtext"];
this.activatedRoute.queryParams.subscribe(param=>{
this.headtext=param.headtext
datayuex=param.level
this.zhong=param.zhong
headName=this.headtext+''+datayuex;
this.activatedRoute.queryParams.subscribe((param) => {
this.headtext = param.headtext;
datayuex = param.level;
this.zhong = param.zhong;
headName = this.headtext + "" + datayuex;
//console.log(headName)
});
window.setTimeout(()=>{
this.zhuzhuangtu(headName)
},0)
});
window.setTimeout(() => {
this.zhuzhuangtu(headName);
}, 0);
}
selectType:string = 'month'; //选择当前的 查询类型 按月/年
selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据
years:any = []
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12]
years: any = [];
selectMonth: any = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
//日期初始化
dateInit () {
let date = (new Date()).getFullYear()
for (let i=date; i>=date-10;i--) {
this.years.unshift(i)
dateInit() {
let date = new Date().getFullYear();
for (let i = date; i >= date - 10; i--) {
this.years.unshift(i);
}
// 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 = {
show: true, // 开启显示
position: 'top', // 在上方显示
position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle',
textStyle: { // 数值样式
color: 'black',
fontSize: 12
}
}//柱状图数值顶部显示
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队","松江支队","金山支队","崇明支队"]
zhiNumData = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队","松江中队","金山中队","崇明中队"]
tiaoshiPao:any
verticalAlign: "middle",
textStyle: {
// 数值样式
color: "black",
fontSize: 12,
},
}; //柱状图数值顶部显示
zhiNameData = [
"浦东支队",
"黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
"松江支队",
"金山支队",
"崇明支队",
];
zhiNumData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
"松江中队",
"金山中队",
"崇明中队",
];
tiaoshiPao: any;
//气泡提示数据获取
bianli(){
var arrshuzu='[';
for(var i=0;i<this.zhiNumData.length;i++){
arrshuzu+='{"value":'+this.zhiNumData[i]+',"coord":['+i+','+this.zhiNumData[i]+'],"name":'+'"'+this.zhiNameData[i]+'"'+'},'
bianli() {
var arrshuzu = "[";
for (var i = 0; i < this.zhiNumData.length; i++) {
arrshuzu +=
'{"value":' +
this.zhiNumData[i] +
',"coord":[' +
i +
"," +
this.zhiNumData[i] +
'],"name":' +
'"' +
this.zhiNameData[i] +
'"' +
"},";
}
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1)
arrshuzu+=']'
this.tiaoshiPao=JSON.parse(arrshuzu)
arrshuzu = arrshuzu.substring(0, arrshuzu.length - 1);
arrshuzu += "]";
this.tiaoshiPao = JSON.parse(arrshuzu);
//return tishiPao
}
date = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月','九月']
dateNum = [0, 0, 0, 0, 0, 0, 0, 0,0]
date = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
];
dateNum = [0, 0, 0, 0, 0, 0, 0, 0, 0];
//返回
goBack () {
history.go(-1)
this.echartsData.statefulInspectionToggle = true
goBack() {
history.go(-1);
this.echartsData.statefulInspectionToggle = true;
}
axisLabel = {
interval: 0,
formatter:function(value)
{
var ret = "";//拼接加\n返回的类目项
var maxLength = 2;//每项显示文字个数
var valLength = value.length;//X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1)//如果类目项的文字大于3,
{
for (var i = 0; i < rowN; i++) {
var temp = "";//每次截取的字符串
var start = i * maxLength;//开始截取的位置
var end = start + maxLength;//结束截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
temp = value.substring(start, end) + "\n";
ret += temp; //凭借最终的字符串
}
return ret;
}
else {
return value;
}
}
}//echarts两个字换行
interval: 0,
formatter: function (value) {
var ret = ""; //拼接加\n返回的类目项
var maxLength = 2; //每项显示文字个数
var valLength = value.length; //X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1) {
//如果类目项的文字大于3,
for (var i = 0; i < rowN; i++) {
var temp = ""; //每次截取的字符串
var start = i * maxLength; //开始截取的位置
var end = start + maxLength; //结束截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
temp = value.substring(start, end) + "\n";
ret += temp; //凭借最终的字符串
}
return ret;
} else {
return value;
}
},
}; //echarts两个字换行
/* 柱状图 */
zhuzhuangtu(headName:string){
zhuzhuangtu(headName: string) {
var ec = echarts as any;
this.zhutu = ec.init(document.getElementById('zhidui'),'walden');
this.zhutu = ec.init(document.getElementById("zhidui"), "walden");
this.option = {
title: {
text: headName+':总数(0)',
text: headName + ":总数(0)",
left: "center",
top: "0",
textStyle: {
fontSize: 30
}
fontSize: 30,
},
},
/* grid: {
left: '5%',
bottom:'35%'
}, */
xAxis: {
type: 'category',
data: this.zhiNameData,
//axisLabel: this.axisLabel,
axisLabel:{
//this.axisLabel,
textStyle:{
fontSize :18,
color:'#000000'
}
}
type: "category",
data: this.zhiNameData,
//axisLabel: this.axisLabel,
axisLabel: {
//this.axisLabel,
textStyle: {
fontSize: 18,
color: "#000000",
},
},
},
yAxis: {
type: 'value',
axisLabel:{
textStyle:{
fontSize :18,
color:'#000000'
}
}
type: "value",
axisLabel: {
textStyle: {
fontSize: 18,
color: "#000000",
},
},
},
tooltip: {
trigger: 'item',
formatter: (params)=>{
return this.echartsData.tableTooltip('',headName)
trigger: "item",
formatter: (params) => {
return this.echartsData.tableTooltip("", headName);
},
position: this.echartsData.tableTooltipNoShowq
position: this.echartsData.tableTooltipNoShowq,
/* backgroundColor:'rgba(255,255,255,1)',
borderWidth:'1',
borderRadius :'0' */
},
series: [{
series: [
{
data: this.zhiNumData,
type: 'bar',
type: "bar",
markPoint: {
symbolSize:[65, 65],
data: this.tiaoshiPao
},
symbolSize: [65, 65],
data: this.tiaoshiPao,
},
backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)'
color: "rgba(220, 220, 220, 0.8)",
},
barWidth :'38',
barWidth: "38",
//label: this.topTextlabel
}]
},
],
};
this.zhutu.getZr().on('click',params=>{
this.zhutu.getZr().on("click", (params) => {
// console.log(params.name)
const pointInPixel= [params.offsetX, params.offsetY];
if (this.zhutu.containPixel('grid',pointInPixel)) {
let xIndex=this.zhutu.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
const pointInPixel = [params.offsetX, params.offsetY];
if (this.zhutu.containPixel("grid", pointInPixel)) {
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) => {
@ -215,37 +277,50 @@ export class DeleteThereComponent implements OnInit {
this.zhutu.setOption(this.option);
}
/* 鼠标悬停提示 */
tableTooltip2(biaotou:string){
var shuju='[{"name":"浦东中队","number":"156","zhanbi":"3%"},{"name":"黄浦中队","number":"144","zhanbi":"2.8%"},'
shuju+='{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"静安中队","number":"120","zhanbi":"1.3%"},{"name":"普陀中队","number":"100","zhanbi":"1.1%"},'
shuju+='{"name":"虹口中队","number":"95","zhanbi":"1%"},{"name":"杨浦中队","number":"90","zhanbi":"0.9%"},'
shuju+='{"name":"闵行中队","number":"88","zhanbi":"0.8%"},{"name":"宝山中队","number":"83","zhanbi":"0.7%"},'
shuju+='{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"嘉定中队","number":"78","zhanbi":"0.6%"},{"name":"松江中队","number":"75","zhanbi":"0.5%"},'
shuju+='{"name":"金山中队","number":"65","zhanbi":"0.4%"},{"name":"崇明中队","number":"55","zhanbi":"0.3%"}]'
var jsonObj = JSON.parse(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>'
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>';
//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
}
/* 鼠标悬停提示 */
tableTooltip2(biaotou: string) {
var shuju =
'[{"name":"浦东中队","number":"156","zhanbi":"3%"},{"name":"黄浦中队","number":"144","zhanbi":"2.8%"},';
shuju +=
'{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"静安中队","number":"120","zhanbi":"1.3%"},{"name":"普陀中队","number":"100","zhanbi":"1.1%"},';
shuju +=
'{"name":"虹口中队","number":"95","zhanbi":"1%"},{"name":"杨浦中队","number":"90","zhanbi":"0.9%"},';
shuju +=
'{"name":"闵行中队","number":"88","zhanbi":"0.8%"},{"name":"宝山中队","number":"83","zhanbi":"0.7%"},';
shuju +=
'{"name":"徐汇中队","number":"133","zhanbi":"2.1%"},{"name":"长宁中队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"嘉定中队","number":"78","zhanbi":"0.6%"},{"name":"松江中队","number":"75","zhanbi":"0.5%"},';
shuju +=
'{"name":"金山中队","number":"65","zhanbi":"0.4%"},{"name":"崇明中队","number":"55","zhanbi":"0.3%"}]';
var jsonObj = JSON.parse(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>";
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>";
//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 { Router } from '@angular/router';
import {MatDialog, MatDialogRef, 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';
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import {
MatDialog,
MatDialogRef,
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;
@Component({
selector: 'app-delete-two-newadd',
templateUrl: './delete-two-newadd.component.html',
styleUrls: ['./delete-two-newadd.component.scss']
selector: "app-delete-two-newadd",
templateUrl: "./delete-two-newadd.component.html",
styleUrls: ["./delete-two-newadd.component.scss"],
})
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
level:String
setTimeoutObj//延时器需要清除
year: String;
buildingTypeName: String;
level: String;
setTimeoutObj; //延时器需要清除
ngOnInit(): void {
this.dateInit ()
this.bianli()
this.route.queryParams.subscribe(params => {
this.year = params['level'];
this.buildingTypeName = params['headtext'];
this.dateInit();
this.bianli();
this.route.queryParams.subscribe((params) => {
this.year = params["level"];
this.buildingTypeName = params["headtext"];
});
this.setTimeoutObj = window.setTimeout(() => {
this.detailEcharts();
});
this.setTimeoutObj = window.setTimeout(()=>{
this.detailEcharts()
})
}
ngOnDestroy(){
ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj);
this.detailPlanEchart.clear()
this.detailPlanEchart.dispose()
if (this.detailPlanEchart) {
this.detailPlanEchart.clear();
this.detailPlanEchart.dispose();
}
}
selectType:string = 'month'; //选择当前的 查询类型 按月/年
selectType: string = "month"; //选择当前的 查询类型 按月/年
//查询数据
years:any = []
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12]
years: any = [];
selectMonth: any = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
//日期初始化
dateInit () {
let date = (new Date()).getFullYear()
for (let i=date; i>=date-10;i--) {
this.years.unshift(i)
dateInit() {
let date = new Date().getFullYear();
for (let i = date; i >= date - 10; i--) {
this.years.unshift(i);
}
}
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 = {
show: true, // 开启显示
position: 'top', // 在上方显示
position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle',
textStyle: { // 数值样式
color: 'black',
fontSize: 12
}
}//柱状图数值顶部显示
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"]
zhongNumData = [0,0,0,0,0,0,0,0,0,0,0]
verticalAlign: "middle",
textStyle: {
// 数值样式
color: "black",
fontSize: 12,
},
}; //柱状图数值顶部显示
zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
];
zhongNumData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队"]
zhiNumData = [0,0,0,0,0,0,0,0,0,0,0]
tiaoshiPao:any
zhiNameData = [
"浦东支队",
"黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
];
zhiNumData = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
tiaoshiPao: any;
//气泡提示数据获取
bianli(){
var arrshuzu='[';
for(var i=0;i<this.dateNum.length;i++){
arrshuzu+='{"value":'+this.dateNum[i]+',"coord":['+i+','+this.dateNum[i]+'],"name":'+'"'+this.date[i]+'"'+'},'
bianli() {
var arrshuzu = "[";
for (var i = 0; i < this.dateNum.length; i++) {
arrshuzu +=
'{"value":' +
this.dateNum[i] +
',"coord":[' +
i +
"," +
this.dateNum[i] +
'],"name":' +
'"' +
this.date[i] +
'"' +
"},";
}
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1)
arrshuzu+=']'
this.tiaoshiPao=JSON.parse(arrshuzu)
arrshuzu = arrshuzu.substring(0, arrshuzu.length - 1);
arrshuzu += "]";
this.tiaoshiPao = JSON.parse(arrshuzu);
//return tishiPao
}
//返回
goBack () {
history.go(-1)
goBack() {
history.go(-1);
//this.echartsData.statefulInspectionToggle = true
}
detailPlanEchart
option
date = ['高层', '轨道交通', '储罐类', '古建筑', '地下', '化工生产', '厂房', '商市场']
dateNum = [0, 0, 0, 0, 0, 0, 0, 0]
detailPlanEchart;
option;
date = [
"高层",
"轨道交通",
"储罐类",
"古建筑",
"地下",
"化工生产",
"厂房",
"商市场",
];
dateNum = [0, 0, 0, 0, 0, 0, 0, 0];
detailEcharts(){
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp');
detailEcharts() {
this.detailPlanEchart = echarts.init(
document.getElementById("barEchart"),
"skinUpp"
);
this.option = {
grid: {
top: 90,
left:40,
left: 40,
right: 20,
//bottom: 20,
},
// 标题
title: {
text: this.buildingTypeName + '(' + this.year + ')',
text: this.buildingTypeName + "(" + this.year + ")",
top: -4,
left: 'center',
textStyle:{
left: "center",
textStyle: {
//文字颜色
color:'#000',
fontSize: 30
}
color: "#000",
fontSize: 30,
},
},
//提示框
tooltip: {
trigger: 'axis',
formatter: (params)=>{
if(params[0].seriesName == "year"){
return this.serviceData.tableTooltip(this.serviceData.monthTooltip,params[0].name)
}else{
return this.serviceData.tableTooltip(this.serviceData.tableDataZhi,params[0].name)
trigger: "axis",
formatter: (params) => {
if (params[0].seriesName == "year") {
return this.serviceData.tableTooltip(
this.serviceData.monthTooltip,
params[0].name
);
} else {
return this.serviceData.tableTooltip(
this.serviceData.tableDataZhi,
params[0].name
);
}
},
position:this.serviceData.tableTooltipNoShow2
position: this.serviceData.tableTooltipNoShow2,
},
// x轴
xAxis: {
type: 'category',
type: "category",
data: this.date,
axisLabel: {
color: "#000", //刻度线标签颜色
textStyle:{
fontSize :18,
color:'#000000'
}
textStyle: {
fontSize: 18,
color: "#000000",
},
},
//设置坐标轴字体颜色和宽度
axisLine: {
axisLine: {
lineStyle: {
color: "#000",
},
},
splitLine: {//分割线配置
show:true,
splitLine: {
//分割线配置
show: true,
lineStyle: {
color: '#999',
}
}
color: "#999",
},
},
},
// y轴
yAxis: {
type: 'value',
name: '个',
type: "value",
name: "个",
axisLabel: {
//color: "#000", //刻度线标签颜色
textStyle:{
fontSize :18,
color:'#000000'
}
textStyle: {
fontSize: 18,
color: "#000000",
},
},
//设置坐标轴字体颜色和宽度
axisLine: {
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
}
}
},
},
},
// 数据
series: [{
name: 'xxx',
type: 'line',
series: [
{
name: "xxx",
type: "line",
markPoint: {
symbolSize:[65, 65],
data: this.tiaoshiPao
},
symbolSize: [65, 65],
data: this.tiaoshiPao,
},
data: this.dateNum,
}
},
],
};
this.detailPlanEchart.setOption(this.option);
this.detailPlanEchart.getZr().on('click',params=>{
const pointInPixel= [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
this.detailPlanEchart.getZr().on("click", (params) => {
const pointInPixel = [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel("grid", pointInPixel)) {
let xIndex = this.detailPlanEchart.convertFromPixel(
{ seriesIndex: 0 },
[params.offsetX, params.offsetY]
)[0];
/*事件处理代码书写位置*/
if(this.serviceData.level=='0'){
this.router.navigate(['/statisticanalysis/delete_one/delete_there'],{queryParams:{'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}});
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",
},
});
} else if (this.serviceData.level == "1") {
this.router.navigate(["/statisticanalysis/delete_one/delete_four"], {
queryParams: {
level: this.option.xAxis.data[xIndex] + this.buildingTypeName,
},
});
}
}
});
}
//返回按钮
backBtn(){
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
backBtn() {
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;
}
}

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

@ -1,123 +1,209 @@
/*
* @Descripttion:
* @version:
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2020-09-02 16:21:18
* @LastEditors: sueRimn
* @LastEditTime: 2021-06-24 15:27:13
*/
import { Component, OnInit, ViewChild } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { MatDatepickerInputEvent } from '@angular/material/datepicker';
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
import { DateAdapter } from '@angular/material/core';
import {EchartsDataService,} from '../../echarts-data.service'
import { Component, OnInit, ViewChild } from "@angular/core";
import { Router, ActivatedRoute } from "@angular/router";
import { MatDatepickerInputEvent } from "@angular/material/datepicker";
import { MatSnackBarConfig, MatSnackBar } from "@angular/material/snack-bar";
import { DateAdapter } from "@angular/material/core";
import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any;
@Component({
selector: 'app-delete-two',
templateUrl: './delete-two.component.html',
styleUrls: ['./delete-two.component.scss']
selector: "app-delete-two",
templateUrl: "./delete-two.component.html",
styleUrls: ["./delete-two.component.scss"],
})
export class DeleteTwoComponent implements OnInit {
options:any;
datayuex=['一月', '二月', '三月', '四月', '五月', '六月', '七月','八月','九月'];
datayuey=[0, 0, 0, 0, 0, 0, 0,0,0];
datanianx=[2020,2021];
dataniany=[0,0]
tiaoshiPao:any//气泡
options: any;
datayuex = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
];
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('pageTwoName')pageTwoName :PageTwoNameComponent; //父组件中获得子组件的引用 */
ngOnInit(): void {
this.echartsData.statefulInspectionToggle=true
this.dateInit()
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
this.echartsData.statefulInspectionToggle = true;
this.dateInit();
this.tiaoshiPao = this.echartsData.qipao(
this.tiaoshiPao,
this.datayuey,
this.datayuex
);
//this.bianli()
window.setTimeout(()=>{
this.getechartsdata()
},0)
window.setTimeout(() => {
this.getechartsdata();
}, 0);
}
ngOnDestroy():void{
this.headZx.clear()
this.headZx.dispose()
ngOnDestroy(): void {
if (this.headZx) {
this.headZx.clear();
this.headZx.dispose();
}
}
selectType:string = 'month'; //选择当前的 查询类型 按月/年
headZx//echarts实例
selectType: string = "month"; //选择当前的 查询类型 按月/年
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 = []
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12]
years: any = [];
selectMonth: any = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
//日期初始化
dateInit () {
let date = (new Date()).getFullYear()
for (let i=date; i>=date-10;i--) {
this.years.unshift(i)
dateInit() {
let date = new Date().getFullYear();
for (let i = date; i >= date - 10; i--) {
this.years.unshift(i);
}
}
TimeType=0//按月查询还是按年查询
selectOneYear:any = (new Date()).getFullYear() //开始年份
selectTwoYear:any = (new Date()).getFullYear() //结束年份
selectStartMonth:any = 1 //开始月份
selectEndMonth:any = (new Date()).getMonth()+1 //结束月份
TimeType = 0; //按月查询还是按年查询
selectOneYear: any = new Date().getFullYear(); //开始年份
selectTwoYear: any = new Date().getFullYear(); //结束年份
selectStartMonth: any = 1; //开始月份
selectEndMonth: any = new Date().getMonth() + 1; //结束月份
//点击月
monthClick(){
this.TimeType=0
this.tiaoshiPao=null
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
this.headZhexian('Line','删除数量总统计',this.datayuex,this.datayuey)
monthClick() {
this.TimeType = 0;
this.tiaoshiPao = null;
this.tiaoshiPao = this.echartsData.qipao(
this.tiaoshiPao,
this.datayuey,
this.datayuex
);
this.headZhexian("Line", "删除数量总统计", this.datayuex, this.datayuey);
}
//按月查询
monthSubmit (e) {
this.headZhexian('Line','删除数量总统计',this.datayuex,this.datayuey)
monthSubmit(e) {
this.headZhexian("Line", "删除数量总统计", this.datayuex, this.datayuey);
if (e.selectTwoYear > e.selectOneYear) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0
let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59
let startTime =
e.selectOneYear +
"-" +
e.selectStartMonth +
"-" +
1 +
" " +
0 +
":" +
0 +
":" +
0;
let endTime =
e.selectTwoYear +
"-" +
e.selectEndMonth +
"-" +
31 +
" " +
23 +
":" +
59 +
":" +
59;
// console.log(startTime)
// console.log(endTime)
} else if (e.selectTwoYear === e.selectOneYear) {
if(e.selectEndMonth >= e.selectStartMonth) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0
let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59
if (e.selectEndMonth >= e.selectStartMonth) {
let startTime =
e.selectOneYear +
"-" +
e.selectStartMonth +
"-" +
1 +
" " +
0 +
":" +
0 +
":" +
0;
let endTime =
e.selectTwoYear +
"-" +
e.selectEndMonth +
"-" +
31 +
" " +
23 +
":" +
59 +
":" +
59;
// console.log(startTime)
// console.log(endTime)
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择正确时间区段','确定',config);
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("请选择正确时间区段", "确定", config);
}
}else {
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择正确时间区段','确定',config);
config.verticalPosition = "top";
config.duration = 3000;
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(){
this.TimeType=1
this.tiaoshiPao=null
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataniany,this.datanianx)
this.headZhexian('Line','删除数量总统计',this.datanianx,this.dataniany)
yearClick() {
this.TimeType = 1;
this.tiaoshiPao = null;
this.tiaoshiPao = this.echartsData.qipao(
this.tiaoshiPao,
this.dataniany,
this.datanianx
);
this.headZhexian("Line", "删除数量总统计", this.datanianx, this.dataniany);
}
//按年查询
yearSubmit (e) {
yearSubmit(e) {
//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('leftTwo','轨道交通',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('rightFour','商市场',this.datanianx,this.dataniany) */
if (e.selectEndYear >= e.selectStartYear) {
let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0
let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59
let startTime =
e.selectStartYear + "-" + 1 + "-" + 1 + " " + 0 + ":" + 0 + ":" + 0;
let endTime =
e.selectEndYear + "-" + 12 + "-" + 31 + " " + 23 + ":" + 59 + ":" + 59;
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择正确时间区段','确定',config);
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("请选择正确时间区段", "确定", config);
}
}
//支队查询
zhiFind(){
this.echartsData.dezhiorBuinding="zhi"
zhiFind() {
this.echartsData.dezhiorBuinding = "zhi";
}
//建筑类型查询
buildingFind(){
this.echartsData.dezhiorBuinding="building"
buildingFind() {
this.echartsData.dezhiorBuinding = "building";
}
//返回
goBack(){
history.go(-1)
goBack() {
history.go(-1);
}
//获取数据
tabledata
async getechartsdata(){
let Parameters={
MaintainedState:this.route.snapshot.queryParams.type,
TimeType:this.TimeType,
TimeStart:this.TimeType==0?this.selectStartYear+'-'+this.selectStartMonth:this.selectStartYear,
TimeEnd:this.TimeType==0?this.selectEndYear+'-'+this.selectEndMonth:this.selectEndYear,
tabledata;
async getechartsdata() {
let Parameters = {
MaintainedState: this.route.snapshot.queryParams.type,
TimeType: this.TimeType,
TimeStart:
this.TimeType == 0
? this.selectStartYear + "-" + this.selectStartMonth
: this.selectStartYear,
TimeEnd:
this.TimeType == 0
? this.selectEndYear + "-" + this.selectEndMonth
: this.selectEndYear,
//OrganizationId
}
await this.echartsData.getData(Parameters,`/api/StatisticsAnalysis/Companies/Maintained/OrganizationTrend`)
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata)
this.headZhexian('Line','删除数量总统计',this.datayuex,this.datayuey)
};
await this.echartsData.getData(
Parameters,
`/api/StatisticsAnalysis/Companies/Maintained/OrganizationTrend`
);
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
console.log(this.tabledata);
this.headZhexian("Line", "删除数量总统计", this.datayuex, this.datayuey);
}
/**
* @name: 线
* @test: test font
* @msg:
* @param {divid(div),headtext()}
* @return {type}
*/
headZhexian(divid:string,headtext:string,datayuex,datayuey){
var dianji:boolean=headtext=="删除数量总统计" ? false:true;
var divsiaze={contentSize: [350, 496], viewSize: [831, 380]}
var pagex
var pagey
var boxsize=[pagex,pagey]
* @msg:
* @param {divid(div),headtext()}
* @return {type}
*/
headZhexian(divid: string, headtext: string, datayuex, datayuey) {
var dianji: boolean = headtext == "删除数量总统计" ? false : true;
var divsiaze = { contentSize: [350, 496], viewSize: [831, 380] };
var pagex;
var pagey;
var boxsize = [pagex, pagey];
/* document.onmouseover=function(e){
console.log("000")
pagex=e.pageX
pagey=e.pageY
} */
var ec = echarts as any;
this.headZx = ec.init(document.getElementById(`${divid}`),'skinUpp');
this.headZx = ec.init(document.getElementById(`${divid}`), "skinUpp");
this.options = {
grid: {
top: 50,
left:40,
left: 40,
right: 20,
bottom: 20,
},
// 标题
title: {
text: `${headtext}`+`:总数(${this.tabledata[0].totalCount}`,
left:'center',
text: `${headtext}` + `:总数(${this.tabledata[0].totalCount}`,
left: "center",
top: -4,
//副标题文本样式
 subtextStyle:{
color:'#999',
fontWeight:'bold',
},
textStyle:{
subtextStyle: {
color: "#999",
fontWeight: "bold",
},
textStyle: {
//文字颜色
color:'#000',
fontSize:divid=='Line'?30: 22,
}
color: "#000",
fontSize: divid == "Line" ? 30 : 22,
},
},
//提示框
tooltip: {
trigger: 'axis',
formatter: (params)=>{
return this.echartsData.dezhiorBuinding=="zhi"?this.echartsData.tableTooltip(this.echartsData.tableDataZhi,`${headtext}`):this.echartsData.tableTooltip(this.echartsData.buildingType,`${headtext}`)
trigger: "axis",
formatter: (params) => {
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调节背景颜色与透明度
borderWidth:'1',
borderRadius :'0', */
position: this.echartsData.tableTooltipNoShow2
position: this.echartsData.tableTooltipNoShow2,
},
xAxis: {
type: 'category',
boundaryGap:true,
data: datayuex,
axisLabel: {
textStyle:{
fontSize :15,
color:'#000000'
},
color: "#000", //刻度线标签颜色
type: "category",
boundaryGap: true,
data: datayuex,
axisLabel: {
textStyle: {
fontSize: 15,
color: "#000000",
},
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
},
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
},
splitLine: {//分割线配置
show:true,
lineStyle: {
color: '#999',
}
}
},
splitLine: {
//分割线配置
show: true,
lineStyle: {
color: "#999",
},
},
},
yAxis: {
type: 'value',
axisLabel: {
textStyle:{
fontSize :15,
color:'#000000'
},
color: "#000" //刻度线标签颜色
type: "value",
axisLabel: {
textStyle: {
fontSize: 15,
color: "#000000",
},
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
}
}
color: "#000", //刻度线标签颜色
},
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
},
},
},
series: [{
series: [
{
data: datayuey,
type: 'line',
type: "line",
markPoint: {
symbolSize:[65, 65],
data: this.tiaoshiPao
symbolSize: [65, 65],
data: this.tiaoshiPao,
},
clickable: false,
},
clickable:false,
}]
],
};
this.headZx.getZr().on('click', (params) => {
this.headZx.getZr().on("click", (params) => {
// console.log(params.name)
/* this.echartsData.statefulInspectionName =params.name+headtext;
/* this.echartsData.statefulInspectionName =params.name+headtext;
this.router.navigateByUrl(`/statisticanalysis/delete_one/delete_there`); */
const pointInPixel= [params.offsetX, params.offsetY];
if (this.headZx.containPixel('grid',pointInPixel)) {
let xIndex=this.headZx.convertFromPixel({seriesIndex:0},[params.offsetX, 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}});
const pointInPixel = [params.offsetX, params.offsetY];
if (this.headZx.containPixel("grid", pointInPixel)) {
let xIndex = this.headZx.convertFromPixel({ seriesIndex: 0 }, [
params.offsetX,
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}});
}else{
} else {
/*事件处理代码书写位置*/
//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.level=='0'){
this.router.navigate(['/statisticanalysis/delete_one/delete_there'],{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}});
if (this.echartsData.dezhiorBuinding == "zhi") {
if (this.echartsData.level == "0") {
this.router.navigate(
["/statisticanalysis/delete_one/delete_there"],
{
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{
this.router.navigate(['/statisticanalysis/delete_two_newadd'],{queryParams:{'level':this.options.xAxis.data[xIndex],'headtext':headtext}});
} else {
this.router.navigate(["/statisticanalysis/delete_two_newadd"], {
queryParams: {
level: this.options.xAxis.data[xIndex],
headtext: headtext,
},
});
}
}
}
});
this.headZx.setOption(this.options);
}
/**
* @name:
* @test: test font
* @msg:
* @msg:
* @param {string()}
* @return {type}
* @return {type}
*/
biaogeTishi(biaotou:string){
var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},'
shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},'
shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},'
shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]'
var jsonObj = JSON.parse(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>'
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+='<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+='<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
biaogeTishi(biaotou: string) {
var shuju =
'[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},';
shuju +=
'{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},';
shuju +=
'{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},';
shuju +=
'{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},';
shuju +=
'{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},';
shuju +=
'{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]';
var jsonObj = JSON.parse(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>";
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 +=
'<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 +=
'<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 {
/* 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:
* @version:
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2021-05-08 09:42:43
* @LastEditors: sueRimn
* @LastEditTime: 2021-05-19 14:46:30
*/
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
//import {Foimport { FormGroup, FormControl } from '@angular/forms';
import { EchartsDataService } from '../echarts-data.service';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
import { EchartsDataService } from "../echarts-data.service";
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
} from "@angular/material/core";
declare var echarts: any;
@Component({
selector: 'app-real-monitoring',
templateUrl: './real-monitoring.component.html',
styleUrls: ['./real-monitoring.component.scss'],
selector: "app-real-monitoring",
templateUrl: "./real-monitoring.component.html",
styleUrls: ["./real-monitoring.component.scss"],
})
export class RealMonitoringComponent implements OnInit {
/* campaignOne: 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'//添加时间
endtime = String(new Date().getFullYear()) + '-0' + String(new Date().getMonth() + 1)
addtime = String(new Date().getFullYear()) + "-01"; //添加时间
endtime =
String(new Date().getFullYear()) + "-0" + String(new Date().getMonth() + 1);
/* addtime=String(new Date().getFullYear()+new Date().getMonth())
endtime=String(new Date().getFullYear()+new Date().getMonth()) */
ngOnInit(): void {
window.setTimeout(() => {
this.getechartsdata(true)
}, 0)
this.getechartsdata(true);
}, 0);
}
//获取echarts数据
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 = {
objectType: 3,
TrendYear: i
}
TrendYear: i,
};
//获取左侧柱状图的数据
await this.EchartsData.getData(paramdataleft, '/api/StatisticsAnalysis/Trends')
this.leftzhuTable = JSON.parse(JSON.stringify(this.EchartsData.allDate))
await this.EchartsData.getData(
paramdataleft,
"/api/StatisticsAnalysis/Trends"
);
this.leftzhuTable = JSON.parse(JSON.stringify(this.EchartsData.allDate));
//console.log(this.leftzhuTable)
this.leftzhuTable[0].forEach((value, index, array) => {
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]))) {
this.dateNum.push(array[index].count)
this.dateyue.push(array[index].year + '-' + array[index].month)
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]))
) {
this.dateNum.push(array[index].count);
this.dateyue.push(array[index].year + "-" + array[index].month);
}
} else {
if (array[index].month >= this.addtime.split('-')[1] && array[index].month <= this.endtime.split('-')[1]) {
this.dateNum.push(array[index].count)
this.dateyue.push(array[index].year + '-' + array[index].month)
if (
array[index].month >= this.addtime.split("-")[1] &&
array[index].month <= this.endtime.split("-")[1]
) {
this.dateNum.push(array[index].count);
this.dateyue.push(array[index].year + "-" + array[index].month);
}
}
});
}
//获取底端柱状图数据
let paramBottom = {
TimeIntervalStart: this.addtime == '0' ? '' : this.endtime,
TimeIntervalEnd: this.endtime == '0' ? '' : this.endtime
}
TimeIntervalStart: this.addtime == "0" ? "" : this.endtime,
TimeIntervalEnd: this.endtime == "0" ? "" : this.endtime,
};
if (chushi) {
await this.EchartsData.getData(paramBottom, '/api/StatisticsAnalysis/Plans/AuditApproved/Organizations')
this.bottomTable = JSON.parse(JSON.stringify(this.EchartsData.allDate))
this.addNum = this.bottomTable[0].totalCount
await this.EchartsData.getData(
paramBottom,
"/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.zhiNameData.push(array[index].organizationName)
this.zhiNumData.push(array[index].count)
this.zhiNameData.push(array[index].organizationName);
this.zhiNumData.push(array[index].count);
if (index > 0 && index < 4) {
this.addyuan.push(array[index].organizationName)
this.addyuan.push(array[index].organizationName);
}
});
this.bottomzhutu()
this.bottomzhutu();
}
//右侧饼状图数据
let param = {
TimeIntervalStart: this.addtime == '0' ? '' : this.addtime,
TimeIntervalEnd: this.endtime == '0' ? '' : this.endtime
}
await this.EchartsData.getData(param, '/api/StatisticsAnalysis/Plans/AuditApproved/PlanTypes')
this.rightbTable = JSON.parse(JSON.stringify(this.EchartsData.allDate))
console.log(this.rightbTable)
this.rightbTable[0].planTypeStatistics.planTypes.forEach((value,index,array) => {
if(array[index].planTypeName=='Plan2D'){
this.indexData.push({name:'二维预案',value:array[index].count})
}else if(array[index].planTypeName=='Plan3D'){
//array[index].planTypeName=='三维预案'
this.indexData.push({name:'三维预案',value:array[index].count})
}else if(array[index].planTypeName=='Other'){
//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})
TimeIntervalStart: this.addtime == "0" ? "" : this.addtime,
TimeIntervalEnd: this.endtime == "0" ? "" : this.endtime,
};
await this.EchartsData.getData(
param,
"/api/StatisticsAnalysis/Plans/AuditApproved/PlanTypes"
);
this.rightbTable = JSON.parse(JSON.stringify(this.EchartsData.allDate));
console.log(this.rightbTable);
this.rightbTable[0].planTypeStatistics.planTypes.forEach(
(value, index, array) => {
if (array[index].planTypeName == "Plan2D") {
this.indexData.push({ name: "二维预案", value: array[index].count });
} else if (array[index].planTypeName == "Plan3D") {
//array[index].planTypeName=='三维预案'
this.indexData.push({ name: "三维预案", value: array[index].count });
} else if (array[index].planTypeName == "Other") {
//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)
this.leftzhuzhuangtu()
this.rightbingtu()
);
console.log(this.indexData);
this.leftzhuzhuangtu();
this.rightbingtu();
}
//查询按钮
findClick() {
console.log(this.addtime, this.endtime)
console.log(this.addtime, this.endtime);
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
if (this.addtime == '0' || this.endtime == '0') {
this.snackBar.open('结束时间或者开始时间不能为空!', '确定', config);
config.verticalPosition = "top";
config.duration = 3000;
if (this.addtime == "0" || this.endtime == "0") {
this.snackBar.open("结束时间或者开始时间不能为空!", "确定", config);
} else {
if (this.endtime < this.addtime) {
this.snackBar.open('结束时间不能大于开始时间!', '确定', config);
this.snackBar.open("结束时间不能大于开始时间!", "确定", config);
} else {
this.leftzhutu.clear()
this.leftzhutu.dispose()
this.dateyue = []
this.dateNum = []
if (this.leftzhutu) {
this.leftzhutu.clear();
this.leftzhutu.dispose();
}
this.dateyue = [];
this.dateNum = [];
//this.zhiNameData = []
//this.zhiNumData = []
//this.addyuan = []
this.getechartsdata(false)
this.getechartsdata(false);
}
}
}
addNum = 0//新增预案个数
addyuan = []
leftzhuTable//左侧柱状图数据
rightbTable//右侧饼图数据
bottomTable//最低端柱状图数据
leftzhutu
optionLeftzhu//中间左侧柱状图实例
dateyue = []
dateNum = []
zhiNameData = []
zhiNumData = []
rightbing
optionRightbing//中间右侧柱状图
bottomzhu//底部柱状图实例
bottomZhuoption
tiaoshiPao: any
addNum = 0; //新增预案个数
addyuan = [];
leftzhuTable; //左侧柱状图数据
rightbTable; //右侧饼图数据
bottomTable; //最低端柱状图数据
leftzhutu;
optionLeftzhu; //中间左侧柱状图实例
dateyue = [];
dateNum = [];
zhiNameData = [];
zhiNumData = [];
rightbing;
optionRightbing; //中间右侧柱状图
bottomzhu; //底部柱状图实例
bottomZhuoption;
tiaoshiPao: any;
//中间左侧柱状图
async leftzhuzhuangtu() {
var ec = echarts as any;
this.leftzhutu = ec.init(document.getElementById(`leftecharts`), 'walden');
this.leftzhutu = ec.init(document.getElementById(`leftecharts`), "walden");
this.optionLeftzhu = {
grid: {
//top: 10,
containLabel: true,
bottom: 10,
left: 50
left: 50,
},
tooltip: {
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'none'
}
type: "none",
},
},
xAxis: {
type: 'category',
data: this.dateyue,
//axisLabel: this.axisLabel,
axisLabel:{
//this.axisLabel,
textStyle:{
fontSize :14,
color:'#000000'
}
}
type: "category",
data: this.dateyue,
//axisLabel: this.axisLabel,
axisLabel: {
//this.axisLabel,
textStyle: {
fontSize: 14,
color: "#000000",
},
},
},
yAxis: {
type: 'value',
axisLabel:{
textStyle:{
fontSize :14,
color:'#000000'
}
}
type: "value",
axisLabel: {
textStyle: {
fontSize: 14,
color: "#000000",
},
},
},
/* tooltip: {
trigger: 'item',
@ -226,24 +250,30 @@ export class RealMonitoringComponent implements OnInit {
}, */
dataZoom: [
{
type: 'slider',
bottom:2
}
],
series: [{
name: '数量',
data: this.dateNum,
type: 'bar',
markPoint: {
symbolSize: [65, 65],
data: this.EchartsData.qipao(this.tiaoshiPao, this.dateNum, this.dateyue)
type: "slider",
bottom: 2,
},
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.getZr().on('click', async (params)=>{
@ -282,14 +312,15 @@ export class RealMonitoringComponent implements OnInit {
}); */
}
//中间右侧饼图
indexData = []//所有数据
lengthdata = ['二维预案', '三维预案', '文本预案', '其他预案']
indexData = []; //所有数据
lengthdata = ["二维预案", "三维预案", "文本预案", "其他预案"];
rightbingtu() {
this.rightbing = echarts.init(document.getElementById('rightecharts'), 'walden');
this.rightbing = echarts.init(
document.getElementById("rightecharts"),
"walden"
);
this.optionRightbing = {
/* title: {
text: `建筑类型统计(${this.count}家)`,
@ -308,39 +339,39 @@ export class RealMonitoringComponent implements OnInit {
}
}, */
tooltip: {
trigger: 'item',
trigger: "item",
axisPointer: {
type: 'shadow'
}
type: "shadow",
},
},
legend: {
orient: 'vertical',
orient: "vertical",
//left:this.padHw?50:0,
//right:this.padHw?20:250,
top: 20,
right: 30,
textStyle: {
fontSize: 16,
color: "#000000"
color: "#000000",
},
data: this.lengthdata
data: this.lengthdata,
},
series: [
{
top: '0',
name: '预案类型',
type: 'pie',
radius: '60%',
center: ['50%', '53%'],
top: "0",
name: "预案类型",
type: "pie",
radius: "60%",
center: ["50%", "53%"],
label: {
show: true,
fontSize: 16,
formatter: '{b}{c}家\n{d|({d}%)}',
formatter: "{b}{c}家\n{d|({d}%)}",
rich: {
d: {
align: 'center',
fontSize: 18
}
align: "center",
fontSize: 18,
},
},
},
/* 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[3] != undefined ? this.rightbTable[0].planTypeStatistics.planTypes[3].count : 0, name: '文本预案' }
], */
data:this.indexData,
data: this.indexData,
emphasis: {
itemStyle: {
shadowBlur: 10,
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() {
var ec = echarts as any;
this.bottomzhu = ec.init(document.getElementById(`bottomEcharts`), 'walden');
this.bottomzhu = ec.init(
document.getElementById(`bottomEcharts`),
"walden"
);
this.bottomZhuoption = {
grid: {
//top: 10,
containLabel:true,
bottom:2,
left:50
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'none'
}
containLabel: true,
bottom: 2,
left: 50,
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "none",
},
},
xAxis: {
type: 'category',
data: this.zhiNameData,
//axisLabel: this.axisLabel,
axisLabel:{
//this.axisLabel,
textStyle:{
fontSize :14,
color:'#000000'
},
interval: 0,
//rotate:38
formatter:function(value){
var ret = "";//拼接加\n返回的类目项
var maxLength = 3;//每项显示文字个数
var valLength = value.length;//X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1) { //如果类目项的文字大于3,
for (var i = 0; i < rowN; i++) {
var temp = "";//每次截取的字符串
var start = i * maxLength;//开始截取的位置
var end = start + maxLength;//结束截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
temp = value.substring(start, end) + "\n";
ret += temp;
} //凭借最终的字符串
return ret;
}else {
return value;
}
} //function
}
type: "category",
data: this.zhiNameData,
//axisLabel: this.axisLabel,
axisLabel: {
//this.axisLabel,
textStyle: {
fontSize: 14,
color: "#000000",
},
interval: 0,
//rotate:38
formatter: function (value) {
var ret = ""; //拼接加\n返回的类目项
var maxLength = 3; //每项显示文字个数
var valLength = value.length; //X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1) {
//如果类目项的文字大于3,
for (var i = 0; i < rowN; i++) {
var temp = ""; //每次截取的字符串
var start = i * maxLength; //开始截取的位置
var end = start + maxLength; //结束截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
temp = value.substring(start, end) + "\n";
ret += temp;
} //凭借最终的字符串
return ret;
} else {
return value;
}
}, //function
},
},
yAxis: {
type: 'value',
axisLabel:{
textStyle:{
fontSize :14,
color:'#000000'
}
}
type: "value",
axisLabel: {
textStyle: {
fontSize: 14,
color: "#000000",
},
},
},
dataZoom: [
{
type: 'slider',
bottom:90,
type: "slider",
bottom: 90,
//backgroundColor:'rgba(47,69,84,-0.2)',
dataBackground:{
areaStyle:{
opacity:0
}
}
}
],
series: [{
name: '数量',
data: this.zhiNumData,
type: 'bar',
markPoint: {
symbolSize: [65, 65],
data: this.EchartsData.qipao(this.tiaoshiPao, this.zhiNumData, this.zhiNameData)
dataBackground: {
areaStyle: {
opacity: 0,
},
},
},
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
}]
};
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)
}) */
}
}
}

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:
* @version:
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2020-09-01 15:24:39
* @LastEditors: sueRimn
* @LastEditTime: 2021-07-21 08:54:04
*/
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import {EchartsDataService,} from '../../echarts-data.service'
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { EchartsDataService } from "../../echarts-data.service";
declare var echarts: any;
declare var CryptoJS
declare var CryptoJS;
@Component({
selector: 'app-page-one',
templateUrl: './page-one.component.html',
styleUrls: ['./page-one.component.scss']
selector: "app-page-one",
templateUrl: "./page-one.component.html",
styleUrls: ["./page-one.component.scss"],
})
export class PageOneComponent implements OnInit {
options:any;
constructor(private router: Router,public echartsData:EchartsDataService) { }
options: any;
padHw
orid
constructor(private router: Router, public echartsData: EchartsDataService) {}
padHw;
orid;
ngOnInit() {
if(window.matchMedia("(max-width: 1400px)").matches){
this.padHw=true
if (window.matchMedia("(max-width: 1400px)").matches) {
this.padHw = true;
//this.padjt=
}else{
this.padHw=false
} else {
this.padHw = false;
}
if(sessionStorage.getItem('refresh') === 'true') {
sessionStorage.removeItem('refresh');
if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem("refresh");
location.reload();
}
window.setTimeout(()=>{
this.getechartsdata()
})
}
window.setTimeout(() => {
this.getechartsdata();
});
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 identityJsonparse=JSON.parse(identityJson)
this.orid=identityJsonparse.oid
let identityJsonparse = JSON.parse(identityJson);
this.orid = identityJsonparse.oid;
//console.log(identityJsonparse)
}
ngOnDestroy(): void {
this.indexBzt.clear()
this.indexBzt.dispose()
if (!this.indexBzt) {
return;
}
this.indexBzt.clear();
this.indexBzt.dispose();
}
async getechartsdata(){
await this.echartsData.getData(null,`/api/StatisticsAnalysis/Plans`)
this.initCharts("pieone")
this.initCharts("pietwo")
async getechartsdata() {
await this.echartsData.getData(null, `/api/StatisticsAnalysis/Plans`);
this.initCharts("pieone");
this.initCharts("pietwo");
}
//级别和类型转换
pieonetype=true//级别
clickhuan(){
this.pieonetype=!this.pieonetype
this.initCharts("pieone")
pieonetype = true; //级别
clickhuan() {
this.pieonetype = !this.pieonetype;
this.initCharts("pieone");
}
/* 首页饼状图 */
indexBzt
tabledata
count
indexData
planCategoriesData=[]//预案级别
planStatusesData=[]//预案状态
planTypeStatisticsdata=[]//预案类型
initCharts(tid){
this.planTypeStatisticsdata=[]
this.planCategoriesData=[]
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
if(tid=='pieone')
{
if(this.pieonetype){
this.tabledata[0].planCategoryStatistics.planCategories.forEach((value,index,array) => {
if(array[index].planCategoryName=='LevelOne'){
this.planCategoriesData.push({name:'Ⅰ级预案',value:array[index].count,planStatusName:array[index].planCategoryName,type:1})
}else if(array[index].planCategoryName=='LevelTwo'){
this.planCategoriesData.push({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})
indexBzt;
tabledata;
count;
indexData;
planCategoriesData = []; //预案级别
planStatusesData = []; //预案状态
planTypeStatisticsdata = []; //预案类型
initCharts(tid) {
this.planTypeStatisticsdata = [];
this.planCategoriesData = [];
this.tabledata = JSON.parse(JSON.stringify(this.echartsData.allDate));
if (tid == "pieone") {
if (this.pieonetype) {
this.tabledata[0].planCategoryStatistics.planCategories.forEach(
(value, index, array) => {
if (array[index].planCategoryName == "LevelOne") {
this.planCategoriesData.push({
name: "Ⅰ级预案",
value: array[index].count,
planStatusName: array[index].planCategoryName,
type: 1,
});
} else if (array[index].planCategoryName == "LevelTwo") {
this.planCategoriesData.push({
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{
this.tabledata[0].planTypeStatistics.planTypes.forEach((value,index,array) => {
if(array[index].planTypeName=='Plan2D'){
this.planTypeStatisticsdata.push({name:'二维预案',value:array[index].count,planStatusName:array[index].planTypeName,type:1})
}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 {
this.tabledata[0].planTypeStatistics.planTypes.forEach(
(value, index, array) => {
if (array[index].planTypeName == "Plan2D") {
this.planTypeStatisticsdata.push({
name: "二维预案",
value: array[index].count,
planStatusName: array[index].planTypeName,
type: 1,
});
} 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{
this.tabledata[0].planStatusStatistics.planStatuses.forEach((value,index,array) => {
if(array[index].planStatusName=='New'){
this.planStatusesData.push({name:'预案新增',value:array[index].count,type:1,planStatusName:array[index].planStatusName})
}else if(array[index].planStatusName=='Auditing'){
this.planStatusesData.push({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})
} else {
this.tabledata[0].planStatusStatistics.planStatuses.forEach(
(value, index, array) => {
if (array[index].planStatusName == "New") {
this.planStatusesData.push({
name: "预案新增",
value: array[index].count,
type: 1,
planStatusName: array[index].planStatusName,
});
} else if (array[index].planStatusName == "Auditing") {
this.planStatusesData.push({
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;
this.indexBzt = ec.init(document.getElementById(tid),'walden');
var options={
this.indexBzt = ec.init(document.getElementById(tid), "walden");
var options = {
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}份)`,
top: "7%",
left: 'center',
textStyle:{
fontSize:this.padHw?25: 31
}
text:
tid == "pieone" && this.pieonetype
? `预案级别统计(${this.tabledata[0].planCategoryStatistics.totalCount}份)`
: tid == "pieone" && !this.pieonetype
? `预案类型统计(${this.tabledata[0].planTypeStatistics.totalCount}份)`
: `预案状态统计(${this.tabledata[0].planStatusStatistics.totalCount}份)`,
top: "7%",
left: "center",
textStyle: {
fontSize: this.padHw ? 25 : 31,
},
},
tooltip: {
trigger: 'item',
formatter: (params)=>{
this.echartsData.biaogeTishiyuan(params.data,tid,this.pieonetype)
return this.echartsData.res
}
trigger: "item",
formatter: (params) => {
this.echartsData.biaogeTishiyuan(params.data, tid, this.pieonetype);
return this.echartsData.res;
},
},
legend: {
bottom: 50,
left: 'center',
//padding:20,
// itemWidth:60,
// itemHeight:25,
textStyle:{
fontSize:this.padHw?15: 18,
color:"#000000"
},
data:tid=='pieone'&&this.pieonetype?['Ⅰ级预案', 'Ⅱ级预案', 'Ⅲ级预案', 'Ⅳ级预案', 'Ⅴ级预案']:tid=='pieone'&&!this.pieonetype?['二维预案', '三维预案', '其它预案', '文本预案'] :['预案新增', '预案审核通过', '预案编制', '预案审核退回', '预案审核中']
left: "center",
//padding:20,
// itemWidth:60,
// itemHeight:25,
textStyle: {
fontSize: this.padHw ? 15 : 18,
color: "#000000",
},
data:
tid == "pieone" && this.pieonetype
? ["Ⅰ级预案", "Ⅱ级预案", "Ⅲ级预案", "Ⅳ级预案", "Ⅴ级预案"]
: tid == "pieone" && !this.pieonetype
? ["二维预案", "三维预案", "其它预案", "文本预案"]
: [
"预案新增",
"预案审核通过",
"预案编制",
"预案审核退回",
"预案审核中",
],
},
series: [
{
name: '访问来源',
type: 'pie',
radius: '50%',
center: ['50%', '45%'],
label:{
normal:{
show:true,
// position: 'inner',
fontSize:this.padHw?14: 18,
formatter:this.padHw?'{b} \n{c}份({d}%)' :'{b} {c}份\n({d}%)',
},
rich: {
d: {
align: 'center',
}
},
{
name: "访问来源",
type: "pie",
radius: "50%",
center: ["50%", "45%"],
label: {
normal: {
show: true,
// position: 'inner',
fontSize: this.padHw ? 14 : 18,
formatter: this.padHw ? "{b} \n{c}份({d}%)" : "{b} {c}份\n({d}%)",
},
rich: {
d: {
align: "center",
},
data:tid=='pieone'&&this.pieonetype?this.planCategoriesData:tid=='pieone'&&!this.pieonetype?this.planTypeStatisticsdata:this.planStatusesData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
},
},
data:
tid == "pieone" && this.pieonetype
? this.planCategoriesData
: 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)
if(tid=='pieone'){
if(this.pieonetype){
for(var i=0;i<this.tabledata[0].planCategoryStatistics.planCategories.length;i++){
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)
if (tid == "pieone") {
if (this.pieonetype) {
for (
var i = 0;
i < this.tabledata[0].planCategoryStatistics.planCategories.length;
i++
) {
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(()=>{
if(array.length>0){
this.router.navigate(['/statisticanalysis/statePageOne/time'],{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}});
window.setTimeout(() => {
if (array.length > 0) {
this.router.navigate(
["/statisticanalysis/statePageOne/time"],
{
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{
for(var i=0;i<this.tabledata[0].planTypeStatistics.planTypes.length;i++){
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)
} else {
for (
var i = 0;
i < this.tabledata[0].planTypeStatistics.planTypes.length;
i++
) {
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(()=>{
if(array.length>0){
this.router.navigate(['/statisticanalysis/statePageOne/time'],{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}});
window.setTimeout(() => {
if (array.length > 0) {
this.router.navigate(
["/statisticanalysis/statePageOne/time"],
{
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{
for(var i=0;i<this.tabledata[0].planStatusStatistics.planStatuses.length;i++){
if(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)
} else {
for (
var i = 0;
i < this.tabledata[0].planStatusStatistics.planStatuses.length;
i++
) {
if (
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(()=>{
if(array.length>0){
this.router.navigate(['/statisticanalysis/statePageOne/time'],{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'}});
window.setTimeout(() => {
if (array.length > 0) {
this.router.navigate(
["/statisticanalysis/statePageOne/time"],
{
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);
}
/**
* @name:
* @test: test font
* @msg:
* @msg:
* @param {string()}
* @return {type}
* @return {type}
*/
biaogeTishi(biaotou:string){
var shuju='[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},'
shuju+='{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},'
shuju+='{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},'
shuju+='{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},'
shuju+='{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},'
shuju+='{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]'
var jsonObj = JSON.parse(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>'
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+='<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+='<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
}
biaogeTishi(biaotou: string) {
var shuju =
'[{"name":"浦东支队","number":"156","zhanbi":"3%"},{"name":"黄浦支队","number":"144","zhanbi":"2.8%"},';
shuju +=
'{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"静安支队","number":"120","zhanbi":"1.3%"},{"name":"普陀支队","number":"100","zhanbi":"1.1%"},';
shuju +=
'{"name":"虹口支队","number":"95","zhanbi":"1%"},{"name":"杨浦支队","number":"90","zhanbi":"0.9%"},';
shuju +=
'{"name":"闵行支队","number":"88","zhanbi":"0.8%"},{"name":"宝山支队","number":"83","zhanbi":"0.7%"},';
shuju +=
'{"name":"徐汇支队","number":"133","zhanbi":"2.1%"},{"name":"长宁支队","number":"122","zhanbi":"1.6%"},';
shuju +=
'{"name":"嘉定支队","number":"78","zhanbi":"0.6%"},{"name":"松江支队","number":"75","zhanbi":"0.5%"},';
shuju +=
'{"name":"金山支队","number":"65","zhanbi":"0.4%"},{"name":"崇明支队","number":"55","zhanbi":"0.3%"}]';
var jsonObj = JSON.parse(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>";
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 +=
'<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 +=
'<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 { Router } from '@angular/router';
import {MatDialog, MatDialogRef, 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';
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import {
MatDialog,
MatDialogRef,
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;
@Component({
selector: 'app-page-there-year',
templateUrl: './page-there-year.component.html',
styleUrls: ['./page-there-year.component.scss']
selector: "app-page-there-year",
templateUrl: "./page-there-year.component.html",
styleUrls: ["./page-there-year.component.scss"],
})
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
buildingTypeName:String
level:String
setTimeoutObj//延时器需要清除
type
tabledata//获取所有数据
lastyears//上个页面传过来的年份
count=0//总数
pieonetype//判断是级别还是类型,上个页面传过来的参数
planType//预案类型
tid;
year: String;
buildingTypeName: String;
level: String;
setTimeoutObj; //延时器需要清除
type;
tabledata; //获取所有数据
lastyears; //上个页面传过来的年份
count = 0; //总数
pieonetype; //判断是级别还是类型,上个页面传过来的参数
planType; //预案类型
ngOnInit(): void {
this.dateInit ()
this.route.queryParams.subscribe(params => {
this.year = params['level'];
this.buildingTypeName = params['headtext'];
this.type=params['type']
this.lastyears=params['headtext'].substring(0,4)
this.tid=params.tid
this.pieonetype=params.pieonetype
this.dateInit();
this.route.queryParams.subscribe((params) => {
this.year = params["level"];
this.buildingTypeName = params["headtext"];
this.type = params["type"];
this.lastyears = params["headtext"].substring(0, 4);
this.tid = params.tid;
this.pieonetype = params.pieonetype;
});
if(this.year=='二维预案'){
this.planType=1
}else if(this.year=='三维预案'){
this.planType=2
}else if(this.year=='其他预案'){
this.planType=4
}else if(this.year=='文本预案'){
this.planType=16
if (this.year == "二维预案") {
this.planType = 1;
} else if (this.year == "三维预案") {
this.planType = 2;
} else if (this.year == "其他预案") {
this.planType = 4;
} else if (this.year == "文本预案") {
this.planType = 16;
}
this.setTimeoutObj = window.setTimeout(()=>{
this.getechartsData()
})
this.setTimeoutObj = window.setTimeout(() => {
this.getechartsData();
});
}
ngOnDestroy(){
ngOnDestroy() {
window.clearTimeout(this.setTimeoutObj);
this.detailPlanEchart.clear()
this.detailPlanEchart.dispose()
if (!this.detailPlanEchart) {
return;
}
this.detailPlanEchart.clear();
this.detailPlanEchart.dispose();
}
async getechartsData(){
let paramdata={
planStatus:this.tid=='pieone'?'': this.type,
PlanCategory:this.tid=='pieone'&&this.pieonetype=='true'?this.type:'',
objectType:this.tid=='pieone'&&this.pieonetype=='true'?2:this.tid=='pieone'&&this.pieonetype=='false'?5: 1,
TrendYear:this.lastyears||'',
TrendType:0
async getechartsData() {
let paramdata = {
planStatus: this.tid == "pieone" ? "" : this.type,
PlanCategory:
this.tid == "pieone" && this.pieonetype == "true" ? this.type : "",
objectType:
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.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
}
this.date.forEach((value,index,array)=>{
this.date[index]=this.date[index]+'月'
})
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.detailEcharts()
this.date.forEach((value, index, array) => {
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 = []
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12]
years: any = [];
selectMonth: any = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
//日期初始化
dateInit () {
let date = (new Date()).getFullYear()
for (let i=date; i>=date-10;i--) {
this.years.unshift(i)
dateInit() {
let date = new Date().getFullYear();
for (let i = date; i >= date - 10; i--) {
this.years.unshift(i);
}
}
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 = {
show: true, // 开启显示
position: 'top', // 在上方显示
position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle',
textStyle: { // 数值样式
color: 'black',
fontSize: 12
}
}//柱状图数值顶部显示
zhongNameData = ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队"]
zhongNumData = [200,190,180,170,160,150,140,130,120,110,100]
verticalAlign: "middle",
textStyle: {
// 数值样式
color: "black",
fontSize: 12,
},
}; //柱状图数值顶部显示
zhongNameData = [
"浦东中队",
"黄浦中队",
"徐汇中队",
"长宁中队",
"静安中队",
"普陀中队",
"虹口中队",
"杨浦中队",
"闵行中队",
"宝山中队",
"嘉定中队",
];
zhongNumData = [200, 190, 180, 170, 160, 150, 140, 130, 120, 110, 100];
zhiNameData = ["浦东支队","黄浦支队","徐汇支队","长宁支队","静安支队","普陀支队","虹口支队","杨浦支队","闵行支队","宝山支队","嘉定支队"]
zhiNumData = [300,290,280,270,260,250,240,230,220,210,200]
tiaoshiPao:any
zhiNameData = [
"浦东支队",
"黄浦支队",
"徐汇支队",
"长宁支队",
"静安支队",
"普陀支队",
"虹口支队",
"杨浦支队",
"闵行支队",
"宝山支队",
"嘉定支队",
];
zhiNumData = [300, 290, 280, 270, 260, 250, 240, 230, 220, 210, 200];
tiaoshiPao: any;
//气泡提示数据获取
bianli(){
var arrshuzu='[';
for(var i=0;i<this.dateNum.length;i++){
arrshuzu+='{"value":'+this.dateNum[i]+',"coord":['+i+','+this.dateNum[i]+'],"name":'+'"'+this.date[i]+'"'+'},'
bianli() {
var arrshuzu = "[";
for (var i = 0; i < this.dateNum.length; i++) {
arrshuzu +=
'{"value":' +
this.dateNum[i] +
',"coord":[' +
i +
"," +
this.dateNum[i] +
'],"name":' +
'"' +
this.date[i] +
'"' +
"},";
}
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1)
arrshuzu+=']'
this.tiaoshiPao=JSON.parse(arrshuzu)
arrshuzu = arrshuzu.substring(0, arrshuzu.length - 1);
arrshuzu += "]";
this.tiaoshiPao = JSON.parse(arrshuzu);
//return tishiPao
}
//返回
goBack () {
history.go(-1)
goBack() {
history.go(-1);
//this.echartsData.statefulInspectionToggle = true
}
detailPlanEchart
option
date = []
dateNum = []
detailPlanEchart;
option;
date = [];
dateNum = [];
detailEcharts(){
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp');
detailEcharts() {
this.detailPlanEchart = echarts.init(
document.getElementById("barEchart"),
"skinUpp"
);
this.option = {
grid: {
top: 110,
},
// 标题
title: {
text: `${this.year}${this.buildingTypeName}总数(${this.count}`,
//top: -14,
left: 'center',
textStyle:{
left: "center",
textStyle: {
//文字颜色
color:'#000',
fontSize: 30
}
color: "#000",
fontSize: 30,
},
},
//提示框
tooltip: {
trigger: 'axis',
trigger: "axis",
/* formatter: (params)=>{
if(params[0].seriesName == "year"){
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)
}
}, */
position:this.serviceData.tableTooltipNoShow2
position: this.serviceData.tableTooltipNoShow2,
},
// x轴
xAxis: {
type: 'category',
type: "category",
data: this.date,
axisLabel: {
color: "#000", //刻度线标签颜色
textStyle:{
fontSize :18,
color:'#000000'
}
textStyle: {
fontSize: 18,
color: "#000000",
},
},
//设置坐标轴字体颜色和宽度
axisLine: {
axisLine: {
lineStyle: {
color: "#000",
},
},
splitLine: {//分割线配置
show:true,
splitLine: {
//分割线配置
show: true,
lineStyle: {
color: '#999',
}
}
color: "#999",
},
},
},
// y轴
yAxis: {
type: 'value',
name: '个',
type: "value",
name: "个",
axisLabel: {
//color: "#000", //刻度线标签颜色
textStyle:{
fontSize :18,
color:'#000000'
}
textStyle: {
fontSize: 18,
color: "#000000",
},
},
//设置坐标轴字体颜色和宽度
axisLine: {
//设置坐标轴字体颜色和宽度
axisLine: {
lineStyle: {
color: "#000",
}
}
},
},
},
// 数据
series: [{
name: 'xxx',
type: 'line',
series: [
{
name: "xxx",
type: "line",
markPoint: {
symbolSize:[65, 65],
data: this.tiaoshiPao
},
symbolSize: [65, 65],
data: this.tiaoshiPao,
},
data: this.dateNum,
}
},
],
};
this.detailPlanEchart.setOption(this.option);
this.detailPlanEchart.getZr().on('click',params=>{
const pointInPixel= [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
this.detailPlanEchart.getZr().on("click", (params) => {
const pointInPixel = [params.offsetX, params.offsetY];
if (this.detailPlanEchart.containPixel("grid", pointInPixel)) {
let xIndex = this.detailPlanEchart.convertFromPixel(
{ seriesIndex: 0 },
[params.offsetX, params.offsetY]
)[0];
/*事件处理代码书写位置*/
if(this.serviceData.level=='0'||this.serviceData.level=='1'||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.level == "0" ||
this.serviceData.level == "1" ||
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){
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.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/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],
},
});
} 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(){
window.history.go(-1)
}
backBtn() {
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 { Router,ActivatedRoute } from '@angular/router';
import {EchartsDataService} from '../../echarts-data.service';
import { MatSnackBarConfig, MatSnackBar } from '@angular/material/snack-bar';
import { DateAdapter } from '@angular/material/core';
import { Component, OnInit } from "@angular/core";
import { Router, ActivatedRoute } from "@angular/router";
import { EchartsDataService } from "../../echarts-data.service";
import { MatSnackBarConfig, MatSnackBar } from "@angular/material/snack-bar";
import { DateAdapter } from "@angular/material/core";
declare var echarts: any;
@Component({
selector: 'app-page-there',
templateUrl: './page-there.component.html',
styleUrls: ['./page-there.component.scss']
selector: "app-page-there",
templateUrl: "./page-there.component.html",
styleUrls: ["./page-there.component.scss"],
})
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实例
option
time:String
buildingTypeName:String
setTimeoutObj//延时器需要清除
headtext:string;
zhong:string
type
tabledata
organizationId=[]
lastid
tid
ngOnDestroy():void{
this.zhutu.clear()
this.zhutu.dispose()
ngOnDestroy(): void {
if (!this.zhutu) {
return;
}
this.zhutu.clear();
this.zhutu.dispose();
}
ngOnInit(): void {
if(sessionStorage.getItem('refresh') === 'true') {
sessionStorage.removeItem('refresh');
if (sessionStorage.getItem("refresh") === "true") {
sessionStorage.removeItem("refresh");
location.reload();
}
if(window.matchMedia("(max-width: 1400px)").matches){
this.padHw=true
}
if (window.matchMedia("(max-width: 1400px)").matches) {
this.padHw = true;
//this.padjt=
}else{
this.padHw=false
} else {
this.padHw = false;
}
this.dateInit();
let datayuex:string;
this.activatedRoute.queryParams.subscribe(param=>{
this.lastid=param.id
this.type=param.type
this.headtext=param.headtext
datayuex=param.level
this.zhong=param.zhong
this.headName=datayuex+this.headtext;
this.tid=param.tid
this.pieonetype=param.pieonetype
if(this.headtext=='二维预案'){
this.planType=1
}else if(this.headtext=='三维预案'){
this.planType=2
}else if(this.headtext=='其他预案'){
this.planType=4
}else if(this.headtext=='文本预案'){
this.planType=16
let datayuex: string;
this.activatedRoute.queryParams.subscribe((param) => {
this.lastid = param.id;
this.type = param.type;
this.headtext = param.headtext;
datayuex = param.level;
this.zhong = param.zhong;
this.headName = datayuex + this.headtext;
this.tid = param.tid;
this.pieonetype = param.pieonetype;
if (this.headtext == "二维预案") {
this.planType = 1;
} else if (this.headtext == "三维预案") {
this.planType = 2;
} else if (this.headtext == "其他预案") {
this.planType = 4;
} else if (this.headtext == "文本预案") {
this.planType = 16;
}
//console.log(headName)
});
window.setTimeout(()=>{
this.getechartsdata()
})
});
window.setTimeout(() => {
this.getechartsdata();
});
}
pieonetype//判断是级别还是类型,上个页面传过来的参数
planType//预案类型
padHw
headName
selectType:string = 'month'; //选择当前的 查询类型 按月/年
async getechartsdata(){
let paramdata/* ={
pieonetype; //判断是级别还是类型,上个页面传过来的参数
planType; //预案类型
padHw;
headName;
selectType: string = "month"; //选择当前的 查询类型 按月/年
async getechartsdata() {
let 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:''
} */
if(this.echartsData.planYear==undefined&&this.echartsData.planMonth!=undefined){
this.echartsData.planYear=new Date().getFullYear()
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,
}
}else if(this.echartsData.planYear==undefined&&this.echartsData.planMonth==undefined){
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:'',
}
}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,
}
if (
this.echartsData.planYear == undefined &&
this.echartsData.planMonth != undefined
) {
this.echartsData.planYear = new Date().getFullYear();
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,
};
} else if (
this.echartsData.planYear == undefined &&
this.echartsData.planMonth == undefined
) {
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
: "",
};
} 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`)
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)
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`
);
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.zhuzhuangtu(this.headName)
this.tiaoshiPao = this.echartsData.qipao(
this.tiaoshiPao,
this.zhiNumData,
this.zhiNameData
);
this.zhuzhuangtu(this.headName);
}
//查询数据
years:any = []
selectMonth:any = [1,2,3,4,5,6,7,8,9,10,11,12]
years: any = [];
selectMonth: any = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
//日期初始化
dateInit () {
let date = (new Date()).getFullYear()
for (let i=date; i>=date-10;i--) {
this.years.unshift(i)
dateInit() {
let date = new Date().getFullYear();
for (let i = date; i >= date - 10; i--) {
this.years.unshift(i);
}
// 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 = {
show: true, // 开启显示
position: 'top', // 在上方显示
position: "top", // 在上方显示
distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
verticalAlign: 'middle',
textStyle: { // 数值样式
color: 'black',
fontSize: 12
}
}//柱状图数值顶部显示
zhiNameData = []
zhiNumData = []
tiaoshiPao:any
verticalAlign: "middle",
textStyle: {
// 数值样式
color: "black",
fontSize: 12,
},
}; //柱状图数值顶部显示
zhiNameData = [];
zhiNumData = [];
tiaoshiPao: any;
//气泡提示数据获取
bianli(){
var arrshuzu='[';
for(var i=0;i<this.zhiNumData.length;i++){
arrshuzu+='{"value":'+this.zhiNumData[i]+',"coord":['+i+','+this.zhiNumData[i]+'],"name":'+'"'+this.zhiNameData[i]+'"'+'},'
bianli() {
var arrshuzu = "[";
for (var i = 0; i < this.zhiNumData.length; i++) {
arrshuzu +=
'{"value":' +
this.zhiNumData[i] +
',"coord":[' +
i +
"," +
this.zhiNumData[i] +
'],"name":' +
'"' +
this.zhiNameData[i] +
'"' +
"},";
}
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1)
arrshuzu+=']'
this.tiaoshiPao=JSON.parse(arrshuzu)
arrshuzu = arrshuzu.substring(0, arrshuzu.length - 1);
arrshuzu += "]";
this.tiaoshiPao = JSON.parse(arrshuzu);
//return tishiPao
}
date = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月','九月']
dateNum = [270, 253, 244, 199, 189, 173, 160, 198,200]
date = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
];
dateNum = [270, 253, 244, 199, 189, 173, 160, 198, 200];
//返回
goBack () {
goBack() {
//this.zhutu.clear()
this.zhutu.dispose()
history.go(-1)
this.echartsData.statefulInspectionToggle = true
this.zhutu ? this.zhutu.dispose() : null;
history.go(-1);
this.echartsData.statefulInspectionToggle = true;
}
axisLabel = {
interval: 0,
//rotate:-30,
textStyle:{
fontSize :15,
color:'#000000'
//rotate:-30,
textStyle: {
fontSize: 15,
color: "#000000",
},
formatter:function(value)
{
var ret = "";//拼接加\n返回的类目项
var maxLength = 2;//每项显示文字个数
var valLength = value.length;//X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1)//如果类目项的文字大于3,
{
for (var i = 0; i < rowN; i++) {
var temp = "";//每次截取的字符串
var start = i * maxLength;//开始截取的位置
var end = start + maxLength;//结束截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
temp = value.substring(start, end) + "\n";
ret += temp; //凭借最终的字符串
}
return ret;
}
else {
return value;
}
formatter: function (value) {
var ret = ""; //拼接加\n返回的类目项
var maxLength = 2; //每项显示文字个数
var valLength = value.length; //X轴类目项的文字个数
var rowN = Math.ceil(valLength / maxLength); //类目项需要换行的行数
if (rowN > 1) {
//如果类目项的文字大于3,
for (var i = 0; i < rowN; i++) {
var temp = ""; //每次截取的字符串
var start = i * maxLength; //开始截取的位置
var end = start + maxLength; //结束截取的位置
//这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
temp = value.substring(start, end) + "\n";
ret += temp; //凭借最终的字符串
}
return ret;
} else {
return value;
}
}//echarts两个字换行
},
}; //echarts两个字换行
/* 柱状图 */
zhuzhuangtu(headName:string){
zhuzhuangtu(headName: string) {
var ec = echarts as any;
this.zhutu = ec.init(document.getElementById('zhidui'),'walden');
this.zhutu = ec.init(document.getElementById("zhidui"), "walden");
this.option = {
title: {
text: headName+`总数(${this.tabledata[0].totalCount})`,
text: headName + `总数(${this.tabledata[0].totalCount})`,
left: "center",
top:0,
top: 0,
//bottom: "540",
textStyle: {
fontSize: 30
}
fontSize: 30,
},
},
grid: {
top: this.padHw?90:110,
containLabel:true,
top: this.padHw ? 90 : 110,
containLabel: true,
//bottom: 10
},
},
xAxis: {
id:this.organizationId,
type: 'category',
data: this.zhiNameData,
axisLabel: this.axisLabel,
id: this.organizationId,
type: "category",
data: this.zhiNameData,
axisLabel: this.axisLabel,
},
yAxis: {
type: 'value',
axisLabel:{
textStyle:{
fontSize :18,
color:'#000000'
}
}
type: "value",
axisLabel: {
textStyle: {
fontSize: 18,
color: "#000000",
},
},
},
tooltip: {
trigger: 'item',
formatter: (params)=>{
return this.echartsData.biaogeTishida(params)
trigger: "item",
formatter: (params) => {
return this.echartsData.biaogeTishida(params);
},
position: this.echartsData.tableTooltipNoShowq
position: this.echartsData.tableTooltipNoShowq,
/* backgroundColor:'rgba(255,255,255,1)',
borderWidth:'1',
borderRadius :'0' */
},
series: [{
series: [
{
data: this.zhiNumData,
type: 'bar',
type: "bar",
markPoint: {
symbolSize:[65, 65],
data: this.tiaoshiPao
},
symbolSize: [65, 65],
data: this.tiaoshiPao,
},
backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)'
color: "rgba(220, 220, 220, 0.8)",
},
barWidth :'38',
barWidth: "38",
//label: this.topTextlabel
}]
},
],
};
this.zhutu.getZr().on('click',params=>{
this.zhutu.getZr().on("click", (params) => {
// console.log(params.name)
const pointInPixel= [params.offsetX, params.offsetY];
if (this.zhutu.containPixel('grid',pointInPixel)) {
let xIndex=this.zhutu.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
const pointInPixel = [params.offsetX, params.offsetY];
if (this.zhutu.containPixel("grid", pointInPixel)) {
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
console.log(this.echartsData.planYear)
if((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.echartsData.isQuery == false
? (this.echartsData.planYear = this.option.xAxis.data[xIndex])
: this.echartsData.planYear == undefined;
console.log(this.echartsData.planYear);
if (
(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) => {

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

4
src/index.html

@ -27,9 +27,9 @@
<!-- <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
<!-- <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 type="text/javascript" src="/assets/wordexport/jquery.js"></script>
<script type="text/javascript" src="/assets/wordexport/FileSaver.js"></script>

Loading…
Cancel
Save