| | |
| | | }) |
| | | export class MonitorPointEditComponent implements OnInit { |
| | | |
| | | orgOptions = []; |
| | | |
| | | orgOptions = []; |
| | | configMap: {organizationId: number}; |
| | | data: MonitorPoint; |
| | | isSaving = false; |
| | | validateForm: FormGroup; |
| | |
| | | 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]], |
| | |
| | | }; |
| | | this.validateForm = this.formBuilder.group( |
| | | validates |
| | | ); |
| | | this.validateForm.controls['organizationId'].valueChanges.subscribe( |
| | | value => { |
| | | this.configMap.organizationId = value; |
| | | } |
| | | ); |
| | | } |
| | | close() { |
| | |
| | | } |
| | | } |
| | | 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) { |
| | |
| | | } |
| | | ); break; |
| | | case 1: |
| | | this.areacodeService.getAreas(option.value).subscribe( |
| | | // 区不是叶节点 兼容旧组件 |
| | | this.areacodeService.getAreas(option.value , false).subscribe( |
| | | (res: {label: string, value: string}[]) => { |
| | | event.resolve( res ); |
| | | } |
| | |
| | | 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) => { |