From 6f1ab8e489e791734a2c63550b63ad1cb74b4f57 Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Wed, 04 Jul 2018 17:19:29 +0800
Subject: [PATCH] 设备页面bug 修复
---
src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts | 34 +++++++++++++++++++++++++++++-----
1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts b/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts
index faa04fe..2e75da8 100644
--- a/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts
+++ b/src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts
@@ -14,8 +14,8 @@
})
export class MonitorPointEditComponent implements OnInit {
- orgOptions = [];
-
+ orgOptions = [];
+ configMap: {organizationId: number};
data: MonitorPoint;
isSaving = false;
validateForm: FormGroup;
@@ -36,7 +36,10 @@
value: data.areaCode
};
}
- this.OrgSelectChange(null);
+ this.orgSelectChange(null);
+ if (!!this.configMap.organizationId && !data.organizationId) {
+ data.organizationId = this.configMap.organizationId;
+ }
const validates: MonitorPoint|object = {
name: [data.name, [Validators.required] ],
organizationId: [data.organizationId, [Validators.required]],
@@ -48,6 +51,11 @@
};
this.validateForm = this.formBuilder.group(
validates
+ );
+ this.validateForm.controls['organizationId'].valueChanges.subscribe(
+ value => {
+ this.configMap.organizationId = value;
+ }
);
}
close() {
@@ -77,6 +85,7 @@
}
}
areaLazyLoad(event: { option: CascaderOption, index: number, resolve: (children: CascaderOption[]) => void, reject: () => void }) {
+ // console.info(event);
const index = event['index'];
const option = event.option;
switch (index) {
@@ -93,7 +102,20 @@
}
); break;
case 1:
- this.areacodeService.getAreas(option.value).subscribe(
+ // ������������������ ���������������
+ this.areacodeService.getAreas(option.value , false).subscribe(
+ (res: {label: string, value: string}[]) => {
+ event.resolve( res );
+ }
+ ); break;
+ case 2:
+ this.areacodeService.getTowns(option.value).subscribe(
+ (res: {label: string, value: string}[]) => {
+ event.resolve( res );
+ }
+ ); break;
+ case 3:
+ this.areacodeService.getVillages(option.value).subscribe(
(res: {label: string, value: string}[]) => {
event.resolve( res );
}
@@ -104,8 +126,10 @@
this.data.provinceCode = codes[0];
this.data.cityCode = codes[1];
this.data.areaCode = codes[2];
+ this.data.townCode = codes[3];
+ this.data.villageCode = codes[4];
}
- OrgSelectChange(text) {
+ orgSelectChange(text) {
const pageBean: PageBean = {pageIndex: 0, pageSize: 20};
this.organizationService.getPagingList(pageBean, text).subscribe(
(res: PageBean) => {
--
Gitblit v1.8.0