From 899b4ddd9790728851834062c57892f600ee4355 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Tue, 19 Jun 2018 11:23:55 +0800 Subject: [PATCH] Merge branch 'develop' of http://blit.7drlb.com:8888/r/screen-frontend into develop --- src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.ts b/src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.ts new file mode 100644 index 0000000..35a0948 --- /dev/null +++ b/src/app/routes/sensors/basic-info/sensor-unit/sensor-unit/sensor-unit.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit } from '@angular/core'; +import { _HttpClient } from '@delon/theme'; +import { NzModalSubject } from 'ng-zorro-antd'; +import { FormGroup } from '@angular/forms'; + +@Component({ + selector: 'app-sensor-unit', + templateUrl: './sensor-unit.component.html', +}) +export class SensorUnitComponent implements OnInit { + public isSaving = false; + public validateForm: FormGroup; + public data: any; + constructor( + private subject: NzModalSubject, + private http: _HttpClient + ) { } + + ngOnInit() { + } + save($event, value, valid) { + $event.preventDefault(); + if (valid) { + for (const i in this.validateForm.controls) { + this.validateForm.controls[ i ].disable(); + } + this.isSaving = true; + Object.keys(value).forEach( (key: string) => { + // '_'������������������������������ + if (!key.startsWith('_') && value[key] != null) { + this.data[key] = value[key]; + } + } ); + } else { + this.validate(); + } + } + validate() { + for (const i in this.validateForm.controls) { + this.validateForm.controls[ i ].markAsDirty(); + } + } +} -- Gitblit v1.8.0