Browse Source

替换数据

智慧矿山应急安全培训、考核、演练管理系统
jongbowen 2 years ago
parent
commit
d8b268e2c6
  1. 2
      package.json
  2. 201
      src/app/examiner/statistic-analysis/examStatistics/echarts/echarts.component.ts

2
package.json

@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.config.json --open --host 192.168.1.51 --port 4300 ",
"start": "ng serve --proxy-config proxy.config.json --open --port 4300 ",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",

201
src/app/examiner/statistic-analysis/examStatistics/echarts/echarts.component.ts

@ -1,5 +1,6 @@
import { Component, OnInit } from "@angular/core";
import { Router, NavigationExtras } from "@angular/router";
import { HttpClient, HttpHeaders } from "@angular/common/http";
declare var echarts: any;
@Component({
selector: "app-echarts",
@ -7,104 +8,59 @@ declare var echarts: any;
styleUrls: ["./echarts.component.scss"],
})
export class EchartsComponent implements OnInit {
constructor(public router: Router) {}
constructor(public router: Router,private http: HttpClient,) {}
ngOnInit(): void {
window.setTimeout(() => {
this.initCharts();
}, 0);
this.getProfiles()
// window.setTimeout(() => {
// this.initCharts();
// }, 0);
}
zhutu; //柱状图实例
echartsData
zhiData = {
name: [
"南宁支队",
"柳州支队",
"桂林支队",
"梧州支队",
"北海支队",
"防尘岗支队",
"钦州支队",
"贵港支队",
"玉林支队",
"百色支队",
"贺州支队",
"河池支队",
"来宾支队",
"崇左支队",
],
frequency: [18, 17, 14, 14, 12, 11, 15, 13, 12, 16, 16, 13, 18, 17, 12],
number: [
180, 170, 140, 140, 120, 110, 150, 130, 120, 160, 160, 130, 180, 170, 120,
],
};
zhiData2 = {
name: [
"南宁支队",
"柳州支队",
"桂林支队",
"梧州支队",
"北海支队",
"防尘岗支队",
"钦州支队",
"贵港支队",
"玉林支队",
"百色支队",
"贺州支队",
"河池支队",
"来宾支队",
"崇左支队",
],
frequency: [18, 17, 14, 14, 12, 11, 15, 13, 12, 16, 16, 13, 18, 17, 12],
number: [
180, 170, 140, 140, 120, 110, 150, 130, 120, 160, 160, 130, 180, 170, 120,
],
};
daData = {
name: [
"青秀大队",
"特勤大队",
"兴宁大队",
"江南大队",
"西乡塘大队",
"良庆大队",
"邕宁大队",
"高新大队",
"华侨大队",
"经开大队",
"武鸣大队",
"隆安大队",
"马山大队",
"上林大队",
"宾阳大队",
"横县大队",
],
frequency: [2, 3, 1, 1, 2, 1, 0, 1, 1, 0, 2, 0, 0, 1, 0,0],
number: [30, 30, 10, 10, 20, 10, 0, 10, 10, 0, 20, 0, 0, 10, 0,0],
name: [],
number: [],
};
jiuData = {
name: [
"南宁市青秀区仙葫消防救援站",
"南宁市青秀区凤岭消防救援站",
"南宁市青秀区柳沙消防救援站",
],
frequency: [1, 1, 1],
number: [8, 11, 11],
};
staticExam = false; //考试统计
upStatic = false; //发布考试统计
//考试统计按钮
staticecam() {
this.staticExam = true;
this.upStatic = false;
Profiles: any;
getProfiles() {
this.http.get("/api/ExamAccounts/Profiles").subscribe((data: any) => {
this.Profiles = data;
sessionStorage.setItem("creatorData", JSON.stringify(data));
this.getExamStatisticalAnalyses();
});
}
//发布考试按钮
upexam() {
this.staticExam = false;
this.upStatic = true;
organizationId
oldOrganizationId
queryMode=0
getExamStatisticalAnalyses(){
let params:any={
QueryMode:this.queryMode,
OrganizationId:this.organizationId?this.organizationId:this.Profiles.organizationId,
PageNumber:1,
PageSize:9999
}
this.http.get('/api/ExamStatisticalAnalyses/ExaminationStatistics',{params:params}).subscribe((res:any)=>{
console.log(res);
if(this.level==1){
this.oldOrganizationId=params.OrganizationId
}
this.echartsData=res
this.zhiData = {
name: [],
number: [],
};
this.echartsData.forEach(element => {
this.zhiData.name.push(element.organizationName)
this.zhiData.number.push(element.count)
});
this.initCharts();
})
}
title = "考试频次(次)";
examinationIndex = false;
color = "#41CDFC";
@ -114,31 +70,31 @@ export class EchartsComponent implements OnInit {
this.title = "考试频次(次)";
this.examinationIndex = false;
this.color = "#41CDFC";
this.queryMode=0
} else {
this.title = "考试人数(个)";
this.examinationIndex = true;
this.color = "#FF8678";
this.queryMode=1
}
let myChart = echarts.init(document.getElementById("zhidui"));
myChart.dispose();
this.initCharts();
this.getProfiles()
}
//后退
level = 0;
back() {
if (this.level != 0) {
if (this.level == 1) {
this.zhiData = this.zhiData2;
let myChart = echarts.init(document.getElementById("zhidui"));
myChart.clear();
} else {
this.zhiData = this.daData;
let myChart = echarts.init(document.getElementById("zhidui"));
myChart.clear();
}
this.initCharts();
this.level = this.level - 1;
if(this.level==1){
this.organizationId=this.Profiles.organizationId
}else if(this.level==2){
this.organizationId=this.oldOrganizationId
}
this.level=this.level-1
let myChart = echarts.init(document.getElementById("zhidui"));
myChart.dispose();
this.getExamStatisticalAnalyses()
}
initCharts() {
var detailPlanEchart = echarts.init(document.getElementById("zhidui"));
@ -201,9 +157,7 @@ export class EchartsComponent implements OnInit {
},
series: [
{
data: this.examinationIndex
? this.zhiData.number
: this.zhiData.frequency,
data: this.zhiData.number,
type: "bar",
// showBackground: true,
backgroundStyle: {
@ -236,21 +190,30 @@ export class EchartsComponent implements OnInit {
detailPlanEchart.setOption(option);
}
clickFunc(e) {
console.log(e);
let myChart = echarts.init(document.getElementById("zhidui"));
if (e.name.indexOf("支队") != -1) {
this.zhiData = this.daData;
this.level = 1;
myChart.dispose();
this.initCharts();
} else if (e.name.indexOf("大队") != -1) {
this.zhiData = this.jiuData;
this.level = 2;
myChart.dispose();
this.initCharts();
} else {
window.open("home/statistic-examination/station-examinee");
}
console.log(e);
this.echartsData.forEach(element=>{
if(element.organizationName==e.name&&element.level!=3){
this.organizationId=element.organizationId
this.level=this.level+1
myChart.dispose();
this.getExamStatisticalAnalyses()
}else if(element.organizationName==e.name&&element.level==3){
window.open("home/statistic-examination/station-examinee?organizationId="+element.organizationId);
}
})
// if (e.name.indexOf("支队") != -1) {
// this.zhiData = this.daData;
// this.level = 1;
// myChart.dispose();
// this.initCharts();
// } else if (e.name.indexOf("大队") != -1) {
// this.zhiData = this.jiuData;
// this.level = 2;
// myChart.dispose();
// this.initCharts();
// } else {
// window.open("home/statistic-examination/station-examinee");
// }
}
}

Loading…
Cancel
Save