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. 111
      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) {
//
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) => {
console.log(values);
dispatch(equipmentWarehouse.postAddCascade(values)).then((res) => {
dispatch(equipmentWarehouse.postAddCascade({ ...values, camera: data })).then((res) => {
console.log(res);
if (res.success) {
onReset();
@ -217,8 +222,10 @@ function cameraModal (props) {
ipcRef.current.toempty();
} else if (clickNum == 4) {
cascadeRef.current.resetCascadeCamera();
cascadeRef.current.toempty()
} else {
nvrRef.current.resetFluoriteCamera();
ipcRef.current.toempty()
}
}
@ -578,7 +585,7 @@ function cameraModal (props) {
</Spin>
) : (
<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>
)}
</div>

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

@ -1,23 +1,52 @@
import React, { useState, useRef, useEffect, useImperativeHandle } from "react";
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 "./cameraModal.less";
import PerfectScrollbar from "perfect-scrollbar";
let equipmentScrollbar;
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete }) {
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete, close }) {
const form = useRef();
const { equipmentWarehouse } = actions;
const [sip, setSip] = useState([]);
const [NVRcameraList, setNVRcameraList] = useState([]); //nvr
const [nvrCheckList, setNvrCheckList] = useState([]); //nvr
const [cascadeList, setCascadeList] = useState([]); //nvr
const [CheckList, setCheckList] = useState([]); //nvr
const [isAllChoose, setIsAllChoose] = useState(false); //
const cameraDataNvr = cameraData.nvr || "";
const [formData, setFormData] = useState() //
useEffect(() => {
dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => {
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");
if (videoStreaming && equipmentScrollbar) {
@ -26,32 +55,32 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
}, []);
useEffect(() => {
NVRcameraList
cascadeList
? (equipmentScrollbar = new PerfectScrollbar("#video_streaming", {
suppressScrollX: true,
}))
: "";
}, [NVRcameraList]);
}, [cascadeList]);
useEffect(() => {
//
console.log(testComplete)
if (testComplete) {
dispatch(equipmentWarehouse.getCascadeStream({ sip: "111" })).then((res) => {
dispatch(equipmentWarehouse.getCascadeStream({ sip: formData.sip })).then((res) => {
console.log(res.payload.data);
let chooseList = [];
let data = res.payload.data.map((item, index) => {
item.change = false;
return item;
})
setNVRcameraList(data)
setCascadeList(data)
for (let index = 0; index < data.length; index++) {
chooseList.push(data[index].id);
}
setNvrCheckList(chooseList);
setCheckList(chooseList);
setIsAllChoose(true);
});
}
close()
}, [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));
if (cameraData.name == name) {
NvrchangeList[index].change = true;
setNVRcameraList(NvrchangeList);
let NvrchangeList = JSON.parse(JSON.stringify(cascadeList));
if (!cameraData||cameraData.gbId==id) {
NvrchangeList[index].change = true;
setCascadeList(NvrchangeList);
}
e.stopPropagation();
}
function nvronBlur (index) {
//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
let NvrchangeList = JSON.parse(JSON.stringify(cascadeList));
NvrchangeList[index].change = false;
setNVRcameraList(NvrchangeList);
setCascadeList(NvrchangeList);
}
function inputchange (e, index) {
//nvr
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList));
let NvrchangeList = JSON.parse(JSON.stringify(cascadeList));
NvrchangeList[index].name = e;
setNVRcameraList(NvrchangeList);
setCascadeList(NvrchangeList);
}
function allChoose (e) {
///
let chooseList = [];
if (NVRcameraList.length == nvrCheckList.length) {
setNvrCheckList([]);
if (cascadeList.length == CheckList.length) {
setCheckList([]);
setIsAllChoose(false);
} else {
for (let index = 0; index < NVRcameraList.length; index++) {
chooseList.push(NVRcameraList[index].id);
for (let index = 0; index < cascadeList.length; index++) {
chooseList.push(cascadeList[index].id);
}
setNvrCheckList(chooseList);
setCheckList(chooseList);
setIsAllChoose(true);
}
}
function playVideo (e) {
//nvr
console.log("22222222222222222");
e.stopPropagation();
}
function onDisabled (name) {
if ((cameraDataNvr && cameraData.name == name) || !cameraDataNvr) {
function onDisabled (id) {
if (id==cameraData.gbId) {
return false;
} else {
return true;
@ -140,6 +170,12 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
//
cascadeCameraForm: form.current.validate,
resetCascadeCamera: form.current.reset,
cascadeList: cascadeList.filter((v) =>
CheckList.some((e) => e == v.id)
),
toempty: () => {
setCascadeList([])
}
}));
return (
<>
@ -150,6 +186,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
labelWidth="115px"
onValueChange={(values) => {
console.log(values);
setFormData(values)
}}
getFormApi={(formApi) => (form.current = formApi)}
@ -202,14 +239,14 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
id="video_streaming"
style={{ maxHeight: 300, position: "relative" }}
>
{NVRcameraList.length > 0 ? (
{cascadeList.length > 0 ? (
<div
style={{ display: "flex", alignItems: "center", marginLeft: 211 }}
style={{ display: "flex", justifyContent: "flex-end", marginRight: 50 }}
>
<Radio
checked={isAllChoose}
mode="advanced"
disabled={true}
disabled={cameraData ? true : false}
onChange={(e) => allChoose(e)}
aria-label="全选"
>
@ -223,17 +260,17 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
type="pureCard"
direction="vertical"
aria-label="视频流获取"
value={nvrCheckList}
value={CheckList}
onChange={(nvrCheck) => {
setNvrCheckList(nvrCheck);
if (NVRcameraList.length == nvrCheck.length) {
setCheckList(nvrCheck);
if (cascadeList.length == nvrCheck.length) {
setIsAllChoose(true);
} else {
setIsAllChoose(false);
}
}}>
{NVRcameraList.length > 0
? NVRcameraList.map((item, index) => (
{cascadeList.length > 0
? cascadeList.map((item, index) => (
<Col
key={index}
span={12}
@ -245,7 +282,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
>
<Checkbox
value={item.id}
disabled={onDisabled(item.name)}
disabled={onDisabled(item.id)}
extra={
<div>
<div
@ -285,7 +322,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
color: "#1859C1",
}}
onClick={(e) =>
NvrChangeName(e, index, item.name)
NvrChangeName(e, index, item.id)
}
/>
</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.change = false;
// item.support = false;
if (item.camera) {
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 [venderList, setvenderList] = useState([]); //
const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); //
const [search, setSearch] = useState({}); //
const [rowId, setRowId] = useState(); //id
const [cameraData, setCameraData] = useState({}); //
const [modify, setModify] = useState(false); //
@ -123,16 +123,16 @@ const CameraHeader = (props) => {
onClick={() => {
if (deviceClickb.current) {
if (row.type == "nvr") {
setearch({ ...searchb.current, nvrId: row.nvr.id })
setSearch({ ...searchb.current, nvrId: row.nvr.id })
} else {
setearch({ ...searchb.current, externalDomain: row.externalDomain })
setSearch({ ...searchb.current, externalDomain: row.externalDomain })
}
deviceClickb.current = false
} else {
if (row.type == "nvr") {
setearch({ ...searchb.current, nvrId: null })
setSearch({ ...searchb.current, nvrId: null })
} else {
setearch({ ...searchb.current, externalDomain: null })
setSearch({ ...searchb.current, externalDomain: null })
}
deviceClickb.current = true
}
@ -205,7 +205,7 @@ const CameraHeader = (props) => {
row.forbidden
)
).then(() => {
equipmentGetCamera();
dispatch(equipmentWarehouse.getCamera(searchb.current));
});
}}
>
@ -227,7 +227,7 @@ const CameraHeader = (props) => {
row.forbidden
)
).then(() => {
equipmentGetCamera();
dispatch(equipmentWarehouse.getCamera(searchb.current));
});
}}
>
@ -244,7 +244,7 @@ const CameraHeader = (props) => {
dispatch(
equipmentWarehouse.delCamera(row.id)
).then(() => {
equipmentGetCamera();
dispatch(equipmentWarehouse.getCamera(searchb.current));
});
}}
>
@ -608,7 +608,7 @@ const CameraHeader = (props) => {
}}
onClick={() => {
api.current.validate().then((v) => {
setearch(v);
setSearch(v);
setQuery({ limit: 10, page: 0 })
searchb.current = { ...v, limit: 10, page: 0 }
});
@ -629,7 +629,7 @@ const CameraHeader = (props) => {
}}
onClick={() => {
api.current.reset();
setearch({});
setSearch({});
}}
>
重置
@ -772,7 +772,7 @@ const CameraHeader = (props) => {
setAddNvr(false)
setNvrNumber("")
setAxyData("")
equipmentGetCamera();
dispatch(equipmentWarehouse.getCamera(searchb.current));
}}
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 [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [search, setearch] = useState({}); //
const searchb = useRef(search)
const [rowId, setRowId] = useState(); //id
const [reminder, setReminder] = useState(false); //
const api = useRef();
@ -117,7 +118,7 @@ const NvrHeader = (props) => {
modalName="revise"
venderList={venderList}
close={() => {
equipmentGetNvr();
dispatch(equipmentWarehouse.getNvr(searchb.current));
}}
/>
</Button>
@ -137,7 +138,7 @@ const NvrHeader = (props) => {
position="topRight"
onConfirm={() => {
dispatch(equipmentWarehouse.delNvr(row.id)).then(() => {
equipmentGetNvr();
dispatch(equipmentWarehouse.getNvr(searchb.current));
});
}}
>
@ -453,6 +454,7 @@ const NvrHeader = (props) => {
api.current.validate().then((v) => {
setearch(v);
setQuery({ limit: 10, page: 0 })
searchb.current = { ...v, limit: 10, page: 0 }
});
}}
>

Loading…
Cancel
Save