Browse Source

[修改]报表统计按需查询显示

tangshan
陈敬瑜 3 years ago
parent
commit
bc10e10307
  1. 28
      src/app/statistic-analysis/combined-query/combined-query.component.html
  2. 5
      src/app/statistic-analysis/combined-query/combined-query.component.scss
  3. 122
      src/app/statistic-analysis/combined-query/combined-query.component.ts

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

@ -54,10 +54,10 @@
<label style="margin-right: 10px;">预案类型:</label> <label style="margin-right: 10px;">预案类型:</label>
<mat-form-field> <mat-form-field>
<mat-select [(ngModel)]="reservePlanType" name="reservePlanType" placeholder='请选择预案类型' [multiple]="true"> <mat-select [(ngModel)]="reservePlanType" name="reservePlanType" placeholder='请选择预案类型' [multiple]="true">
<mat-option value=16>文本预案</mat-option>
<mat-option value=1>二维预案</mat-option> <mat-option value=1>二维预案</mat-option>
<mat-option value=2>三维预案</mat-option> <mat-option value=2>三维预案</mat-option>
<mat-option value=4>其他预案</mat-option> <mat-option value=4>其他预案</mat-option>
<mat-option value=16>文本预案</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -72,17 +72,15 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="queryField" *ngIf="preparelevels==0"> <div class="queryField" *ngIf="preparelevels==0">
<label style="margin-right: 10px;">单位状态:</label> <label style="margin-right: 10px;">单位状态:</label>
<mat-form-field> <mat-form-field>
<mat-select [(ngModel)]="preparelevel" name="preparelevel" placeholder='请选择编制级别'> <mat-select required [(ngModel)]="preparelevel" name="preparelevel" placeholder='请选择单位状态' [multiple]="true">
<mat-option value=0>新增</mat-option> <mat-option [value]='preparelevel[0]'>新增</mat-option>
<mat-option value=1>维护更新</mat-option> <mat-option [value]='preparelevel[1]||2'>维护更新</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="queryField" *ngIf="preparelevels==1"> <div class="queryField" *ngIf="preparelevels==1">
<label style="margin-right: 10px;">预案级别:</label> <label style="margin-right: 10px;">预案级别:</label>
<mat-form-field> <mat-form-field>
@ -95,6 +93,24 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="queryField" *ngIf="preparelevels==0">
<label style="margin-right: 10px;">按总数排序:</label>
<mat-form-field>
<mat-select placeholder='请选择排序方式' [(ngModel)]="integritySort" name="integritySort">
<mat-option value=1>从高到低</mat-option>
<mat-option value=0>从低到高</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="queryField" *ngIf="preparelevels==1">
<label style="margin-right: 10px;">按总数排序:</label>
<mat-form-field>
<mat-select placeholder='请选择排序方式' [(ngModel)]="yuanintegritySort" name="integritySort">
<mat-option value=1>从高到低</mat-option>
<mat-option value=0>从低到高</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="queryField" *ngIf="preparelevels==0||preparelevels==1"> <div class="queryField" *ngIf="preparelevels==0||preparelevels==1">
<button mat-raised-button color="primary">查询</button> <button mat-raised-button color="primary">查询</button>
<button mat-raised-button style="margin-left: 25px;" type="button" (click)="reset()">重置</button> <button mat-raised-button style="margin-left: 25px;" type="button" (click)="reset()">重置</button>

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

@ -90,8 +90,6 @@
.body{ .body{
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow-y: auto;
overflow-x: auto;
.buttonbox{ .buttonbox{
padding-left: 50px; padding-left: 50px;
button{ button{
@ -99,7 +97,8 @@
} }
} }
.tablebox{ .tablebox{
height: 100%; height: 620px;
overflow-y: auto;
//margin-bottom: 15px; //margin-bottom: 15px;
table{ table{
width: 100%; width: 100%;

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

@ -10,6 +10,7 @@ import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dial
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { TreeService } from '../../http-interceptors/tree.service' import { TreeService } from '../../http-interceptors/tree.service'
import { Viewer } from 'photo-sphere-viewer'; import { Viewer } from 'photo-sphere-viewer';
import { timeStamp } from 'console';
@Component({ @Component({
selector: 'app-combined-query', selector: 'app-combined-query',
@ -94,6 +95,8 @@ export class CombinedQueryComponent implements OnInit {
//获得所有预案或单位信息 //获得所有预案或单位信息
tableDataNull=false tableDataNull=false
async getAllPlanInfo() { async getAllPlanInfo() {
/* this.planCategory=new Array<number>();
this.reservePlanType=new Array<number>(); */
let paramsdata:any={ let paramsdata:any={
QueryMode:this.preparelevels, QueryMode:this.preparelevels,
OrganizationId:this.jsId||'', OrganizationId:this.jsId||'',
@ -101,31 +104,42 @@ export class CombinedQueryComponent implements OnInit {
TimeIntervalStart:this.dwaddtime||'', TimeIntervalStart:this.dwaddtime||'',
TimeIntervalEnd:this.dwendtime||'', TimeIntervalEnd:this.dwendtime||'',
BuildingTypeIds:this.unittype||[], BuildingTypeIds:this.unittype||[],
CompanyStatus:this.preparelevel||'' CompanyStatus:this.preparelevel||[],
SortBy:'totalCount',
SortType:this.integritySort
} }
let yuandata={ let yuandata={
QueryMode:this.preparelevels, QueryMode:this.preparelevels,
OrganizationId:this.jsId||'', OrganizationId:this.yuanjsId||'',
HasChildren:this.yuanjscheck||'', HasChildren:this.yuanjscheck||'',
TimeIntervalStart:this.yuanaddtime||'', TimeIntervalStart:this.yuanaddtime||'',
TimeIntervalEnd:this.yuanendtime||'', TimeIntervalEnd:this.yuanendtime||'',
PlanCategory:this.planCategory||[], PlanCategories:this.planCategory||[],
PlanType:this.reservePlanType||[] PlanTypes:this.reservePlanType||[],
SortBy:'totalCount',
SortType:this.yuanintegritySort
} }
let result = await new Promise((resolve, reject)=>{ let result = await new Promise((resolve, reject)=>{
this.http.get("/api/StatisticsAnalysis/ReportTable", { params:this.preparelevels==0? paramsdata:yuandata }).subscribe((data: any) => { this.http.get("/api/StatisticsAnalysis/ReportTable", { params:this.preparelevels==0? paramsdata:yuandata }).subscribe((data: any) => {
//console.log(data) console.log(data)
if(data.length==0){ if(data.length==0){
this.tableDataNull=true this.tableDataNull=true
}else{ }else{
this.tableDataNull=false this.tableDataNull=false
if(this.preparelevels==0){ if(this.preparelevels==0){
//单位查询 //单位查询
if(this.preparelevel.length==0){
//必须选择单位状态
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择单位状态', '确定', config);
}else{
this.tabledataSource=[] this.tabledataSource=[]
this.displayedColumns=['组织名称', '总数'] this.displayedColumns=['组织名称', '总数']
data.forEach((element,i,value) => { data.forEach((element,i,value) => {
this.tabledataSource.push({name:[element.orgName,element.companyStatistics.totalCount]}) this.tabledataSource.push({name:[element.orgName,element.companyStatistics.totalCount]})
if(value[0].companyStatistics.buildingTypesCounts.length>0){ if(value[0].companyStatistics.buildingTypesCounts!=null){
value[i].companyStatistics.buildingTypesCounts.forEach((build,bi,bvalue) => { value[i].companyStatistics.buildingTypesCounts.forEach((build,bi,bvalue) => {
if(i==0){ if(i==0){
this.displayedColumns.push(value[0].companyStatistics.buildingTypesCounts[bi].buildingTypeName) this.displayedColumns.push(value[0].companyStatistics.buildingTypesCounts[bi].buildingTypeName)
@ -140,52 +154,30 @@ export class CombinedQueryComponent implements OnInit {
} }
}); });
}
} }
else if(this.preparelevels==1){ else if(this.preparelevels==1){
//预案查询 //预案查询
this.yuanColumns=['组织名称', '总数'] this.yuanColumns=['组织名称', '总数']
this.yuanTable=[{name:[0,0]}] this.yuanTable=[{name:[0,0]}]
//console.log(this.planCategory,this.reservePlanType) if(this.reservePlanType.length!=0){
if(this.planCategory.length==0&&this.reservePlanType.length!=0){
this.yuanColumns.push('Ⅰ级预案','Ⅱ级预案','Ⅲ级预案','Ⅳ级预案','Ⅴ级预案')
this.yuanTable[0].name.push(0,0,0,0,0)
this.reservePlanType.forEach(element => { this.reservePlanType.forEach(element => {
if(element==1){ if(element==1){
this.yuanColumns.push('二维预案') this.yuanColumns.push('二维')
this.yuanTable[0].name.push(0) this.yuanTable[0].name.push(0)
}else if(element==2){ }else if(element==2){
this.yuanColumns.push('三维预案') this.yuanColumns.push('三维')
this.yuanTable[0].name.push(0) this.yuanTable[0].name.push(0)
}else if(element==4){ }else if(element==4){
this.yuanColumns.push('其他预案') this.yuanColumns.push('其他')
this.yuanTable[0].name.push(0) this.yuanTable[0].name.push(0)
}else if(element==16){ }else if(element==16){
this.yuanColumns.push('文本预案') this.yuanColumns.push('文本')
this.yuanTable[0].name.push(0) this.yuanTable[0].name.push(0)
} }
}); });
}else if(this.planCategory.length!=0&&this.reservePlanType.length==0){ }
this.yuanColumns.push('文本预案','二维预案','三维预案','其他预案') if(this.planCategory.length!=0){
this.yuanTable[0].name.push(0,0,0,0)
this.planCategory.forEach(element=>{
if(element==1){
this.yuanColumns.push('Ⅰ级预案')
this.yuanTable[0].name.push(0)
}else if(element==2){
this.yuanColumns.push('Ⅱ级预案')
this.yuanTable[0].name.push(0)
}else if(element==3){
this.yuanColumns.push('Ⅲ级预案')
this.yuanTable[0].name.push(0)
}else if(element==4){
this.yuanColumns.push('Ⅳ级预案')
this.yuanTable[0].name.push(0)
}else if(element==5){
this.yuanColumns.push('Ⅴ级预案')
this.yuanTable[0].name.push(0)
}
})
}else if(this.planCategory.length!=0&&this.reservePlanType.length!=0){
this.planCategory.forEach(element=>{ this.planCategory.forEach(element=>{
if(element==1){ if(element==1){
this.yuanColumns.push('Ⅰ级预案') this.yuanColumns.push('Ⅰ级预案')
@ -204,23 +196,8 @@ export class CombinedQueryComponent implements OnInit {
this.yuanTable[0].name.push(0) this.yuanTable[0].name.push(0)
} }
}) })
this.reservePlanType.forEach(element => {
if(element==1){
this.yuanColumns.push('二维预案')
this.yuanTable[0].name.push(0)
}else if(element==2){
this.yuanColumns.push('三维预案')
this.yuanTable[0].name.push(0)
}else if(element==4){
this.yuanColumns.push('其他预案')
this.yuanTable[0].name.push(0)
}else if(element==16){
this.yuanColumns.push('文本预案')
this.yuanTable[0].name.push(0)
}
});
} }
//console.log(this.yuanTable)
data.forEach((element,i,value) => { data.forEach((element,i,value) => {
if(i==0){ if(i==0){
this.yuanTable[0].name[0]=value[0].orgName this.yuanTable[0].name[0]=value[0].orgName
@ -240,17 +217,22 @@ export class CombinedQueryComponent implements OnInit {
this.yuanColumns.forEach((th,thi,thvalu)=>{ this.yuanColumns.forEach((th,thi,thvalu)=>{
data.forEach((element,i,value) => { data.forEach((element,i,value) => {
//预案级别数据 //预案级别数据
value[i].planStatistics.planCategoryStatistics.planCategories.forEach((jibie,ji,jval) => { if(value[i].planStatistics.planCategoryStatistics!=null){
if(thvalu[thi].indexOf(jval[ji].planCategoryName)!=-1&&yuani==i){ value[i].planStatistics.planCategoryStatistics.planCategories.forEach((jibie,ji,jval) => {
yuanval[yuani].name[thi]=jval[ji].count if(thvalu[thi].indexOf(jval[ji].planCategoryName)!=-1&&yuani==i){
} yuanval[yuani].name[thi]=jval[ji].count
}); }
//预案类型数据 });
value[i].planStatistics.planTypeStatistics.planTypes.forEach((planlx,lxi,lxval) => { }
if(value[i].planStatistics.planTypeStatistics!=null){
//预案类型数据
value[i].planStatistics.planTypeStatistics.planTypes.forEach((planlx,lxi,lxval) => {
if(thvalu[thi].indexOf(lxval[lxi].planTypeName)!=-1&&yuani==i){ if(thvalu[thi].indexOf(lxval[lxi].planTypeName)!=-1&&yuani==i){
yuanval[yuani].name[thi]=lxval[lxi].count yuanval[yuani].name[thi]=lxval[lxi].count
} }
}); });
}
}); });
}) })
@ -259,8 +241,8 @@ export class CombinedQueryComponent implements OnInit {
} }
//this.tabledataSource=data //this.tabledataSource=data
//console.log(this.yuanColumns) console.log(this.yuanColumns)
//console.log(this.yuanTable) console.log(this.yuanTable)
this.excelData=data this.excelData=data
resolve(this.excelData) resolve(this.excelData)
} }
@ -482,7 +464,7 @@ export class CombinedQueryComponent implements OnInit {
let config = new MatSnackBarConfig(); let config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
if(this.dwendtime<this.dwaddtime||this.yuanaddtime<this.yuanendtime){ if(this.dwendtime<this.dwaddtime||this.yuanaddtime>this.yuanendtime){
this.snackBar.open('开始时间不能早于结束时间', '确定', config); this.snackBar.open('开始时间不能早于结束时间', '确定', config);
} }
this.getAllPlanInfo(); this.getAllPlanInfo();
@ -496,9 +478,11 @@ export class CombinedQueryComponent implements OnInit {
yuanjscheck: boolean //预案所选组织机构勾选框 yuanjscheck: boolean //预案所选组织机构勾选框
unittype=[] //单位类型 unittype=[] //单位类型
reservePlanType=[] //预案类型 reservePlanType=[] //预案类型
preparelevel: any //编制级别 preparelevel=[1] //单位状态
plcheck: boolean //编制级别勾选框 plcheck: boolean //编制级别勾选框
planCategory = []//预案级别 planCategory=[] //预案级别
integritySort=1 //单位排序字段
yuanintegritySort=1 //预案排序字段
//重置 //重置
reset() { reset() {
if(this.preparelevels==0){ if(this.preparelevels==0){
@ -506,8 +490,7 @@ export class CombinedQueryComponent implements OnInit {
this.jsId = '' this.jsId = ''
this.jscheck = false this.jscheck = false
this.unittype = [] this.unittype = []
this.preparelevel = [0]
this.preparelevel = ''
this.dwaddtime = '' this.dwaddtime = ''
this.dwendtime = '' this.dwendtime = ''
}else if(this.preparelevels==1){ }else if(this.preparelevels==1){
@ -523,11 +506,6 @@ export class CombinedQueryComponent implements OnInit {
//重新获取初始化列表 //重新获取初始化列表
this.getAllPlanInfo(); this.getAllPlanInfo();
} }
//导出
tableToexcel(){
this.exal()(document.getElementById("table"), "导出表格")
}
exal(){ exal(){
var uri = 'data:application/vnd.ms-excel;base64,', var uri = 'data:application/vnd.ms-excel;base64,',
@ -575,7 +553,7 @@ export class CombinedQueryComponent implements OnInit {
const link = document.createElement('a'); const link = document.createElement('a');
const blob = new Blob([data], {type: 'application/vnd.ms-excel'}); const blob = new Blob([data], {type: 'application/vnd.ms-excel'});
link.setAttribute('href', window.URL.createObjectURL(blob)); link.setAttribute('href', window.URL.createObjectURL(blob));
link.setAttribute('download', '统计信息'+'.xls'); link.setAttribute('download', '报表统计'+'.xls');
link.style.visibility = 'hidden'; link.style.visibility = 'hidden';
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();

Loading…
Cancel
Save