Browse Source

[新增]报表统计新增返回按钮

tangshan
邵佳豪 3 years ago
parent
commit
6fbe935cc5
  1. 20
      src/app/statistic-analysis/combined-query/combined-query.component.html
  2. 3
      src/app/statistic-analysis/combined-query/combined-query.component.scss
  3. 88
      src/app/statistic-analysis/combined-query/combined-query.component.ts

20
src/app/statistic-analysis/combined-query/combined-query.component.html

@ -3,7 +3,7 @@
<mat-tab-group style="height: 100%;" [selectedIndex]="selected.value"
(selectedIndexChange)="selectedIndexChange($event)">
<mat-tab *ngFor="let item of lable" [label]="item" [disabled]="isMasklayer">
<ng-template matTabContent class="box">
<ng-template matTabContent class="box">
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm">
<div class="header">
<div class="queryBox">
@ -134,22 +134,32 @@
<div class="tablebox" id="table">
<table cellpadding="0" cellspacing="0" *ngIf="preparelevels==0&&!tableDataNull">
<thead>
<th *ngFor="let item of displayedColumns;let i=index">{{item}}</th>
<th *ngFor="let item of displayedColumns;let i=index">{{item}}<mat-icon
*ngIf="i == 0 && orRecord.length != 0" style="cursor: pointer;vertical-align: text-top;"
(click)="goBack()">undo
</mat-icon>
</th>
</thead>
<tbody>
<tr *ngFor="let element of tabledataSource">
<td *ngFor="let eletd of element.name;let key = index" (click)="clicktd(key,eletd)">{{eletd}}</td>
<td *ngFor="let eletd of element.name;let key = index" [ngClass]="{'pointer': key == 0}"
(click)="clicktd(key,eletd)">{{eletd}}</td>
</tr>
</tbody>
</table>
<table cellpadding="0" cellspacing="0" *ngIf="preparelevels==1&&!tableDataNull">
<thead>
<th *ngFor="let item of yuanColumns;let i=index">{{item}}</th>
<th *ngFor="let item of yuanColumns;let i=index">{{item}}<mat-icon
*ngIf="i == 0 && orRecord.length != 0" style="cursor: pointer;vertical-align: text-top;"
(click)="goBack()">undo
</mat-icon>
</th>
</thead>
<tbody>
<tr *ngFor="let element of yuanTable">
<td *ngFor="let eletd of element.name;let key = index" (click)="clicktd(key,eletd)">{{eletd}}</td>
<td *ngFor="let eletd of element.name;let key = index" [ngClass]="{'pointer': key == 0}"
(click)="clicktd(key,eletd)">{{eletd}}</td>
</tr>
</tbody>
</table>

3
src/app/statistic-analysis/combined-query/combined-query.component.scss

@ -176,6 +176,9 @@
mat-paginator {
width: 100%;
}
.pointer{
cursor: pointer;
}
}
}

88
src/app/statistic-analysis/combined-query/combined-query.component.ts

@ -59,10 +59,30 @@ export class CombinedQueryComponent implements OnInit {
selected = new FormControl(0); //选项卡实例
//判断选了哪一个
selectedIndexChange(e) {
this.orRecord = []
this.selected.setValue(e)
this.preparelevels = Number(e)
if (this.preparelevels == 0) {
this.js = this.organizationName
this.jsId = this.organizationId
this.jscheck = true
this.unittype = []
this.allunittype.forEach(element => {
this.unittype.push(element.id)
});
this.preparelevel = [1]
this.dwaddtime = '2020-01-01'//单位查询开始时间
this.dwendtime = this.getNowFormatDate()//单位结束时间
} else if (this.preparelevels == 1) {
this.yuanjs = this.organizationName
this.yuanjsId = this.organizationId
this.yuanaddtime = '2020-01-01'//预案查询开始时间
this.yuanendtime = this.getNowFormatDate()//预案查询结束时间
this.yuanjscheck = true
this.reservePlanType = ['1', '2', '4', '16']
this.planCategory = ['1', '2', '3', '4', '5']
}
this.getAllPlanInfo()
}
@ -413,6 +433,7 @@ export class CombinedQueryComponent implements OnInit {
//重置
reset() {
this.orRecord = []
if (this.preparelevels == 0) {
this.js = this.organizationName
this.jsId = this.organizationId
@ -437,27 +458,66 @@ export class CombinedQueryComponent implements OnInit {
this.getAllPlanInfo();
}
orRecord = []
//进入下一层
clicktd(key, element) {
// console.log(key)
// console.log(element)
// console.log(this.allorganizations)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
if (key == 0) {
let clickOr
this.allorganizations.forEach(item => {
if (element === item.name) {
if (this.preparelevels == 0) {
this.js = element
this.jsId = item.id
} else if (this.preparelevels == 1) {
this.yuanjs = element
this.yuanjsId = item.id
}
this.getAllPlanInfo();
clickOr = item
}
});
// console.log(clickOr)
if (this.preparelevels == 0) {
if (element == this.js) {
this.snackBar.open('已在当前查询的消防救援站下,无法下钻', '确定', config);
return
}
} else if (this.preparelevels == 1) {
if (element == this.yuanjs) {
this.snackBar.open('已在当前查询的消防救援站下,无法下钻', '确定', config);
return
}
}
if (clickOr.children.length == 0 && this.excelData.length == 1) {
this.snackBar.open('无下级消防救援站,无法下钻', '确定', config);
return
}
//记录点击过的消防救援站
this.orRecord.push({ name: this.js, id: this.jsId })
if (this.preparelevels == 0) {
this.js = element
this.jsId = clickOr.id
} else if (this.preparelevels == 1) {
this.yuanjs = element
this.yuanjsId = clickOr.id
}
console.log(this.orRecord)
this.getAllPlanInfo();
}
}
goBack() {
if (this.preparelevels == 0) {
this.js = this.orRecord[this.orRecord.length - 1].name
this.jsId = this.orRecord[this.orRecord.length - 1].id
} else if (this.preparelevels == 1) {
this.yuanjs = this.orRecord[this.orRecord.length - 1].name
this.yuanjsId = this.orRecord[this.orRecord.length - 1].id
}
this.orRecord.pop();
console.log(this.orRecord)
this.getAllPlanInfo();
}
exal() {

Loading…
Cancel
Save