| | |
| | | import { Component, OnInit } from '@angular/core'; |
| | | import { Device} from '@business/entity/data'; |
| | | import { _Validators } from '@delon/abc'; |
| | | import { PageBean } from '@business/entity/grid'; |
| | | import { PageBean, ResultBean } from '@business/entity/grid'; |
| | | import { _HttpClient } from '@delon/theme'; |
| | | import { environment } from '@env/environment'; |
| | | import { debug } from 'util'; |
| | | |
| | | @Component({ |
| | | selector: 'app-device-edit', |
| | |
| | | }) |
| | | export class DeviceEditComponent implements OnInit { |
| | | public monitorPoints: any [] = []; |
| | | public professions: any [] = []; |
| | | public deviceVersions: any [] = []; |
| | | public operateUsers: any [] = []; |
| | | public isSaving = false; |
| | |
| | | private formBuilder: FormBuilder, |
| | | private monitorPointService: MonitorPointService, |
| | | private versionService: VersionService, |
| | | private operateUserService: OperateUserService |
| | | private operateUserService: OperateUserService, |
| | | private http:_HttpClient |
| | | ) { } |
| | | data: Device; |
| | | validateForm: FormGroup; |
| | |
| | | this.monitorPointChange(null); |
| | | this.deviceVersionChange(null); |
| | | this.operateUserChange(null); |
| | | this.professionChange(); |
| | | if (this.data.createTime == null) { |
| | | this.data.createTime = new Date().getTime(); |
| | | } |
| | | debugger; |
| | | const validates: Device = { |
| | | name: [data.name, [Validators.required]], |
| | | mac: [data.mac, [Validators.required]], |
| | | deviceVersionId: [data.deviceVersionId], |
| | | monitorPointId: [data.monitorPointId], |
| | | professionId: [data.professionId], |
| | | operateUserId: [data.operateUserId], |
| | | address: [data.address], |
| | | id: [data.id], |
| | |
| | | ToolsService.markAsDirty(this.validateForm); |
| | | } |
| | | } |
| | | professionChange(){ |
| | | this.http.get<ResultBean<any[]>>(environment.SERVER_BASH_URL+"profession/getall").subscribe( |
| | | result => { |
| | | if(!!result.code){ |
| | | debugger; |
| | | this.professions = result.data; |
| | | } |
| | | } |
| | | ); |
| | | } |
| | | monitorPointChange(text) { |
| | | const pageBean: PageBean = {pageIndex: 0, pageSize: 20}; |
| | | this.monitorPointService.getPagingList(pageBean, text).subscribe( |