| | |
| | | import { DataType, AreaNames } from './../../../core/entity/grid'; |
| | | import { AreaNames, MonitorPoint } from '@business/entity/data'; |
| | | import { Version, ValueTransformer } from '@angular/compiler/src/util'; |
| | | import { Subject } from 'rxjs/Subject'; |
| | | import { ToolsService } from '@core/services/tools.service'; |
| | | import { Component, OnInit } from '@angular/core'; |
| | | import { NzMessageService, NzModalService } from 'ng-zorro-antd'; |
| | | import { ModalHelper } from '@delon/theme'; |
| | | import { HttpClient } from '@angular/common/http'; |
| | | import { environment } from '../../../../environments/environment'; |
| | | import { DateService } from '@core/services/date.service'; |
| | | import { VersionService } from 'app/routes/devices/version/version.service'; |
| | | import { Types } from '@core/enum/types.enum'; |
| | | import { Column, Grid, PageBean } from '@core/entity/grid'; |
| | | import { environment } from 'environments/environment'; |
| | | import { VersionService } from '@business/services/http/version.service'; |
| | | import { Types } from '@business/enum/types.enum'; |
| | | import { Column, Grid, PageBean, DataType } from '@business/entity/grid'; |
| | | import { filter } from 'rxjs/operators/filter'; |
| | | import { MonitorPointEditComponent } from 'app/routes/devices/monitor-point/monitor-point-edit/monitor-point-edit.component'; |
| | | import { MonitorPointService } from 'app/routes/devices/monitor-point/monitor-point.service'; |
| | | import { MonitorPointService } from '@business/services/http/monitor-point.service'; |
| | | |
| | | interface MonitorPoint { |
| | | address?: any|Column; |
| | | areaCode?: any|Column; |
| | | cityCode?: any|Column; |
| | | description?: any|Column; |
| | | id?: any|Column; |
| | | isDelete?: any|Column; |
| | | latitude?: any|Column; |
| | | longitude?: any|Column; |
| | | name?: any|Column; |
| | | organizationId?: any|Column; |
| | | provinceCode?: any|Column; |
| | | } |
| | | |
| | | @Component({ |
| | | selector: 'app-monitor-point', |
| | | templateUrl: './monitor-point.component.html', |
| | |
| | | export class MonitorPointComponent implements OnInit { |
| | | |
| | | |
| | | private organization: MonitorPoint; |
| | | private monitorPoint: MonitorPoint; |
| | | grid: Grid<MonitorPoint> = new Grid(null); |
| | | queryMap = { text: '请输入名称', value: ''}; |
| | | queryTextStream: Subject<string> = new Subject<string>(); |
| | | private initPage() { |
| | | this.organization = { |
| | | this.monitorPoint = { |
| | | name: { |
| | | text: '名称', |
| | | width: '120px' |
| | | width: '300px' |
| | | }, |
| | | address: { |
| | | text: '地址', |
| | | width: '300px', |
| | | format: (value: any, col: Column, row: any) => { |
| | | value = value == null ? '' : value ; |
| | | if (row['areaNames'] != null) { |
| | | return row['areaNames']['provinceName'] + row['areaNames']['cityName'] + row['areaNames']['areaName'] + value; |
| | | } else { |
| | | return value; |
| | | } |
| | | |
| | | } |
| | | }, |
| | | description: { |
| | | text: '描述', |
| | | width: '300px' |
| | | } |
| | | }; |
| | | this.grid.title = '设备型号'; |
| | | this.grid.setColumns(this.organization); |
| | | this.grid.title = '监控点'; |
| | | this.grid.setColumns(this.monitorPoint); |
| | | this.grid.pageSize = 10; |
| | | } |
| | | constructor( |
| | |
| | | if ( d != null) { |
| | | Object.assign(data, d); |
| | | } |
| | | const cols = this.organization; |
| | | this.modalHelper.static(MonitorPointEditComponent, { cols , data }).subscribe( |
| | | this.modalHelper.static(MonitorPointEditComponent, { data }).subscribe( |
| | | ( ret: { data: any, close: Function} ) => { |
| | | // 修改状态 |
| | | if (ret.data['index'] != null ) { |
| | | const index: number = ret.data['index'] ; |
| | | const origData = this.grid.getData()[index]; |
| | | const origData = this.grid.data[index]; |
| | | const isModified = Object.keys(origData).some( |
| | | (key: string) => { |
| | | return ret.data[key] !== origData[key]; |
| | |
| | | // 未作修改 |
| | | if (!isModified) { |
| | | ret.close(); |
| | | this.msgSrv.success('组织未作任何修改!'); |
| | | this.msgSrv.success(this.grid.title + '未作任何修改!'); |
| | | return; |
| | | } |
| | | } |
| | |
| | | if (res.code === 1) { |
| | | this.load(); |
| | | ret.close(); |
| | | this.msgSrv.success('组织保存成功!'); |
| | | this.msgSrv.success(this.grid.title + '保存成功!'); |
| | | } |
| | | } |
| | | ); |
| | |
| | | ( res: any) => { |
| | | if (res.code === 1) { |
| | | this.load(); |
| | | this.msgSrv.success('设备型号删除成功!'); |
| | | this.msgSrv.success(this.grid.title + '删除成功!'); |
| | | } |
| | | } |
| | | ); |
| | |
| | | } |
| | | this.load(); |
| | | } |
| | | |
| | | reset(ls: any[]) { |
| | | for (const item of ls) item.value = false; |
| | | this.load(true); |
| | | } |
| | | |
| | | } |