|
@@ -40,16 +40,68 @@ import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
|
|
|
],
|
|
|
})
|
|
|
export class BasicComponent implements OnInit {
|
|
|
+ /**传递的分册记录id */
|
|
|
+ @Input('eduTextbookVolumeId') eduTextbookVolumeId: string | any
|
|
|
+
|
|
|
+
|
|
|
+ /**分册记录Parse */
|
|
|
+ eduTextbookVolume: Parse.Object | any
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ngAfterViewInit(): void { }
|
|
|
+ ngOnInit() {
|
|
|
+ this.refersh()
|
|
|
+ }
|
|
|
+ /**获取扩展分册记录 */
|
|
|
+ async getEduTextbookVolume() {
|
|
|
+ if (this.eduTextbookVolumeId) {
|
|
|
+ let query = new Parse.Query('eduTextbookVolume')
|
|
|
+ this.eduTextbookVolume = await query.get(this.eduTextbookVolumeId)
|
|
|
+ console.log(this.eduTextbookVolume);
|
|
|
+ } else {
|
|
|
+ console.log("分册id未传递")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ async refersh() {
|
|
|
+ await this.getEduTextbookVolume()
|
|
|
+ if (this.eduTextbookVolume?.get('editionUnit')) {
|
|
|
+ this.isShowChooseEU = false
|
|
|
+ }
|
|
|
+ this.importantProject = this.eduTextbookVolume?.get('importantProject') || []
|
|
|
+ if (this.importantProject?.length > 0) {
|
|
|
+ for (let i in this.importantProjectList) {
|
|
|
+ if (this.importantProject.indexOf(this.importantProjectList[i].value) != -1) {
|
|
|
+ this.importantProjectList[i].checked = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.validateForm = this.fb.group({
|
|
|
+ ISBN: [parseInt(this.eduTextbookVolume?.get('ISBN') || '') || null, [Validators.required]],
|
|
|
+ author: [this.eduTextbookVolume?.get('author') || '', [Validators.required]],
|
|
|
+ unit: [this.eduTextbookVolume?.get('unit') || '', [Validators.required]],
|
|
|
+ lang: [this.eduTextbookVolume?.get('lang') || '', [Validators.required]],
|
|
|
+ authors: [this.eduTextbookVolume?.get('authors') || ''],
|
|
|
+ editor: [this.eduTextbookVolume?.get('editor') || '',],
|
|
|
+ editionUnit: [this.eduTextbookVolume?.get('editionUnit') || '', [Validators.required]],
|
|
|
+ editionFirst: [this.eduTextbookVolume?.get('editionFirst') || new Date(), [Validators.required]],
|
|
|
+ carrierShape: [this.eduTextbookVolume?.get('carrierShape') || '', [Validators.required]],
|
|
|
+ editionDate: [this.eduTextbookVolume?.get('editionDate') || new Date(), [Validators.required]],
|
|
|
+ editionNumber: [this.eduTextbookVolume?.get('editionNumber') || 0, [Validators.required]],
|
|
|
+ printDate: [this.eduTextbookVolume?.get('printDate') || new Date(), [Validators.required]],
|
|
|
+ printNumber: [this.eduTextbookVolume?.get('printNumber') || 0, [Validators.required]],
|
|
|
+ printSum: [this.eduTextbookVolume?.get('printSum') || 0, [Validators.required]],
|
|
|
+ importantProjectOther: [this.eduTextbookVolume?.get('importantProjectOther') || ''],
|
|
|
+ unitType: [this.eduTextbookVolume?.get('unitType') || '', [Validators.required]],
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- @Input('eduTextbook') eduTextbook: Parse.Object | any;
|
|
|
- @Input('editFrom') editFrom: any;
|
|
|
- @Output() state: EventEmitter<any> = new EventEmitter<any>();
|
|
|
- @Output() save: EventEmitter<any> = new EventEmitter<any>();
|
|
|
|
|
|
changeCode() { }
|
|
|
getCode(e: any) { }
|
|
|
|
|
|
- /***教材获批截图 */
|
|
|
+ /**教材获批截图 */
|
|
|
approvedImgList: Array<any> = [{
|
|
|
name: '获批截图',
|
|
|
status: 'done',
|
|
@@ -69,41 +121,27 @@ export class BasicComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
// 其他字段,需补充接口与数据库对应关系
|
|
|
- this.validateForm.get("title")?.setValue(result?.book_name)
|
|
|
this.validateForm.get("author")?.setValue(result?.author_name)
|
|
|
this.validateForm.get("authors")?.setValue(result?.author)
|
|
|
- this.validateForm.get("majorPoniter")?.setValue(result?.major)
|
|
|
this.validateForm.get("lang")?.setValue(languages.options?.[result?.languages]?.name)
|
|
|
this.validateForm.get("editionUnit")?.setValue(result?.publisher)
|
|
|
this.validateForm.get("editionDate")?.setValue(new Date(result?.publish_time))
|
|
|
this.validateForm.get("carrierShape")?.setValue(result?.publication_class)
|
|
|
-
|
|
|
console.log(result)
|
|
|
}
|
|
|
/**出版时间及版次不可选择时间 */
|
|
|
disabledEditionDate = (current: Date): boolean => {
|
|
|
return current < new Date(2022, 11, 1)
|
|
|
}
|
|
|
- /** 全册次数*/
|
|
|
- typeNumber: number = 2
|
|
|
- typeNumberChange() {
|
|
|
- if (this.typeNumber < 2) {
|
|
|
- this.msg.create('warning', '不得小于两册')
|
|
|
- this.typeNumber = 2
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
validateForm: FormGroup<{
|
|
|
- title: FormControl<string>; //申报教材名称
|
|
|
ISBN: FormControl<any>; //国际标准书号
|
|
|
author: FormControl<string>; //第一主编(作者)
|
|
|
unit: FormControl<string>; //第一主编(作者)单位
|
|
|
unitType: FormControl<string>//第一主编(作者)单位类型
|
|
|
- type: FormControl<string>; //申报类型
|
|
|
- majorPoniter: FormControl<string>; //教材应用对象及所诉学科专业类
|
|
|
lang: FormControl<string>; //教材主要语种类型
|
|
|
authors: FormControl<string>; //其他主编姓名
|
|
|
editor: FormControl<string>; //其他编者姓名
|
|
|
- approval: FormControl<string>; //是否为重点立项教材
|
|
|
editionUnit: FormControl<string>; //出版单位
|
|
|
editionFirst: FormControl<Date>; //初版时间
|
|
|
carrierShape: FormControl<string>; //载体形式
|
|
@@ -113,18 +151,13 @@ export class BasicComponent implements OnInit {
|
|
|
printNumber: FormControl<number>; //最新印次
|
|
|
printSum: FormControl<number>; //初版以来合计印数
|
|
|
importantProjectOther: FormControl<string>; //其他省部级及以上项目
|
|
|
- approvedImgUrl: FormControl<string>//重点立项教材获批截图
|
|
|
}> = this.fb.group({
|
|
|
- title: ['', [Validators.required]],
|
|
|
ISBN: [null, [Validators.required]],
|
|
|
author: ['', [Validators.required]],
|
|
|
unit: ['', [Validators.required]],
|
|
|
- type: ['', [Validators.required]],
|
|
|
- majorPoniter: ['', [Validators.required]],
|
|
|
lang: ['', [Validators.required]],
|
|
|
authors: [''],
|
|
|
editor: [''],
|
|
|
- approval: ['', [Validators.required]],
|
|
|
editionUnit: ['', [Validators.required]],
|
|
|
editionFirst: [new Date(), [Validators.required]],
|
|
|
carrierShape: ['', [Validators.required]],
|
|
@@ -134,13 +167,9 @@ export class BasicComponent implements OnInit {
|
|
|
printNumber: [0, [Validators.required]],
|
|
|
printSum: [0, [Validators.required]],
|
|
|
importantProjectOther: [''],
|
|
|
- approvedImgUrl: [''],
|
|
|
unitType: ['', [Validators.required]],
|
|
|
});
|
|
|
- /** 所属学科专业类显示数量*/
|
|
|
- nzOptionOverflowSize = 5
|
|
|
- //教材应用对象及所诉学科专业类
|
|
|
- selectList = major.majors.options
|
|
|
+
|
|
|
//语言选择
|
|
|
selectLang: Array<any> = languages.options;
|
|
|
//可选单位类型
|
|
@@ -213,175 +242,60 @@ export class BasicComponent implements OnInit {
|
|
|
this.importantProject = checkedList.map(item => item.value)
|
|
|
console.log(this.importantProject)
|
|
|
}
|
|
|
- /* 是否重点立项教材可选列表 */
|
|
|
- options: Array<any> = [
|
|
|
- {
|
|
|
- name: '经中央有关部门审定的教材',
|
|
|
- code: '经中央有关部门审定的教材',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '首届全国教材建设奖优秀教材(高等教育类)教材',
|
|
|
- code: '首届全国教材建设奖优秀教材(高等教育类)教材',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '“101计划”核心教材',
|
|
|
- code: '“101计划”核心教材',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '“四新”重点建设教材(含战略性新兴领域教材)',
|
|
|
- code: '“四新”重点建设教材(含战略性新兴领域教材)',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '否',
|
|
|
- code: '否',
|
|
|
- }
|
|
|
- ];
|
|
|
+
|
|
|
|
|
|
constructor(
|
|
|
public tbookSer: textbookServer,
|
|
|
private fb: NonNullableFormBuilder,
|
|
|
private modal: NzModalService,
|
|
|
private msg: NzMessageService,
|
|
|
- ) {
|
|
|
- }
|
|
|
+ ) { }
|
|
|
|
|
|
isShowChooseEU: boolean = true
|
|
|
- ngOnInit() {
|
|
|
- if (this.eduTextbook?.get('editionUnit')) {
|
|
|
- this.isShowChooseEU = false
|
|
|
- }
|
|
|
- this.importantProject = this.eduTextbook?.get('importantProject') || []
|
|
|
- if (this.importantProject?.length > 0) {
|
|
|
- for (let i in this.importantProjectList) {
|
|
|
- if (this.importantProject.indexOf(this.importantProjectList[i].value) != -1) {
|
|
|
- this.importantProjectList[i].checked = true
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- this.approvedImgList[0].url = this.eduTextbook?.get('approvedImgUrl')
|
|
|
- this.typeNumber = this.eduTextbook?.get('typeNumber') || 2
|
|
|
- console.log(this.eduTextbook);
|
|
|
- this.validateForm = this.fb.group({
|
|
|
- title: [this.eduTextbook?.get('title') || '', [Validators.required]],
|
|
|
- ISBN: [parseInt(this.eduTextbook?.get('ISBN') || '') || null, [Validators.required]],
|
|
|
- author: [this.eduTextbook?.get('author') || '', [Validators.required]],
|
|
|
- unit: [this.eduTextbook?.get('unit') || '', [Validators.required]],
|
|
|
- type: [this.eduTextbook?.get('type') || '全册', [Validators.required]],
|
|
|
- majorPoniter: [this.eduTextbook?.get('majorPoniter')?.code || '', [Validators.required]],
|
|
|
- lang: [this.eduTextbook?.get('lang') || '', [Validators.required]],
|
|
|
- authors: [this.eduTextbook?.get('authors') || ''],
|
|
|
- editor: [this.eduTextbook?.get('editor') || '',],
|
|
|
- approval: [this.eduTextbook?.get('approval') || '', [Validators.required]],
|
|
|
- editionUnit: [this.eduTextbook?.get('editionUnit') || '', [Validators.required]],
|
|
|
- editionFirst: [this.eduTextbook?.get('editionFirst') || new Date(), [Validators.required]],
|
|
|
- carrierShape: [this.eduTextbook?.get('carrierShape') || '', [Validators.required]],
|
|
|
- editionDate: [this.eduTextbook?.get('editionDate') || new Date(), [Validators.required]],
|
|
|
- editionNumber: [this.eduTextbook?.get('editionNumber') || 0, [Validators.required]],
|
|
|
- printDate: [this.eduTextbook?.get('printDate') || new Date(), [Validators.required]],
|
|
|
- printNumber: [this.eduTextbook?.get('printNumber') || 0, [Validators.required]],
|
|
|
- printSum: [this.eduTextbook?.get('printSum') || 0, [Validators.required]],
|
|
|
- importantProjectOther: [this.eduTextbook?.get('importantProjectOther') || ''],
|
|
|
- approvedImgUrl: [this.eduTextbook?.get('approvedImgUrl') || ''],
|
|
|
- unitType: [this.eduTextbook?.get('unitType') || '', [Validators.required]],
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
upload(e: any, type: string) {
|
|
|
console.log(e);
|
|
|
let file = e[0];
|
|
|
- if (type == 'approvedImgUrl') {
|
|
|
- this.validateForm.value[type] = file?.url
|
|
|
- }
|
|
|
+ // if (type == 'approvedImgUrl') {
|
|
|
+ // this.validateForm.value[type] = file?.url
|
|
|
+ // }
|
|
|
console.log(this.validateForm.value)
|
|
|
}
|
|
|
- async submitForm(event?: string): Promise<void> {
|
|
|
- console.log(this.validateForm.value);
|
|
|
- console.log(this.validateForm.valid);
|
|
|
- if (this.validateForm.valid) {
|
|
|
- let params = this.validateForm.value
|
|
|
- if (event == 'next') {
|
|
|
- await this.saveEduTextbook(params, this.validateForm.valid)
|
|
|
- this.state.emit({ type: 'next', textBook: this.eduTextbook });
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (event == 'save') {
|
|
|
- let params = this.validateForm.value
|
|
|
- await this.saveEduTextbook(params, this.validateForm.valid)
|
|
|
- this.modal.success({
|
|
|
- nzTitle: '保存成功',
|
|
|
- nzContent: '<p>已保存并且至空间</p>',
|
|
|
- nzOnOk: () => console.log('Info OK')
|
|
|
- });
|
|
|
- return
|
|
|
- }
|
|
|
- if (event == 'next') {
|
|
|
- let params = this.validateForm.value
|
|
|
- await this.saveEduTextbook(params, this.validateForm.valid)
|
|
|
- this.state.emit({ type: 'next', textBook: this.eduTextbook });
|
|
|
- }
|
|
|
- }
|
|
|
- if (event == 'save') {
|
|
|
- let params = this.validateForm.value
|
|
|
- await this.saveEduTextbook(params, this.validateForm.valid)
|
|
|
- this.modal.success({
|
|
|
- nzTitle: '保存成功',
|
|
|
- nzContent: '<p>已保存并且至空间</p>',
|
|
|
- nzOnOk: () => console.log('Info OK')
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
async saveEduTextbook(params: any, isComplete: boolean) {
|
|
|
this.changeImportantProject()
|
|
|
console.log(params);
|
|
|
- if (!this.eduTextbook) {
|
|
|
+ if (!this.eduTextbookVolume) {
|
|
|
let obj = Parse.Object.extend('EduTextbook');
|
|
|
- this.eduTextbook = new obj();
|
|
|
+ this.eduTextbookVolume = new obj();
|
|
|
}
|
|
|
- //如果填写未完整,仅保存,状态修改待完善101
|
|
|
- if (this.eduTextbook.get('status') == '102' && !isComplete) {
|
|
|
- this.eduTextbook?.set('status', '101');
|
|
|
- this.eduTextbook.set('complete', false)
|
|
|
- } else if (!this.eduTextbook.get('status')) {
|
|
|
- this.eduTextbook?.set('status', '101');
|
|
|
- }
|
|
|
- this.eduTextbook?.set('user', Parse.User.current()?.toPointer());
|
|
|
- this.eduTextbook?.set('company', {
|
|
|
- __type: 'Pointer',
|
|
|
- className: 'Company',
|
|
|
- objectId: this.tbookSer.company,
|
|
|
- });
|
|
|
- this.eduTextbook?.set('title', params.title);
|
|
|
- this.eduTextbook?.set('ISBN', (params.ISBN || 0).toString());
|
|
|
- this.eduTextbook?.set('author', params.author);
|
|
|
- this.eduTextbook?.set('unit', params.unit);
|
|
|
- this.eduTextbook?.set('type', params.type);
|
|
|
- this.eduTextbook?.set('typeNumber', this.typeNumber);
|
|
|
- let majorPoniter = this.selectList.find((item) => item.code == params.majorPoniter);
|
|
|
- this.eduTextbook?.set('majorPoniter', majorPoniter);
|
|
|
- this.eduTextbook?.set('lang', params.lang);
|
|
|
- this.eduTextbook?.set('authors', params.authors);
|
|
|
- this.eduTextbook?.set('editor', params.editor);
|
|
|
- this.eduTextbook?.set('approval', params.approval);
|
|
|
- this.eduTextbook?.set('editionUnit', params.editionUnit);
|
|
|
- this.eduTextbook?.set('editionFirst', params.editionFirst);
|
|
|
- this.eduTextbook?.set('carrierShape', params.carrierShape);
|
|
|
- this.eduTextbook?.set('editionDate', params.editionDate);
|
|
|
- this.eduTextbook?.set('editionNumber', params.editionNumber);
|
|
|
- this.eduTextbook?.set('printDate', params.printDate);
|
|
|
- this.eduTextbook?.set('printNumber', params.printNumber);
|
|
|
- this.eduTextbook?.set('printSum', params.printSum);
|
|
|
- this.eduTextbook?.set('importantProject', this.importantProject);
|
|
|
- this.eduTextbook?.set('importantProjectOther', params.importantProjectOther);
|
|
|
- this.eduTextbook?.set('approvedImgUrl', params.approvedImgUrl)
|
|
|
- this.eduTextbook?.set('unitType', params.unitType)
|
|
|
- await this.eduTextbook?.save();
|
|
|
- return
|
|
|
+
|
|
|
+
|
|
|
+ this.eduTextbookVolume?.set('user', Parse.User.current()?.toPointer());
|
|
|
+
|
|
|
+ this.eduTextbookVolume?.set('ISBN', (params.ISBN || 0).toString());
|
|
|
+ this.eduTextbookVolume?.set('author', params.author);
|
|
|
+ this.eduTextbookVolume?.set('unit', params.unit);
|
|
|
+ this.eduTextbookVolume?.set('lang', params.lang);
|
|
|
+ this.eduTextbookVolume?.set('authors', params.authors);
|
|
|
+ this.eduTextbookVolume?.set('editor', params.editor);
|
|
|
+ this.eduTextbookVolume?.set('editionUnit', params.editionUnit);
|
|
|
+ this.eduTextbookVolume?.set('editionFirst', params.editionFirst);
|
|
|
+ this.eduTextbookVolume?.set('carrierShape', params.carrierShape);
|
|
|
+ this.eduTextbookVolume?.set('editionDate', params.editionDate);
|
|
|
+ this.eduTextbookVolume?.set('editionNumber', params.editionNumber);
|
|
|
+ this.eduTextbookVolume?.set('printDate', params.printDate);
|
|
|
+ this.eduTextbookVolume?.set('printNumber', params.printNumber);
|
|
|
+ this.eduTextbookVolume?.set('printSum', params.printSum);
|
|
|
+ this.eduTextbookVolume?.set('importantProject', this.importantProject);
|
|
|
+ this.eduTextbookVolume?.set('importantProjectOther', params.importantProjectOther);
|
|
|
+ this.eduTextbookVolume?.set('unitType', params.unitType)
|
|
|
+ await this.eduTextbookVolume?.save();
|
|
|
}
|
|
|
- selectedValue = null;
|
|
|
- listOfOption: Array<{ value: string; text: string }> = [];
|
|
|
nzFilterOption = (): boolean => true;
|
|
|
+ /** 搜索出版单位防抖定时器*/
|
|
|
eduTimeout: any
|
|
|
/**出版单位列表 */
|
|
|
eduList: Array<Parse.Object> = []
|
|
@@ -396,7 +310,6 @@ export class BasicComponent implements OnInit {
|
|
|
query.limit(10)
|
|
|
this.eduList = await query.find()
|
|
|
}, 500);
|
|
|
-
|
|
|
}
|
|
|
openFile(url: any) {
|
|
|
window.open(url)
|