|
@@ -35,7 +35,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { provideNativeDateAdapter } from '@angular/material/core';
|
|
import { provideNativeDateAdapter } from '@angular/material/core';
|
|
-
|
|
|
|
|
|
+import { ViewChildren, QueryList } from '@angular/core';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-basic',
|
|
selector: 'app-basic',
|
|
@@ -73,12 +73,125 @@ export class BasicInComponent implements OnInit {
|
|
|
|
|
|
@ViewChild(MatAccordion) accordion: MatAccordion | any;
|
|
@ViewChild(MatAccordion) accordion: MatAccordion | any;
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ViewChildren(BasicComponent) children: QueryList<BasicComponent> | any;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**上传分册数据 */
|
|
|
|
+ async saveEduTextbookVolume() {
|
|
|
|
+ let arr = [] //存储返回的数组id
|
|
|
|
+ let isVrifly = true //默认都通过,若一项填写未完成,则不通过
|
|
|
|
+ return Promise.all(this.children.map(async (comp: any) => {
|
|
|
|
+ console.log(comp);
|
|
|
|
+ let req = await comp.saveEduTextbook()
|
|
|
|
+ console.log(req)
|
|
|
|
+ // arr.push(comp.saveEduTextbook())
|
|
|
|
+ //加上子组件返回是否填写完成的方法
|
|
|
|
+ // return arr
|
|
|
|
+ })).then(data => {
|
|
|
|
+ console.log(data);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ async saveEduTextbook(params: any, isComplete: boolean) {
|
|
|
|
+ this.changeImportantProject()
|
|
|
|
+ console.log(params);
|
|
|
|
+ if (!this.eduTextbook) {
|
|
|
|
+ let obj = Parse.Object.extend('EduTextbook');
|
|
|
|
+ this.eduTextbook = 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', params.typeNumber);
|
|
|
|
+ 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', params.importantProject);
|
|
|
|
+ this.eduTextbook?.set('importantProject', this.importantProject);
|
|
|
|
+ this.eduTextbook?.set('importantProjectOther', params.importantProjectOther);
|
|
|
|
+ // this.eduTextbook?.set('copyrightImgUrl', params.copyrightImgUrl);
|
|
|
|
+ // this.eduTextbook?.set('CIPImgUrl', params.CIPImgUrl);
|
|
|
|
+ this.eduTextbook?.set('approvedImgUrl', params.approvedImgUrl)
|
|
|
|
+ this.eduTextbook?.set('unitType', params.unitType)
|
|
|
|
+ await this.eduTextbook?.save();
|
|
|
|
+ this.saveEduTextbookVolume()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
ngAfterViewInit() {
|
|
ngAfterViewInit() {
|
|
this.accordion?.openAll()
|
|
this.accordion?.openAll()
|
|
this.cdr.detectChanges()
|
|
this.cdr.detectChanges()
|
|
|
|
+ this.getEduTextbookVolumeList()
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ /**扩展表记录 */
|
|
|
|
+ eduTextbookVolumeList: Array<any> = []
|
|
|
|
+ /**获取扩展表记录 */
|
|
|
|
+ async getEduTextbookVolumeList() {
|
|
|
|
+ console.log(this.validateForm?.value?.type)
|
|
|
|
+ // if(this.validateForm?.value?.type=='全册'){
|
|
|
|
+ let query = new Parse.Query('EduTextbookVolume')
|
|
|
|
+ query.equalTo('eduTextbook', this.eduTextbook?.id)
|
|
|
|
+ query.select('objectId')
|
|
|
|
+ query.ascending('createdAt')//小到大
|
|
|
|
+ query.notEqualTo('isDeleted', true)
|
|
|
|
+ if (this.validateForm?.value?.type == '全册') {
|
|
|
|
+ query.limit(this.typeNumber)
|
|
|
|
+ } else {
|
|
|
|
+ query.limit(1)
|
|
|
|
+ }
|
|
|
|
+ let list = await query.find()
|
|
|
|
+ console.log(list)
|
|
|
|
+ this.eduTextbookVolumeList = new Array(this.typeNumber).fill({ objectId: '' })
|
|
|
|
+ for (let i in list) {
|
|
|
|
+ this.eduTextbookVolumeList[i] = { objectId: list[i]?.id }
|
|
|
|
+ }
|
|
|
|
+ // }
|
|
|
|
+ }
|
|
|
|
+ /**申报类型选择全册 */
|
|
|
|
+ checkAll() {
|
|
|
|
+ this.validateForm.get("type")?.setValue('全册')
|
|
|
|
+
|
|
|
|
+ this.accordion?.openAll()
|
|
|
|
+ this.getEduTextbookVolumeList()
|
|
}
|
|
}
|
|
- /**扩展表记录 */
|
|
|
|
- eduTextbookVolumeList: Array<any> = []
|
|
|
|
ngOnInit() {
|
|
ngOnInit() {
|
|
if (this.eduTextbook?.get('editionUnit')) {
|
|
if (this.eduTextbook?.get('editionUnit')) {
|
|
this.isShowChooseEU = false
|
|
this.isShowChooseEU = false
|
|
@@ -94,15 +207,7 @@ export class BasicInComponent implements OnInit {
|
|
|
|
|
|
this.approvedImgList[0].url = this.eduTextbook?.get('approvedImgUrl')
|
|
this.approvedImgList[0].url = this.eduTextbook?.get('approvedImgUrl')
|
|
this.typeNumber = this.eduTextbook?.get('typeNumber') || 2
|
|
this.typeNumber = this.eduTextbook?.get('typeNumber') || 2
|
|
- if(this.eduTextbook?.get('type')=='全册'){
|
|
|
|
- let query = new Parse.Query('eduTextbookVolume')
|
|
|
|
-
|
|
|
|
- this.eduTextbookVolumeList=new Array(this.typeNumber-1).fill(false)
|
|
|
|
- console.log(this.eduTextbookVolumeList)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
-
|
|
|
|
// console.log(this.approvedImgList)
|
|
// console.log(this.approvedImgList)
|
|
console.log(this.eduTextbook);
|
|
console.log(this.eduTextbook);
|
|
this.validateForm = this.fb.group({
|
|
this.validateForm = this.fb.group({
|
|
@@ -185,14 +290,15 @@ export class BasicInComponent implements OnInit {
|
|
this.msg.create('warning', '不得小于两册')
|
|
this.msg.create('warning', '不得小于两册')
|
|
this.typeNumber = 2
|
|
this.typeNumber = 2
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- this.eduTextbookVolumeList = []
|
|
|
|
- // for (let i = 1; i++; i <= this.typeNumber) {
|
|
|
|
- // this.eduTextbookVolumeList.push(false)
|
|
|
|
- // }
|
|
|
|
- this.eduTextbookVolumeList=new Array(this.typeNumber-1).fill(false)
|
|
|
|
- console.log(this.eduTextbookVolumeList)
|
|
|
|
|
|
+ this.getEduTextbookVolumeList()
|
|
|
|
+ // this.eduTextbookVolumeList = []
|
|
|
|
+ // // for (let i = 1; i++; i <= this.typeNumber) {
|
|
|
|
+ // // this.eduTextbookVolumeList.push(false)
|
|
|
|
+ // // }
|
|
|
|
+ // this.eduTextbookVolumeList=new Array(this.typeNumber-1).fill(false)
|
|
|
|
+ // console.log(this.eduTextbookVolumeList)
|
|
|
|
|
|
}
|
|
}
|
|
validateForm: FormGroup<{
|
|
validateForm: FormGroup<{
|
|
@@ -366,7 +472,7 @@ export class BasicInComponent implements OnInit {
|
|
}
|
|
}
|
|
|
|
|
|
isShowChooseEU: boolean = true
|
|
isShowChooseEU: boolean = true
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
upload(e: any, type: string) {
|
|
upload(e: any, type: string) {
|
|
console.log(e);
|
|
console.log(e);
|
|
@@ -414,59 +520,7 @@ export class BasicInComponent implements OnInit {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- async saveEduTextbook(params: any, isComplete: boolean) {
|
|
|
|
- this.changeImportantProject()
|
|
|
|
- console.log(params);
|
|
|
|
- if (!this.eduTextbook) {
|
|
|
|
- let obj = Parse.Object.extend('EduTextbook');
|
|
|
|
- this.eduTextbook = 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', params.typeNumber);
|
|
|
|
- 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', params.importantProject);
|
|
|
|
- this.eduTextbook?.set('importantProject', this.importantProject);
|
|
|
|
- this.eduTextbook?.set('importantProjectOther', params.importantProjectOther);
|
|
|
|
- // this.eduTextbook?.set('copyrightImgUrl', params.copyrightImgUrl);
|
|
|
|
- // this.eduTextbook?.set('CIPImgUrl', params.CIPImgUrl);
|
|
|
|
- this.eduTextbook?.set('approvedImgUrl', params.approvedImgUrl)
|
|
|
|
- this.eduTextbook?.set('unitType', params.unitType)
|
|
|
|
|
|
|
|
- await this.eduTextbook?.save();
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|