From af95e3f15895995607604ecf0e757c48169795b3 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Thu, 05 Jul 2018 15:00:27 +0800
Subject: [PATCH] 修复 区域为空拼接问题
---
src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 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 6cee432..8fafe6e 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;
@@ -32,11 +32,14 @@
let _areas = null;
if (areaNames != null) {
_areas = {
- label: Object.values(areaNames).join('/'),
+ label: Object.values(areaNames).filter(d=>d).join('/'),
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,7 +85,7 @@
}
}
areaLazyLoad(event: { option: CascaderOption, index: number, resolve: (children: CascaderOption[]) => void, reject: () => void }) {
- console.info(event);
+ // console.info(event);
const index = event['index'];
const option = event.option;
switch (index) {
@@ -94,7 +102,8 @@
}
); break;
case 1:
- this.areacodeService.getAreas(option.value).subscribe(
+ // ������������������ ���������������
+ this.areacodeService.getAreas(option.value , false).subscribe(
(res: {label: string, value: string}[]) => {
event.resolve( res );
}
@@ -120,7 +129,7 @@
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