|
@@ -33,7 +33,7 @@ interface filter {
|
|
|
NzEmptyModule,
|
|
|
],
|
|
|
standalone: true,
|
|
|
- providers: [DatePipe]
|
|
|
+ providers: [DatePipe],
|
|
|
})
|
|
|
export class TextbookComponent implements OnInit {
|
|
|
textbookList: Array<Parse.Object> = [];
|
|
@@ -55,7 +55,7 @@ export class TextbookComponent implements OnInit {
|
|
|
showMore: false, //显示更多字段
|
|
|
isCheck: true,
|
|
|
noStared: false, //非推荐
|
|
|
- team:false, //只获取当前部门或下级部门所属用户提交的教材
|
|
|
+ team: false, //只获取当前部门或下级部门所属用户的教材,且不限制是否提交
|
|
|
btns: {
|
|
|
edit: false, //编辑
|
|
|
isDelete: false, //删除权限
|
|
@@ -64,6 +64,7 @@ export class TextbookComponent implements OnInit {
|
|
|
star: false, //加入推荐
|
|
|
remove: false, //移除推荐
|
|
|
submit: false, //提交
|
|
|
+ beforSubmit: false, //高校联系人提交至工作联系人
|
|
|
export: false,
|
|
|
verify: false, //提交推荐权限
|
|
|
restore: false, //恢复教材
|
|
@@ -105,9 +106,15 @@ export class TextbookComponent implements OnInit {
|
|
|
value: '经中央有关部门审定的教材',
|
|
|
text: '经中央有关部门审定的教材',
|
|
|
},
|
|
|
- { value: '首届全国教材建设奖优秀教材(高等教育类)教材', text: '首届全国教材建设奖优秀教材(高等教育类)教材' },
|
|
|
+ {
|
|
|
+ value: '首届全国教材建设奖优秀教材(高等教育类)教材',
|
|
|
+ text: '首届全国教材建设奖优秀教材(高等教育类)教材',
|
|
|
+ },
|
|
|
{ value: '“101计划”核心教材', text: '“101计划”核心教材' },
|
|
|
- { value: '“四新”重点建设教材(含战略性新兴领域教材)', text: '“四新”重点建设教材(含战略性新兴领域教材)' },
|
|
|
+ {
|
|
|
+ value: '“四新”重点建设教材(含战略性新兴领域教材)',
|
|
|
+ text: '“四新”重点建设教材(含战略性新兴领域教材)',
|
|
|
+ },
|
|
|
{ value: '否', text: '否' },
|
|
|
],
|
|
|
onChange: (data: any) => {
|
|
@@ -151,9 +158,9 @@ export class TextbookComponent implements OnInit {
|
|
|
setOfCheckedId = new Set<string>();
|
|
|
searchValue: string = '';
|
|
|
manage: boolean = false;
|
|
|
- calc:number = 120
|
|
|
+ calc: number = 120;
|
|
|
|
|
|
- showLoading:boolean = false //全局
|
|
|
+ showLoading: boolean = false; //全局
|
|
|
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
@@ -167,7 +174,7 @@ export class TextbookComponent implements OnInit {
|
|
|
ngOnInit() {
|
|
|
this.activeRoute.paramMap.subscribe(async (params) => {
|
|
|
// this.eduProcessId = params.get('id');
|
|
|
- this.calc += Object.values(this.filterObj?.btns).length * 70
|
|
|
+ this.calc += Object.values(this.filterObj?.btns).length * 70;
|
|
|
this.getTextbook();
|
|
|
if (Object.values(this.filterObj?.btns).some((item) => item)) {
|
|
|
this.manage = true;
|
|
@@ -215,8 +222,10 @@ export class TextbookComponent implements OnInit {
|
|
|
// },
|
|
|
// });
|
|
|
let query = Parse.Query.or(query1);
|
|
|
- if(this.filterObj.team){
|
|
|
- let childrens = await this.tbookSer.getChild(this.tbookSer.profile.user.department?.objectId)
|
|
|
+ if (this.filterObj.team) {
|
|
|
+ let childrens = await this.tbookSer.getChild(
|
|
|
+ this.tbookSer.profile.user.department?.objectId
|
|
|
+ );
|
|
|
let query3 = Parse.Query.fromJSON('EduTextbook', {
|
|
|
where: {
|
|
|
$or: [
|
|
@@ -224,7 +233,7 @@ export class TextbookComponent implements OnInit {
|
|
|
user: {
|
|
|
$inQuery: {
|
|
|
where: {
|
|
|
- 'department':{$in: [childrens],}
|
|
|
+ department: { $in: [childrens] },
|
|
|
},
|
|
|
className: '_User',
|
|
|
},
|
|
@@ -232,11 +241,8 @@ export class TextbookComponent implements OnInit {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- })
|
|
|
- query = Parse.Query.and(
|
|
|
- query3,
|
|
|
- Parse.Query.or(query1)
|
|
|
- )
|
|
|
+ });
|
|
|
+ query = Parse.Query.and(query3, Parse.Query.or(query1));
|
|
|
}
|
|
|
// }
|
|
|
// this.uid && query.equalTo('user',this.tbookSer.profile.user?.objectId);
|
|
@@ -253,7 +259,7 @@ export class TextbookComponent implements OnInit {
|
|
|
this.uid && query.equalTo('user', this.uid);
|
|
|
query.descending('createdAt');
|
|
|
query.notEqualTo('isDeleted', true);
|
|
|
- if (!this.uid) {
|
|
|
+ if (!this.uid && !this.filterObj.team) {
|
|
|
query.equalTo('render', true);
|
|
|
// query.containedIn('status', ['200', '400']);
|
|
|
}
|
|
@@ -366,7 +372,7 @@ export class TextbookComponent implements OnInit {
|
|
|
if (data?.id) {
|
|
|
data.set('status', '300');
|
|
|
data.set('render', null);
|
|
|
- data.set('code', null);
|
|
|
+ // data.set('code', null);
|
|
|
await data.save();
|
|
|
} else {
|
|
|
let selectedList = this.textbookList.filter((item: any) =>
|
|
@@ -376,7 +382,7 @@ export class TextbookComponent implements OnInit {
|
|
|
return new Promise((resolve) => {
|
|
|
item.set('status', '300');
|
|
|
item.set('render', null);
|
|
|
- item.set('code', null);
|
|
|
+ // item.set('code', null);
|
|
|
item.save().then(() => resolve(true));
|
|
|
});
|
|
|
});
|
|
@@ -457,7 +463,7 @@ export class TextbookComponent implements OnInit {
|
|
|
this.getTextbook();
|
|
|
} catch (err) {}
|
|
|
}
|
|
|
- this.onAllChecked(false)
|
|
|
+ this.onAllChecked(false);
|
|
|
if (this.filterObj?.btns?.verify) {
|
|
|
history.go();
|
|
|
}
|
|
@@ -468,9 +474,9 @@ export class TextbookComponent implements OnInit {
|
|
|
}
|
|
|
//提交教材
|
|
|
async submit(data?: Parse.Object) {
|
|
|
- if(!this.tbookSer?.profile?.user?.department?.objectId){
|
|
|
- this.message.error('当前账号暂未绑定所属单位')
|
|
|
- return
|
|
|
+ if (!this.tbookSer?.profile?.user?.department?.objectId) {
|
|
|
+ this.message.error('当前账号暂未绑定所属单位');
|
|
|
+ return;
|
|
|
}
|
|
|
let parentMap = await this.tbookSer.formatNode(
|
|
|
this.tbookSer?.profile?.user?.department?.objectId
|
|
@@ -481,10 +487,14 @@ export class TextbookComponent implements OnInit {
|
|
|
this.message.warning('你的申报单位暂无进行的流程');
|
|
|
return;
|
|
|
}
|
|
|
- let inviteUnit = parentMap[1]?.title //推荐单位
|
|
|
- // if(parentMap[0]?.title == '省级教育行政部门' || parentMap[0]?.title == '有关部门(单位)教育司(局)'){
|
|
|
- // inviteUnit = parentMap[2]?.title
|
|
|
- // }
|
|
|
+ let inviteUnit = parentMap[1]?.title; //推荐单位
|
|
|
+ let status = '200';
|
|
|
+ if (
|
|
|
+ parentMap[0]?.title == '省级教育行政部门' ||
|
|
|
+ parentMap[0]?.title == '有关部门(单位)教育司(局)'
|
|
|
+ ) {
|
|
|
+ status = '103';
|
|
|
+ }
|
|
|
this.modal.confirm({
|
|
|
nzTitle: '确认提交教材?',
|
|
|
nzContent: `提交后,教材将不可编辑,并从「我的教材」移至「已提交评审教材」。`,
|
|
@@ -501,7 +511,7 @@ export class TextbookComponent implements OnInit {
|
|
|
this.tbookSer.formatTime('YYYYmmdd', new Date()) +
|
|
|
Math.random().toString().slice(-4);
|
|
|
data.set('render', true);
|
|
|
- data.set('status', '200');
|
|
|
+ data.set('status', status);
|
|
|
data.set('code', t);
|
|
|
data.set('eduProcess', {
|
|
|
__type: 'Pointer',
|
|
@@ -534,7 +544,7 @@ export class TextbookComponent implements OnInit {
|
|
|
this.tbookSer.formatTime('YYYYmmdd', new Date()) +
|
|
|
Math.random().toString().slice(-4);
|
|
|
item.set('render', true);
|
|
|
- item.set('status', '200');
|
|
|
+ item.set('status', status);
|
|
|
item.set('code', t);
|
|
|
item.set('eduProcess', {
|
|
|
__type: 'Pointer',
|
|
@@ -566,11 +576,9 @@ export class TextbookComponent implements OnInit {
|
|
|
failCount +
|
|
|
'条教材提交失败,请检查必填信息是否完整'
|
|
|
)
|
|
|
- : this.message.success('已提交' +
|
|
|
- count +
|
|
|
- '条教材,' +
|
|
|
- failCount +
|
|
|
- '条教材提交失败');
|
|
|
+ : this.message.success(
|
|
|
+ '已提交' + count + '条教材,' + failCount + '条教材提交失败'
|
|
|
+ );
|
|
|
this.onAllChecked(false);
|
|
|
} catch (err) {}
|
|
|
}
|
|
@@ -580,6 +588,65 @@ export class TextbookComponent implements OnInit {
|
|
|
nzOnCancel: () => console.log('Cancel'),
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ //高校联系人提交教材至工作联系人
|
|
|
+ async beforSubmit(data?: Parse.Object) {
|
|
|
+ if (this.eduProcess?.get('status') != '200') {
|
|
|
+ this.message.warning('当前流程状态非遴选中,不可此操作');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.modal.confirm({
|
|
|
+ nzTitle: '确认提交教材?',
|
|
|
+ nzContent: `将提交至工作联系人,并从「待提交教材」移至「待评审教材」。`,
|
|
|
+ nzOkText: '确认',
|
|
|
+ nzOkType: 'primary',
|
|
|
+ nzOkDanger: false,
|
|
|
+ nzOnOk: async () => {
|
|
|
+ if (data?.id) {
|
|
|
+ data.set('status', '200');
|
|
|
+ await data.save();
|
|
|
+ this.message.success('提交成功')
|
|
|
+ } else {
|
|
|
+ let count = 0,
|
|
|
+ failCount = 0;
|
|
|
+ let selectedList = this.textbookList.filter((item: any) =>
|
|
|
+ this.setOfCheckedId.has(item?.id)
|
|
|
+ );
|
|
|
+ let deletePromiseList = selectedList.map((item: any) => {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ if (item?.get('status') == '103') {
|
|
|
+ count++;
|
|
|
+ item.set('status', '200');
|
|
|
+ item.save().then(() => resolve(true));
|
|
|
+ } else {
|
|
|
+ failCount++;
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ await Promise.all(deletePromiseList);
|
|
|
+ failCount > 0
|
|
|
+ ? this.message.success(
|
|
|
+ '已提交' +
|
|
|
+ count +
|
|
|
+ '条教材,' +
|
|
|
+ failCount +
|
|
|
+ '条教材提交失败,请检查教材是否已提交'
|
|
|
+ )
|
|
|
+ : this.message.success(
|
|
|
+ '已提交' + count + '条教材,' + failCount + '条教材提交失败'
|
|
|
+ );
|
|
|
+ this.onAllChecked(false);
|
|
|
+ } catch (err) {}
|
|
|
+ }
|
|
|
+ this.getTextbook();
|
|
|
+ },
|
|
|
+ nzCancelText: '取消',
|
|
|
+ nzOnCancel: () => console.log('Cancel'),
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
//恢复
|
|
|
restore(data?: Parse.Object) {
|
|
|
this.modal.confirm({
|
|
@@ -629,25 +696,24 @@ export class TextbookComponent implements OnInit {
|
|
|
}
|
|
|
//导出附件
|
|
|
async exportProcess(data?: Parse.Object) {
|
|
|
- if(this.showLoading) return
|
|
|
- this.showLoading = true
|
|
|
- try{
|
|
|
- let bookList: Array<string> = []
|
|
|
- if(data?.id){
|
|
|
- bookList = [data?.id]
|
|
|
- }else{
|
|
|
- bookList = Array.from(this.setOfCheckedId)
|
|
|
+ if (this.showLoading) return;
|
|
|
+ this.showLoading = true;
|
|
|
+ try {
|
|
|
+ let bookList: Array<string> = [];
|
|
|
+ if (data?.id) {
|
|
|
+ bookList = [data?.id];
|
|
|
+ } else {
|
|
|
+ bookList = Array.from(this.setOfCheckedId);
|
|
|
}
|
|
|
// let processId = await this.getEduProcess(
|
|
|
// this.tbookSer.profile.user?.department?.objectId
|
|
|
// );
|
|
|
- await this.tbookSer.tbookExportReport({ bookList: bookList })
|
|
|
- this.showLoading = false
|
|
|
- }
|
|
|
- catch(err){
|
|
|
- this.message.error('导出超时,请稍后重试')
|
|
|
+ await this.tbookSer.tbookExportReport({ bookList: bookList });
|
|
|
+ this.showLoading = false;
|
|
|
+ } catch (err) {
|
|
|
+ this.message.error('导出超时,请稍后重试');
|
|
|
console.log(err);
|
|
|
- this.showLoading = false
|
|
|
+ this.showLoading = false;
|
|
|
}
|
|
|
// Parse.Cloud.run('tbookExportReport', { bookList: bookList }).then(
|
|
|
// (data) => {
|
|
@@ -673,10 +739,12 @@ export class TextbookComponent implements OnInit {
|
|
|
}
|
|
|
//报送
|
|
|
async submitted() {
|
|
|
- if(this.eduProcess?.get('status') == '400'){
|
|
|
- this.message.warning('已提交报送,无需重复提交')
|
|
|
- this.toUrl(`/nav-province-contact/manage/submitted/${this.eduProcess?.id}`)
|
|
|
- return
|
|
|
+ if (this.eduProcess?.get('status') == '400') {
|
|
|
+ this.message.warning('已提交报送,无需重复提交');
|
|
|
+ this.toUrl(
|
|
|
+ `/nav-province-contact/manage/submitted/${this.eduProcess?.id}`
|
|
|
+ );
|
|
|
+ return;
|
|
|
}
|
|
|
// this.eduProcess?.set('status', '400');
|
|
|
// this.eduProcess?.set('releaseDate', new Date());
|
|
@@ -694,7 +762,7 @@ export class TextbookComponent implements OnInit {
|
|
|
]);
|
|
|
let count = await query.count();
|
|
|
if (count > this.eduProcess?.get('num')) {
|
|
|
- this.message.warning('当前推荐教材数量已超额')
|
|
|
+ this.message.warning('当前推荐教材数量已超额');
|
|
|
return;
|
|
|
}
|
|
|
// await this.eduProcess?.save();
|
|
@@ -704,16 +772,16 @@ export class TextbookComponent implements OnInit {
|
|
|
// await item.save();
|
|
|
// }
|
|
|
// this.message.success('提交成功')
|
|
|
- this.toUrl(`/nav-province-contact/manage/submitted/${this.eduProcess?.id}`)
|
|
|
+ this.toUrl(`/nav-province-contact/manage/submitted/${this.eduProcess?.id}`);
|
|
|
}
|
|
|
//导出表格
|
|
|
async export() {
|
|
|
console.log(this.eduProcess);
|
|
|
- let query = new Parse.Query('EduProcess')
|
|
|
- query.equalTo('objectId',this.eduProcess?.id)
|
|
|
- query.include('profileSubmitted','profileSubmitted.user')
|
|
|
- query.select('name','profileSubmitted')
|
|
|
- let r = await query.first()
|
|
|
+ let query = new Parse.Query('EduProcess');
|
|
|
+ query.equalTo('objectId', this.eduProcess?.id);
|
|
|
+ query.include('profileSubmitted', 'profileSubmitted.user');
|
|
|
+ query.select('name', 'profileSubmitted');
|
|
|
+ let r = await query.first();
|
|
|
let data: any = await this.getTextbook('', true);
|
|
|
let table = `<table border="1px" cellspacing="0" cellpadding="0">
|
|
|
<thead>
|
|
@@ -730,7 +798,9 @@ export class TextbookComponent implements OnInit {
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th></th><th></th>
|
|
|
- <th style="font-size: 12px;font-family: '黑体';text-align: left;">单位名称(公章):${r?.get('name')}</th>
|
|
|
+ <th style="font-size: 12px;font-family: '黑体';text-align: left;">单位名称(公章):${r?.get(
|
|
|
+ 'name'
|
|
|
+ )}</th>
|
|
|
<th colspan="3"></th>
|
|
|
<th></th><th></th><th></th>
|
|
|
</tr>
|
|
@@ -741,8 +811,14 @@ export class TextbookComponent implements OnInit {
|
|
|
<tr>
|
|
|
<th></th><th></th>
|
|
|
<th style="font-size: 12px;font-family: '黑体';text-align: left;">申报工作联系人:</th>
|
|
|
- <th colspan="2" style="font-size: 12px;font-family: '黑体';text-align: left;">姓名 ${r?.get('profileSubmitted')?.get('user')?.get('name')}</th>
|
|
|
- <th colspan="2" style="font-size: 12px;font-family: '黑体';text-align: left;">电话 ${r?.get('profileSubmitted')?.get('user')?.get('phone')}</th>
|
|
|
+ <th colspan="2" style="font-size: 12px;font-family: '黑体';text-align: left;">姓名 ${r
|
|
|
+ ?.get('profileSubmitted')
|
|
|
+ ?.get('user')
|
|
|
+ ?.get('name')}</th>
|
|
|
+ <th colspan="2" style="font-size: 12px;font-family: '黑体';text-align: left;">电话 ${r
|
|
|
+ ?.get('profileSubmitted')
|
|
|
+ ?.get('user')
|
|
|
+ ?.get('phone')}</th>
|
|
|
<th></th><th></th><th></th>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -768,7 +844,7 @@ export class TextbookComponent implements OnInit {
|
|
|
for (var row = 0; row < data.length; row++) {
|
|
|
_body += '<tr>';
|
|
|
_body += '<td>';
|
|
|
- _body += `${row+1}`;
|
|
|
+ _body += `${row + 1}`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
_body += '<td>';
|
|
@@ -803,15 +879,17 @@ export class TextbookComponent implements OnInit {
|
|
|
_body += `${data[row]?.get('editionUnit') || '-'}`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
-
|
|
|
_body += '<td>';
|
|
|
- _body += `${this.datePipe.transform(data[row]?.get('editionFirst'), 'yyyy-MM') || '-'}`;
|
|
|
+ _body += `${
|
|
|
+ this.datePipe.transform(data[row]?.get('editionFirst'), 'yyyy-MM') ||
|
|
|
+ '-'
|
|
|
+ }`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
_body += '<td>';
|
|
|
_body += `${data[row]?.get('carrierShape') || '-'}`;
|
|
|
_body += '</td>';
|
|
|
-
|
|
|
+
|
|
|
_body += '</tr>';
|
|
|
}
|
|
|
table += _body;
|