Browse Source

[修改]统计分析区间查询换新接口

zhuzhou
chenjingyu 4 years ago
parent
commit
96146ad928
  1. 12
      src/app/statistic-analysis/addUnit/add-unit-three-line-details/add-unit-three-line-details.component.scss
  2. 29
      src/app/statistic-analysis/addUnit/add-unit-three-line-details/add-unit-three-line-details.component.ts
  3. 4
      src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.html
  4. 78
      src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.scss
  5. 85
      src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.ts
  6. 8
      src/app/statistic-analysis/state/page-there-year/page-there-year.component.scss
  7. 51
      src/app/statistic-analysis/state/page-there-year/page-there-year.component.ts
  8. 4
      src/app/statistic-analysis/state/page-two-time/page-two-time.component.html
  9. 89
      src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss
  10. 124
      src/app/statistic-analysis/state/page-two-time/page-two-time.component.ts

12
src/app/statistic-analysis/addUnit/add-unit-three-line-details/add-unit-three-line-details.component.scss

@ -33,7 +33,7 @@
// padding: 0 15px; // padding: 0 15px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: nowrap;
align-items:center; align-items:center;
justify-content:center; justify-content:center;
.queryField { .queryField {
@ -67,10 +67,16 @@
overflow: auto; overflow: auto;
#barEchart{ #barEchart{
width: 80%; width: 80%;
height: 550px;
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%;
transform: translate(-50%,-50%); transform: translate(-50%,-50%);
@media screen and (max-device-width:1400px){
height: 450px;
top: 60%;
}
@media screen and (min-device-width:1400px){
height: 550px;
top: 50%;
}
} }
} }

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

@ -19,6 +19,7 @@ export class AddUnitThreeLineDetailsComponent implements OnInit {
setTimeoutObj//延时器需要清除 setTimeoutObj//延时器需要清除
qopao qopao
lastId lastId
zhiorbuild
ngOnInit(): void { ngOnInit(): void {
if(sessionStorage.getItem('refresh') === 'true') { if(sessionStorage.getItem('refresh') === 'true') {
sessionStorage.removeItem('refresh'); sessionStorage.removeItem('refresh');
@ -30,10 +31,11 @@ export class AddUnitThreeLineDetailsComponent implements OnInit {
this.year = params['year']; this.year = params['year'];
this.buildingTypeName = params['buildingType']; this.buildingTypeName = params['buildingType'];
this.lastId=params['id'] this.lastId=params['id']
this.zhiorbuild=params['type']
}); });
this.setTimeoutObj = window.setTimeout(()=>{ this.setTimeoutObj = window.setTimeout(()=>{
this.getdata() this.getdata()
},1000) })
} }
ngOnDestroy(){ ngOnDestroy(){
@ -45,24 +47,26 @@ export class AddUnitThreeLineDetailsComponent implements OnInit {
zongcount=0 zongcount=0
async getdata(){ async getdata(){
let parzhi={ let parzhi={
objectType:0,
BuildingTypeId:this.lastId, BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType, TrendType:this.serviceData.selectType,
//TrendYear:this.year||'' TrendYear:this.year||''
} }
let parbuild={ let parbuild={
objectType:0,
OrganizationId:this.lastId, OrganizationId:this.lastId,
TrendType:this.serviceData.selectType, TrendType:this.serviceData.selectType,
//TrendYear:this.year||'' TrendYear:this.year||''
} }
await this.serviceData.getData(this.serviceData.zuzhiorBuilding=='zhi'?parbuild:parzhi,`/api/StatisticsAnalysis`) await this.serviceData.getData(this.zhiorbuild=='zhi'?parbuild:parzhi,`/api/StatisticsAnalysis/Trends`)
this.setTimeoutObj = window.setTimeout(() => { this.setTimeoutObj = window.setTimeout(() => {
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate))
//console.log(this.tabledata) //console.log(this.tabledata)
for(var i=0;i<this.tabledata[0].companyStatistics.trendStatistics.added.length;i++){ for(var i=0;i<this.tabledata[0].length;i++){
if(this.tabledata[0].companyStatistics.trendStatistics.added[i].month>=this.serviceData.selectStartMonth||this.tabledata[0].companyStatistics.trendStatistics.added[i].month<=this.serviceData.selectEndMonth){ if(this.tabledata[0][i].month>=this.serviceData.selectStartMonth||this.tabledata[0][i].month<=this.serviceData.selectEndMonth){
this.date.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].month) this.date.push(this.tabledata[0][i].month)
this.dateNum.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].count) this.dateNum.push(this.tabledata[0][i].count)
this.zongcount=this.zongcount+this.tabledata[0].companyStatistics.trendStatistics.added[i].count this.zongcount=this.zongcount+this.tabledata[0][i].count
} }
} }
@ -119,10 +123,7 @@ export class AddUnitThreeLineDetailsComponent implements OnInit {
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp'); this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp');
this.option = { this.option = {
grid: { grid: {
top: 50, top: 90,
left:40,
right: 20,
//bottom: 20,
}, },
// 标题 // 标题
title: { title: {
@ -208,7 +209,7 @@ export class AddUnitThreeLineDetailsComponent implements OnInit {
if (this.detailPlanEchart.containPixel('grid',pointInPixel)) { if (this.detailPlanEchart.containPixel('grid',pointInPixel)) {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':this.buildingTypeName,'id':this.lastId}}) this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':this.buildingTypeName,'id':this.lastId,'type':this.zhiorbuild}})
//this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'level':'zhidui','time':this.option.xAxis.data[xIndex],'buildingTpye':this.buildingTypeName}}); //this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_barDetails'],{queryParams:{'level':'zhidui','time':this.option.xAxis.data[xIndex],'buildingTpye':this.buildingTypeName}});
} }
}); });

4
src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.html

@ -4,7 +4,7 @@
* @Author: sueRimn * @Author: sueRimn
* @Date: 2020-09-05 13:50:45 * @Date: 2020-09-05 13:50:45
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2021-03-13 14:41:42 * @LastEditTime: 2021-04-02 09:31:45
--> -->
<div class="box"> <div class="box">
<div class="header"> <div class="header">
@ -70,7 +70,7 @@
<div class="btnbox"> <div class="btnbox">
<button mat-stroked-button style="margin-left: 30px;" (click)="backClick()">返回</button> <button mat-stroked-button style="margin-left: 30px;" (click)="backClick()">返回</button>
<button mat-stroked-button (click)="forward()" style="margin-left: 20px;">类型统计</button> <button mat-stroked-button (click)="forward()" style="margin-left: 20px;">类型统计</button>
<button mat-stroked-button (click)="reverse()" [ngClass]="{'selectedBtn': true}"style="margin-left: 50px;">区间选择</button> <button mat-stroked-button (click)="reverse()" [ngClass]="{'selectedBtn': true}"style="margin-left: 20px;">区间选择</button>
</div> </div>
</div> </div>
<div class="echartsbox"> <div class="echartsbox">

78
src/app/statistic-analysis/addUnit/add-unit-two-time/add-unit-two-time.component.scss

@ -11,18 +11,26 @@
overflow: auto; overflow: auto;
} }
#Line{ #Line{
width: 50%; //width: 50%;
height: 420px; height: 600px;
margin: 50px auto; //margin: 50px auto;
} }
} }
.publicCss{ .publicCss{
width: 80%; width: 80%;
height: 550px; //height: 550px;
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 55%; //top: 55%;
transform: translate(-50%,-50%); transform: translate(-50%,-50%);
@media screen and (max-device-width:1400px){
height: 450px;
top: 60%;
}
@media screen and (min-device-width:1400px){
height: 550px;
top: 55%;
}
} }
//头部搜索栏 //头部搜索栏
@ -34,31 +42,57 @@
// padding: 0 15px; // padding: 0 15px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: nowrap;
align-items:center; @media screen and (min-device-width:1200px){
justify-content:center; align-items:center;
justify-content:center;
}
@media screen and (max-device-width:1200px){
justify-content: center;
align-items:center;
}
.queryField { .queryField {
margin: 0 10px; @media screen and (max-device-width:1200px){
font-size: 14px; font-size: 14px;
.mat-form-field { .mat-form-field {
width: 130px; width: 100px;
max-height: 50px;; max-height: 50px;;
margin: 0 15px 0 10px; margin: 0 5px 0 5px;
} }
}
@media screen and (min-device-width:1200px){
margin: 0 10px;
font-size: 14px;
.mat-form-field {
width: 130px;
max-height: 50px;;
margin: 0 15px 0 10px;
}
}
} }
.btnbox{ .btnbox{
display: flex; @media screen and (min-device-width:1200px){
flex-direction:row-reverse;
//float: right;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%;
button{ button{
width: 88px; width: 88px;
height: 36px; height: 36px;
} }
margin-right:4%; margin-right:4%;
}
@media screen and (max-device-width:1200px){
justify-content: center;
align-items: center;
button{
width: 88px;
height: 36px;
}
}
display: flex;
flex-direction:nowrap;
height: 100%;
} }
} }
.selectedBtn{ .selectedBtn{

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

@ -41,24 +41,26 @@ export class AddUnitTwoTimeComponent implements OnInit {
yeardatee yeardatee
async getdata(){ async getdata(){
let parzhi={ let parzhi={
objectType:0,
BuildingTypeId:this.lastId, BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType, TrendType:this.serviceData.selectType,
TrendYear:this.yeardatee||'' TrendYear:this.yeardatee||''
} }
let parbuild={ let parbuild={
objectType:0,
OrganizationId:this.lastId, OrganizationId:this.lastId,
TrendType:this.serviceData.selectType, TrendType:this.serviceData.selectType,
TrendYear:this.yeardatee||'' TrendYear:this.yeardatee||''
} }
await this.serviceData.getData(this.serviceData.zuzhiorBuilding=='zhi'?parbuild:parzhi,`/api/StatisticsAnalysis`) await this.serviceData.getData(this.zhiorbuild=="zhi"?parbuild:parzhi,`/api/StatisticsAnalysis/Trends`)
this.setTimeoutObj = window.setTimeout(() => { this.setTimeoutObj = window.setTimeout(() => {
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate))
//console.log(this.tabledata) console.log(this.tabledata[0])
for(var i=0;i<this.tabledata[0].companyStatistics.trendStatistics.added.length;i++){ for(var i=0;i<this.tabledata[0].length;i++){
if(this.tabledata[0].companyStatistics.trendStatistics.added[i].month>=this.serviceData.selectStartMonth||this.tabledata[0].companyStatistics.trendStatistics.added[i].month<=this.serviceData.selectEndMonth){ if(this.tabledata[0][i].month>=this.serviceData.selectStartMonth||this.tabledata[0][i].month<=this.serviceData.selectEndMonth){
this.date.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].month) this.date.push(this.tabledata[0][i].month)
this.dateNum.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].count) this.dateNum.push(this.tabledata[0][i].count)
this.zongcount=this.zongcount+this.tabledata[0].companyStatistics.trendStatistics.added[i].count this.zongcount=this.zongcount+this.tabledata[0][i].count
} }
} }
@ -102,11 +104,11 @@ export class AddUnitTwoTimeComponent implements OnInit {
if (e.selectEndMonth>=e.selectStartMonth) { if (e.selectEndMonth>=e.selectStartMonth) {
let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime = e.selectOneYear + '-' + e.selectStartMonth + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0
let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 let endTime = e.selectTwoYear + '-' + e.selectEndMonth + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59
for(var i=0;i<this.tabledata[0].companyStatistics.trendStatistics.added.length;i++){ for(var i=0;i<this.tabledata[0].length;i++){
if(this.tabledata[0].companyStatistics.trendStatistics.added[i].month>=this.serviceData.selectStartMonth&&this.tabledata[0].companyStatistics.trendStatistics.added[i].month<=this.serviceData.selectEndMonth){ if(this.tabledata[0][i].month>=this.serviceData.selectStartMonth&&this.tabledata[0][i].month<=this.serviceData.selectEndMonth){
this.date.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].month) this.date.push(this.tabledata[0][i].month)
this.dateNum.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].count) this.dateNum.push(this.tabledata[0][i].count)
this.zongcount=this.zongcount+this.tabledata[0].companyStatistics.trendStatistics.added[i].count this.zongcount=this.zongcount+this.tabledata[0][i].count
} }
} }
//this.oneInit (this.date,this.dateNum) //this.oneInit (this.date,this.dateNum)
@ -123,20 +125,31 @@ export class AddUnitTwoTimeComponent implements OnInit {
selectEndYear:any = (new Date()).getFullYear() //结束年份 selectEndYear:any = (new Date()).getFullYear() //结束年份
//按年查询 //按年查询
yearSubmit (e) { yearSubmit (e) {
this.zongcount=0
this.date2=[]
this.dateNum2=[]
if (e.selectEndYear >= e.selectStartYear) { if (e.selectEndYear >= e.selectStartYear) {
let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0 let startTime = e.selectStartYear + '-' + 1 + '-' + 1 + ' ' + 0 + ':' + 0 +':'+ 0
let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59
//console.log(startTime) for(var i=0;i<this.tabledata[0].length;i++){
//console.log(endTime) if(this.tabledata[0][i].year>=e.selectStartYear&&this.tabledata[0][i].year<=e.selectEndYear){
this.date2.push(this.tabledata[0][i].month)
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')
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('请选择正确时间区段','确定',config); this.snackBar.open('结束年份必须大于开始年份','确定',config);
} }
} }
//年或月点击 //年或月点击
dateChange(){ async dateChange(){
this.tiaoshiPao=null this.tiaoshiPao=null
this.forArr.forEach(item => { this.forArr.forEach(item => {
item.echart.dispose() item.echart.dispose()
@ -145,22 +158,32 @@ export class AddUnitTwoTimeComponent implements OnInit {
if(this.selectType == "year"){ if(this.selectType == "year"){
this.zongcount=0 this.zongcount=0
this.serviceData.selectType=2 this.serviceData.selectType=2
let paramdata={ let parzhi={
objectType:0,
BuildingTypeId:this.lastId, BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType TrendType:this.serviceData.selectType,
}
let parbuild={
objectType:0,
OrganizationId:this.lastId,
TrendType:this.serviceData.selectType,
} }
this.serviceData.getData(paramdata,`/api/StatisticsAnalysis`) /* let paramdata={
BuildingTypeId:this.lastId,
TrendType:this.serviceData.selectType
} */
await this.serviceData.getData(this.zhiorbuild=="zhi"?parbuild:parzhi,`/api/StatisticsAnalysis/Trends`)
this.setTimeoutObj = window.setTimeout(() => { this.setTimeoutObj = window.setTimeout(() => {
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate))
//console.log(this.tabledata) console.log(this.tabledata)
for(var i=0;i<this.tabledata[0].companyStatistics.trendStatistics.added.length;i++){ for(var i=0;i<this.tabledata[0].length;i++){
this.dateNum2.push(this.tabledata[0].companyStatistics.trendStatistics.added[0].count) this.dateNum2.push(this.tabledata[0][i].count)
this.zongcount=this.zongcount+this.tabledata[0].companyStatistics.trendStatistics.added[i].count this.zongcount=this.zongcount+this.tabledata[0][i].count
} }
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date) this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2) this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2)
this.twoInit (this.date2,this.dateNum2,'year') this.twoInit (this.date2,this.dateNum2,'year')
}, 1000); });
/* this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2) /* this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum2,this.date2)
this.twoInit(this.date2,this.dateNum2,'year') */ this.twoInit(this.date2,this.dateNum2,'year') */
} }
@ -224,7 +247,7 @@ export class AddUnitTwoTimeComponent implements OnInit {
} }
date2 = ['2020', '2021'] date2 = ['2020', '2021']
dateNum2 = [0] dateNum2 = []
//新增数量统计 //新增数量统计
oneInit (date,dateNum) { oneInit (date,dateNum) {
@ -320,15 +343,12 @@ export class AddUnitTwoTimeComponent implements OnInit {
item.echart = echarts.init(document.getElementById('gaoceng'), 'skinUpp'); item.echart = echarts.init(document.getElementById('gaoceng'), 'skinUpp');
var option = { var option = {
grid: { grid: {
top: 50, top: 90,
left:40,
right: 20,
//bottom: 20,
}, },
// 标题 // 标题
title: { title: {
text: this.headname+`:总数(${this.zongcount}`, text: this.headname+`:总数(${this.zongcount}`,
top: -4, top:-4,
left: 'center', left: 'center',
textStyle:{ textStyle:{
//文字颜色 //文字颜色
@ -374,6 +394,7 @@ export class AddUnitTwoTimeComponent implements OnInit {
}, },
// y轴 // y轴
yAxis: { yAxis: {
//min:10,
type: 'value', type: 'value',
name: '个', name: '个',
axisLabel: { axisLabel: {
@ -411,7 +432,7 @@ export class AddUnitTwoTimeComponent implements OnInit {
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
// console.log(option.series[0].data[xIndex],option.xAxis.data[xIndex],option.title.text,option.series[0].name) // console.log(option.series[0].data[xIndex],option.xAxis.data[xIndex],option.title.text,option.series[0].name)
if(option.series[0].name == "year"){ 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}}); this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_time/three_lineDetails'],{queryParams:{'year':this.date2[xIndex],'buildingType':this.headname,'id':this.lastId,'type':this.zhiorbuild}});
/* this.selectType="month" /* this.selectType="month"
this.yeardatee=option.xAxis.data[xIndex] this.yeardatee=option.xAxis.data[xIndex]
@ -420,7 +441,7 @@ export class AddUnitTwoTimeComponent implements OnInit {
}else{ }else{
if(this.serviceData.level=='0'||this.serviceData.level=='1'||this.serviceData.level=='2'){ 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_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}}) this.router.navigate(['/statisticanalysis/addUnit_one/addUnit_two_type'],{queryParams:{'level':this.headname,'id':this.lastId,'type':this.zhiorbuild}})
} }
} }

8
src/app/statistic-analysis/state/page-there-year/page-there-year.component.scss

@ -10,6 +10,14 @@
height: 100%; height: 100%;
// overflow: auto; // overflow: auto;
} }
#barEchart{
@media screen and (max-device-width:1200px){
height: 550px;
}
@media screen and (min-device-width:1200px){
height: 350px;
}
}
#Line{ #Line{
width: 50%; width: 50%;
height: 420px; height: 420px;

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

@ -20,36 +20,43 @@ export class PageThereYearComponent implements OnInit {
level:String level:String
setTimeoutObj//延时器需要清除 setTimeoutObj//延时器需要清除
type type
tabledata tabledata//获取所有数据
lastyears//上个页面传过来的年份
ngOnInit(): void { ngOnInit(): void {
this.dateInit () this.dateInit ()
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.year = params['level']; this.year = params['level'];
this.buildingTypeName = params['headtext']; this.buildingTypeName = params['headtext'];
this.type=params['type'] this.type=params['type']
this.lastyears=params['years']
}); });
let paramdata={
planStatus:this.type,
TrendType:this.serviceData.selectType
}
this.serviceData.getData(paramdata,`/api/StatisticsAnalysis`)
this.setTimeoutObj = window.setTimeout(()=>{ this.setTimeoutObj = window.setTimeout(()=>{
this.tabledata=JSON.parse(JSON.stringify(this.serviceData.allDate)) this.getechartsData()
console.log(this.tabledata[0].planStatistics.trendStatistics.added) })
for(var i=0;i<this.tabledata[0].companyStatistics.trendStatistics.added.length;i++){
this.date.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].month)
this.dateNum.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].count)
}
this.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.detailEcharts()
},1000)
} }
ngOnDestroy(){ ngOnDestroy(){
window.clearTimeout(this.setTimeoutObj); window.clearTimeout(this.setTimeoutObj);
this.detailPlanEchart.clear() this.detailPlanEchart.clear()
this.detailPlanEchart.dispose() this.detailPlanEchart.dispose()
} }
async getechartsData(){
let paramdata={
planStatus:this.type,
TrendYear:this.lastyears||'',
objectType:1,
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.tiaoshiPao=this.serviceData.qipao(this.tiaoshiPao,this.dateNum,this.date)
this.detailEcharts()
}
selectType:string = 'month'; //选择当前的 查询类型 按月/年 selectType:string = 'month'; //选择当前的 查询类型 按月/年
//查询数据 //查询数据
@ -112,10 +119,8 @@ export class PageThereYearComponent implements OnInit {
this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp'); this.detailPlanEchart = echarts.init(document.getElementById('barEchart'), 'skinUpp');
this.option = { this.option = {
grid: { grid: {
//top: 50, top: 90,
left:40,
right: 20,
//bottom: 20,
}, },
// 标题 // 标题
title: { title: {
@ -201,11 +206,13 @@ export class PageThereYearComponent implements OnInit {
let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex=this.detailPlanEchart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
if(this.serviceData.level=='0'||this.serviceData.level=='1'||this.serviceData.level=='2'){ if(this.serviceData.level=='0'||this.serviceData.level=='1'||this.serviceData.level=='2'){
this.router.navigate(['/statisticanalysis/stataPageThere'],{queryParams:{'level':this.option.xAxis.data[xIndex],'headtext':this.buildingTypeName,'zhong':'1','type':this.type}}); this.serviceData.isQuery=true
//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}});
} }
else if(this.serviceData.level=='3'){ else if(this.serviceData.level=='3'){
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':1}}); this.router.navigate(['/statisticanalysis/CompangInfo'],{queryParams:{'name':params.name,'type':this.type}});
} }
} }
}); });

4
src/app/statistic-analysis/state/page-two-time/page-two-time.component.html

@ -4,7 +4,7 @@
* @Author: sueRimn * @Author: sueRimn
* @Date: 2020-09-05 08:59:24 * @Date: 2020-09-05 08:59:24
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2021-04-01 15:54:10 * @LastEditTime: 2021-04-02 10:02:35
--> -->
<div class="content"> <div class="content">
@ -66,7 +66,7 @@
</div> </div>
<div class="fixedCss"> <div class="fixedCss">
<button mat-raised-button (click)='goBack()' >返回</button> <button mat-raised-button (click)='goBack()' style="margin-left: 5px;">返回</button>
<button mat-raised-button (click)='toggleTrue()' [ngClass]="{'selectButton': this.echartsData.isQuery}" style="margin:0 10px;" *ngIf="echartsData.statefulInspectionToggle">横向查询</button> <button mat-raised-button (click)='toggleTrue()' [ngClass]="{'selectButton': this.echartsData.isQuery}" style="margin:0 10px;" *ngIf="echartsData.statefulInspectionToggle">横向查询</button>
<button mat-raised-button (click)='toggleFalse()' [ngClass]="{'selectButton': !this.echartsData.isQuery}" *ngIf="echartsData.statefulInspectionToggle">纵向查询</button> <button mat-raised-button (click)='toggleFalse()' [ngClass]="{'selectButton': !this.echartsData.isQuery}" *ngIf="echartsData.statefulInspectionToggle">纵向查询</button>
</div> </div>

89
src/app/statistic-analysis/state/page-two-time/page-two-time.component.scss

@ -20,39 +20,80 @@
//头部搜索栏 //头部搜索栏
.header { .header {
border-bottom: 1px solid #999; border-bottom: 1px solid #999;
height: 70px; height: 80px;
min-height: 70px; min-height: 81px;;
box-sizing: border-box; box-sizing: border-box;
padding: 0 15px; // padding: 0 15px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: nowrap;
align-items:center; @media screen and (min-device-width:1200px){
justify-content:center; align-items:center;
.queryField { justify-content:center;
margin: 0 10px;
font-size: 14px;
.mat-form-field {
width: 130px;
max-height: 50px;;
margin: 0 15px 0 10px;
} }
@media screen and (max-device-width:1200px){
justify-content: center;
align-items:center;
}
.queryField {
@media screen and (max-device-width:1200px){
font-size: 14px;
.mat-form-field {
width: 100px;
max-height: 50px;;
margin: 0 5px 0 5px;
}
}
@media screen and (min-device-width:1200px){
margin: 0 10px;
font-size: 14px;
.mat-form-field {
width: 130px;
max-height: 50px;;
margin: 0 15px 0 10px;
}
}
} }
.fixedCss{ .fixedCss{
position: fixed; @media screen and (min-device-width:1200px){
top: 81px; justify-content: center;
right: 32px; align-items: center;
button{
width: 88px;
height: 36px;
}
margin-right:4%;
}
@media screen and (max-device-width:1200px){
justify-content: center;
align-items: center;
button{
width: 88px;
height: 36px;
}
}
display: flex;
flex-direction:nowrap;
height: 100%;
} }
} }
//echarts div公有样式 //echarts div公有样式
.publicCss{ .publicCss{
width: 80%; width: 80%;
height: 550px; @media screen and (max-device-width:1400px){
position: absolute; height: 450px;
left: 50%; top: 60%;
top: 50%; }
transform: translate(-50%,-50%); @media screen and (min-device-width:1400px){
height: 550px;
top: 50%;
}
position: absolute;
left: 50%;
transform: translate(-50%,-50%);
} }
.publicOneLineCss{ .publicOneLineCss{
height: 350px; height: 350px;

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

@ -128,11 +128,12 @@ export class PageTwoTimeComponent implements OnInit {
let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59 let endTime = e.selectEndYear + '-' + 12 + '-' + 31 + ' ' + 23 + ':' + 59 +':'+ 59
this.echartsData.selectOneYear=e.selectStartYear this.echartsData.selectOneYear=e.selectStartYear
this.echartsData.selectTwoYear=e.selectEndYear this.echartsData.selectTwoYear=e.selectEndYear
this.appEcharts.findyear()
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('请选择正确时间区段','确定',config); this.snackBar.open('结束时间必须大于开始时间','确定',config);
} }
} }
@ -149,13 +150,14 @@ 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) { }
zongcount=0
type type
organizationId=[]
tiaoshiPao:any tiaoshiPao:any
datayuey=[] datayuey=[]
datayuex=[] datayuex=[]
dataYearX = ['2020','2021'] dataYearX = []
dataYearY = ['0'] dataYearY = []
toggleTrue (){} toggleTrue (){}
//气泡提示数据获取 //气泡提示数据获取
bianli(){ bianli(){
@ -176,18 +178,32 @@ export class echartsComponent implements OnInit {
this.headtext=param.level this.headtext=param.level
this.type=param.type this.type=param.type
}); });
window.setTimeout(()=>{
this.getechartsData()
})
}
ngOnDestroy () {
this.twoExample.clear()
this.twoExample.dispose()
}
//获取数据
async getechartsData(){
let paramdata={ let paramdata={
//planStatus:this.type, planStatus:this.type,
TrendType:this.echartsData.selectType objectType:1,
TrendType:0
} }
this.echartsData.getData(paramdata,`/api/StatisticsAnalysis`) await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`)
window.setTimeout(()=>{ this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) console.log(this.tabledata)
//console.log(this.tabledata[0].companyStatistics.trendStatistics.added) for(var i=0;i<this.tabledata[0].length;i++){
for(var i=0;i<this.tabledata[0].companyStatistics.trendStatistics.added.length;i++){ if(this.tabledata[0][i].month>=this.echartsData.selectStartMonth||this.tabledata[0][i].month<=this.echartsData.selectEndMonth){
if(this.tabledata[0].companyStatistics.trendStatistics.added[i].month>=this.echartsData.selectStartMonth||this.tabledata[0].companyStatistics.trendStatistics.added[i].month<=this.echartsData.selectEndMonth){ this.datayuex.push(this.tabledata[0][i].month)
this.datayuex.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].month) this.datayuey.push(this.tabledata[0][i].count)
this.datayuey.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].count) this.zongcount=this.zongcount+this.tabledata[0][i].count
} }
} }
@ -195,38 +211,36 @@ export class echartsComponent implements OnInit {
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
//this.oneInit() //this.oneInit()
this.twoInit() this.twoInit()
},1000)
}
ngOnDestroy () {
this.twoExample.clear()
this.twoExample.dispose()
} }
changeTime (e) { async changeTime (e) {
this.twoExample.clear() this.twoExample.clear()
this.twoExample.dispose() this.twoExample.dispose()
if (e=='year') { if (e=='year') {
//this.oneInit(this.dataYearX,this.dataYearY) //this.oneInit(this.dataYearX,this.dataYearY)
this.dataYearX=[]
this.echartsData.selectType=2 this.echartsData.selectType=2
this.zongcount=0
let paramdata={ let paramdata={
//planStatus:this.type, objectType:1,
planStatus:this.type,
TrendType:this.echartsData.selectType TrendType:this.echartsData.selectType
} }
this.echartsData.getData(paramdata,`/api/StatisticsAnalysis`) await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`)
window.setTimeout(()=>{ window.setTimeout(()=>{
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
console.log(this.tabledata[0].companyStatistics.trendStatistics.added) console.log(this.tabledata)
this.dataYearY.push(this.tabledata[0].companyStatistics.trendStatistics.added[0].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.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
//this.oneInit() //this.oneInit()
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataYearY,this.dataYearX) this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataYearY,this.dataYearX)
this.twoInit(this.dataYearX,this.dataYearY) this.twoInit(this.dataYearX,this.dataYearY)
},1000) })
//this.twoInit(this.dataYearX,this.dataYearY) //this.twoInit(this.dataYearX,this.dataYearY)
} else { } else {
@ -238,29 +252,53 @@ export class echartsComponent implements OnInit {
} }
} }
//按月查询 //按月查询
findYue(){ async findYue(){
this.twoExample.clear() this.twoExample.clear()
this.datayuex=[] this.datayuex=[]
this.datayuey=[] this.datayuey=[]
let paramdata={ let paramdata={
objectType:1,
planStatus:this.type, planStatus:this.type,
TrendType:this.echartsData.selectType TrendType:this.echartsData.selectType
} }
this.echartsData.getData(paramdata,`/api/StatisticsAnalysis`) await this.echartsData.getData(paramdata,`/api/StatisticsAnalysis/Trends`)
window.setTimeout(()=>{ window.setTimeout(()=>{
this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate)) this.tabledata=JSON.parse(JSON.stringify(this.echartsData.allDate))
//console.log(this.tabledata[0].companyStatistics.trendStatistics.added) //console.log(this.tabledata[0].companyStatistics.trendStatistics.added)
for(var i=0;i<this.tabledata[0].companyStatistics.trendStatistics.added.length;i++){ for(var i=0;i<this.tabledata[0].length;i++){
if(this.tabledata[0].companyStatistics.trendStatistics.added[i].month>=this.echartsData.selectStartMonth&&this.tabledata[0].companyStatistics.trendStatistics.added[i].month<=this.echartsData.selectEndMonth){ if(this.tabledata[0][i].month>=this.echartsData.selectStartMonth&&this.tabledata[0][i].month<=this.echartsData.selectEndMonth){
this.datayuex.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].month) this.datayuex.push(this.tabledata[0][i].month)
this.datayuey.push(this.tabledata[0].companyStatistics.trendStatistics.added[i].count) this.datayuey.push(this.tabledata[0][i].count)
} }
} }
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex) this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.datayuey,this.datayuex)
this.twoInit(this.datayuex,this.datayuey) this.twoInit(this.datayuex,this.datayuey)
},1000) })
}
//按年查询
async findyear(){
this.twoExample.clear()
this.dataYearX=[]
this.dataYearY=[]
let paramdata={
objectType:1,
planStatus:this.type,
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)
}
}
this.tiaoshiPao=this.echartsData.qipao(this.tiaoshiPao,this.dataYearY,this.dataYearX)
this.twoInit(this.dataYearX,this.dataYearY)
})
} }
headtext headtext
twoExample:any; twoExample:any;
tabledata tabledata
@ -268,10 +306,9 @@ export class echartsComponent implements OnInit {
let that = this let that = this
this.twoExample = echarts.init(document.getElementById('two'), 'skinUpp'); this.twoExample = echarts.init(document.getElementById('two'), 'skinUpp');
var option = { var option = {
// 标题 // 标题
title: { title: {
text: this.headtext+':总数(102)', text: this.headtext+`:总数(${this.zongcount}`,
top: -4, top: -4,
left: 'center', left: 'center',
bottom: 100, bottom: 100,
@ -281,6 +318,9 @@ export class echartsComponent implements OnInit {
color:'#000', color:'#000',
} }
}, },
grid: {
top: 90,
},
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
position: this.echartsData.tableTooltipNoShowq, position: this.echartsData.tableTooltipNoShowq,
@ -353,7 +393,7 @@ export class echartsComponent implements OnInit {
if (this.twoExample.containPixel('grid',pointInPixel)) { if (this.twoExample.containPixel('grid',pointInPixel)) {
let xIndex=this.twoExample.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0]; let xIndex=this.twoExample.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
if(this.echartsData.selectType==2){ if(this.echartsData.selectType==2){
this.router.navigate(['/statisticanalysis/stataPageThereYearComponent'],{queryParams:{'level':option.xAxis.data[xIndex],'headtext':option.title.text,'type':this.type}}); this.router.navigate(['/statisticanalysis/stataPageThereYearComponent'],{queryParams:{'level':this.headtext,'headtext':option.title.text,'type':this.type,'year':X[xIndex]}});
}else{ }else{
/*事件处理代码书写位置*/ /*事件处理代码书写位置*/
if(this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2'){ if(this.echartsData.level=='0'||this.echartsData.level=='1'||this.echartsData.level=='2'){
@ -363,7 +403,7 @@ export class echartsComponent implements OnInit {
//this.router.navigate(['/statisticanalysis/statePageOne/name'],{queryParams:{'level':option.xAxis.data[xIndex],'headtext':this.headtext,'type':this.type}}); //this.router.navigate(['/statisticanalysis/statePageOne/name'],{queryParams:{'level':option.xAxis.data[xIndex],'headtext':this.headtext,'type':this.type}});
} else if(this.echartsData.level=='3'){ } else if(this.echartsData.level=='3'){
//中队跳转 //中队跳转
this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'name':params.name,'type':1}}); this.router.navigate(['/statisticanalysis/AllPlan'],{queryParams:{'name':params.name,'type':this.type}});
} }
} }

Loading…
Cancel
Save