Browse Source

[新增]统计导出

非煤矿山灾害智能感知和预警系统
邵佳豪 2 years ago
parent
commit
f82a505c02
  1. 11
      src/app/home/statistic-analysis/form/examine/examine.component.html
  2. 32
      src/app/home/statistic-analysis/form/examine/examine.component.ts
  3. 11
      src/app/home/statistic-analysis/form/review/review.component.html
  4. 31
      src/app/home/statistic-analysis/form/review/review.component.ts
  5. 2
      src/app/home/statistic-analysis/home/home.component.ts
  6. 1
      src/theme.less

11
src/app/home/statistic-analysis/form/examine/examine.component.html

@ -9,7 +9,8 @@
nzTheme="outline"></i>查询</button>
<button (click)="reset()" nz-button nzType="default"><i nz-icon nzType="reload"
nzTheme="outline"></i>重置</button>
<button (click)="exportExcel()" nz-button nzType="default"><span nz-icon nzType="vertical-align-bottom"
nzTheme="outline"></span>导出</button>
</div>
@ -44,16 +45,16 @@
{{item['当场整改数']}}
</td>
<td>
{{item['上报数量']}}
{{item['推送大队总数']}}
</td>
<td>
{{item['消除隐患数量']}}
{{item['大队排除隐患数']}}
</td>
<td>
{{item['单位数']}}
{{item['社会单位数']}}
</td>
<td>
{{item['总隐患数'] == 0 ? '0.0' : ((item['消除隐患数量']/item['总隐患数'])*100).toFixed(1) }}%
{{item['隐患复查合格率']}}%
</td>
</tr>
</tbody>

32
src/app/home/statistic-analysis/form/examine/examine.component.ts

@ -5,6 +5,7 @@ import { TreeService } from 'src/app/service/tree.service';
import * as moment from 'moment';
import * as echarts from 'echarts';
import { Router } from '@angular/router';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'app-examine',
templateUrl: './examine.component.html',
@ -12,7 +13,7 @@ import { Router } from '@angular/router';
})
export class ExamineComponent implements OnInit {
constructor(private http: HttpClient, private toTree: TreeService, private methodService: MethodService, private router: Router) { }
constructor(private http: HttpClient, private toTree: TreeService, private methodService: MethodService, private router: Router, private message: NzMessageService) { }
echartsOfBar
@ -285,4 +286,33 @@ export class ExamineComponent implements OnInit {
goback() {
this.router.navigate(['/statistic/home'])
}
exportExcel() {
const httpOptions = {
responseType: 'blob' as 'json',
params: {
OrganizationId: this.searchForm.or,
CheckStartTime: moment(this.searchForm.date[0]).format('yyyy-MM-DD') + ' 00:00:00',
CheckEndTime: moment(this.searchForm.date[1]).format('yyyy-MM-DD') + ' 23:59:59',
RecheckStaType: '检查情况'
}
};
this.http.get(`/api/PlanTasks/ExportOrgRecheckStat`, httpOptions).subscribe({
next: (data: any) => {
const link = document.createElement('a');
const blob = new Blob([data], { type: 'application/vnd.ms-excel' });
link.setAttribute('href', window.URL.createObjectURL(blob));
link.setAttribute('download', '检查情况统计' + '.xls');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
this.message.create('success', `导出成功`);
},
error: err => {
this.message.create('error', `导出失败`);
}
})
}
}

11
src/app/home/statistic-analysis/form/review/review.component.html

@ -9,7 +9,8 @@
nzTheme="outline"></i>查询</button>
<button (click)="reset()" nz-button nzType="default"><i nz-icon nzType="reload"
nzTheme="outline"></i>重置</button>
<button (click)="exportExcel()" nz-button nzType="default"><span nz-icon nzType="vertical-align-bottom"
nzTheme="outline"></span>导出</button>
</div>
@ -36,16 +37,16 @@
</span>
</td>
<td>
{{item['完成数']}}
{{item['完成数']}}
</td>
<td>
{{item['需要复查数']}}
{{item['大队需要复查数']}}
</td>
<td>
{{item['复查通过数']}}
{{item['大队已复查数']}}
</td>
<td>
{{item['需要复查数'] == 0 ? '0.0' : ((item['复查通过数']/item['需要复查数'])*100).toFixed(1) }}%
{{item['任务复查合格率']}}%
</td>
</tr>
</tbody>

31
src/app/home/statistic-analysis/form/review/review.component.ts

@ -5,6 +5,7 @@ import { TreeService } from 'src/app/service/tree.service';
import * as moment from 'moment';
import * as echarts from 'echarts';
import { Router } from '@angular/router';
import { NzMessageService } from 'ng-zorro-antd/message';
@Component({
selector: 'app-review',
templateUrl: './review.component.html',
@ -13,7 +14,7 @@ import { Router } from '@angular/router';
export class ReviewComponent implements OnInit {
constructor(private http: HttpClient, private toTree: TreeService, private methodService: MethodService, private router: Router) { }
constructor(private http: HttpClient, private toTree: TreeService, private methodService: MethodService, private router: Router, private message: NzMessageService) { }
echartsOfBar
@ -256,5 +257,31 @@ export class ReviewComponent implements OnInit {
goback() {
this.router.navigate(['/statistic/home'])
}
exportExcel() {
const httpOptions = {
responseType: 'blob' as 'json',
params: {
OrganizationId: this.searchForm.or,
CheckStartTime: moment(this.searchForm.date[0]).format('yyyy-MM-DD') + ' 00:00:00',
CheckEndTime: moment(this.searchForm.date[1]).format('yyyy-MM-DD') + ' 23:59:59',
RecheckStaType: '复查情况'
}
};
this.http.get(`/api/PlanTasks/ExportOrgRecheckStat`, httpOptions).subscribe({
next: (data: any) => {
const link = document.createElement('a');
const blob = new Blob([data], { type: 'application/vnd.ms-excel' });
link.setAttribute('href', window.URL.createObjectURL(blob));
link.setAttribute('download', '复查情况统计' + '.xls');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
this.message.create('success', `导出成功`);
},
error: err => {
this.message.create('error', `导出失败`);
}
})
}
}

2
src/app/home/statistic-analysis/home/home.component.ts

@ -566,7 +566,7 @@ export class HomeComponent implements OnInit {
center_left.forEach(element => {
let monthnum = new Date(element.date).getMonth() + 1
if (monthnum == new Date().getMonth() + 1) {
element.percentOfPass = Math.round(((element.totalCount - element.badCount) / element.totalCount) * 100)
element.percentOfPass = Math.round(((element.totalCount - element.badCount) / element.totalCount) * 100) || 0
this.buhegedata = element
}
element.month = monthnum

1
src/theme.less

@ -36,6 +36,7 @@
// 周计划日期选择权
.weeklyplan {
.ant-picker {
padding-left: 0;
}

Loading…
Cancel
Save