|  |  |  | 
|---|
|  |  |  | import { DeviceVersion } from '@business/entity/data'; | 
|---|
|  |  |  | import { Component, OnInit } from '@angular/core'; | 
|---|
|  |  |  | import { NzMessageService, NzModalSubject } from 'ng-zorro-antd'; | 
|---|
|  |  |  | import { FormGroup, FormBuilder, Validators } from '@angular/forms'; | 
|---|
|  |  |  | import { DeviceVersion } from 'app/routes/devices/version/version.component'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Component({ | 
|---|
|  |  |  | selector: 'app-version-edit', | 
|---|
|  |  |  | 
|---|
|  |  |  | ) { } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ngOnInit() { | 
|---|
|  |  |  | if (this.data.createTime == null) { | 
|---|
|  |  |  | this.data.createTime = new Date().getTime(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | const validates: DeviceVersion = { | 
|---|
|  |  |  | name: [this.data.name, [Validators.required] ], | 
|---|
|  |  |  | version: [this.data.version == null ? 1 : this.data.version, [Validators.required] ], | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } ); | 
|---|
|  |  |  | this.subject.next( this ); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.validate(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|