Browse Source

Merge branch 'dev_trial' of https://gitea.free-sun.vip/free-sun/FS-IOT into dev_trial

release_0.0.2
巴林闲侠 2 years ago
parent
commit
09af37576b
  1. 11
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx
  2. 109
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
  3. 2
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx
  4. 22
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
  5. 6
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx

11
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cameraModal.jsx

@ -153,9 +153,14 @@ function cameraModal (props) {
}); });
} else if (clickNum == 4) { } else if (clickNum == 4) {
// //
let data = cascadeRef.current.cascadeList.map((v) => {
return { id: v.id, name: v.name, };
});
console.log(cascadeRef.current.cascadeList)
console.log(data)
cascadeRef.current.cascadeCameraForm().then((values) => { cascadeRef.current.cascadeCameraForm().then((values) => {
console.log(values); console.log(values);
dispatch(equipmentWarehouse.postAddCascade(values)).then((res) => { dispatch(equipmentWarehouse.postAddCascade({ ...values, camera: data })).then((res) => {
console.log(res); console.log(res);
if (res.success) { if (res.success) {
onReset(); onReset();
@ -217,8 +222,10 @@ function cameraModal (props) {
ipcRef.current.toempty(); ipcRef.current.toempty();
} else if (clickNum == 4) { } else if (clickNum == 4) {
cascadeRef.current.resetCascadeCamera(); cascadeRef.current.resetCascadeCamera();
cascadeRef.current.toempty()
} else { } else {
nvrRef.current.resetFluoriteCamera(); nvrRef.current.resetFluoriteCamera();
ipcRef.current.toempty()
} }
} }
@ -578,7 +585,7 @@ function cameraModal (props) {
</Spin> </Spin>
) : ( ) : (
<Spin tip={loadingTip} spinning={isloading}> <Spin tip={loadingTip} spinning={isloading}>
<CascadeCamera dRef={cascadeRef} cameraData={cameraData} parentCamera={parentCamera} testComplete={testComplete.current} /> <CascadeCamera dRef={cascadeRef} cameraData={cameraData} parentCamera={parentCamera} testComplete={testComplete.current} close={()=>testComplete.current = false} />
</Spin> </Spin>
)} )}
</div> </div>

109
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx

@ -1,23 +1,52 @@
import React, { useState, useRef, useEffect, useImperativeHandle } from "react"; import React, { useState, useRef, useEffect, useImperativeHandle } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Form, Row, Col, Checkbox, Radio, CheckboxGroup, } from "@douyinfe/semi-ui"; import { Form, Row, Col, Checkbox, Radio, CheckboxGroup, Input } from "@douyinfe/semi-ui";
import { IconEdit, IconPlayCircle, } from "@douyinfe/semi-icons"; import { IconEdit, IconPlayCircle, } from "@douyinfe/semi-icons";
import "./cameraModal.less"; import "./cameraModal.less";
import PerfectScrollbar from "perfect-scrollbar"; import PerfectScrollbar from "perfect-scrollbar";
let equipmentScrollbar; let equipmentScrollbar;
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete }) { function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete, close }) {
const form = useRef(); const form = useRef();
const { equipmentWarehouse } = actions; const { equipmentWarehouse } = actions;
const [sip, setSip] = useState([]); const [sip, setSip] = useState([]);
const [NVRcameraList, setNVRcameraList] = useState([]); //nvr const [cascadeList, setCascadeList] = useState([]); //nvr
const [nvrCheckList, setNvrCheckList] = useState([]); //nvr const [CheckList, setCheckList] = useState([]); //nvr
const [isAllChoose, setIsAllChoose] = useState(false); // const [isAllChoose, setIsAllChoose] = useState(false); //
const cameraDataNvr = cameraData.nvr || ""; const [formData, setFormData] = useState() //
useEffect(() => { useEffect(() => {
dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => { dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => {
setSip(res.payload.data); setSip(res.payload.data);
if (cameraData) {
let sip=res.payload.data.find((item)=>item.streamid==cameraData.topSerialNo)
dispatch(equipmentWarehouse.getCascadeStream({ sip: sip.sipip })).then((res) => {
console.log(res.payload.data);
let oneData = res.payload.data[0];
let modifyData = res.payload.data.find(
(item) => item.id == cameraData.gbId
);
console.log(modifyData)
let data = res.payload.data.map((item, index) => {
if (item.camera) {
item.name = item.camera.name;
}
if (index == 0) {
item = modifyData;
}
if (
item.camera&&item.camera.name == cameraData.name
) {
item = oneData;
}
return item;
})
setCascadeList(data)
setCheckList([data[0].id])
});
}
}); });
const videoStreaming = document.getElementById("video_streaming"); const videoStreaming = document.getElementById("video_streaming");
if (videoStreaming && equipmentScrollbar) { if (videoStreaming && equipmentScrollbar) {
@ -26,32 +55,32 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
}, []); }, []);
useEffect(() => { useEffect(() => {
NVRcameraList cascadeList
? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", { ? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", {
suppressScrollX: true, suppressScrollX: true,
})) }))
: ""; : "";
}, [NVRcameraList]); }, [cascadeList]);
useEffect(() => { useEffect(() => {
// //
console.log(testComplete)
if (testComplete) { if (testComplete) {
dispatch(equipmentWarehouse.getCascadeStream({ sip: "111" })).then((res) => { dispatch(equipmentWarehouse.getCascadeStream({ sip: formData.sip })).then((res) => {
console.log(res.payload.data); console.log(res.payload.data);
let chooseList = []; let chooseList = [];
let data = res.payload.data.map((item, index) => { let data = res.payload.data.map((item, index) => {
item.change = false; item.change = false;
return item; return item;
}) })
setNVRcameraList(data) setCascadeList(data)
for (let index = 0; index < data.length; index++) { for (let index = 0; index < data.length; index++) {
chooseList.push(data[index].id); chooseList.push(data[index].id);
} }
setNvrCheckList(chooseList); setCheckList(chooseList);
setIsAllChoose(true); setIsAllChoose(true);
}); });
} }
close()
}, [testComplete]) }, [testComplete])
@ -87,48 +116,49 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
}, },
]; ];
function NvrChangeName (e, index, name) { function NvrChangeName (e, index, id) {
// //
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList)); let NvrchangeList = JSON.parse(JSON.stringify(cascadeList));
if (cameraData.name == name) { if (!cameraData||cameraData.gbId==id) {
NvrchangeList[index].change = true; NvrchangeList[index].change = true;
setNVRcameraList(NvrchangeList); setCascadeList(NvrchangeList);
} }
e.stopPropagation(); e.stopPropagation();
} }
function nvronBlur (index) { function nvronBlur (index) {
//nvr //nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList)); let NvrchangeList = JSON.parse(JSON.stringify(cascadeList));
NvrchangeList[index].change = false; NvrchangeList[index].change = false;
setNVRcameraList(NvrchangeList); setCascadeList(NvrchangeList);
} }
function inputchange (e, index) { function inputchange (e, index) {
//nvr //nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList)); let NvrchangeList = JSON.parse(JSON.stringify(cascadeList));
NvrchangeList[index].name = e; NvrchangeList[index].name = e;
setNVRcameraList(NvrchangeList); setCascadeList(NvrchangeList);
} }
function allChoose (e) { function allChoose (e) {
/// ///
let chooseList = []; let chooseList = [];
if (NVRcameraList.length == nvrCheckList.length) { if (cascadeList.length == CheckList.length) {
setNvrCheckList([]); setCheckList([]);
setIsAllChoose(false); setIsAllChoose(false);
} else { } else {
for (let index = 0; index < NVRcameraList.length; index++) { for (let index = 0; index < cascadeList.length; index++) {
chooseList.push(NVRcameraList[index].id); chooseList.push(cascadeList[index].id);
} }
setNvrCheckList(chooseList); setCheckList(chooseList);
setIsAllChoose(true); setIsAllChoose(true);
} }
} }
function playVideo (e) { function playVideo (e) {
//nvr //nvr
console.log("22222222222222222"); console.log("22222222222222222");
e.stopPropagation(); e.stopPropagation();
} }
function onDisabled (name) { function onDisabled (id) {
if ((cameraDataNvr && cameraData.name == name) || !cameraDataNvr) { if (id==cameraData.gbId) {
return false; return false;
} else { } else {
return true; return true;
@ -140,6 +170,12 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
// //
cascadeCameraForm: form.current.validate, cascadeCameraForm: form.current.validate,
resetCascadeCamera: form.current.reset, resetCascadeCamera: form.current.reset,
cascadeList: cascadeList.filter((v) =>
CheckList.some((e) => e == v.id)
),
toempty: () => {
setCascadeList([])
}
})); }));
return ( return (
<> <>
@ -150,6 +186,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
labelWidth="115px" labelWidth="115px"
onValueChange={(values) => { onValueChange={(values) => {
console.log(values); console.log(values);
setFormData(values)
}} }}
getFormApi={(formApi) => (form.current = formApi)} getFormApi={(formApi) => (form.current = formApi)}
@ -202,14 +239,14 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
id="video_streaming" id="video_streaming"
style={{ maxHeight: 300, position: "relative" }} style={{ maxHeight: 300, position: "relative" }}
> >
{NVRcameraList.length > 0 ? ( {cascadeList.length > 0 ? (
<div <div
style={{ display: "flex", alignItems: "center", marginLeft: 211 }} style={{ display: "flex", justifyContent: "flex-end", marginRight: 50 }}
> >
<Radio <Radio
checked={isAllChoose} checked={isAllChoose}
mode="advanced" mode="advanced"
disabled={true} disabled={cameraData ? true : false}
onChange={(e) => allChoose(e)} onChange={(e) => allChoose(e)}
aria-label="全选" aria-label="全选"
> >
@ -223,17 +260,17 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
type="pureCard" type="pureCard"
direction="vertical" direction="vertical"
aria-label="视频流获取" aria-label="视频流获取"
value={nvrCheckList} value={CheckList}
onChange={(nvrCheck) => { onChange={(nvrCheck) => {
setNvrCheckList(nvrCheck); setCheckList(nvrCheck);
if (NVRcameraList.length == nvrCheck.length) { if (cascadeList.length == nvrCheck.length) {
setIsAllChoose(true); setIsAllChoose(true);
} else { } else {
setIsAllChoose(false); setIsAllChoose(false);
} }
}}> }}>
{NVRcameraList.length > 0 {cascadeList.length > 0
? NVRcameraList.map((item, index) => ( ? cascadeList.map((item, index) => (
<Col <Col
key={index} key={index}
span={12} span={12}
@ -245,7 +282,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
> >
<Checkbox <Checkbox
value={item.id} value={item.id}
disabled={onDisabled(item.name)} disabled={onDisabled(item.id)}
extra={ extra={
<div> <div>
<div <div
@ -285,7 +322,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
color: "#1859C1", color: "#1859C1",
}} }}
onClick={(e) => onClick={(e) =>
NvrChangeName(e, index, item.name) NvrChangeName(e, index, item.id)
} }
/> />
</div> </div>

2
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/nvrCamera.jsx

@ -68,8 +68,6 @@ function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }
) { ) {
item = oneData; item = oneData;
} }
// item.change = false;
// item.support = false;
if (item.camera) { if (item.camera) {
item.name = item.camera.name; item.name = item.camera.name;
} }

22
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx

@ -31,7 +31,7 @@ const CameraHeader = (props) => {
const [setupp, setSetupp] = useState([]); const [setupp, setSetupp] = useState([]);
const [venderList, setvenderList] = useState([]); // const [venderList, setvenderList] = useState([]); //
const [query, setQuery] = useState({ limit: 10, page: 0 }); // const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); // const [search, setSearch] = useState({}); //
const [rowId, setRowId] = useState(); //id const [rowId, setRowId] = useState(); //id
const [cameraData, setCameraData] = useState({}); // const [cameraData, setCameraData] = useState({}); //
const [modify, setModify] = useState(false); // const [modify, setModify] = useState(false); //
@ -123,16 +123,16 @@ const CameraHeader = (props) => {
onClick={() => { onClick={() => {
if (deviceClickb.current) { if (deviceClickb.current) {
if (row.type == "nvr") { if (row.type == "nvr") {
setearch({ ...searchb.current, nvrId: row.nvr.id }) setSearch({ ...searchb.current, nvrId: row.nvr.id })
} else { } else {
setearch({ ...searchb.current, externalDomain: row.externalDomain }) setSearch({ ...searchb.current, externalDomain: row.externalDomain })
} }
deviceClickb.current = false deviceClickb.current = false
} else { } else {
if (row.type == "nvr") { if (row.type == "nvr") {
setearch({ ...searchb.current, nvrId: null }) setSearch({ ...searchb.current, nvrId: null })
} else { } else {
setearch({ ...searchb.current, externalDomain: null }) setSearch({ ...searchb.current, externalDomain: null })
} }
deviceClickb.current = true deviceClickb.current = true
} }
@ -205,7 +205,7 @@ const CameraHeader = (props) => {
row.forbidden row.forbidden
) )
).then(() => { ).then(() => {
equipmentGetCamera(); dispatch(equipmentWarehouse.getCamera(searchb.current));
}); });
}} }}
> >
@ -227,7 +227,7 @@ const CameraHeader = (props) => {
row.forbidden row.forbidden
) )
).then(() => { ).then(() => {
equipmentGetCamera(); dispatch(equipmentWarehouse.getCamera(searchb.current));
}); });
}} }}
> >
@ -244,7 +244,7 @@ const CameraHeader = (props) => {
dispatch( dispatch(
equipmentWarehouse.delCamera(row.id) equipmentWarehouse.delCamera(row.id)
).then(() => { ).then(() => {
equipmentGetCamera(); dispatch(equipmentWarehouse.getCamera(searchb.current));
}); });
}} }}
> >
@ -608,7 +608,7 @@ const CameraHeader = (props) => {
}} }}
onClick={() => { onClick={() => {
api.current.validate().then((v) => { api.current.validate().then((v) => {
setearch(v); setSearch(v);
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
searchb.current = { ...v, limit: 10, page: 0 } searchb.current = { ...v, limit: 10, page: 0 }
}); });
@ -629,7 +629,7 @@ const CameraHeader = (props) => {
}} }}
onClick={() => { onClick={() => {
api.current.reset(); api.current.reset();
setearch({}); setSearch({});
}} }}
> >
重置 重置
@ -772,7 +772,7 @@ const CameraHeader = (props) => {
setAddNvr(false) setAddNvr(false)
setNvrNumber("") setNvrNumber("")
setAxyData("") setAxyData("")
equipmentGetCamera(); dispatch(equipmentWarehouse.getCamera(searchb.current));
}} }}
modalName={modalName} modalName={modalName}
/> />

6
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/nvr.jsx

@ -27,6 +27,7 @@ const NvrHeader = (props) => {
const [venderList, setvenderList] = useState([]); // const [venderList, setvenderList] = useState([]); //
const [query, setQuery] = useState({ limit: 10, page: 0 }); // const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); // const [search, setearch] = useState({}); //
const searchb = useRef(search)
const [rowId, setRowId] = useState(); //id const [rowId, setRowId] = useState(); //id
const [reminder, setReminder] = useState(false); // const [reminder, setReminder] = useState(false); //
const api = useRef(); const api = useRef();
@ -117,7 +118,7 @@ const NvrHeader = (props) => {
modalName="revise" modalName="revise"
venderList={venderList} venderList={venderList}
close={() => { close={() => {
equipmentGetNvr(); dispatch(equipmentWarehouse.getNvr(searchb.current));
}} }}
/> />
</Button> </Button>
@ -137,7 +138,7 @@ const NvrHeader = (props) => {
position="topRight" position="topRight"
onConfirm={() => { onConfirm={() => {
dispatch(equipmentWarehouse.delNvr(row.id)).then(() => { dispatch(equipmentWarehouse.delNvr(row.id)).then(() => {
equipmentGetNvr(); dispatch(equipmentWarehouse.getNvr(searchb.current));
}); });
}} }}
> >
@ -453,6 +454,7 @@ const NvrHeader = (props) => {
api.current.validate().then((v) => { api.current.validate().then((v) => {
setearch(v); setearch(v);
setQuery({ limit: 10, page: 0 }) setQuery({ limit: 10, page: 0 })
searchb.current = { ...v, limit: 10, page: 0 }
}); });
}} }}
> >

Loading…
Cancel
Save