From 8ac3a87733b421c1f1cb3b691f946c05bdae02df Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Fri, 06 Jul 2018 13:54:14 +0800 Subject: [PATCH] 设备,监控点维护 完善 --- src/app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component.ts | 36 ++++++++++++++++++++++++++++++------ 1 files changed, 30 insertions(+), 6 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..669a144 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,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