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 cd6953a..6195458 100644
--- a/src/app/system-management/condition-monitoring/condition-monitoring.component.html
+++ b/src/app/system-management/condition-monitoring/condition-monitoring.component.html
@@ -128,6 +128,7 @@
未更新
更新中
已更新
+ 更新超时
{{data.monitorUpdatingStartedTime ? (data.monitorUpdatingStartedTime | date:"yyyy-MM-dd HH:mm:ss") :
diff --git a/src/app/system-management/host-config/addcamera/addcamera.component.ts b/src/app/system-management/host-config/addcamera/addcamera.component.ts
index 22a885f..9e9f94e 100644
--- a/src/app/system-management/host-config/addcamera/addcamera.component.ts
+++ b/src/app/system-management/host-config/addcamera/addcamera.component.ts
@@ -1,7 +1,8 @@
import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
+import { NzSafeAny } from 'ng-zorro-antd/core/types';
@Component({
selector: 'app-addcamera',
templateUrl: './addcamera.component.html',
@@ -13,8 +14,9 @@ export class AddcameraComponent implements OnInit {
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
ngOnInit(): void {
+ const { namevalidate } = MyValidators;
this.validateForm = this.fb.group({
- name: [null, [Validators.required]],
+ name: [null, [Validators.required, namevalidate]],
user: [null, [Validators.required]],
password: [null, [Validators.required]],
uri: [null, [Validators.required]],
@@ -25,3 +27,24 @@ export class AddcameraComponent implements OnInit {
}
+export type MyErrorsOptions = { 'zh-cn': string; en: string } & Record;
+export type MyValidationErrors = Record;
+export class MyValidators extends Validators {
+ static namevalidate(control: AbstractControl): MyValidationErrors | null {
+ const value = control.value;
+
+ if (isEmptyInputValue(value)) {
+ return null;
+ }
+
+ return isPassword(value) ? null : { mobile: { 'zh-cn': `名称只能是汉字、大小写英文、数字,不能使用特殊字符`, en: `Password phone number is not valid` } };
+ }
+
+}
+
+function isEmptyInputValue(value: NzSafeAny): boolean {
+ return value == null || value.length === 0;
+}
+function isPassword(value: string): boolean {
+ return typeof value === 'string' && /^[\u4E00-\u9FA5A-Za-z0-9]+$/.test(value);
+}
diff --git a/src/app/system-management/host-config/editcamera/editcamera.component.ts b/src/app/system-management/host-config/editcamera/editcamera.component.ts
index 70834fc..5d675cb 100644
--- a/src/app/system-management/host-config/editcamera/editcamera.component.ts
+++ b/src/app/system-management/host-config/editcamera/editcamera.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit, Input } from '@angular/core';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
+import { MyValidators } from '../addcamera/addcamera.component';
@Component({
selector: 'app-editcamera',
@@ -15,10 +16,11 @@ export class EditcameraComponent implements OnInit {
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { }
ngOnInit(): void {
+ const { namevalidate } = MyValidators;
let datacopy = JSON.parse(JSON.stringify(this.data))
console.log('编辑数据', datacopy)
this.validateForm = this.fb.group({
- name: [datacopy.name, [Validators.required]],
+ name: [datacopy.name, [Validators.required,namevalidate]],
user: [datacopy.user, [Validators.required]],
password: [datacopy.password, [Validators.required]],
uri: [datacopy.uri, [Validators.required]],
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 13da0b2..103ad56 100644
--- a/src/app/system-management/host-config/host-config.component.ts
+++ b/src/app/system-management/host-config/host-config.component.ts
@@ -189,7 +189,7 @@ export class HostConfigComponent implements OnInit {
if (data.configFiles) {
this.isSourceYaml = true
const element = document.documentElement
- if(element.requestFullscreen) { //进入全屏
+ if (element.requestFullscreen) { //进入全屏
element.requestFullscreen();
}
const modal = this.modal.create({
@@ -208,7 +208,7 @@ export class HostConfigComponent implements OnInit {
data: item.id
},
nzOnOk: async () => {
-
+
}
});
const instance = modal.getContentComponent();
@@ -241,23 +241,23 @@ export class HostConfigComponent implements OnInit {
// this.message.create('error', '存在摄像头未标注的情况');
// return
// }
- let ids = []
- this.listOfData.forEach((item: any) => {
- ids.push(item.id)
- })
- this.http.get('/api/Cameras/Statuses', {
- params: { ids: ids }
- }).subscribe({
- next: (data) => {
- console.log('连接状态', data)
- this.disposalData()
- this.router.navigate(['/system/host/camera/configForm'], { queryParams: { 'hostId': this.hostId, 'orId': this.orId } })
- },
- error: (err) => {
- console.log('连接失败', err)
- }
- })
-
+ // let ids = []
+ // this.listOfData.forEach((item: any) => {
+ // ids.push(item.id)
+ // })
+ // this.http.get('/api/Cameras/Statuses', {
+ // params: { ids: ids }
+ // }).subscribe({
+ // next: (data) => {
+ // console.log('连接状态', data)
+
+ // },
+ // error: (err) => {
+ // console.log('连接失败', err)
+ // }
+ // })
+ this.disposalData()
+ this.router.navigate(['/system/host/camera/configForm'], { queryParams: { 'hostId': this.hostId, 'orId': this.orId } })
}
|