diff --git a/src/app/pipes/boolean.pipe.ts b/src/app/pipes/boolean.pipe.ts index 025507f..a2e8c63 100644 --- a/src/app/pipes/boolean.pipe.ts +++ b/src/app/pipes/boolean.pipe.ts @@ -63,3 +63,21 @@ export class differentContentTitle implements PipeTransform { } } +@Pipe({ name: 'yuan' }) +export class yuan implements PipeTransform { + transform(value: string): string { + if (value == 'LevelOne') { + return '一级预案' + } else if (value == 'LevelTwo') { + return '二级预案' + } else if (value == 'LevelThree') { + return '三级预案' + }else if (value == 'LevelFour') { + return '四级预案' + }else if (value == 'LevelFive') { + return '五级预案' + }else if (value == 'PlanText') { + return '文本预案' + } + } +} diff --git a/src/app/statistic-analysis/combined-query/combined-query.component.html b/src/app/statistic-analysis/combined-query/combined-query.component.html index 30db40c..f78fac7 100644 --- a/src/app/statistic-analysis/combined-query/combined-query.component.html +++ b/src/app/statistic-analysis/combined-query/combined-query.component.html @@ -72,8 +72,8 @@ <label style="margin-right: 10px;">单位状态:</label> <mat-form-field> <mat-select [(ngModel)]="preparelevel" name="preparelevel" placeholder='请选择编制级别'> - <mat-option value=1>新增</mat-option> - <mat-option value=2>维护更新</mat-option> + <mat-option value=0>新增</mat-option> + <mat-option value=1>维护更新</mat-option> </mat-select> </mat-form-field> </div> @@ -82,9 +82,6 @@ <label style="margin-right: 10px;">预案级别:</label> <mat-form-field> <mat-select placeholder='请选择预案级别' [(ngModel)]="planCategory" name="planCategory" [multiple]="true"> - <mat-option value=6>应急预案(国家级)</mat-option> - <mat-option value=7>应急预案(市级)</mat-option> - <mat-option value=8>类型预案</mat-option> <mat-option value=1>Ⅰ级预案</mat-option> <mat-option value=2>Ⅱ级预案</mat-option> <mat-option value=3>Ⅲ级预案</mat-option> @@ -105,13 +102,33 @@ <mat-divider></mat-divider> <div class="body"> <div class="tablebox"> - <table mat-table [dataSource]="tabledataSource" class="mat-elevation-z8" id="table"> + <!-- <table mat-table [dataSource]="tabledataSource" class="mat-elevation-z8" id="table"> <ng-container *ngFor="let item of displayedColumns;let i=index" [matColumnDef]="displayedColumns[i]"> <th mat-header-cell *matHeaderCellDef>{{item}}</th> <td mat-cell *matCellDef="let element">{{element.name}}</td> </ng-container> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> + </table> --> + <table cellpadding="0" cellspacing="0" *ngIf="preparelevels==0"> + <thead> + <th *ngFor="let item of displayedColumns;let i=index">{{item}}</th> + </thead> + <tbody> + <tr *ngFor="let element of tabledataSource"> + <td *ngFor="let eletd of element.name">{{eletd}}</td> + </tr> + </tbody> + </table> + <table cellpadding="0" cellspacing="0" *ngIf="preparelevels==1"> + <thead> + <th *ngFor="let item of yuanColumns;let i=index">{{item}}</th> + </thead> + <tbody> + <tr *ngFor="let element of yuanTable"> + <td *ngFor="let eletd of element.name">{{eletd}}</td> + </tr> + </tbody> </table> </div> diff --git a/src/app/statistic-analysis/combined-query/combined-query.component.scss b/src/app/statistic-analysis/combined-query/combined-query.component.scss index 6b834aa..a82c777 100644 --- a/src/app/statistic-analysis/combined-query/combined-query.component.scss +++ b/src/app/statistic-analysis/combined-query/combined-query.component.scss @@ -88,6 +88,10 @@ } } .body{ + height: 100%; + width: 100%; + overflow-y: auto; + overflow-x: auto; .buttonbox{ padding-left: 50px; button{ @@ -97,8 +101,35 @@ .tablebox{ table{ width: 100%; - // margin-left: 2%; + background-color: white; margin-top: 15px; + table-layout: fixed; + thead,tr{ + border-bottom: 1px solid grey; + } + th { + border-bottom: 1px solid #999; + //width: 30%; + font-size: 16px; + text-align: center; + height: 60px; + line-height: 60px; + } + td { + + height: 50px; + line-height: 50px; + text-align: center; + font-size: 16px; + margin-left: 3px; + border-bottom: 1px solid #999; + .spantext{ + margin-left: 7px; + } + .buleColor{ + color: #2196f3; + } + } } mat-paginator{ width:100%; diff --git a/src/app/statistic-analysis/combined-query/combined-query.component.ts b/src/app/statistic-analysis/combined-query/combined-query.component.ts index 5a37e7e..2204428 100644 --- a/src/app/statistic-analysis/combined-query/combined-query.component.ts +++ b/src/app/statistic-analysis/combined-query/combined-query.component.ts @@ -54,10 +54,12 @@ export class CombinedQueryComponent implements OnInit { dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); myControl = new FormControl(); hasChild = (_: number, node: any) => node.expandable; - displayedColumns: string[] = ['组织名称', 'addpeople', 'level'];//, 'addtime', 'plantype', 'auditStatus', 'openRange', 'projectlevel', 'operation' + displayedColumns: string[] = ['组织名称', '总数'];//, 'addtime', 'plantype', 'auditStatus', 'openRange', 'projectlevel', 'operation' + yuanColumns:string[]=['组织名称', '总数']; allorganizations: any //所有组织机构 allunittype: any //所有单位类型 - tabledataSource: any //表格数据 + tabledataSource=[] //单位表格数据 + yuanTable=[]//预案表格数据 url findTj=0//查询条件 @@ -85,7 +87,6 @@ export class CombinedQueryComponent implements OnInit { //判断选了哪一个 selectedIndexChange(e){ this.selected.setValue(e) - console.log(e) this.preparelevels=Number(e) } //获得所有预案或单位信息 @@ -97,16 +98,128 @@ export class CombinedQueryComponent implements OnInit { TimeIntervalStart:this.addtime||'', TimeIntervalEnd:this.endtime||'', BuildingTypeIds:this.unittype||'', + CompanyStatus:this.preparelevel||'' } - this.http.get("/api/StatisticsAnalysis/ReportTable", { params: paramsdata }).subscribe((data: any) => { + let yuandata={ + QueryMode:this.preparelevels, + OrganizationId:this.jsId||'', + HasChildren:this.jscheck||'', + TimeIntervalStart:this.addtime||'', + TimeIntervalEnd:this.endtime||'', + PlanCategory:this.planCategory||'', + PlanType:this.reservePlanType||'' + } + this.http.get("/api/StatisticsAnalysis/ReportTable", { params:this.preparelevels==0? paramsdata:yuandata }).subscribe((data: any) => { console.log(data) - this.tabledataSource=data + //this.tabledataSource=data if(this.preparelevels==0){ - this.tabledataSource.forEach(element => { - this.displayedColumns.push(element) + this.tabledataSource=[] + this.displayedColumns=['组织名称', '总数'] + data.forEach((element,i,value) => { + this.tabledataSource.push({name:[element.orgName,element.companyStatistics.totalCount]}) + if(value[0].companyStatistics.buildingTypesCounts.length>0){ + value[i].companyStatistics.buildingTypesCounts.forEach((build,bi,bvalue) => { + if(i==0){ + this.displayedColumns.push(value[0].companyStatistics.buildingTypesCounts[bi].buildingTypeName||'111') + this.tabledataSource[0].name.push(value[0].companyStatistics.buildingTypesCounts[bi].count) + }else{ + this.tabledataSource[i].name.push(bvalue[bi].count) + } + /* this.tabledataSource.forEach((td,ti,tval)=>{ + tval[ti].name.push(item.count) + }) */ + }); + + } }); } - + else if(this.preparelevels==1){ + this.yuanColumns=['组织名称', '总数'] + this.yuanTable=[{name:[0,0]}] + //console.log(this.planCategory,this.reservePlanType) + 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 => { + 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) + } + }); + }else if(this.planCategory.length!=0&&this.reservePlanType.length==0){ + this.yuanColumns.push('文本预案','二维预案','三维预案','其他预案') + 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) + } + }) + console.log(this.yuanTable) + data.forEach((element,i,value) => { + if(i==0){ + this.yuanTable[0].name[0]=value[0].orgName + this.yuanTable[0].name[1]=value[0].planStatistics.totalCount + }else{ + this.yuanTable.push({name:[value[i].orgName,value[i].planStatistics.totalCount]}) + } + + /* if(value[0].planStatistics.planCategoryStatistics.planCategories.length>0){ + value[i].planStatistics.planCategoryStatistics.planCategories.forEach((build,bi,bvalue) => { + if(i==0){ + this.yuanColumns.push(value[0].planStatistics.planCategoryStatistics.planCategories[bi].planCategoryName) + this.yuanTable[0].name.push(value[0].planStatistics.planCategoryStatistics.planCategories[bi].count) + }else{ + this.yuanTable[i].name.push(bvalue[bi].count) + } + }); + + } */ + /* if(value[0].planStatistics.planTypeStatistics.length>0){ + value[i].planStatistics.planTypeStatistics.forEach((build,bi,bvalue) => { + if(i==0){ + this.yuanColumns.push(value[0].planStatistics.planTypeStatistics[bi].planCategoryName) + this.yuanTable[0].name.push(value[0].planStatistics.planCategoryStatistics[bi].count) + }else{ + this.yuanTable[i].name.push(bvalue[bi].count) + } + }); + } */ + }); + this.yuanTable.forEach((element,i,value)=>{ + if(i>0){ + for(let a=value[i].name.length;a<value[0].name.length;a++){ + value[i].name.push(0) + } + } + }) + this.yuanTable.forEach((element,index,value)=>{ + + }) + } + console.log(this.yuanColumns) + console.log(this.yuanTable) } ) } @@ -326,7 +439,7 @@ export class CombinedQueryComponent implements OnInit { jsId: any //所选组织机构的id jscheck: boolean //所选组织机构勾选框 unittype: any //单位类型 - reservePlanType: any //预案类型 + reservePlanType=[] //预案类型 preparelevel: any //编制级别 plcheck: boolean //编制级别勾选框 planCategory = []//预案级别 @@ -337,7 +450,7 @@ export class CombinedQueryComponent implements OnInit { this.jsId = '' this.jscheck = false this.unittype = '' - this.reservePlanType = '' + this.reservePlanType = [] this.preparelevel = '' this.addtime = '' this.endtime = ''