|
@@ -58,7 +58,7 @@ export class textbookServer {
|
|
|
}
|
|
|
//格式化链
|
|
|
async formatNode(id: string): Promise<Array<any>> {
|
|
|
- if(!id) return []
|
|
|
+ if (!id) return [];
|
|
|
let query = new Parse.Query('Department');
|
|
|
query.select('name', 'parent', 'hasChildren', 'type', 'branch');
|
|
|
let r = await query.get(id);
|
|
@@ -147,7 +147,7 @@ export class textbookServer {
|
|
|
document.body.removeChild(a); // 下载后移除<a>元素
|
|
|
});
|
|
|
}
|
|
|
- async preview(options:{bookid:string}){
|
|
|
+ async preview(options: { bookid: string }) {
|
|
|
let url = Parse.serverURL + '/api/tbook/preview';
|
|
|
let response = await fetch(url, {
|
|
|
method: 'POST',
|
|
@@ -158,9 +158,9 @@ export class textbookServer {
|
|
|
body: JSON.stringify(options),
|
|
|
});
|
|
|
let result = await response.json();
|
|
|
- let { urlPdf } = result?.data
|
|
|
+ let { urlPdf } = result?.data;
|
|
|
console.log(urlPdf);
|
|
|
- window.open(urlPdf)
|
|
|
+ window.open(urlPdf);
|
|
|
}
|
|
|
|
|
|
async getEduProcess(id: string): Promise<string | undefined> {
|
|
@@ -177,7 +177,7 @@ export class textbookServer {
|
|
|
}
|
|
|
|
|
|
//需要删除是否存在为联系人情况
|
|
|
- async getEduProcessProf(filter: Array<string>): Promise<string|undefined> {
|
|
|
+ async getEduProcessProf(filter: Array<string>): Promise<string | undefined> {
|
|
|
let query = new Parse.Query('EduProcess');
|
|
|
query.notEqualTo('isDeleted', true);
|
|
|
query.containedIn('profileSubmitted', filter);
|
|
@@ -197,19 +197,19 @@ export class textbookServer {
|
|
|
msg?: NzMessageService
|
|
|
): Promise<boolean | undefined> {
|
|
|
console.log(pid, type, dpid);
|
|
|
-
|
|
|
+
|
|
|
let query = new Parse.Query('EduProcess');
|
|
|
- if(!dpid){
|
|
|
+ if (!dpid) {
|
|
|
query.equalTo('profileSubmitted', pid);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
query.equalTo('department', dpid);
|
|
|
}
|
|
|
query.include('profileSubmitted');
|
|
|
query.select('objectId', 'profileSubmitted');
|
|
|
- query.notEqualTo('isDeleted',true)
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
let res = await query.first();
|
|
|
if (!res?.id) {
|
|
|
- msg?.warning('所属单位不存在')
|
|
|
+ msg?.warning('所属单位不存在');
|
|
|
return false;
|
|
|
}
|
|
|
if (type == 'del') {
|
|
@@ -220,23 +220,23 @@ export class textbookServer {
|
|
|
} else {
|
|
|
//添加工作联系人
|
|
|
if (res?.get('profileSubmitted')?.get('user')) {
|
|
|
- msg?.warning('该单位已有部门联系人,请先移除后再操作')
|
|
|
+ msg?.warning('该单位已有部门联系人,请先移除后再操作');
|
|
|
return false;
|
|
|
}
|
|
|
- res?.set('profileSubmitted',{
|
|
|
+ res?.set('profileSubmitted', {
|
|
|
__type: 'Pointer',
|
|
|
className: 'Profile',
|
|
|
objectId: pid,
|
|
|
- })
|
|
|
- await res.save()
|
|
|
- return true
|
|
|
+ });
|
|
|
+ await res.save();
|
|
|
+ return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
/* 批量预设(临时) */
|
|
|
async saveProcess() {
|
|
|
- let count = 0
|
|
|
+ let count = 0;
|
|
|
/* 批量关联流程管理员 */
|
|
|
// let queryEdupro = new Parse.Query('EduProcess')
|
|
|
// queryEdupro.select('department','name')
|
|
@@ -330,7 +330,7 @@ export class textbookServer {
|
|
|
// queryPareet.equalTo('name', item.name)
|
|
|
// let dep = await queryPareet.first()
|
|
|
// console.log(dep?.get('name'));
|
|
|
-
|
|
|
+
|
|
|
// // for (let index = 0; index < prents.length; index++) {
|
|
|
// // let item = prents[index];
|
|
|
// let query = new Parse.Query('EduProcess')
|
|
@@ -370,31 +370,60 @@ export class textbookServer {
|
|
|
// count ++
|
|
|
// console.log('已完成'+dep?.get('name')+'流程');
|
|
|
// console.log(count);
|
|
|
-
|
|
|
+
|
|
|
// // }
|
|
|
// }
|
|
|
+
|
|
|
+ /* 去重出版单位 */
|
|
|
+ let list = updateDept.list4;
|
|
|
+ for (let index = 0; index < list.length; index++) {
|
|
|
+ const item = list[index];
|
|
|
+ let queryPareet = new Parse.Query('Department');
|
|
|
+ queryPareet.equalTo('name', item);
|
|
|
+ queryPareet.descending('createdAt');
|
|
|
+ let dep = await queryPareet.find();
|
|
|
+ for (let j = 0; j < dep.length; j++) {
|
|
|
+ const e = dep[j];
|
|
|
+ let queryEdupro = new Parse.Query('EduProcess');
|
|
|
+ queryEdupro.equalTo('department', e.id);
|
|
|
+ queryEdupro.select('objectId', 'profileSubmitted');
|
|
|
+ queryEdupro.descending('createdAt');
|
|
|
+ let eps = await queryEdupro.find();
|
|
|
+ console.log(eps);
|
|
|
+ if (eps.length > 1) {
|
|
|
+ eps[0].set('isDeleted', true);
|
|
|
+ await eps[0].save();
|
|
|
+ }
|
|
|
+ if (!eps || eps.length == 0) {
|
|
|
+ e.set('isDeleted', true);
|
|
|
+ await e.save();
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(count);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/* 获取所有未上传签名页附件教材 */
|
|
|
- async get_authorSignPDF_def(){
|
|
|
- let query = new Parse.Query('EduTextbook')
|
|
|
+ async get_authorSignPDF_def() {
|
|
|
+ let query = new Parse.Query('EduTextbook');
|
|
|
// let query = Parse.Query.fromJSON('EduTextbook', {
|
|
|
// where: {
|
|
|
// status:{$in: ['102','103','200','201','300']},
|
|
|
// authorSignPDF
|
|
|
// },
|
|
|
// });
|
|
|
- let list:any = []
|
|
|
- query.notEqualTo('isDeleted',true)
|
|
|
- query.containedIn('status',['102','103','200','201','300'])
|
|
|
- query.doesNotExist('authorSignPDF.url')
|
|
|
- query.exists('code')
|
|
|
- query.select('code')
|
|
|
- query.limit(1000)
|
|
|
- query.greaterThanOrEqualTo('createdAt', new Date('2024/8/5 00:00'))
|
|
|
- let r = await query.find()
|
|
|
+ let list: any = [];
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
+ query.containedIn('status', ['102', '103', '200', '201', '300']);
|
|
|
+ query.doesNotExist('authorSignPDF.url');
|
|
|
+ query.exists('code');
|
|
|
+ query.select('code');
|
|
|
+ query.limit(1000);
|
|
|
+ query.greaterThanOrEqualTo('createdAt', new Date('2024/8/5 00:00'));
|
|
|
+ let r = await query.find();
|
|
|
// console.log(r);
|
|
|
- r.forEach(item=> list.push(item.get('code')))
|
|
|
+ r.forEach((item) => list.push(item.get('code')));
|
|
|
console.log(list);
|
|
|
}
|
|
|
}
|