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 6b863cc..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";
@@ -20,7 +21,9 @@ function cameraModal (props) {
CameraAbility,
cameraData, //修改时传来的值
modify,
- parentCamera
+ parentCamera,
+ addNvr,
+ nvrNumber
} = props;
const { equipmentWarehouse } = actions;
const fluoriteRef = useRef();
@@ -28,16 +31,16 @@ 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 左边
-
+
const [clickNum, setclickNum] = useState(
cameraData.type == "yingshi"
? 1
: cameraData.type == "ipc"
? 3
- : cameraData.type == "nvr"
+ : cameraData.type == "nvr" || addNvr
? 2
: cameraData.type == "cascade"
? 4
@@ -47,7 +50,7 @@ function cameraModal (props) {
useEffect(() => {
dispatch(equipmentWarehouse.getCameraKind());
dispatch(equipmentWarehouse.getAbility());
- cameraData.type == "nvr" ? setcameraList(cameraList.slice(1, 4)) : "";
+ cameraData.type == "nvr" || addNvr ? setcameraList(cameraList.slice(1, 4)) : "";
}, []);
const cameraList = [
//循环摄像头列表
@@ -149,20 +152,19 @@ function cameraModal (props) {
}
function handleChoose (id) {
//选择摄像头接入类型
- if (!modify) {
+ if (!addNvr && !modify) {
setclickNum(id);
}
-
}
function turnLift () {
//轮播图向左
- if (!modify) {
+ if (!addNvr && !modify) {
setcameraList(cameraList.slice(0, 3));
}
}
function turnRight () {
//轮播图向右
- if (!modify) {
+ if (!addNvr && !modify) {
setcameraList(cameraList.slice(1, 4));
}
}
@@ -198,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) => {
//表单校验失败
@@ -215,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) => {
//表单校验失败
@@ -283,7 +330,7 @@ function cameraModal (props) {
afterClose={handleAfterClose}
onCancel={handleCancel}
>
-
+ <>
@@ -337,7 +384,7 @@ function cameraModal (props) {
}}
onClick={() => handleChoose(item.id)}
>
- {modify ? item.id == clickNum ? "" :
{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 464c3af..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
@@ -1,358 +1,416 @@
import React, { useState, useRef, useEffect, useImperativeHandle } from "react";
import { connect } from "react-redux";
import {
- Form,
- Row,
- Col,
- Button,
- CheckboxGroup,
- Checkbox,
- Radio,
- Input,
+ Form,
+ Row,
+ Col,
+ Button,
+ CheckboxGroup,
+ Checkbox,
+ Radio,
+ Input,
+ Spin,
} from "@douyinfe/semi-ui";
-import { IconEdit, IconPlayCircle } from "@douyinfe/semi-icons";
+import { IconEdit, IconPlayCircle, IconTickCircle } from "@douyinfe/semi-icons";
import "./cameraModal.less";
import PerfectScrollbar from "perfect-scrollbar";
import { isIndexed } from "immutable";
let equipmentScrollbar;
-function nvrCamera({ dispatch, actions, nvrRef, cameraData }) {
- const { equipmentWarehouse } = actions;
- const cameraDataNvr = cameraData.nvr || "";
- const form = useRef();
- const [nvrCheckList, setNvrCheckList] = useState([]); //nvr视频流多选
- const [NVRcameraList, setNVRcameraList] = useState([]); //nvr视频流列表
- const [isAllChoose, setIsAllChoose] = useState(false); //全选
- const [equipmentNum, setEquipmentNum] = useState(""); //nvr视频编号
+function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }) {
+ const { equipmentWarehouse } = actions;
+ const cameraDataNvr = cameraData.nvr || "";
+ const form = useRef();
+ const [nvrCheckList, setNvrCheckList] = useState([]); //nvr视频流多选
+ const [NVRcameraList, setNVRcameraList] = useState([]); //nvr视频流列表
+ const [isAllChoose, setIsAllChoose] = useState(false); //全选
+ const [equipmentNum, setEquipmentNum] = useState(""); //nvr视频编号
+ const [isloading, setloading] = useState(false); //是否显示loading
+ const [loadingTip, setloadingTip] = useState("正在接入视频流..."); //loading tip的值
+ const [step, setstep] = useState("none");
+ const [stepp, setstepp] = useState("none");
- useEffect(() => {
- NVRcameraList
- ? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", {
- suppressScrollX: true,
- }))
- : "";
- }, [NVRcameraList]);
- useEffect(() => {
- const videoStreaming = document.getElementById("video_streaming");
- if (videoStreaming && equipmentScrollbar) {
- equipmentScrollbar.update();
- }
- });
- useEffect(() => {
- cameraDataNvr
- ? dispatch(
- equipmentWarehouse.getVideoStreaming({
- streamId: cameraDataNvr.serialNo,
- })
- ).then((res) => {
- let oneData = res.payload.data[0];
-
- let modifyData = res.payload.data.find(
- (item) => item.camera.name == cameraData.name
- );
- console.log(oneData);
- console.log(modifyData);
- let data = res.payload.data.map((item, index) => {
- if (index == 0) {
- item = modifyData;
- }
- if (
- item.camera
- ? item.camera.name == cameraData.name && index > 0
- : index < 0
- ) {
- item = oneData;
- }
- item.change = false;
- item.support = false;
- if (item.camera) {
- item.name = item.camera.name;
- }
+ useEffect(() => {
+ NVRcameraList
+ ? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", {
+ suppressScrollX: true,
+ }))
+ : "";
+ }, [NVRcameraList]);
+ useEffect(() => {
+ const videoStreaming = document.getElementById("video_streaming");
+ if (videoStreaming && equipmentScrollbar) {
+ equipmentScrollbar.update();
+ }
+ });
+ useEffect(() => {
+ if (cameraDataNvr) {
+ setloading(true);
+ setstep("block");
+ dispatch(
+ equipmentWarehouse.getVideoStreaming({
+ streamId: cameraDataNvr.serialNo,
+ })
+ ).then((res) => {
+ let oneData = res.payload.data[0];
+ let modifyData = res.payload.data.find(
+ (item) => item.camera == null ? false : item.camera.name == cameraData.name
+ );
+ let data = res.payload.data.map((item, index) => {
+ if (index == 0) {
+ item = modifyData;
+ }
+ if (
+ item.camera
+ ? item.camera.name == cameraData.name && index > 0
+ : index < 0
+ ) {
+ item = oneData;
+ }
+ item.change = false;
+ item.support = false;
+ if (item.camera) {
+ item.name = item.camera.name;
+ }
+ return item;
+ });
+ setNVRcameraList(data);
+ setNvrCheckList([data[0].id]);
+ if (res.success) {
+ setTimeout(() => {
+ setloadingTip("接入完成");
+ setTimeout(() => {
+ setstep("none");
+ setloading(false);
+ setstepp("block");
+ setloadingTip("正在接入视频流...");
+ }, 800);
+ }, 800)
+ }
+ })
+ }
- return item;
- });
- console.log(data);
- setNVRcameraList(data);
+ //NVR添加页面跳到nvr摄像头添加页面
+ if (addNvr) {
+ setloading(true);
+ setstep("block");
+ dispatch(equipmentWarehouse.getVideoStreaming({ streamId: nvrNumber })).then((res) => {
+ let chooseList = [];
+ let data = res.payload.data.map((item) => {
+ item.change = false;
+ item.support = false;
+ return item;
+ });
+ setNVRcameraList(data);
+ for (let index = 0; index < data.length; index++) {
+ chooseList.push(data[index].id);
+ }
+ setNvrCheckList(chooseList);
+ setIsAllChoose(true);
+ if (res.success) {
+ setTimeout(() => {
+ setloadingTip("接入完成");
+ setTimeout(() => {
+ setstep("none");
+ setloading(false);
+ setstepp("block");
+ setloadingTip("正在接入视频流...");
+ }, 800);
+ }, 800)
+ }
+ })
+ }
- setNvrCheckList([data[0].id]);
- })
- : "";
- }, []);
- function NvrChangeName(e, index, name) {
- //nvr摄像头视频流获取修改名称
- let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
- if (!cameraDataNvr || cameraData.name == name) {
- NvrchangeList[index].change = true;
- setNVRcameraList(NvrchangeList);
- e.stopPropagation();
+ }, []);
+ function NvrChangeName (e, index, name) {
+ //nvr摄像头视频流获取修改名称
+ let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
+ if (!cameraDataNvr || cameraData.name == name) {
+ NvrchangeList[index].change = true;
+ setNVRcameraList(NvrchangeList);
+ e.stopPropagation();
+ }
+ }
+ function nvronBlur (index) {
+ //nvr摄像头名称修改失去焦点
+ let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
+ NvrchangeList[index].change = false;
+ setNVRcameraList(NvrchangeList);
+ }
+ function inputchange (e, index) {
+ //nvr摄像头名称修改
+ let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
+ NvrchangeList[index].name = e;
+ setNVRcameraList(NvrchangeList);
+ }
+ function toggle (e, index) {
+ //nvr云台支持
+ let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
+ NvrchangeList[index].support = e.target.checked;
+ setNVRcameraList(NvrchangeList);
+ e.stopPropagation();
+ }
+ function getVideoList () {
+ form.current
+ .validate()
+ .then((values) => {
+ //表单校验成功
+ let chooseList = [];
+ let valuess = JSON.parse(JSON.stringify(values));
+ valuess.streamId = values.serialNo;
+ delete valuess.serialNo;
+ setloading(true);
+ setstep("block");
+ dispatch(equipmentWarehouse.getVideoStreaming(valuess)).then((res) => {
+ let data = res.payload.data.map((item) => {
+ item.change = false;
+ item.support = false;
+ return item;
+ });
+ setNVRcameraList(data);
+ for (let index = 0; index < data.length; index++) {
+ chooseList.push(data[index].id);
+ }
+ setNvrCheckList(chooseList);
+ setIsAllChoose(true);
+ if (res.success) {
+ setTimeout(() => {
+ setloadingTip("接入完成");
+ setTimeout(() => {
+ setstep("none");
+ setloading(false);
+ setstepp("block");
+ setloadingTip("正在接入视频流...");
+ }, 800);
+ }, 800)
+ }
+ });
+ })
+ .catch((errors) => {
+ //表单校验失败
+ console.log("errors", errors);
+ });
}
- }
- function nvronBlur(index) {
- //nvr摄像头名称修改失去焦点
- let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
- NvrchangeList[index].change = false;
- setNVRcameraList(NvrchangeList);
- }
- function inputchange(e, index) {
- //nvr摄像头名称修改
- let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
- console.log(e);
- NvrchangeList[index].name = e;
- setNVRcameraList(NvrchangeList);
- }
- function toggle(e, index) {
- //nvr云台支持
- console.log(e)
- let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
- console.log(NvrchangeList)
- NvrchangeList[index].support = e.target.checked;
- setNVRcameraList(NvrchangeList);
- e.stopPropagation();
- }
- function getVideoList() {
- form.current
- .validate()
- .then((values) => {
- //表单校验成功
+ function allChoose (e) {
+ //全选/全不选
let chooseList = [];
- let valuess = JSON.parse(JSON.stringify(values));
- valuess.streamId = values.serialNo;
- delete valuess.serialNo;
- dispatch(equipmentWarehouse.getVideoStreaming(valuess)).then((res) => {
- let data = res.payload.data.map((item) => {
- item.change = false;
- item.support = false;
- return item;
- });
- console.log(data);
- setNVRcameraList(data);
- for (let index = 0; index < data.length; index++) {
- chooseList.push(data[index].id);
- }
- console.log(chooseList);
- setNvrCheckList(chooseList);
- setIsAllChoose(true);
- });
- })
- .catch((errors) => {
- //表单校验失败
- console.log("errors", errors);
- });
- }
- function allChoose(e) {
- //全选/全不选
- let chooseList = [];
- if (NVRcameraList.length == nvrCheckList.length) {
- setNvrCheckList([]);
- setIsAllChoose(false);
- } else {
- for (let index = 0; index < NVRcameraList.length; index++) {
- chooseList.push(NVRcameraList[index].id);
- }
- setNvrCheckList(chooseList);
- setIsAllChoose(true);
+ if (NVRcameraList.length == nvrCheckList.length) {
+ setNvrCheckList([]);
+ setIsAllChoose(false);
+ } else {
+ for (let index = 0; index < NVRcameraList.length; index++) {
+ chooseList.push(NVRcameraList[index].id);
+ }
+ setNvrCheckList(chooseList);
+ setIsAllChoose(true);
+ }
}
- }
- function playVideo(e) {
- //nvr播放视频
- console.log("22222222222222222");
- e.stopPropagation();
- }
- function onDisabled(name) {
- if ((cameraDataNvr && cameraData.name == name) || !cameraDataNvr) {
- return false;
- } else {
- return true;
+ function playVideo (e) {
+ //nvr播放视频
+ console.log("22222222222222222");
+ e.stopPropagation();
}
- }
- useImperativeHandle(nvrRef, () => ({
- //传给父组件方法
- //aa即为子组件暴露给父组件的方法
- resetFluoriteCamera: form.current.reset,
- equipmentNum: cameraDataNvr ? cameraDataNvr.serialNo : equipmentNum,
- NVRcameraList: NVRcameraList.filter((v) =>
- nvrCheckList.some((e) => e == v.id)
- ),
- }));
- return (
- <>
-
- >
- );
+ disabled={cameraDataNvr ? true : false}
+ onChange={(e) => allChoose(e)}
+ aria-label="全选"
+ >
+ 全选
+
+
+ ) : (
+ ""
+ )}
+
+
+ {
+ setNvrCheckList(nvrCheck);
+ if (NVRcameraList.length == nvrCheck.length) {
+ setIsAllChoose(true);
+ } else {
+ setIsAllChoose(false);
+ }
+ }}
+ >
+
+
+
+ {NVRcameraList.length > 0
+ ? NVRcameraList.map((item, index) => (
+
+
+
+
+ 通道名称:
+ {item.change ? (
+ inputchange(e, index)}
+ onBlur={() => nvronBlur(index)}
+ >
+ ) : (
+ item.name
+ )}
+
+
+
+ NvrChangeName(e, index, item.name)
+ }
+ />
+
+
+
+ 设备编号:{item.streamid}
+
+
+ playVideo(e)}
+ />
+ toggle(e, index)}
+ aria-label="单选"
+ >
+ 云台支持
+
+
+
+ }
+ style={{ width: 280, border: "1px solid #F9F9F9" }}
+ >
+
+ ))
+ : ""}
+
+
+
+
+
+
+
+
+ >
+ );
}
-function mapStateToProps(state) {
- const { auth, global, members } = state;
- return {
- loading: members.isRequesting,
- user: auth.user,
- actions: global.actions,
- members: members.data,
- };
+function mapStateToProps (state) {
+ const { auth, global, members } = state;
+ return {
+ loading: members.isRequesting,
+ user: auth.user,
+ actions: global.actions,
+ members: members.data,
+ };
}
export default connect(mapStateToProps)(nvrCamera);
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
index 578dda1..01fe83b 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrModal.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useRef, useEffect } from "react";
+import React, { useState, useRef, useEffect,useImperativeHandle } from "react";
import { connect } from "react-redux";
import { Modal, Form, Row, Col, Spin } from "@douyinfe/semi-ui";
import { IconTickCircle } from "@douyinfe/semi-icons";
@@ -6,7 +6,7 @@ import { IconTickCircle } from "@douyinfe/semi-icons";
import moment from "moment";
function nvrModal(props) {
- const { modalName } = props;
+ const { modalName ,nvrRef} = props;
const { dispatch, actions, vender, close } = props;
const nvrData = props.nvrData || {}; //修改时传来的值
const form = useRef();
@@ -18,10 +18,6 @@ function nvrModal(props) {
const [cancelText, setcancelText] = useState("取消"); //取消弹框text 左边
const [formObj, setformObj] = useState(); //接口入参
- useEffect(() => {
- console.log(props.user.id);
- }, []);
-
function showDialog() {
//打开弹框
setVisible(true);
@@ -47,6 +43,7 @@ function nvrModal(props) {
.validate()
.then((values) => {
//表单校验
+ console.log(values)
let valuesObj = JSON.parse(JSON.stringify(values));
valuesObj.longitude = values.position.split(",")[0];
valuesObj.latitude = values.position.split(",")[1];
@@ -61,7 +58,6 @@ function nvrModal(props) {
serialNo: valuesObj.serialNo,
})
).then((res) => {
- console.log(res);
var after = new moment(); //验证后时间
var duration = moment.duration(after.diff(front))._data.milliseconds;
if (res.success) {
@@ -127,6 +123,11 @@ function nvrModal(props) {
//高德经纬度
window.open("https://lbs.amap.com/tools/picker", "_blank");
}
+ useImperativeHandle(nvrRef, () => ({
+ //传给父组件方法
+ //aa即为子组件暴露给父组件的方法
+ nvrNumber: ()=>formObj.serialNo
+ }));
return (
<>
{modalName == "add" ? "添加NVR" : "修改"}
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
index e1c13a8..2b4baa9 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
@@ -37,6 +37,8 @@ const CameraHeader = (props) => {
const [cameraData, setCameraData] = useState({}); //表格数据
const [modify, setModify] = useState(false); //修改
const [parentCamera, setParentCamera] = useState(""); //级联摄像头父级设备
+ const [addNvr, setAddNvr] = useState(false); //nvr页面传递参数打开NVR摄像头添加弹框
+ const [nvrNumber, setNvrNumber] = useState();
const { equipmentWarehouse } = actions;
const api = useRef();
const searchb = useRef(search)
@@ -44,8 +46,14 @@ const CameraHeader = (props) => {
const CAMERAS = "cameras";
useEffect(() => {
-
console.log(props)
+ if (props.location.query) {
+ setAddNvr(props.location.query.addNvr)
+ setNvrNumber(props.location.query.serialNo)
+ setCameraModal(true);
+ }
+
+
dispatch(actions.equipmentWarehouse.getVender()).then((res) => {
setvenderList(res.payload.data);
attribute(res.payload.data);
@@ -115,7 +123,6 @@ const CameraHeader = (props) => {
width: "20%",
dataIndex: "",
render: (_, row) => {
- console.log(row);
return (