123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import { Component, OnInit, 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 {
- FormControl,
- FormGroup,
- NonNullableFormBuilder,
- Validators,
- } from '@angular/forms';
- interface course {
- date: Date|any,
- wordage: number|any,
- num: number|any,
- sumNum:number|any,
- accolade:string
- }
- @Component({
- selector: 'app-textbook-content',
- imports: [
- CommonCompModule,
- ReactiveFormsModule,
- NzSelectModule,
- NzRadioModule,
- NzGridModule,
- NzCheckboxModule,
- NzTableModule,
- ],
- standalone: true,
- templateUrl: './textbook-content.component.html',
- styleUrls: ['./textbook-content.component.scss'],
- })
- export class TextbookContentComponent implements OnInit {
- @Input('editFrom') editFrom: any;
- @Input('maxWidth') maxWidth: number = 0;
- @Output() next: EventEmitter<any> = new EventEmitter<any>();
- @Output() save: EventEmitter<any> = new EventEmitter<any>();
- validateForm: FormGroup<{
- innovateExplain: FormControl<string>; //申报教材特色及创新
- influence: FormControl<string>; //申报教材应用情况及社会影响力
- }> = this.fb.group({
- innovateExplain: ['', [Validators.required]],
- influence: ['', [Validators.required]],
- });
- //申报教材建设历程
- courses: Array<course> = [
- {
- date: '',//出版时间
- wordage: '',//字数
- num: '',//重印次数
- sumNum:'',//本版总印数
- accolade:''//获奖励情况
- },
- ];
- constructor(
- private fb: NonNullableFormBuilder,
- private msg: NzMessageService
- ) { }
- ngOnInit() {}
- submitForm(event?: string): void {
- console.log(this.validateForm.value);
- if (this.validateForm.valid) {
- console.log(this.validateForm.value);
- } else {
- Object.values(this.validateForm.controls).forEach((control) => {
- if (control.invalid) {
- control.markAsDirty();
- control.updateValueAndValidity({ onlySelf: true });
- }
- });
- this.msg.warning('请填写完整信息');
- }
- if (event == 'next') {
- this.next.emit();
- }
- }
- changeCode() {}
- getCode(e: any) {}
- //添加作者信息
- onPush(idx: number) {
- this.courses.splice(idx+1, 0, {
- date: '',
- wordage: '',
- num: '',
- sumNum:'',
- accolade:''
- });
- }
- //删除作者信息
- onDel(idx: number) {
- this.courses.splice(idx, 1);
- }
- }
|