From 7ca521e4267b987270f6ccbb9a6c076aeb467d96 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Wed, 04 Jul 2018 17:11:33 +0800 Subject: [PATCH] 设备,监控站 管理功能增强 --- src/app/routes/devices/monitor-point/monitor-point.component.ts | 36 ++++++++++++++++++++++++++++++------ 1 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/app/routes/devices/monitor-point/monitor-point.component.ts b/src/app/routes/devices/monitor-point/monitor-point.component.ts index 67e290b..6892d0e 100644 --- a/src/app/routes/devices/monitor-point/monitor-point.component.ts +++ b/src/app/routes/devices/monitor-point/monitor-point.component.ts @@ -14,6 +14,8 @@ import { MonitorPointEditComponent } from 'app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component'; import { MonitorPointService } from '@business/services/http/monitor-point.service'; import { CoordinatesPickerComponent } from 'app/routes/map/coordinates-picker/coordinates-picker.component'; +import { OrganizationService } from '@business/services/http/organization.service'; +import { ExampleService } from '@business/services/util/example.service'; @Component({ @@ -23,10 +25,10 @@ }) export class MonitorPointComponent implements OnInit { - + public orgOptions = []; private monitorPoint: MonitorPoint; grid: Grid<MonitorPoint> = new Grid(null); - queryMap = { text: '���������������', value: '' }; + queryMap: { mpointName?: string, organizationId?: number } = { mpointName: null, organizationId: null }; queryTextStream: Subject<string> = new Subject<string>(); private initPage() { this.monitorPoint = { @@ -64,10 +66,10 @@ constructor( private coorPickerService: CoorPickerService, private monitorPointService: MonitorPointService, - private confirmServ: NzModalService, public msgSrv: NzMessageService, private modalHelper: ModalHelper, + private organizationService: OrganizationService ) { } ngOnInit() { @@ -78,9 +80,14 @@ .subscribe(queryText => { this.load(); }); + this.orgSelectChange(); + } + public setOrganizationId(orgId) { + this.queryMap.organizationId = orgId; + this.load(); } queryTextChanged($event) { - this.queryTextStream.next(this.queryMap.value); + this.queryTextStream.next(this.queryMap.mpointName); } load(reload: boolean = false) { if (reload) { @@ -90,7 +97,13 @@ setTimeout(() => { this.grid.loading = true; }, 1); - this.monitorPointService.getPagingList(this.grid, this.queryMap.value).subscribe( + const example = new ExampleService(); + const organizationId = !!this.queryMap.organizationId ? this.queryMap.organizationId : null; + const mpointName = !!this.queryMap.mpointName ? '%' + this.queryMap.mpointName + '%' : null; + example.or() + .andEqualTo({name: 'organizationId', value: organizationId }) + .andLike({name: 'name', value: mpointName }); + this.monitorPointService.getPageByExample(this.grid, example).subscribe( (res: PageBean) => { this.grid.loading = true; if (res != null && res.data != null) { @@ -110,7 +123,8 @@ if (d != null) { Object.assign(data, d); } - this.modalHelper.static(MonitorPointEditComponent, { data }).subscribe( + const configMap = this.queryMap; + this.modalHelper.static(MonitorPointEditComponent, { data, configMap }).subscribe( (ret: { data: any, close: Function }) => { // ������������ if (ret.data['index'] != null) { @@ -217,4 +231,14 @@ } ); } + orgSelectChange(text?: string) { + const pageBean: PageBean = {pageIndex: 0, pageSize: 20}; + this.organizationService.getPagingList(pageBean, text).subscribe( + (res: PageBean) => { + if (res != null && res.data != null) { + this.orgOptions = res.data; + } + } + ); + } } -- Gitblit v1.8.0