From 11bca7348d89f74ea7887b526cc12a1eaed149ab Mon Sep 17 00:00:00 2001
From: qq55341701 <55341701@qq.com>
Date: Tue, 3 May 2022 17:29:21 +0800
Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=AE=8C=E5=96=84=E8=BE=B9?=
=?UTF-8?q?=E7=BC=98=E7=9B=92=E5=AD=90=E7=9B=91=E6=8E=A7=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../analysis-of-the-host.component.html | 2 +-
.../analysis-of-the-host.component.ts | 6 +-
.../condition-monitoring.component.html | 97 +++++++++----
.../condition-monitoring.component.scss | 11 ++
.../condition-monitoring.component.ts | 127 +++++++++++++++++-
.../host-config/host-config.component.html | 2 +-
.../host-config/host-config.component.ts | 4 +
.../organization/organization.component.ts | 1 +
src/styles.scss | 4 +
9 files changed, 224 insertions(+), 30 deletions(-)
diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html
index 3dd07ad..dec2352 100644
--- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html
+++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html
@@ -47,7 +47,7 @@
-
+
ip |
diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
index e09ace8..c10206d 100644
--- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
+++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts
@@ -27,8 +27,8 @@ export class AnalysisOfTheHostComponent implements OnInit {
totalCount: string
getAllOrganization() {
- let OrganizationUnitId = ''
let params = {
+ ContainsChildren: true,
PageSize: 9999
}
this.http.get('/api/Organizations', {
@@ -68,14 +68,18 @@ export class AnalysisOfTheHostComponent implements OnInit {
//获得加油站的主机
listOfData: any[] = [];
+ isLoading = false
getHost() {
+ this.isLoading = true
this.http.get('/api/EdgeDevices', {
params: {
+ ContainsChildren: true,
OrganizationId: this.selectedOilStation.id,
PageSize: 999
}
}).subscribe((data: any) => {
console.log('主机列表', data.items)
+ this.isLoading = false
this.listOfData = data.items
})
}
diff --git a/src/app/system-management/condition-monitoring/condition-monitoring.component.html b/src/app/system-management/condition-monitoring/condition-monitoring.component.html
index 050f0f1..43f136a 100644
--- a/src/app/system-management/condition-monitoring/condition-monitoring.component.html
+++ b/src/app/system-management/condition-monitoring/condition-monitoring.component.html
@@ -1,24 +1,75 @@
-
-
-
- ip地址 |
- 所属油站 |
- 设备状态 |
-
-
-
-
- {{ data.hostIPAddress }} |
- {{ data.gasStationName }} |
- {{ data.state == 'Disconnected' ? '未连接' : '已连接' }} |
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+ |
+ ip地址 |
+ 所属油站 |
+ 设备状态 |
+ 识别程序服务状态 |
+
+
+
+
+ |
+ {{ data.hostIPAddress }} |
+ {{ data.gasStationName }} |
+ {{ data.hubConnectionState == 'Disconnected' ? '未连接' : '已连接' }} |
+
+ 未启动
+ 启动中
+ 运行中
+ 失败
+ |
+
+
+
+
+
diff --git a/src/app/system-management/condition-monitoring/condition-monitoring.component.scss b/src/app/system-management/condition-monitoring/condition-monitoring.component.scss
index e69de29..93deb2e 100644
--- a/src/app/system-management/condition-monitoring/condition-monitoring.component.scss
+++ b/src/app/system-management/condition-monitoring/condition-monitoring.component.scss
@@ -0,0 +1,11 @@
+.topbox{
+ form{
+ display: flex;
+ nz-form-item{
+ margin-right: 6px;
+ }
+ }
+ .searchParams{
+ width: 250px;
+ }
+}
\ No newline at end of file
diff --git a/src/app/system-management/condition-monitoring/condition-monitoring.component.ts b/src/app/system-management/condition-monitoring/condition-monitoring.component.ts
index 60cfd74..c6bca7c 100644
--- a/src/app/system-management/condition-monitoring/condition-monitoring.component.ts
+++ b/src/app/system-management/condition-monitoring/condition-monitoring.component.ts
@@ -1,6 +1,8 @@
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
-
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { NzMessageService } from 'ng-zorro-antd/message';
+import { TreeService } from 'src/app/service/tree.service';
@Component({
selector: 'app-condition-monitoring',
templateUrl: './condition-monitoring.component.html',
@@ -8,24 +10,77 @@ import { Component, OnInit } from '@angular/core';
})
export class ConditionMonitoringComponent implements OnInit {
- constructor(private http: HttpClient) { }
-
+ constructor(private http: HttpClient, private fb: FormBuilder, private toTree: TreeService, private message: NzMessageService) { }
+ validateForm!: FormGroup;
ngOnInit(): void {
- this.getConditionMonitoring()
+ this.validateForm = this.fb.group({
+ organization: [null]
+ });
+ this.getAllOrganization()
+
+ }
+ //获取所有组织机构
+ nodes: any = []
+ defaultOrId: string
+ defaultExpandedKeys = [];
+ getAllOrganization() {
+ let params = {
+ ContainsChildren: true,
+ pageSize: 9999
+ }
+ this.http.get('/api/Organizations', {
+ params: params
+ }).subscribe((data: any) => {
+ console.log('组织机构列表', data)
+ data.items.forEach(element => {
+ element.key = element.id
+ element.title = element.name
+ // element.selectable = false
+ });
+ this.nodes = [...this.toTree.toTree(data.items)]
+ this.defaultOrId = this.nodes[0].id
+ this.validateForm.value.organization = this.defaultOrId
+ this.getConditionMonitoring()
+ })
}
+ submitForm(): void {
+ for (const i in this.validateForm.controls) {
+ this.validateForm.controls[i].markAsDirty();
+ this.validateForm.controls[i].updateValueAndValidity();
+ }
+ this.getConditionMonitoring()
+ }
+ resetForm(e: MouseEvent): void {
+ e.preventDefault();
+ this.validateForm.reset();
+ for (const key in this.validateForm.controls) {
+ this.validateForm.controls[key].markAsPristine();
+ this.validateForm.controls[key].updateValueAndValidity();
+ }
+ this.validateForm.patchValue({
+ organization: this.nodes[0].id,
+ });
+ this.PageNumber = 1
+ this.getConditionMonitoring()
+ }
listOfData: any
num: string
PageNumber: number = 1
+ isLoading = false
//获取盒子状态
getConditionMonitoring() {
let params = {
+ ContainsChildren: true,
+ OrganizationId: this.defaultOrId,
PageNumber: this.PageNumber,
PageSize: 10
}
+ this.isLoading = true
this.http.get('/api/EdgeDevices/Statuses', { params: params }).subscribe(
(data: any) => {
console.log(data)
+ this.isLoading = false
this.listOfData = data.items
this.num = data.totalCount
}, err => {
@@ -37,4 +92,68 @@ export class ConditionMonitoringComponent implements OnInit {
this.PageNumber = $event
this.getConditionMonitoring()
}
+
+
+ checked = false;
+ loading = false;
+ indeterminate = false;
+ listOfCurrentPageData: readonly any[] = [];
+ setOfCheckedId = new Set();
+ updateCheckedSet(id: number, checked: boolean): void {
+ if (checked) {
+ this.setOfCheckedId.add(id);
+ } else {
+ this.setOfCheckedId.delete(id);
+ }
+ }
+
+ onCurrentPageDataChange(listOfCurrentPageData: readonly any[]): void {
+ this.listOfCurrentPageData = listOfCurrentPageData;
+ this.refreshCheckedStatus();
+ }
+
+ refreshCheckedStatus(): void {
+ const listOfEnabledData = this.listOfCurrentPageData.filter(({ disabled }) => !disabled);
+ this.checked = listOfEnabledData.every(({ id }) => this.setOfCheckedId.has(id));
+ this.indeterminate = listOfEnabledData.some(({ id }) => this.setOfCheckedId.has(id)) && !this.checked;
+ }
+
+ onItemChecked(id: number, checked: boolean): void {
+ this.updateCheckedSet(id, checked);
+ this.refreshCheckedStatus();
+ }
+
+ onAllChecked(checked: boolean): void {
+ this.listOfCurrentPageData
+ .filter(({ disabled }) => !disabled)
+ .forEach(({ id }) => this.updateCheckedSet(id, checked));
+ this.refreshCheckedStatus();
+ }
+
+ sendRequest(): void {
+ this.loading = true;
+ const requestData = this.listOfData.filter(data => this.setOfCheckedId.has(data.id));
+ console.log(requestData);
+ let strArr = []
+ requestData.forEach(element => {
+ strArr.push(element.id)
+ });
+ let params = {
+ edgeDeviceIds: strArr
+ }
+ this.http.put('/api/EdgeDevices/Commands/UpdateStates', '', { params: params }).subscribe({
+ next: (data) => {
+ this.message.create('success', '通知边缘盒子成功,请过一段时间手动刷新尝试!');
+ this.setOfCheckedId.clear();
+ this.refreshCheckedStatus();
+ this.loading = false;
+ },
+ error: (err) => {
+ this.loading = false;
+ }
+ })
+ // setTimeout(() => {
+
+ // }, 1000);
+ }
}
diff --git a/src/app/system-management/host-config/host-config.component.html b/src/app/system-management/host-config/host-config.component.html
index b859533..4452fe2 100644
--- a/src/app/system-management/host-config/host-config.component.html
+++ b/src/app/system-management/host-config/host-config.component.html
@@ -6,7 +6,7 @@
摄像头列表
-
+
序号 |
diff --git a/src/app/system-management/host-config/host-config.component.ts b/src/app/system-management/host-config/host-config.component.ts
index 70cc51a..f21f8d0 100644
--- a/src/app/system-management/host-config/host-config.component.ts
+++ b/src/app/system-management/host-config/host-config.component.ts
@@ -67,15 +67,19 @@ export class HostConfigComponent implements OnInit {
history.go(-1)
}
//摄像头
+ isLoading = false
getCamera() {
let params = {
+ ContainsChildren: true,
EdgeDeviceId: this.hostId
}
+ this.isLoading = true
this.http.get('/api/Cameras',{ params: params }).subscribe((data: any) => {
data.items.forEach(element => {
element.dimensionedPointsObj = JSON.parse(element.dimensionedPoints)
});
this.listOfData = data.items
+ this.isLoading = false
console.log('摄像头列表', data.items)
})
}
diff --git a/src/app/system-management/organization/organization.component.ts b/src/app/system-management/organization/organization.component.ts
index 1c67c4d..20c1e2d 100644
--- a/src/app/system-management/organization/organization.component.ts
+++ b/src/app/system-management/organization/organization.component.ts
@@ -51,6 +51,7 @@ export class OrganizationComponent implements OnInit {
let params = {
// OrganizationUnitId: OrganizationUnitId,
// IsContainsChildren: "true"
+ ContainsChildren: true,
pageSize: 9999
}
this.http.get('/api/Organizations', {
diff --git a/src/styles.scss b/src/styles.scss
index 96f53d1..dd9d7b7 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -131,4 +131,8 @@ app-root {
.forbid{
color: gray;
pointer-events:none
+}
+
+.maxHeightTreeSelect {
+ max-height: 280px;
}
\ No newline at end of file