| | |
| | | import { Component, OnInit, ElementRef, ViewChild } from '@angular/core'; |
| | | import { SimpleTableColumn, SimpleTableComponent } from '@delon/abc'; |
| | | import { Subject } from 'rxjs/Subject'; |
| | | import { CoordinatesPickerComponent } from 'app/routes/map/coordinates-picker/coordinates-picker.component'; |
| | | import { CoorPickerService } from 'app/routes/map/coordinates-picker/coordinates-picker.service'; |
| | | import { CoordinatesPickerComponent } from '../../map/coordinates-picker/coordinates-picker.component'; |
| | | import { CoorPickerService } from '../../map/coordinates-picker/coordinates-picker.service'; |
| | | import { OrganizationService } from '@business/services/http/organization.service'; |
| | | import { ExampleService, Criteria } from '@business/services/util/example.service'; |
| | | import { AdjustConfigComponent } from '../../devices/basic-info/adjust-config/adjust-config.component'; |
| | | import { DeviceEditComponent } from '../../devices/basic-info/device-edit/device-edit.component'; |
| | | import { DeviceControllerService } from '../device-controller/device-controller.service'; |
| | | |
| | | @Component({ |
| | | selector: 'app-device-status', |
| | |
| | | { title: '维护人', index: 'operateUser.name' }, |
| | | { title: '生产时间', width: '100px', type: 'date', index: 'createTime' }, |
| | | { title: '安装时间', width: '100px', type: 'date', index: 'installTime' }, |
| | | { |
| | | title: '操作区', |
| | | buttons: [ |
| | | { |
| | | text: '详细', |
| | | type: 'none', |
| | | click: (record: any) => this.addOrModify(record) |
| | | }, |
| | | { |
| | | text: '数据', |
| | | type: 'none', |
| | | click: (record: any) => { |
| | | this.deviceControllerService.data = record; |
| | | this.deviceControllerService.incumbent = 'data'; |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | ]; |
| | | queryTextStream: Subject<string> = new Subject<string>(); |
| | | public queryMap: {orgId?: number, mpointId?: number, devMacOrName?: string} |
| | |
| | | private modalHelper: ModalHelper, |
| | | private coorPickerService: CoorPickerService, |
| | | private organizationService: OrganizationService, |
| | | private http: _HttpClient |
| | | private http: _HttpClient, |
| | | private deviceControllerService: DeviceControllerService, |
| | | ) { } |
| | | |
| | | ngOnInit() { |
| | |
| | | if (!!configMap['mpointId'] && !d['monitorPoint']) { |
| | | data['monitorPoint'] = this.getMonitorPoint(configMap['mpointId']); |
| | | } |
| | | this.modalHelper.static(DeviceEditComponent, { data, configMap }).subscribe( |
| | | const isEditState = false; |
| | | this.modalHelper.static(DeviceEditComponent, { data,configMap,isEditState }).subscribe( |
| | | (ret: { data: any, close: Function }) => { |
| | | // 修改状态 |
| | | if (ret.data['id'] != null) { |
| | | const origData = d; |
| | | const isModified = Object.keys(ret.data).some( |
| | | (key: string) => { |
| | | return ret.data[key] !== origData[key]; |
| | | } |
| | | ); |
| | | // 未作修改 |
| | | if (!isModified) { |
| | | ret.close(); |
| | | this.msgSrv.success('数据未作任何修改!'); |
| | | return; |
| | | } |
| | | } |
| | | this.deviceService.save(ret.data).subscribe( |
| | | (res: any) => { |
| | | if (res.code === 1) { |
| | | this.load(); |
| | | ret.close(); |
| | | this.msgSrv.success('数据保存成功!'); |
| | | } |
| | | } |
| | | ); |
| | | // // 修改状态 |
| | | // if (ret.data['id'] != null) { |
| | | // const origData = d; |
| | | // const isModified = Object.keys(ret.data).some( |
| | | // (key: string) => { |
| | | // return ret.data[key] !== origData[key]; |
| | | // } |
| | | // ); |
| | | // // 未作修改 |
| | | // if (!isModified) { |
| | | // ret.close(); |
| | | // this.msgSrv.success('数据未作任何修改!'); |
| | | // return; |
| | | // } |
| | | // } |
| | | // this.deviceService.save(ret.data).subscribe( |
| | | // (res: any) => { |
| | | // if (res.code === 1) { |
| | | // this.load(); |
| | | // ret.close(); |
| | | // this.msgSrv.success('数据保存成功!'); |
| | | // } |
| | | // } |
| | | // ); |
| | | }); |
| | | } |
| | | private getMonitorPoint(mpointId: number) { |