|
@@ -0,0 +1,145 @@
|
|
|
+import { Component, OnInit } from '@angular/core';
|
|
|
+
|
|
|
+
|
|
|
+import { Input, Output, EventEmitter } from '@angular/core';
|
|
|
+import { CommonCompModule } from '../../../../../services/common.modules';
|
|
|
+import { NzSelectModule } from 'ng-zorro-antd/select';
|
|
|
+import { ReactiveFormsModule } from '@angular/forms';
|
|
|
+import { NzRadioModule } from 'ng-zorro-antd/radio';
|
|
|
+import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
+import { NzGridModule } from 'ng-zorro-antd/grid';
|
|
|
+import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
|
|
|
+import { NzTableModule } from 'ng-zorro-antd/table';
|
|
|
+import { NzModalService } from 'ng-zorro-antd/modal';
|
|
|
+import Parse from 'parse';
|
|
|
+import {
|
|
|
+ FormControl,
|
|
|
+ FormGroup,
|
|
|
+ NonNullableFormBuilder,
|
|
|
+ Validators,
|
|
|
+} from '@angular/forms';
|
|
|
+import { textbookServer } from '../../../../../services/textbook';
|
|
|
+import { CreatedService } from '../../../../../services/created.service'
|
|
|
+
|
|
|
+
|
|
|
+interface course {
|
|
|
+ date: Date | any,
|
|
|
+ wordage: number | any,
|
|
|
+ num: number | any,
|
|
|
+ sumNum: number | any,
|
|
|
+ accolade: string
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+@Component({
|
|
|
+ selector: 'app-three',
|
|
|
+ templateUrl: './content.component.html',
|
|
|
+ styleUrls: ['./content.component.scss'],
|
|
|
+ standalone: true,
|
|
|
+ imports: [
|
|
|
+ CommonCompModule,
|
|
|
+ ReactiveFormsModule,
|
|
|
+ NzSelectModule,
|
|
|
+ NzRadioModule,
|
|
|
+ NzGridModule,
|
|
|
+ NzCheckboxModule,
|
|
|
+ NzTableModule,
|
|
|
+ ContentComponent
|
|
|
+ ],
|
|
|
+})
|
|
|
+export class ContentComponent implements OnInit {
|
|
|
+
|
|
|
+ @Input('eduTextbookVolumeId') eduTextbookVolumeId: any;
|
|
|
+
|
|
|
+
|
|
|
+ @Input('eduTextbook') eduTextbook: any;
|
|
|
+ @Input('maxWidth') maxWidth: number = 0;
|
|
|
+ @Output() state: EventEmitter<any> = new EventEmitter<any>();
|
|
|
+ @Output() save: EventEmitter<any> = new EventEmitter<any>();
|
|
|
+ validateForm: FormGroup<{
|
|
|
+ }> = this.fb.group({
|
|
|
+ });
|
|
|
+ //申报教材建设历程
|
|
|
+ courses: Array<course> = [
|
|
|
+ {
|
|
|
+ date: '',//出版时间
|
|
|
+ wordage: '',//字数
|
|
|
+ num: '',//重印次数
|
|
|
+ sumNum: '',//本版总印数
|
|
|
+ accolade: ''//获奖励情况
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ constructor(
|
|
|
+ public tbookSer: textbookServer,
|
|
|
+ private fb: NonNullableFormBuilder,
|
|
|
+ private modal: NzModalService,
|
|
|
+ private msg: NzMessageService,
|
|
|
+ private creatSev: CreatedService
|
|
|
+ ) { }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**分册记录Parse */
|
|
|
+ eduTextbookVolume: Parse.Object | any
|
|
|
+ /**获取扩展分册记录 */
|
|
|
+ async getEduTextbookVolume() {
|
|
|
+ console.log('传递的分册id' + this.eduTextbookVolumeId)
|
|
|
+ if (this.eduTextbookVolumeId) {
|
|
|
+ let query = new Parse.Query('EduTextbookVolume')
|
|
|
+ this.eduTextbookVolume = await query.get(this.eduTextbookVolumeId)
|
|
|
+ console.log(this.eduTextbookVolume);
|
|
|
+ } else {
|
|
|
+ console.log("分册id未传递")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ngAfterViewInit(): void {
|
|
|
+ //Called after ngAfterContentInit when the component's view has been initialized. Applies to components only.
|
|
|
+ //Add 'implements AfterViewInit' to the class.
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ async refersh() {
|
|
|
+ await this.getEduTextbookVolume()
|
|
|
+ if (this.eduTextbookVolume?.id) {
|
|
|
+
|
|
|
+ this.creatSev.type = this.eduTextbookVolume.get('type')
|
|
|
+ this.creatSev.typeNumber = this.eduTextbookVolume.get('typeNumber')
|
|
|
+
|
|
|
+ this.validateForm = this.fb.group({
|
|
|
+ });
|
|
|
+ console.log(this.validateForm.value);
|
|
|
+ this.courses = this.eduTextbookVolume.get('courses') || this.courses
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ngOnInit() {
|
|
|
+ this.refersh()
|
|
|
+ }
|
|
|
+
|
|
|
+ changeCode() { }
|
|
|
+ getCode(e: any) { }
|
|
|
+ //添加作者信息
|
|
|
+ onPush(idx: number) {
|
|
|
+ this.courses.splice(idx + 1, 0, {
|
|
|
+ date: '',
|
|
|
+ wordage: '',
|
|
|
+ num: '',
|
|
|
+ sumNum: '',
|
|
|
+ accolade: ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //删除作者信息
|
|
|
+ onDel(idx: number) {
|
|
|
+ if (this.courses?.length == 1) return
|
|
|
+ this.courses.splice(idx, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ async saveEduTextbook() {
|
|
|
+ console.log('执行子组件方法')
|
|
|
+ this.eduTextbookVolume?.set('courses', this.courses)
|
|
|
+ await this.eduTextbookVolume?.save()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|