123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { Component, EventEmitter, OnInit, Output } from '@angular/core';
- import { Router, ActivatedRoute } from '@angular/router';
- import { CommonCompModule } from '../../../../services/common.modules';
- import Parse from 'parse';
- @Component({
- selector: 'app-export-file',
- templateUrl: './export-file.component.html',
- styleUrls: ['./export-file.component.scss'],
- imports: [CommonCompModule],
- standalone: true,
- })
- export class ExportFileComponent implements OnInit {
- @Output() change: EventEmitter<any> = new EventEmitter<any>();
- starCount: number = 0;
- otherCount: number = 0;
- allCount: number = 0;
- tbookId: any;
- constructor(private router: Router, private activeRoute: ActivatedRoute) {}
- ngOnInit() {
- this.activeRoute.paramMap.subscribe(async (params) => {
- let id = params.get('id');
- this.tbookId = id;
- // let query = new Parse.Query('EduProcess');
- // query.include('branch', 'department');
- // query.equalTo('objectId', id);
- // this.eduProcess = await query.first();
- console.log(id);
- let query = new Parse.Query('EduTextbook');
- query.notEqualTo('isDeleted', true);
- query.equalTo('recommend', true);
- query.equalTo('eduProcess', id);
- this.allCount = await query.count();
- query.containedIn('approval', [
- '首届全国教材建设奖优秀教材(高等教育类)教材',
- '否',
- ]);
- this.otherCount = await query.count();
- });
- }
- close() {
- history.back();
- }
- next() {
- this.change.emit('next');
- }
- onDownload() {
- Parse.Cloud.run('tbookExportReport', { processId: this.tbookId }).then(
- (data) => {
- console.log(data);
- let url = data.zipUrl;
- const a = document.createElement('a'); // 创建一个<a>元素
- a.href = url; // 设置链接的href属性为要下载的文件的URL
- a.download = '报送流程'; // 设置下载文件的名称
- document.body.appendChild(a); // 将<a>元素添加到文档中
- a.click(); // 模拟点击<a>元素
- document.body.removeChild(a); // 下载后移除<a>元素
- }
- );
- }
- }
|