|
@@ -274,45 +274,60 @@ export class textbookServer {
|
|
|
// count++
|
|
|
// }
|
|
|
// }
|
|
|
- let arr = []
|
|
|
+ let arr = [];
|
|
|
let query = new Parse.Query('EduTextbook');
|
|
|
- query.notEqualTo('isDeleted',true)
|
|
|
- query.notEqualTo('discard',true)
|
|
|
- query.equalTo('render',true)
|
|
|
- query.select('title','childrens.ISBN','childrens.author','childrens.editionUnit','inviteUnit')
|
|
|
- query.limit(3000)
|
|
|
- query.containedIn('status',['400'])
|
|
|
- let eduTextbook = await query.find()
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
+ query.notEqualTo('discard', true);
|
|
|
+ query.equalTo('render', true);
|
|
|
+ query.select(
|
|
|
+ 'title',
|
|
|
+ 'childrens.ISBN',
|
|
|
+ 'childrens.author',
|
|
|
+ 'childrens.editionUnit',
|
|
|
+ 'inviteUnit'
|
|
|
+ );
|
|
|
+ query.limit(3000);
|
|
|
+ query.containedIn('status', ['400']);
|
|
|
+ let eduTextbook = await query.find();
|
|
|
for (let index = 0; index < eduTextbook.length; index++) {
|
|
|
const item = eduTextbook[index];
|
|
|
- let ISBN = '',author = '',editionUnit = ''
|
|
|
- item?.get('childrens').forEach((children:any) => {
|
|
|
- ISBN = children?.get('ISBN')+ ' ' + ISBN
|
|
|
- author = children?.get('author')+ ' ' + author
|
|
|
- editionUnit = children?.get('editionUnit')+ ' ' + editionUnit
|
|
|
+ let ISBN = '',
|
|
|
+ author = '',
|
|
|
+ editionUnit = '';
|
|
|
+ item?.get('childrens').forEach((children: any) => {
|
|
|
+ ISBN = children?.get('ISBN') + ' ' + ISBN;
|
|
|
+ author = children?.get('author') + ' ' + author;
|
|
|
+ editionUnit = children?.get('editionUnit') + ' ' + editionUnit;
|
|
|
});
|
|
|
arr.push({
|
|
|
- "教材名称":item?.get('title'),
|
|
|
- "ISBN":ISBN,
|
|
|
- "作者":author,
|
|
|
- "出版社":editionUnit,
|
|
|
- "所属院校":item?.get('inviteUnit'),
|
|
|
- })
|
|
|
+ 教材名称: item?.get('title'),
|
|
|
+ ISBN: ISBN,
|
|
|
+ 作者: author,
|
|
|
+ 出版社: editionUnit,
|
|
|
+ 所属院校: item?.get('inviteUnit'),
|
|
|
+ });
|
|
|
// item?.set('deadline', new Date('2024-09-30 16:00'));
|
|
|
// await item?.save()
|
|
|
// count++
|
|
|
}
|
|
|
console.log(arr);
|
|
|
-
|
|
|
}
|
|
|
- /* 格式化拓展表字段 */
|
|
|
- fromatFiled(list: Array<Parse.Object>, filed: string): string {
|
|
|
+ /* 格式化拓展表字段 */
|
|
|
+ fromatFiled(list: Array<Parse.Object>, filed: string): string {
|
|
|
let arr: Array<string | null> = [];
|
|
|
let isDate = false;
|
|
|
// 监测空值
|
|
|
list?.forEach((item: Parse.Object) => {
|
|
|
// arr.add(item.get(filed))
|
|
|
+ if (
|
|
|
+ isDate ||
|
|
|
+ Object.prototype.toString.call(item.get(filed)).indexOf('Date') != -1
|
|
|
+ ) {
|
|
|
+ arr.push(this.formatTime('YYYY-mm-dd', item.get(filed)) + '/'+ item.get('printNumber'));
|
|
|
+ isDate = true;
|
|
|
+ } else {
|
|
|
arr.push(item.get(filed));
|
|
|
+ }
|
|
|
});
|
|
|
let j = Array.from(arr).join(',');
|
|
|
if (!isDate) {
|
|
@@ -324,14 +339,24 @@ export class textbookServer {
|
|
|
async exportEduTextbook() {
|
|
|
try {
|
|
|
let query = new Parse.Query('EduTextbook');
|
|
|
- query.notEqualTo('isDeleted',true)
|
|
|
- query.notEqualTo('discard',true)
|
|
|
- query.equalTo('render',true)
|
|
|
- query.select('title','childrens.ISBN','childrens.author','childrens.editionUnit','inviteUnit','user.department','department.branch')
|
|
|
- query.limit(3000)
|
|
|
- query.containedIn('status',['103','200','201','400'])
|
|
|
- // query.containedIn('status',['400'])
|
|
|
- let data = await query.find()
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
+ query.notEqualTo('discard', true);
|
|
|
+ query.equalTo('render', true);
|
|
|
+ query.select(
|
|
|
+ 'title',
|
|
|
+ 'childrens.ISBN',
|
|
|
+ 'childrens.author',
|
|
|
+ 'childrens.printDate',
|
|
|
+ 'childrens.printNumber',
|
|
|
+ 'childrens.editionUnit',
|
|
|
+ 'inviteUnit',
|
|
|
+ 'user.department',
|
|
|
+ 'department.branch'
|
|
|
+ );
|
|
|
+ query.limit(3000);
|
|
|
+ // query.containedIn('status', ['103', '200', '201', '400']);
|
|
|
+ query.containedIn('status',['400'])
|
|
|
+ let data = await query.find();
|
|
|
let table = `<table border="1px" cellspacing="0" cellpadding="0">
|
|
|
<thead>
|
|
|
<tr>
|
|
@@ -341,6 +366,7 @@ export class textbookServer {
|
|
|
<th>ISBN</th>
|
|
|
<th>出版单位</th>
|
|
|
<th>所属院校</th>
|
|
|
+ <th>最新印次和时间</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
@@ -348,15 +374,16 @@ export class textbookServer {
|
|
|
let _body = '';
|
|
|
for (var row = 0; row < data.length; row++) {
|
|
|
// console.log(data[row].get('user')?.get('department'));
|
|
|
- let inviteUnit = data[row]?.get('inviteUnit')
|
|
|
+ let inviteUnit = data[row]?.get('inviteUnit');
|
|
|
if (
|
|
|
data[row]?.get('department')?.get('branch') == '省级教育行政部门' ||
|
|
|
- data[row]?.get('department')?.get('branch') == '有关部门(单位)教育司(局)'
|
|
|
+ data[row]?.get('department')?.get('branch') ==
|
|
|
+ '有关部门(单位)教育司(局)'
|
|
|
) {
|
|
|
let parentMap = await this.formatNode(
|
|
|
data[row].get('user')?.get('department')?.id
|
|
|
);
|
|
|
- inviteUnit = parentMap[2]?.title
|
|
|
+ inviteUnit = parentMap[2]?.title;
|
|
|
}
|
|
|
_body += '<tr>';
|
|
|
_body += '<td>';
|
|
@@ -380,7 +407,10 @@ export class textbookServer {
|
|
|
_body += '</td>';
|
|
|
|
|
|
_body += '<td>';
|
|
|
- _body += ` ${this.fromatFiled(data[row]?.get('childrens'), 'ISBN')}`;
|
|
|
+ _body += ` ${this.fromatFiled(
|
|
|
+ data[row]?.get('childrens'),
|
|
|
+ 'ISBN'
|
|
|
+ )}`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
// _body += '<td>';
|
|
@@ -413,6 +443,13 @@ export class textbookServer {
|
|
|
_body += `${inviteUnit}`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
+ _body += '<td>';
|
|
|
+ _body += `${this.fromatFiled(
|
|
|
+ data[row]?.get('childrens'),
|
|
|
+ 'printDate'
|
|
|
+ )}`;
|
|
|
+ _body += '</td>';
|
|
|
+
|
|
|
_body += '</tr>';
|
|
|
}
|
|
|
table += _body;
|