|
@@ -0,0 +1,63 @@
|
|
|
+import { Component, OnInit } from '@angular/core';
|
|
|
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
|
+import { CommonCompModule } from '../../../services/common.modules';
|
|
|
+import { Router, ActivatedRoute } from '@angular/router';
|
|
|
+import { NzSelectModule } from 'ng-zorro-antd/select';
|
|
|
+import {
|
|
|
+ FormControl,
|
|
|
+ FormGroup,
|
|
|
+ NonNullableFormBuilder,
|
|
|
+ Validators,
|
|
|
+} from '@angular/forms';
|
|
|
+import { textbookServer } from '../../../services/textbook';
|
|
|
+import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
+import { NzModalService } from 'ng-zorro-antd/modal';
|
|
|
+import { provinces } from '../../../services/provinces';
|
|
|
+import { SubmittedComponent } from '../components/submitted/submitted.component'
|
|
|
+import { ProfileComponent } from '../components/profile/profile.component'
|
|
|
+@Component({
|
|
|
+ selector: 'app-create-collection',
|
|
|
+ imports: [
|
|
|
+ CommonCompModule,FormsModule, ReactiveFormsModule,NzSelectModule,SubmittedComponent,ProfileComponent
|
|
|
+ ],
|
|
|
+ standalone: true,
|
|
|
+ templateUrl: './create-collection.component.html',
|
|
|
+ styleUrls: ['./create-collection.component.scss'],
|
|
|
+})
|
|
|
+export class CreateCollectionComponent implements OnInit {
|
|
|
+ provinces: Array<string> = provinces.options
|
|
|
+ showEdit:boolean = false
|
|
|
+
|
|
|
+ validateForm: FormGroup<{
|
|
|
+ name: FormControl<Array<string> | any>; //合集名称
|
|
|
+ desc: FormControl<Array<string> | any>; //合集描述
|
|
|
+ code: FormControl<string | any>; //合集code
|
|
|
+ area:FormControl<string>; //关联省级行政区
|
|
|
+ }> = this.fb.group({
|
|
|
+ name: ['', [Validators.required]],
|
|
|
+ desc: ['', [Validators.required]],
|
|
|
+ code: ['', [Validators.required]],
|
|
|
+ area: ['', [Validators.required]],
|
|
|
+ })
|
|
|
+ constructor(
|
|
|
+ private router: Router,
|
|
|
+ public tbookSer: textbookServer,
|
|
|
+ private fb: NonNullableFormBuilder,
|
|
|
+ private msg: NzMessageService,
|
|
|
+ private modal: NzModalService
|
|
|
+ ) { }
|
|
|
+
|
|
|
+ ngOnInit() {}
|
|
|
+ submitForm(): void {
|
|
|
+ if (this.validateForm.valid) {
|
|
|
+ console.log('submit', this.validateForm.value);
|
|
|
+ } else {
|
|
|
+ Object.values(this.validateForm.controls).forEach(control => {
|
|
|
+ if (control.invalid) {
|
|
|
+ control.markAsDirty();
|
|
|
+ control.updateValueAndValidity({ onlySelf: true });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|