邵佳豪
6 months ago
22 changed files with 1503 additions and 1052 deletions
@ -1,161 +1,181 @@
|
||||
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; |
||||
import { HttpClient } from '@angular/common/http'; |
||||
import { TreeService } from 'src/app/service/tree.service'; |
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
||||
import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; |
||||
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNode } from 'ng-zorro-antd/tree'; |
||||
import { Router } from '@angular/router'; |
||||
import { NavChangeService } from 'src/app/service/navChange.service'; |
||||
import { fromEvent } from 'rxjs'; |
||||
import { debounceTime } from 'rxjs/operators'; |
||||
import { OilStationListComponent } from './oil-station-list/oil-station-list.component'; |
||||
import { UpdateLicenseListComponent } from './update-license-list/update-license-list.component'; |
||||
import { FileLicenseListComponent } from './file-license-list/file-license-list.component'; |
||||
import { Component, OnInit, ViewChild, ElementRef } from "@angular/core"; |
||||
import { HttpClient } from "@angular/common/http"; |
||||
import { TreeService } from "src/app/service/tree.service"; |
||||
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; |
||||
import { |
||||
NzContextMenuService, |
||||
NzDropdownMenuComponent, |
||||
} from "ng-zorro-antd/dropdown"; |
||||
import { |
||||
NzFormatEmitEvent, |
||||
NzTreeComponent, |
||||
NzTreeNode, |
||||
} from "ng-zorro-antd/tree"; |
||||
import { Router } from "@angular/router"; |
||||
import { NavChangeService } from "src/app/service/navChange.service"; |
||||
import { fromEvent } from "rxjs"; |
||||
import { debounceTime } from "rxjs/operators"; |
||||
import { OilStationListComponent } from "./oil-station-list/oil-station-list.component"; |
||||
import { UpdateLicenseListComponent } from "./update-license-list/update-license-list.component"; |
||||
import { FileLicenseListComponent } from "./file-license-list/file-license-list.component"; |
||||
@Component({ |
||||
selector: 'app-plan-admin', |
||||
templateUrl: './plan-admin.component.html', |
||||
styleUrls: ['./plan-admin.component.scss'] |
||||
selector: "app-plan-admin", |
||||
templateUrl: "./plan-admin.component.html", |
||||
styleUrls: ["./plan-admin.component.scss"], |
||||
}) |
||||
export class PlanAdminComponent implements OnInit { |
||||
|
||||
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; |
||||
@ViewChild('child') oilStationListComponent!: OilStationListComponent;; |
||||
@ViewChild('child2') updateLicenseListComponent!: UpdateLicenseListComponent;; |
||||
@ViewChild('child3') fileLicenseListComponent!: FileLicenseListComponent;; |
||||
constructor(private element: ElementRef, private navChangeService: NavChangeService, private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router) { } |
||||
@ViewChild("nzTreeComponent", { static: false }) |
||||
nzTreeComponent!: NzTreeComponent; |
||||
@ViewChild("child") oilStationListComponent!: OilStationListComponent; |
||||
@ViewChild("child2") updateLicenseListComponent!: UpdateLicenseListComponent; |
||||
@ViewChild("child3") fileLicenseListComponent!: FileLicenseListComponent; |
||||
constructor( |
||||
private element: ElementRef, |
||||
private navChangeService: NavChangeService, |
||||
private http: HttpClient, |
||||
private toTree: TreeService, |
||||
private fb: FormBuilder, |
||||
private nzContextMenuService: NzContextMenuService, |
||||
private router: Router |
||||
) {} |
||||
|
||||
ngOnInit(): void { |
||||
this.getAllOrganization() |
||||
this.getAllOrganization(); |
||||
} |
||||
|
||||
|
||||
|
||||
//选择右侧tab页
|
||||
selectedTab = 0 |
||||
selectedTab = 0; |
||||
selectTab(index) { |
||||
this.selectedTab = index |
||||
this.selectedTab = index; |
||||
|
||||
if (this.selectedTab == 0) { |
||||
setTimeout(() => { |
||||
this.oilStationListComponent.list = [] |
||||
this.oilStationListComponent.SkipCount = '0' |
||||
this.oilStationListComponent.onChildMethod() |
||||
this.oilStationListComponent.list = []; |
||||
this.oilStationListComponent.SkipCount = "0"; |
||||
this.oilStationListComponent.onChildMethod(); |
||||
}, 0); |
||||
} |
||||
if (this.selectedTab == 1) { |
||||
setTimeout(() => { |
||||
this.updateLicenseListComponent.list = [] |
||||
this.updateLicenseListComponent.SkipCount = '0' |
||||
this.updateLicenseListComponent.onChildMethod() |
||||
this.updateLicenseListComponent.list = []; |
||||
this.updateLicenseListComponent.SkipCount = "0"; |
||||
this.updateLicenseListComponent.onChildMethod(); |
||||
}, 0); |
||||
} |
||||
if (this.selectedTab == 2) { |
||||
setTimeout(() => { |
||||
this.fileLicenseListComponent.list = [] |
||||
this.fileLicenseListComponent.SkipCount = '0' |
||||
this.fileLicenseListComponent.onChildMethod() |
||||
this.fileLicenseListComponent.list = []; |
||||
this.fileLicenseListComponent.SkipCount = "0"; |
||||
this.fileLicenseListComponent.onChildMethod(); |
||||
}, 0); |
||||
} |
||||
} |
||||
|
||||
|
||||
//获取所有组织机构
|
||||
nodes: any = [] |
||||
nzExpandAll = false |
||||
nzSelectedKeys: any = [] |
||||
orSpin: boolean = false |
||||
organization: any |
||||
nodes: any = []; |
||||
nzExpandAll = false; |
||||
nzSelectedKeys: any = []; |
||||
orSpin: boolean = false; |
||||
organization: any; |
||||
getAllOrganization() { |
||||
this.orSpin = true |
||||
let OrganizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id |
||||
this.orSpin = true; |
||||
let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata")) |
||||
.organization.id; |
||||
let params = { |
||||
OrganizationUnitId: OrganizationUnitId, |
||||
IsContainsChildren: "true" |
||||
} |
||||
this.http.get('/api/services/app/Organization/GetAll', { |
||||
params: params |
||||
}).subscribe((data: any) => { |
||||
data.result.items = data.result.items.filter((item, i) => { |
||||
return !item.isGasStation |
||||
// OrganizationUnitId: OrganizationUnitId,
|
||||
IsContainsChildren: "true", |
||||
}; |
||||
this.http |
||||
.get("/api/services/app/Organization/GetAll", { |
||||
params: params, |
||||
}) |
||||
this.organization = data.result.items |
||||
this.getStationsNum(data.result.items) |
||||
}) |
||||
.subscribe((data: any) => { |
||||
data.result.items = data.result.items.filter((item, i) => { |
||||
return !item.isGasStation; |
||||
}); |
||||
this.organization = data.result.items; |
||||
this.getStationsNum(data.result.items); |
||||
}); |
||||
} |
||||
|
||||
|
||||
//获得组织机构下有多少油站
|
||||
stationsList |
||||
stationsList; |
||||
getStationsNum(e) { |
||||
let OrganizationUnitId = JSON.parse(sessionStorage.getItem('userdata')).organization.id |
||||
this.http.get('/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true').subscribe((data: any) => { |
||||
this.stationsList = data.result |
||||
const arrs = e.map(item => { |
||||
const data = this.stationsList.find(i => item.id == i.organizationId) |
||||
return { |
||||
...item, |
||||
products: data ? data : false |
||||
} |
||||
}) |
||||
for (let index = 0; index < arrs.length; index++) { |
||||
if (arrs[index].id == OrganizationUnitId) { |
||||
arrs[index].parentId = null |
||||
let OrganizationUnitId = JSON.parse(sessionStorage.getItem("userdata")) |
||||
.organization.id; |
||||
let OrganizationUnitIds = JSON.parse( |
||||
sessionStorage.getItem("userdata") |
||||
).organizations.map((v) => v.id); |
||||
this.http |
||||
.get( |
||||
"/api/services/app/GasStation/GetCountsByOrganizations?IsContainsChildren=true" |
||||
) |
||||
.subscribe((data: any) => { |
||||
this.stationsList = data.result; |
||||
const arrs = e.map((item) => { |
||||
const data = this.stationsList.find( |
||||
(i) => item.id == i.organizationId |
||||
); |
||||
return { |
||||
...item, |
||||
products: data ? data : false, |
||||
}; |
||||
}); |
||||
for (let index = 0; index < arrs.length; index++) { |
||||
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) { |
||||
if (OrganizationUnitIds.includes(arrs[index].id)) { |
||||
arrs[index].parentId = null; |
||||
} |
||||
} else { |
||||
if (arrs[index].id == OrganizationUnitId) { |
||||
arrs[index].parentId = null; |
||||
} |
||||
} |
||||
arrs[index].title = arrs[index].displayName; |
||||
arrs[index].key = arrs[index].id; |
||||
} |
||||
arrs[index].title = arrs[index].displayName |
||||
arrs[index].key = arrs[index].id |
||||
} |
||||
this.orSpin = false |
||||
this.nodes = [...this.toTree.toTree(arrs)] |
||||
this.nzExpandedKeys = [OrganizationUnitId] |
||||
this.nzSelectedKeys = [OrganizationUnitId] |
||||
sessionStorage.setItem('planAdminOrid', OrganizationUnitId) |
||||
this.oilStationListComponent.onChildMethod() |
||||
}) |
||||
this.orSpin = false; |
||||
this.nodes = [...this.toTree.toTree(arrs)]; |
||||
|
||||
console.log("树形结构", this.nodes); |
||||
this.nzExpandedKeys = [OrganizationUnitId]; |
||||
this.nzSelectedKeys = [OrganizationUnitId]; |
||||
sessionStorage.setItem("planAdminOrid", OrganizationUnitId); |
||||
this.oilStationListComponent.onChildMethod(); |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nzExpandedKeys: any = [] |
||||
nzExpandedKeys: any = []; |
||||
activatedNode?: NzTreeNode; |
||||
//点击tree节点
|
||||
activeNode(data: NzFormatEmitEvent): void { |
||||
this.activatedNode = data.node!; |
||||
sessionStorage.setItem('planAdminOrid', data.node.origin.id) |
||||
sessionStorage.setItem("planAdminOrid", data.node.origin.id); |
||||
if (this.selectedTab == 0) { |
||||
setTimeout(() => { |
||||
this.oilStationListComponent.list = [] |
||||
this.oilStationListComponent.SkipCount = '0' |
||||
this.oilStationListComponent.onChildMethod() |
||||
this.oilStationListComponent.list = []; |
||||
this.oilStationListComponent.SkipCount = "0"; |
||||
this.oilStationListComponent.onChildMethod(); |
||||
}, 0); |
||||
} |
||||
if (this.selectedTab == 1) { |
||||
setTimeout(() => { |
||||
this.updateLicenseListComponent.list = [] |
||||
this.updateLicenseListComponent.SkipCount = '0' |
||||
this.updateLicenseListComponent.onChildMethod() |
||||
this.updateLicenseListComponent.list = []; |
||||
this.updateLicenseListComponent.SkipCount = "0"; |
||||
this.updateLicenseListComponent.onChildMethod(); |
||||
}, 0); |
||||
} |
||||
if (this.selectedTab == 2) { |
||||
setTimeout(() => { |
||||
this.fileLicenseListComponent.list = [] |
||||
this.fileLicenseListComponent.SkipCount = '0' |
||||
this.fileLicenseListComponent.onChildMethod() |
||||
this.fileLicenseListComponent.list = []; |
||||
this.fileLicenseListComponent.SkipCount = "0"; |
||||
this.fileLicenseListComponent.onChildMethod(); |
||||
}, 0); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
expand(e, node) { |
||||
e.stopPropagation() |
||||
node.isExpanded = !node.isExpanded |
||||
e.stopPropagation(); |
||||
node.isExpanded = !node.isExpanded; |
||||
} |
||||
|
||||
} |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,284 +1,326 @@
|
||||
import { HttpClient } from '@angular/common/http'; |
||||
import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core'; |
||||
import { TreeService } from 'src/app/service/tree.service'; |
||||
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; |
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
||||
import { NzModalService } from 'ng-zorro-antd/modal'; |
||||
import { NzMessageService } from 'ng-zorro-antd/message'; |
||||
import { AddhostComponent } from './addhost/addhost.component'; |
||||
import { AddcameraComponent } from './addcamera/addcamera.component'; |
||||
import { EdithostComponent } from './edithost/edithost.component'; |
||||
import { EditcameraComponent } from './editcamera/editcamera.component'; |
||||
import { HttpClient } from "@angular/common/http"; |
||||
import { |
||||
Component, |
||||
OnInit, |
||||
AfterViewInit, |
||||
ViewChild, |
||||
ViewContainerRef, |
||||
} from "@angular/core"; |
||||
import { TreeService } from "src/app/service/tree.service"; |
||||
import { |
||||
NzFormatEmitEvent, |
||||
NzTreeComponent, |
||||
NzTreeNodeOptions, |
||||
} from "ng-zorro-antd/tree"; |
||||
import { FormBuilder, FormGroup, Validators } from "@angular/forms"; |
||||
import { NzModalService } from "ng-zorro-antd/modal"; |
||||
import { NzMessageService } from "ng-zorro-antd/message"; |
||||
import { AddhostComponent } from "./addhost/addhost.component"; |
||||
import { AddcameraComponent } from "./addcamera/addcamera.component"; |
||||
import { EdithostComponent } from "./edithost/edithost.component"; |
||||
import { EditcameraComponent } from "./editcamera/editcamera.component"; |
||||
@Component({ |
||||
selector: 'app-analysis-of-the-host', |
||||
templateUrl: './analysis-of-the-host.component.html', |
||||
styleUrls: ['./analysis-of-the-host.component.scss'] |
||||
selector: "app-analysis-of-the-host", |
||||
templateUrl: "./analysis-of-the-host.component.html", |
||||
styleUrls: ["./analysis-of-the-host.component.scss"], |
||||
}) |
||||
export class AnalysisOfTheHostComponent implements OnInit { |
||||
|
||||
constructor(private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { } |
||||
constructor( |
||||
private fb: FormBuilder, |
||||
private http: HttpClient, |
||||
private toTree: TreeService, |
||||
private modal: NzModalService, |
||||
private message: NzMessageService, |
||||
private viewContainerRef: ViewContainerRef |
||||
) {} |
||||
ngOnInit(): void { |
||||
this.getAllOrganization() |
||||
this.getAllOrganization(); |
||||
} |
||||
|
||||
|
||||
//获取所有组织机构
|
||||
searchValue = ''; |
||||
searchValue = ""; |
||||
nzExpandAll = false; |
||||
totalCount: string |
||||
totalCount: string; |
||||
getAllOrganization() { |
||||
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id |
||||
let params = { |
||||
OrganizationUnitId: OrganizationUnitId, |
||||
IsContainsChildren: "true" |
||||
let userData = null; |
||||
if (sessionStorage.getItem("isGasStation") == "true") { |
||||
userData = JSON.parse(sessionStorage.getItem("userdataOfgasstation")); |
||||
} else { |
||||
userData = JSON.parse(sessionStorage.getItem("userdata")); |
||||
} |
||||
this.http.get('/api/services/app/Organization/GetAll', { |
||||
params: params |
||||
}).subscribe((data: any) => { |
||||
this.totalCount = data.result.totalCount |
||||
data.result.items.forEach(element => { |
||||
if (element.id == OrganizationUnitId) { |
||||
element.parentId = null |
||||
} |
||||
element.key = element.id |
||||
element.title = element.displayName |
||||
element.selectable = false |
||||
let OrganizationUnitId = userData.organization.id; |
||||
let OrganizationUnitIds = userData.organizations?.map((v) => v.id); |
||||
let params = { |
||||
IsContainsChildren: "true", |
||||
}; |
||||
this.http |
||||
.get("/api/services/app/Organization/GetAll", { |
||||
params: params, |
||||
}) |
||||
.subscribe((data: any) => { |
||||
this.totalCount = data.result.totalCount; |
||||
data.result.items.forEach((element) => { |
||||
if (OrganizationUnitIds && OrganizationUnitIds.length !== 0) { |
||||
if (OrganizationUnitIds.includes(element.id)) { |
||||
element.parentId = null; |
||||
} |
||||
} else { |
||||
if (element.id == OrganizationUnitId) { |
||||
element.parentId = null; |
||||
} |
||||
} |
||||
element.key = element.id; |
||||
element.title = element.displayName; |
||||
element.selectable = false; |
||||
}); |
||||
this.nodes = [...this.toTree.toTree(data.result.items)]; |
||||
this.defaultExpandedKeys = [this.nodes[0].id]; |
||||
this.defaultExpandedKeys = [...this.defaultExpandedKeys]; |
||||
}); |
||||
this.nodes = [...this.toTree.toTree(data.result.items)] |
||||
this.defaultExpandedKeys = [this.nodes[0].id] |
||||
this.defaultExpandedKeys = [...this.defaultExpandedKeys] |
||||
}) |
||||
} |
||||
|
||||
|
||||
@ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; |
||||
@ViewChild("nzTreeComponent", { static: false }) |
||||
nzTreeComponent!: NzTreeComponent; |
||||
|
||||
defaultExpandedKeys = []; |
||||
|
||||
nodes: any[] = [] |
||||
nzSelectedKeys: any[] = [] |
||||
selectedOilStation: any |
||||
nodes: any[] = []; |
||||
nzSelectedKeys: any[] = []; |
||||
selectedOilStation: any; |
||||
nzClick(event: NzFormatEmitEvent): void { |
||||
console.log(event.node.origin); |
||||
if (event.node.origin.isGasStation) {//如果点击的是加油站才生效
|
||||
this.nzSelectedKeys[0] = event.node.origin.id |
||||
this.nzSelectedKeys = [...this.nzSelectedKeys] |
||||
this.selectedOilStation = event.node.origin |
||||
this.getHost() |
||||
this.getCamera() |
||||
if (event.node.origin.isGasStation) { |
||||
//如果点击的是加油站才生效
|
||||
this.nzSelectedKeys[0] = event.node.origin.id; |
||||
this.nzSelectedKeys = [...this.nzSelectedKeys]; |
||||
this.selectedOilStation = event.node.origin; |
||||
this.getHost(); |
||||
this.getCamera(); |
||||
} else { |
||||
this.message.info('只有加油站才可以增加主机'); |
||||
this.message.info("只有加油站才可以增加主机"); |
||||
} |
||||
} |
||||
|
||||
//获得加油站的主机
|
||||
listOfData: any[] = []; |
||||
getHost() { |
||||
this.http.get('/api/services/app/EdgeDevice/GetAll', { |
||||
params: { |
||||
organizationUnitId: this.selectedOilStation.id, |
||||
SkipCount: '0', |
||||
MaxResultCount: '100', |
||||
} |
||||
}).subscribe((data: any) => { |
||||
console.log('主机列表', data.result.items) |
||||
this.listOfData = data.result.items |
||||
}) |
||||
this.http |
||||
.get("/api/services/app/EdgeDevice/GetAll", { |
||||
params: { |
||||
organizationUnitId: this.selectedOilStation.id, |
||||
SkipCount: "0", |
||||
MaxResultCount: "100", |
||||
}, |
||||
}) |
||||
.subscribe((data: any) => { |
||||
console.log("主机列表", data.result.items); |
||||
this.listOfData = data.result.items; |
||||
}); |
||||
} |
||||
|
||||
|
||||
//获得加油站摄像头
|
||||
listOfDataCamera: any[] = []; |
||||
getCamera() { |
||||
this.http.get('/api/services/app/Camera/GetAll', { |
||||
params: { |
||||
organizationUnitId: this.selectedOilStation.id, |
||||
SkipCount: '0', |
||||
MaxResultCount: '100', |
||||
} |
||||
}).subscribe((data: any) => { |
||||
// console.log('摄像头列表', data)
|
||||
this.listOfDataCamera = data.result.items |
||||
}) |
||||
this.http |
||||
.get("/api/services/app/Camera/GetAll", { |
||||
params: { |
||||
organizationUnitId: this.selectedOilStation.id, |
||||
SkipCount: "0", |
||||
MaxResultCount: "100", |
||||
}, |
||||
}) |
||||
.subscribe((data: any) => { |
||||
// console.log('摄像头列表', data)
|
||||
this.listOfDataCamera = data.result.items; |
||||
}); |
||||
} |
||||
|
||||
|
||||
ngAfterViewInit(): void { |
||||
|
||||
} |
||||
ngAfterViewInit(): void {} |
||||
|
||||
//新增分析主机
|
||||
addHost() { |
||||
console.log(this.selectedOilStation) |
||||
console.log(this.selectedOilStation); |
||||
const modal = this.modal.create({ |
||||
nzTitle: '新增加油站主机', |
||||
nzTitle: "新增加油站主机", |
||||
nzContent: AddhostComponent, |
||||
nzViewContainerRef: this.viewContainerRef, |
||||
nzWidth: 288, |
||||
nzComponentParams: {}, |
||||
nzOnOk: async () => { |
||||
if (instance.validateForm.valid) { |
||||
await new Promise(resolve => { |
||||
console.log('表单信息', instance.validateForm) |
||||
await new Promise((resolve) => { |
||||
console.log("表单信息", instance.validateForm); |
||||
let body = { |
||||
hostIPAddress: instance.validateForm.value.ip, |
||||
organizationUnitId: this.selectedOilStation.id |
||||
} |
||||
this.http.post('/api/services/app/EdgeDevice/Create', body).subscribe(data => { |
||||
resolve(data) |
||||
this.message.create('success', '创建成功!'); |
||||
this.getHost() |
||||
return true |
||||
}) |
||||
}) |
||||
organizationUnitId: this.selectedOilStation.id, |
||||
}; |
||||
this.http |
||||
.post("/api/services/app/EdgeDevice/Create", body) |
||||
.subscribe((data) => { |
||||
resolve(data); |
||||
this.message.create("success", "创建成功!"); |
||||
this.getHost(); |
||||
return true; |
||||
}); |
||||
}); |
||||
} else { |
||||
this.message.create('warning', '请填写完整!'); |
||||
return false |
||||
this.message.create("warning", "请填写完整!"); |
||||
return false; |
||||
} |
||||
} |
||||
}, |
||||
}); |
||||
const instance = modal.getContentComponent(); |
||||
} |
||||
edit(data) { |
||||
console.log(data) |
||||
console.log(data); |
||||
const modal = this.modal.create({ |
||||
nzTitle: '编辑加油站主机', |
||||
nzTitle: "编辑加油站主机", |
||||
nzContent: EdithostComponent, |
||||
nzViewContainerRef: this.viewContainerRef, |
||||
nzWidth: 288, |
||||
nzComponentParams: { |
||||
ip: data.hostIPAddress |
||||
ip: data.hostIPAddress, |
||||
}, |
||||
nzOnOk: async () => { |
||||
if (instance.validateForm.valid) { |
||||
await new Promise(resolve => { |
||||
console.log('表单信息', instance.validateForm) |
||||
data.hostIPAddress = instance.validateForm.value.ip, |
||||
this.http.put('/api/services/app/EdgeDevice/Update', data).subscribe(data => { |
||||
resolve(data) |
||||
this.message.create('success', '修改成功!'); |
||||
this.getHost() |
||||
return true |
||||
}) |
||||
}) |
||||
await new Promise((resolve) => { |
||||
console.log("表单信息", instance.validateForm); |
||||
(data.hostIPAddress = instance.validateForm.value.ip), |
||||
this.http |
||||
.put("/api/services/app/EdgeDevice/Update", data) |
||||
.subscribe((data) => { |
||||
resolve(data); |
||||
this.message.create("success", "修改成功!"); |
||||
this.getHost(); |
||||
return true; |
||||
}); |
||||
}); |
||||
} else { |
||||
this.message.create('warning', '请填写完整!'); |
||||
return false |
||||
this.message.create("warning", "请填写完整!"); |
||||
return false; |
||||
} |
||||
} |
||||
}, |
||||
}); |
||||
const instance = modal.getContentComponent(); |
||||
} |
||||
delete(item) { |
||||
console.log(item) |
||||
console.log(item); |
||||
this.modal.confirm({ |
||||
nzTitle: `确定要删除${item.name}这个主机吗?`, |
||||
nzOkText: '确定', |
||||
nzOkType: 'primary', |
||||
nzOkText: "确定", |
||||
nzOkType: "primary", |
||||
nzOnOk: () => { |
||||
this.http.delete('/api/services/app/EdgeDevice/Delete', { |
||||
params: { |
||||
Id: item.id |
||||
} |
||||
}).subscribe(data => { |
||||
this.message.create('success', '删除成功!'); |
||||
this.getHost() |
||||
}) |
||||
this.http |
||||
.delete("/api/services/app/EdgeDevice/Delete", { |
||||
params: { |
||||
Id: item.id, |
||||
}, |
||||
}) |
||||
.subscribe((data) => { |
||||
this.message.create("success", "删除成功!"); |
||||
this.getHost(); |
||||
}); |
||||
}, |
||||
nzCancelText: '取消' |
||||
nzCancelText: "取消", |
||||
}); |
||||
} |
||||
|
||||
|
||||
//摄像头
|
||||
addCamera() { |
||||
console.log(this.selectedOilStation) |
||||
console.log(this.selectedOilStation); |
||||
const modal = this.modal.create({ |
||||
nzTitle: '新增加油站摄像头', |
||||
nzTitle: "新增加油站摄像头", |
||||
nzContent: AddcameraComponent, |
||||
nzViewContainerRef: this.viewContainerRef, |
||||
nzWidth: 288, |
||||
nzComponentParams: {}, |
||||
nzOnOk: async () => { |
||||
if (instance.validateForm.valid) { |
||||
await new Promise(resolve => { |
||||
console.log('表单信息', instance.validateForm) |
||||
await new Promise((resolve) => { |
||||
console.log("表单信息", instance.validateForm); |
||||
let body = { |
||||
organizationUnitId: this.selectedOilStation.id, |
||||
ipAdress: instance.validateForm.value.ip, |
||||
code: instance.validateForm.value.code, |
||||
name: instance.validateForm.value.name, |
||||
// description: "",
|
||||
} |
||||
this.http.post('/api/services/app/Camera/Create', body).subscribe(data => { |
||||
resolve(data) |
||||
this.message.create('success', '创建成功!'); |
||||
this.getCamera() |
||||
return true |
||||
}, err => { |
||||
return false |
||||
}) |
||||
}) |
||||
}; |
||||
this.http.post("/api/services/app/Camera/Create", body).subscribe( |
||||
(data) => { |
||||
resolve(data); |
||||
this.message.create("success", "创建成功!"); |
||||
this.getCamera(); |
||||
return true; |
||||
}, |
||||
(err) => { |
||||
return false; |
||||
} |
||||
); |
||||
}); |
||||
} else { |
||||
this.message.create('warning', '请填写完整!'); |
||||
return false |
||||
this.message.create("warning", "请填写完整!"); |
||||
return false; |
||||
} |
||||
} |
||||
}, |
||||
}); |
||||
const instance = modal.getContentComponent(); |
||||
} |
||||
editCamera(data) { |
||||
|
||||
console.log(data) |
||||
console.log(data); |
||||
const modal = this.modal.create({ |
||||
nzTitle: '编辑加油站摄像头', |
||||
nzTitle: "编辑加油站摄像头", |
||||
nzContent: EditcameraComponent, |
||||
nzViewContainerRef: this.viewContainerRef, |
||||
nzWidth: 288, |
||||
nzComponentParams: { |
||||
data: data |
||||
data: data, |
||||
}, |
||||
nzOnOk: async () => { |
||||
if (instance.validateForm.valid) { |
||||
await new Promise(resolve => { |
||||
console.log('表单信息', instance.validateForm) |
||||
data.name = instance.validateForm.value.name |
||||
data.code = instance.validateForm.value.code |
||||
data.ipAdress = instance.validateForm.value.ip |
||||
this.http.put('/api/services/app/Camera/Update', data).subscribe(data => { |
||||
resolve(data) |
||||
this.message.create('success', '编辑成功!'); |
||||
this.getCamera() |
||||
return true |
||||
}, err => { |
||||
return false |
||||
}) |
||||
}) |
||||
await new Promise((resolve) => { |
||||
console.log("表单信息", instance.validateForm); |
||||
data.name = instance.validateForm.value.name; |
||||
data.code = instance.validateForm.value.code; |
||||
data.ipAdress = instance.validateForm.value.ip; |
||||
this.http.put("/api/services/app/Camera/Update", data).subscribe( |
||||
(data) => { |
||||
resolve(data); |
||||
this.message.create("success", "编辑成功!"); |
||||
this.getCamera(); |
||||
return true; |
||||
}, |
||||
(err) => { |
||||
return false; |
||||
} |
||||
); |
||||
}); |
||||
} else { |
||||
this.message.create('warning', '请填写完整!'); |
||||
return false |
||||
this.message.create("warning", "请填写完整!"); |
||||
return false; |
||||
} |
||||
} |
||||
}, |
||||
}); |
||||
const instance = modal.getContentComponent(); |
||||
} |
||||
deleteCamera(item) { |
||||
console.log(item) |
||||
console.log(item); |
||||
this.modal.confirm({ |
||||
nzTitle: `确定要删除${item.name}这个摄像头吗?`, |
||||
nzOkText: '确定', |
||||
nzOkType: 'primary', |
||||
nzOkText: "确定", |
||||
nzOkType: "primary", |
||||
nzOnOk: () => { |
||||
this.http.delete('/api/services/app/Camera/Delete', { |
||||
params: { |
||||
Id: item.id |
||||
} |
||||
}).subscribe(data => { |
||||
this.message.create('success', '删除成功!'); |
||||
this.getCamera() |
||||
}) |
||||
this.http |
||||
.delete("/api/services/app/Camera/Delete", { |
||||
params: { |
||||
Id: item.id, |
||||
}, |
||||
}) |
||||
.subscribe((data) => { |
||||
this.message.create("success", "删除成功!"); |
||||
this.getCamera(); |
||||
}); |
||||
}, |
||||
nzCancelText: '取消' |
||||
nzCancelText: "取消", |
||||
}); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue