| File was renamed from src/app/routes/devices/version/add-or-edit/add-or-edit.component.ts |
| | |
| | | import { DeviceVersion } from './../version.component'; |
| | | import { Component, OnInit } from '@angular/core'; |
| | | import { HttpClient } from '@angular/common/http'; |
| | | import { NzMessageService, NzModalSubject } from 'ng-zorro-antd'; |
| | | import { DateService } from '@core/services/date.service'; |
| | | import { FormGroup, FormBuilder, Validators } from '@angular/forms'; |
| | | import { DeviceVersion } from 'app/routes/devices/version/version.component'; |
| | | |
| | | @Component({ |
| | | selector: 'app-add-or-edit', |
| | | templateUrl: './add-or-edit.component.html', |
| | | selector: 'app-version-edit', |
| | | templateUrl: './version-edit.component.html', |
| | | styles: [] |
| | | }) |
| | | export class AddOrEditComponent implements OnInit { |
| | | export class VersionEditComponent implements OnInit { |
| | | |
| | | cols: DeviceVersion; |
| | | |
| | |
| | | name: [this.data.name, [Validators.required] ], |
| | | version: [this.data.version == null ? 1 : this.data.version, [Validators.required] ], |
| | | createTime: [this.data.createTime, [Validators.required] ], |
| | | description: [this.data.description, [Validators.required] ] |
| | | description: [this.data.description] |
| | | }; |
| | | this.validateForm = this.formBuilder.group( |
| | | validates |
| | |
| | | return; |
| | | } |
| | | this.isSaving = true; |
| | | Object.keys(this.data).forEach( (key: string) => { |
| | | Object.keys(value).forEach( (key: string) => { |
| | | if ( value[key] != null ) { |
| | | this.data[key] = value[key]; |
| | | } |
| | | } ); |
| | | this.subject.next( this ); |
| | | }else { |
| | | for (const i in this.validateForm.controls) { |
| | | this.validateForm.controls[ i ].markAsDirty(); |
| | | } |
| | | this.validate(); |
| | | } |
| | | } |
| | | validate() { |