|
@@ -59,7 +59,7 @@ export class TextbookComponent implements OnInit {
|
|
|
setOfCheckedId = new Set<string>();
|
|
|
searchValue: string = '';
|
|
|
manage: boolean = false;
|
|
|
- eduProcessId:any = '' //流程id,verify存在时需要
|
|
|
+ eduProcessId: any = ''; //流程id,verify存在时需要
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
|
private route: Router,
|
|
@@ -77,7 +77,7 @@ export class TextbookComponent implements OnInit {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- async getTextbook(val?: string) {
|
|
|
+ async getTextbook(val?: string, exported?: boolean): Promise<any[] | void> {
|
|
|
this.loading = true;
|
|
|
let query = new Parse.Query('EduTextbook');
|
|
|
if (val) {
|
|
@@ -124,6 +124,11 @@ export class TextbookComponent implements OnInit {
|
|
|
} else {
|
|
|
query.notEqualTo('discard', true);
|
|
|
}
|
|
|
+ if (exported) {
|
|
|
+ let r = await query.find();
|
|
|
+ this.loading = false;
|
|
|
+ return r;
|
|
|
+ }
|
|
|
// query.include('department');
|
|
|
this.count = await query.count();
|
|
|
query.limit(this.limit);
|
|
@@ -136,6 +141,12 @@ export class TextbookComponent implements OnInit {
|
|
|
console.log(e);
|
|
|
this.getTextbook(e);
|
|
|
}
|
|
|
+ //分页切换
|
|
|
+ pageIndexChange(e: any) {
|
|
|
+ console.log(e);
|
|
|
+ this.pageSize = e;
|
|
|
+ this.getTextbook(this.searchValue);
|
|
|
+ }
|
|
|
//全选
|
|
|
onAllChecked(checked: boolean) {
|
|
|
console.log(checked);
|
|
@@ -303,4 +314,96 @@ export class TextbookComponent implements OnInit {
|
|
|
}
|
|
|
this.route.navigate([url]);
|
|
|
}
|
|
|
+
|
|
|
+ //导出
|
|
|
+ async export() {
|
|
|
+ let data: any = await this.getTextbook('',true);
|
|
|
+ let table = `<table border="1px" cellspacing="0" cellpadding="0">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>申报编号</th>
|
|
|
+ <th>教材名称</th>
|
|
|
+ <th>册数</th>
|
|
|
+ <th>第一主编/作者</th>
|
|
|
+ <th>所属单位</th>
|
|
|
+ <th>所属本科专业</th>
|
|
|
+ <th>主要语种类型</th>
|
|
|
+ <th>ISBN</th>
|
|
|
+ <th>出版单位</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ `;
|
|
|
+ let _body = '';
|
|
|
+ for (var row = 0; row < data.length; row++) {
|
|
|
+ _body += '<tr>';
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${row + 1}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += ` ${data[row].get('title') || '-'}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${
|
|
|
+ data[row]?.get('type') == '单册'
|
|
|
+ ? '单册'
|
|
|
+ : data[row]?.get('typeNumber') || '-'
|
|
|
+ }`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${data[row]?.get('author') || '-'}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${data[row]?.get('unit') || '-'}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${data[row]?.get('major').name || '-'}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${data[row]?.get('lang') || '-'}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${data[row]?.get('ISBN') || '-'}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${data[row]?.get('editionUnit') || '-'}`;
|
|
|
+ _body += '</td>';
|
|
|
+ _body += '</tr>';
|
|
|
+ }
|
|
|
+ table += _body;
|
|
|
+ table += '</tbody>';
|
|
|
+ table += '</table>';
|
|
|
+ let title = '申报流程列表';
|
|
|
+ this.excel(table, `${title}.xls`);
|
|
|
+ }
|
|
|
+ excel(data: any, filename: string) {
|
|
|
+ let html =
|
|
|
+ "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>";
|
|
|
+ html +=
|
|
|
+ '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
|
|
|
+ html += '<meta http-equiv="content-type" content="application/vnd.ms-excel';
|
|
|
+ html += '; charset=UTF-8">';
|
|
|
+ html += '<head>';
|
|
|
+ html += '</head>';
|
|
|
+ html += '<body>';
|
|
|
+ html += data;
|
|
|
+ html += '</body>';
|
|
|
+ html += '</html>';
|
|
|
+ let uri =
|
|
|
+ 'data:application/vnd.ms-excel;charset=utf-8,' + encodeURIComponent(html);
|
|
|
+ let link = document.createElement('a');
|
|
|
+ link.href = uri;
|
|
|
+ link.download = `${filename}`;
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ }
|
|
|
}
|