| | |
| | | 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({ |
| | |
| | | }) |
| | | 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 = { |
| | |
| | | constructor( |
| | | private coorPickerService: CoorPickerService, |
| | | private monitorPointService: MonitorPointService, |
| | | |
| | | private confirmServ: NzModalService, |
| | | public msgSrv: NzMessageService, |
| | | private modalHelper: ModalHelper, |
| | | private organizationService: OrganizationService |
| | | ) { } |
| | | |
| | | ngOnInit() { |
| | |
| | | .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) { |
| | |
| | | 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) { |
| | |
| | | if (d != null) { |
| | | Object.assign(data, d); |
| | | } |
| | | this.modalHelper.static(MonitorPointEditComponent, { data }).subscribe( |
| | | let configMap = {}; |
| | | configMap = Object.assign(configMap, this.queryMap); |
| | | this.modalHelper.static(MonitorPointEditComponent, { data, configMap }).subscribe( |
| | | (ret: { data: any, close: Function }) => { |
| | | // 修改状态 |
| | | if (ret.data['index'] != null) { |
| | |
| | | const areaNames = record.areaNames; |
| | | let adress = ''; |
| | | if (areaNames != null) { |
| | | adress += !!areaNames.provinceName?areaNames.provinceName:''; |
| | | adress += !!areaNames.provinceName ? areaNames.provinceName : ''; |
| | | adress += ' '; |
| | | adress += !!areaNames.cityName?areaNames.cityName:''; |
| | | adress += !!areaNames.cityName ? areaNames.cityName : ''; |
| | | adress += ' '; |
| | | adress += !!areaNames.areaName?areaNames.areaName:''; |
| | | adress += !!areaNames.areaName ? areaNames.areaName : ''; |
| | | adress += ' '; |
| | | adress += !!record.address?record.address:''; |
| | | adress += !!record.address ? record.address : ''; |
| | | } |
| | | this.coorPickerService.data.address = adress; |
| | | this.coorPickerService.data['describe'] = '监控站点名称'; |
| | |
| | | } |
| | | ); |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | | ); |
| | | } |
| | | } |