From 3430ecb5e268f3503205894f7f433a7189ba811c Mon Sep 17 00:00:00 2001 From: wenlele Date: Mon, 20 Jun 2022 10:15:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A4=E7=9F=B3=EF=BC=8C=E7=BA=A7=E8=81=94?= =?UTF-8?q?=EF=BC=8Cipc=E6=B7=BB=E5=8A=A0=E4=BF=AE=E6=94=B9=E6=97=B6?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipmentWarehouse/actions/camera.js | 35 ++++ .../components/cameraModal.jsx | 172 ++++++++++++------ .../components/fluoriteCamera.jsx | 2 +- .../components/nvrCamera.jsx | 1 - .../equipmentWarehouse/containers/nvr.jsx | 14 +- .../web/client/src/utils/webapi.js | 3 + 6 files changed, 164 insertions(+), 63 deletions(-) diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js index 5d8b967..b7814e4 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/actions/camera.js @@ -161,3 +161,38 @@ export function getParentCamera(query) { msg: { option: "" }, //获取级联摄像头父级设备 }); } + +export function getVerifyYingshi(data) { + return (dispatch) => + basicAction({ + type: "post", + dispatch: dispatch, + data, + actionType: "POST_VERIFY_YINGSHI", + url: `${ApiTable.getVerifyYingshi}`, + msg: { option: "" }, //获取级联摄像头父级设备 + }); + } + + export function getVerifyIpc(data) { + return (dispatch) => + basicAction({ + type: "post", + dispatch: dispatch, + data, + actionType: "POST_VERIFY_IPC", + url: `${ApiTable.getVerifyIpc}`, + msg: { option: "" }, //获取级联摄像头父级设备 + }); + } + export function getVerifyCascade(data) { + return (dispatch) => + basicAction({ + type: "post", + dispatch: dispatch, + data, + actionType: "POST_VERIFY_CASCADE", + url: `${ApiTable.getVerifyCascade}`, + msg: { option: "" }, //获取级联摄像头父级设备 + }); + } \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx index 2d9c8bd..68cf5f8 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx @@ -2,6 +2,7 @@ import React, { useState, useRef, useEffect } from "react"; import { connect } from "react-redux"; import { Modal, Spin } from "@douyinfe/semi-ui"; import { IconChevronLeft, IconChevronRight } from "@douyinfe/semi-icons"; +import moment from "moment"; import FluoriteCamera from "./fluoriteCamera"; import NvrCamera from "./nvrCamera"; import IpcCamera from "./ipcCamera"; @@ -30,7 +31,7 @@ function cameraModal (props) { const cascadeRef = useRef(); const nvrRef = useRef(); const [isloading, setloading] = useState(false); //是否显示loading - const [loadingTip, setloadingTip] = useState("获取中...请稍后..."); //loading tip的值 + const [loadingTip, setloadingTip] = useState("测试进行中..."); //loading tip的值 const [okText, setokText] = useState("确定"); //ok弹框text 右边 const [cancelText, setcancelText] = useState("取消"); //取消弹框text 左边 @@ -199,13 +200,40 @@ function cameraModal (props) { } } + //表单验证 function toTest () { if (clickNum == 1) { fluoriteRef.current .fluoriteCameraForm() .then((values) => { //表单校验成功 - console.log("111111111", values); + var front = new moment(); //验证前时间 + setloading(true); + dispatch( + equipmentWarehouse.getVerifyYingshi({ + serialNo: values.serialNo, + }) + ).then((res) => { + var after = new moment(); //验证后时间 + var duration = moment.duration(after.diff(front))._data.milliseconds; + if (res.success) { + setTimeout(() => { + setloadingTip("校验成功"); + setTimeout(() => { + setloading(false); + setloadingTip("测试进行中..."); + }, 800); + }, duration > 2000 ? 0 : 2000 - duration) + } else { + setTimeout(() => { + setloadingTip("校验失败"); + setTimeout(() => { + setloading(false); + setloadingTip("测试进行中..."); + }, 800); + }, duration > 2000 ? 0 : 2000 - duration) + } + }) }) .catch((errors) => { //表单校验失败 @@ -216,54 +244,72 @@ function cameraModal (props) { .ipcCameraForm() .then((values) => { //表单校验成功 - console.log("111111111", values); + console.log(values); + var front = new moment(); //验证前时间 + setloading(true); + dispatch( + equipmentWarehouse.getVerifyIpc({ + serialNo: values.serialNo, + }) + ).then((res) => { + var after = new moment(); //验证后时间 + var duration = moment.duration(after.diff(front))._data.milliseconds; + if (res.success) { + setTimeout(() => { + setloadingTip("校验成功"); + setTimeout(() => { + setloading(false); + setloadingTip("测试进行中..."); + }, 800); + }, duration > 2000 ? 0 : 2000 - duration) + } else { + setTimeout(() => { + setloadingTip("校验失败"); + setTimeout(() => { + setloading(false); + setloadingTip("测试进行中..."); + }, 800); + }, duration > 2000 ? 0 : 2000 - duration) + } + }) }) .catch((errors) => { //表单校验失败 - console.log("errors", errors); + console.log(); }); } else if (clickNum == 4) { cascadeRef.current .cascadeCameraForm() .then((values) => { - //表单校验成功 - let chooseList = []; - let nvrCameraList = [ - { - id: 10, - name: "南昌县1", - number: "111111111111111111", - support: false, - change: false, - }, - { - id: 20, - name: "南昌县2", - number: "222222222222222222", - support: false, - change: false, - }, - { - id: 30, - name: "南昌县3", - number: "333333333333333333", - support: false, - change: false, - }, - { - id: 40, - name: "南昌县4", - number: "444444444444444444", - support: false, - change: false, - }, - ]; - cascadeRef.current.setNVRcameraList(nvrCameraList); - for (let index = 0; index < nvrCameraList.length; index++) { - chooseList.push(nvrCameraList[index].id); - } - cascadeRef.current.setNvrCheckList(chooseList); - cascadeRef.current.setIsAllChoose(true); + console.log(values); + var front = new moment(); //验证前时间 + setloading(true); + dispatch( + equipmentWarehouse.getVerifyCascade({ + sip: values.sip, + }) + ).then((res) => { + var after = new moment(); //验证后时间 + var duration = moment.duration(after.diff(front))._data.milliseconds; + if (res.success) { + setTimeout(() => { + setloadingTip("校验成功"); + setTimeout(() => { + setloading(false); + setloadingTip("测试进行中..."); + }, 800); + }, duration > 2000 ? 0 : 2000 - duration) + } else { + setTimeout(() => { + setloadingTip("校验失败"); + setTimeout(() => { + setloading(false); + setloadingTip("测试进行中..."); + }, 800); + }, duration > 2000 ? 0 : 2000 - duration) + } + }) + }) .catch((errors) => { //表单校验失败 @@ -284,7 +330,7 @@ function cameraModal (props) { afterClose={handleAfterClose} onCancel={handleCancel} > - + <>
@@ -484,27 +530,35 @@ function cameraModal (props) {
{clickNum == 1 ? ( - + + + ) : clickNum == 2 ? ( - + + + ) : clickNum == 3 ? ( - + + + ) : ( - + + + )}
-
+ ); diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx index 952e06e..5db43aa 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/fluoriteCamera.jsx @@ -1,6 +1,6 @@ import React, { useState, useRef, useEffect, useImperativeHandle } from "react"; import { connect } from "react-redux"; -import { Form, Row, Col } from "@douyinfe/semi-ui"; +import { Form, Row, Col,Spin } from "@douyinfe/semi-ui"; import "./cameraModal.less"; function fluoriteCamera ({ cRef, CameraKind, CameraAbility, cameraData }) { const { TextArea } = Form; diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx index 11120a9..877c3ac 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx @@ -52,7 +52,6 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber } streamId: cameraDataNvr.serialNo, }) ).then((res) => { - console.log(res) let oneData = res.payload.data[0]; let modifyData = res.payload.data.find( (item) => item.camera == null ? false : item.camera.name == cameraData.name diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx index 559a880..c875a6b 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx @@ -30,7 +30,7 @@ export const accessType = [ ]; const NvrHeader = (props) => { - const { history,dispatch, actions, user, loading, equipmentWarehouseNvr } = props; + const { history, dispatch, actions, user, loading, equipmentWarehouseNvr } = props; const { equipmentWarehouse } = actions; const [setup, setSetup] = useState(false); const [sideSheet, setSideSheet] = useState(false); @@ -73,12 +73,22 @@ const NvrHeader = (props) => { OFF: "离线", Alarmed: "未知", }; + const colorStatus = { ON: "#04B234", ONLINE: "#04B234", OFF: "rgba(0, 0, 0, 0.45)", Alarmed: "#1859C1", }; + // function colorStatus (data) { + // switch (data) { + // case ON || ONLINE: + // break; + // default: + // break; + // } + + // } const columns = [ { title: "序号", @@ -594,7 +604,7 @@ const NvrHeader = (props) => { toadd="去添加" visible={reminder} onOk={() => { - history.push({pathname:'/equipmentWarehouse/camera',query:{addNvr:true,serialNo:nvrRef.current.nvrNumber()}}); + history.push({ pathname: '/equipmentWarehouse/camera', query: { addNvr: true, serialNo: nvrRef.current.nvrNumber() } }); setReminder(false) }} /> diff --git a/code/VideoAccess-VCMP/web/client/src/utils/webapi.js b/code/VideoAccess-VCMP/web/client/src/utils/webapi.js index 6881681..f175fb6 100644 --- a/code/VideoAccess-VCMP/web/client/src/utils/webapi.js +++ b/code/VideoAccess-VCMP/web/client/src/utils/webapi.js @@ -31,6 +31,9 @@ export const ApiTable = { getCascadeSIP: "camera/sip_list/cascade", //获取级联摄像头sip列表 postAddCascade: "camera/create/cascade", //添加级联摄像头 getParentCamera:"camera/cascade_device", //获取级联摄像头父级设备 + getVerifyYingshi:"camera/verify/yingshi", //验证萤石摄像头信息 + getVerifyIpc:"camera/verify/ipc", //验证IPC摄像头信息 + getVerifyCascade:"camera/verify/cascade", //验证级联摄像头信息 };