|
@ -9,14 +9,15 @@ import { |
|
|
Checkbox, |
|
|
Checkbox, |
|
|
Radio, |
|
|
Radio, |
|
|
Input, |
|
|
Input, |
|
|
|
|
|
Spin, |
|
|
} from "@douyinfe/semi-ui"; |
|
|
} from "@douyinfe/semi-ui"; |
|
|
import { IconEdit, IconPlayCircle } from "@douyinfe/semi-icons"; |
|
|
import { IconEdit, IconPlayCircle, IconTickCircle } from "@douyinfe/semi-icons"; |
|
|
import "./cameraModal.less"; |
|
|
import "./cameraModal.less"; |
|
|
import PerfectScrollbar from "perfect-scrollbar"; |
|
|
import PerfectScrollbar from "perfect-scrollbar"; |
|
|
import { isIndexed } from "immutable"; |
|
|
import { isIndexed } from "immutable"; |
|
|
|
|
|
|
|
|
let equipmentScrollbar; |
|
|
let equipmentScrollbar; |
|
|
function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
function nvrCamera ({ dispatch, actions, nvrRef, cameraData, addNvr, nvrNumber }) { |
|
|
const { equipmentWarehouse } = actions; |
|
|
const { equipmentWarehouse } = actions; |
|
|
const cameraDataNvr = cameraData.nvr || ""; |
|
|
const cameraDataNvr = cameraData.nvr || ""; |
|
|
const form = useRef(); |
|
|
const form = useRef(); |
|
@ -24,6 +25,10 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
const [NVRcameraList, setNVRcameraList] = useState([]); //nvr视频流列表 |
|
|
const [NVRcameraList, setNVRcameraList] = useState([]); //nvr视频流列表 |
|
|
const [isAllChoose, setIsAllChoose] = useState(false); //全选 |
|
|
const [isAllChoose, setIsAllChoose] = useState(false); //全选 |
|
|
const [equipmentNum, setEquipmentNum] = useState(""); //nvr视频编号 |
|
|
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(() => { |
|
|
useEffect(() => { |
|
|
NVRcameraList |
|
|
NVRcameraList |
|
@ -39,19 +44,19 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
cameraDataNvr |
|
|
if (cameraDataNvr) { |
|
|
? dispatch( |
|
|
setloading(true); |
|
|
|
|
|
setstep("block"); |
|
|
|
|
|
dispatch( |
|
|
equipmentWarehouse.getVideoStreaming({ |
|
|
equipmentWarehouse.getVideoStreaming({ |
|
|
streamId: cameraDataNvr.serialNo, |
|
|
streamId: cameraDataNvr.serialNo, |
|
|
}) |
|
|
}) |
|
|
).then((res) => { |
|
|
).then((res) => { |
|
|
|
|
|
console.log(res) |
|
|
let oneData = res.payload.data[0]; |
|
|
let oneData = res.payload.data[0]; |
|
|
|
|
|
|
|
|
let modifyData = res.payload.data.find( |
|
|
let modifyData = res.payload.data.find( |
|
|
(item) => item.camera.name == cameraData.name |
|
|
(item) => item.camera == null ? false : item.camera.name == cameraData.name |
|
|
); |
|
|
); |
|
|
console.log(oneData); |
|
|
|
|
|
console.log(modifyData); |
|
|
|
|
|
let data = res.payload.data.map((item, index) => { |
|
|
let data = res.payload.data.map((item, index) => { |
|
|
if (index == 0) { |
|
|
if (index == 0) { |
|
|
item = modifyData; |
|
|
item = modifyData; |
|
@ -68,15 +73,55 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
if (item.camera) { |
|
|
if (item.camera) { |
|
|
item.name = item.camera.name; |
|
|
item.name = item.camera.name; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return item; |
|
|
return item; |
|
|
}); |
|
|
}); |
|
|
console.log(data); |
|
|
|
|
|
setNVRcameraList(data); |
|
|
setNVRcameraList(data); |
|
|
|
|
|
|
|
|
setNvrCheckList([data[0].id]); |
|
|
setNvrCheckList([data[0].id]); |
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
setloadingTip("接入完成"); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
setstep("none"); |
|
|
|
|
|
setloading(false); |
|
|
|
|
|
setstepp("block"); |
|
|
|
|
|
setloadingTip("正在接入视频流..."); |
|
|
|
|
|
}, 800); |
|
|
|
|
|
}, 800) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
: ""; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//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) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, []); |
|
|
}, []); |
|
|
function NvrChangeName (e, index, name) { |
|
|
function NvrChangeName (e, index, name) { |
|
|
//nvr摄像头视频流获取修改名称 |
|
|
//nvr摄像头视频流获取修改名称 |
|
@ -96,15 +141,12 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
function inputchange (e, index) { |
|
|
function inputchange (e, index) { |
|
|
//nvr摄像头名称修改 |
|
|
//nvr摄像头名称修改 |
|
|
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList)); |
|
|
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList)); |
|
|
console.log(e); |
|
|
|
|
|
NvrchangeList[index].name = e; |
|
|
NvrchangeList[index].name = e; |
|
|
setNVRcameraList(NvrchangeList); |
|
|
setNVRcameraList(NvrchangeList); |
|
|
} |
|
|
} |
|
|
function toggle (e, index) { |
|
|
function toggle (e, index) { |
|
|
//nvr云台支持 |
|
|
//nvr云台支持 |
|
|
console.log(e) |
|
|
|
|
|
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList)); |
|
|
let NvrchangeList = JSON.parse(JSON.stringify(NVRcameraList)); |
|
|
console.log(NvrchangeList) |
|
|
|
|
|
NvrchangeList[index].support = e.target.checked; |
|
|
NvrchangeList[index].support = e.target.checked; |
|
|
setNVRcameraList(NvrchangeList); |
|
|
setNVRcameraList(NvrchangeList); |
|
|
e.stopPropagation(); |
|
|
e.stopPropagation(); |
|
@ -118,20 +160,31 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
let valuess = JSON.parse(JSON.stringify(values)); |
|
|
let valuess = JSON.parse(JSON.stringify(values)); |
|
|
valuess.streamId = values.serialNo; |
|
|
valuess.streamId = values.serialNo; |
|
|
delete valuess.serialNo; |
|
|
delete valuess.serialNo; |
|
|
|
|
|
setloading(true); |
|
|
|
|
|
setstep("block"); |
|
|
dispatch(equipmentWarehouse.getVideoStreaming(valuess)).then((res) => { |
|
|
dispatch(equipmentWarehouse.getVideoStreaming(valuess)).then((res) => { |
|
|
let data = res.payload.data.map((item) => { |
|
|
let data = res.payload.data.map((item) => { |
|
|
item.change = false; |
|
|
item.change = false; |
|
|
item.support = false; |
|
|
item.support = false; |
|
|
return item; |
|
|
return item; |
|
|
}); |
|
|
}); |
|
|
console.log(data); |
|
|
|
|
|
setNVRcameraList(data); |
|
|
setNVRcameraList(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); |
|
|
} |
|
|
} |
|
|
console.log(chooseList); |
|
|
|
|
|
setNvrCheckList(chooseList); |
|
|
setNvrCheckList(chooseList); |
|
|
setIsAllChoose(true); |
|
|
setIsAllChoose(true); |
|
|
|
|
|
if (res.success) { |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
setloadingTip("接入完成"); |
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
setstep("none"); |
|
|
|
|
|
setloading(false); |
|
|
|
|
|
setstepp("block"); |
|
|
|
|
|
setloadingTip("正在接入视频流..."); |
|
|
|
|
|
}, 800); |
|
|
|
|
|
}, 800) |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}) |
|
|
}) |
|
|
.catch((errors) => { |
|
|
.catch((errors) => { |
|
@ -169,7 +222,7 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
//传给父组件方法 |
|
|
//传给父组件方法 |
|
|
//aa即为子组件暴露给父组件的方法 |
|
|
//aa即为子组件暴露给父组件的方法 |
|
|
resetFluoriteCamera: form.current.reset, |
|
|
resetFluoriteCamera: form.current.reset, |
|
|
equipmentNum: cameraDataNvr ? cameraDataNvr.serialNo : equipmentNum, |
|
|
equipmentNum: cameraDataNvr ? cameraDataNvr.serialNo : addNvr ? nvrNumber : equipmentNum, |
|
|
NVRcameraList: NVRcameraList.filter((v) => |
|
|
NVRcameraList: NVRcameraList.filter((v) => |
|
|
nvrCheckList.some((e) => e == v.id) |
|
|
nvrCheckList.some((e) => e == v.id) |
|
|
), |
|
|
), |
|
@ -191,8 +244,8 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
field="serialNo" |
|
|
field="serialNo" |
|
|
maxLength="39" |
|
|
maxLength="39" |
|
|
label="设备编号:" |
|
|
label="设备编号:" |
|
|
disabled={cameraDataNvr ? true : false} |
|
|
disabled={cameraDataNvr ? true : addNvr ? true : false} |
|
|
initValue={cameraDataNvr ? cameraDataNvr.serialNo : ""} |
|
|
initValue={cameraDataNvr ? cameraDataNvr.serialNo : addNvr ? nvrNumber : ""} |
|
|
placeholder="请输入设备编号" |
|
|
placeholder="请输入设备编号" |
|
|
style={{ width: 307 }} |
|
|
style={{ width: 307 }} |
|
|
rules={[ |
|
|
rules={[ |
|
@ -248,6 +301,8 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
id="video_streaming" |
|
|
id="video_streaming" |
|
|
style={{ maxHeight: 300, position: "relative" }} |
|
|
style={{ maxHeight: 300, position: "relative" }} |
|
|
> |
|
|
> |
|
|
|
|
|
<Spin tip={loadingTip} spinning={isloading}> |
|
|
|
|
|
<div style={{ display: stepp }}> |
|
|
{NVRcameraList.length > 0 |
|
|
{NVRcameraList.length > 0 |
|
|
? NVRcameraList.map((item, index) => ( |
|
|
? NVRcameraList.map((item, index) => ( |
|
|
<Col |
|
|
<Col |
|
@ -339,6 +394,10 @@ function nvrCamera({ dispatch, actions, nvrRef, cameraData }) { |
|
|
)) |
|
|
)) |
|
|
: ""} |
|
|
: ""} |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div style={{ height: 50, width: "100%", display: step }}></div> |
|
|
|
|
|
</Spin> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
</CheckboxGroup> |
|
|
</CheckboxGroup> |
|
|
</Row> |
|
|
</Row> |
|
|
</Form> |
|
|
</Form> |
|
|