|
@@ -1,15 +1,24 @@
|
|
|
-import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
|
|
+import {
|
|
|
+ Component,
|
|
|
+ ElementRef,
|
|
|
+ EventEmitter,
|
|
|
+ Input,
|
|
|
+ OnInit,
|
|
|
+ Output,
|
|
|
+ ViewChild,
|
|
|
+} from '@angular/core';
|
|
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
|
import { CommonCompModule } from '../../../../services/common.modules';
|
|
|
import { TextbookComponent } from '../../../../app/textbook/textbook.component';
|
|
|
|
|
|
import Parse from 'parse';
|
|
|
import { textbookServer } from '../../../../services/textbook';
|
|
|
+import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
@Component({
|
|
|
selector: 'app-export-file',
|
|
|
templateUrl: './export-file.component.html',
|
|
|
styleUrls: ['./export-file.component.scss'],
|
|
|
- imports: [CommonCompModule,TextbookComponent],
|
|
|
+ imports: [CommonCompModule, TextbookComponent],
|
|
|
standalone: true,
|
|
|
})
|
|
|
export class ExportFileComponent implements OnInit {
|
|
@@ -26,11 +35,14 @@ export class ExportFileComponent implements OnInit {
|
|
|
status: ['400'],
|
|
|
btns: {},
|
|
|
};
|
|
|
+ showLoading: boolean = false; //全局
|
|
|
|
|
|
constructor(
|
|
|
- private router: Router, private activeRoute: ActivatedRoute,
|
|
|
+ private router: Router,
|
|
|
+ private activeRoute: ActivatedRoute,
|
|
|
public tbookSer: textbookServer,
|
|
|
- ) {}
|
|
|
+ private message: NzMessageService
|
|
|
+ ) {}
|
|
|
|
|
|
ngOnInit() {
|
|
|
this.activeRoute.paramMap.subscribe(async (params) => {
|
|
@@ -59,7 +71,16 @@ export class ExportFileComponent implements OnInit {
|
|
|
next() {
|
|
|
this.change.emit('next');
|
|
|
}
|
|
|
- onDownload() {
|
|
|
- this.tbookSer.tbookExportReport({ processId: this.tbookId })
|
|
|
+ async onDownload() {
|
|
|
+ if (this.showLoading) return;
|
|
|
+ this.showLoading = true;
|
|
|
+ try {
|
|
|
+ await this.tbookSer.tbookExportReport({ processId: this.tbookId });
|
|
|
+ this.showLoading = false;
|
|
|
+ } catch (err) {
|
|
|
+ this.message.error('导出超时,请稍后重试');
|
|
|
+ console.log(err);
|
|
|
+ this.showLoading = false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|