|
@ -4,8 +4,9 @@ import { Form, Row, Col, Checkbox, Radio, CheckboxGroup, Input } from "@douyinfe |
|
|
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; |
|
|
import { VideoPlayModal } from "$components"; |
|
|
|
|
|
|
|
|
|
|
|
let equipmentScrollbar; |
|
|
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete, close, ashTrue, ashFalse }) { |
|
|
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete, close, ashTrue, ashFalse }) { |
|
|
const form = useRef(); |
|
|
const form = useRef(); |
|
|
const { equipmentWarehouse } = actions; |
|
|
const { equipmentWarehouse } = actions; |
|
@ -14,13 +15,16 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
const [CheckList, setCheckList] = useState([]); //nvr视频流多选 |
|
|
const [CheckList, setCheckList] = useState([]); //nvr视频流多选 |
|
|
const [isAllChoose, setIsAllChoose] = useState(false); //全选 |
|
|
const [isAllChoose, setIsAllChoose] = useState(false); //全选 |
|
|
const [formData, setFormData] = useState() //表单数据 |
|
|
const [formData, setFormData] = useState() //表单数据 |
|
|
console.log(cameraData.externalDomain) |
|
|
const [videoPlay, setVideoPlay] = useState(false);//播放 |
|
|
|
|
|
const [videoObj, setVideoObj] = useState(); //播放条件 |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => { |
|
|
dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => { |
|
|
setSip(res.payload.data); |
|
|
setSip(res.payload.data); |
|
|
if (cameraData.id) { |
|
|
if (cameraData.id) { |
|
|
let sip = res.payload.data.find((item) => item.streamid == cameraData.topSerialNo) |
|
|
let sip = res.payload.data.find((item) => item.streamid == cameraData.topSerialNo) |
|
|
dispatch(equipmentWarehouse.getCascadeStream({ sip: sip.sipip })).then((res) => { |
|
|
console.log(sip); |
|
|
|
|
|
dispatch(equipmentWarehouse.getCascadeStream({ streamId: sip.streamid })).then((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.id == cameraData.gbId |
|
|
(item) => item.id == cameraData.gbId |
|
@ -59,7 +63,8 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
//测试成功后获取级联视频流 |
|
|
//测试成功后获取级联视频流 |
|
|
if (testComplete) { |
|
|
if (testComplete) { |
|
|
dispatch(equipmentWarehouse.getCascadeStream({ sip: formData.sip })).then((res) => { |
|
|
console.log(formData); |
|
|
|
|
|
dispatch(equipmentWarehouse.getCascadeStream({ streamId: formData.streamId })).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) => { |
|
@ -115,7 +120,6 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
function NvrChangeName (e, index, id) { |
|
|
function NvrChangeName (e, index, id) { |
|
|
//级联摄像头视频流获取修改名称 |
|
|
//级联摄像头视频流获取修改名称 |
|
|
let NvrchangeList = JSON.parse(JSON.stringify(cascadeList)); |
|
|
let NvrchangeList = JSON.parse(JSON.stringify(cascadeList)); |
|
|
console.log(!cameraData.gbId) |
|
|
|
|
|
if (!cameraData.gbId || cameraData.gbId == id) { |
|
|
if (!cameraData.gbId || cameraData.gbId == id) { |
|
|
NvrchangeList[index].change = true; |
|
|
NvrchangeList[index].change = true; |
|
|
setCascadeList(NvrchangeList); |
|
|
setCascadeList(NvrchangeList); |
|
@ -148,10 +152,20 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
setIsAllChoose(true); |
|
|
setIsAllChoose(true); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
function playVideo (e) { |
|
|
function playVideo (e, id) { |
|
|
//nvr播放视频 |
|
|
//nvr播放视频 |
|
|
console.log("22222222222222222"); |
|
|
if (cameraData.gbId == id || !cameraData.gbId) { |
|
|
|
|
|
let data = cascadeList.find((item) => item.id == id) |
|
|
|
|
|
console.log(formData); |
|
|
|
|
|
setVideoObj({ |
|
|
|
|
|
type: 'cascade', |
|
|
|
|
|
audio: false, |
|
|
|
|
|
serialNo: data.streamid, |
|
|
|
|
|
topSerialNo: cameraData.id ? cameraData.topSerialNo : formData?.streamId, |
|
|
|
|
|
playUrlSd: data?.playUrl?.liveUrl?.sd["WS-RAW"], |
|
|
|
|
|
}) |
|
|
|
|
|
setVideoPlay(true); |
|
|
|
|
|
} |
|
|
e.stopPropagation(); |
|
|
e.stopPropagation(); |
|
|
} |
|
|
} |
|
|
function onDisabled (id) { |
|
|
function onDisabled (id) { |
|
@ -181,7 +195,6 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
labelAlign="left" |
|
|
labelAlign="left" |
|
|
labelWidth="115px" |
|
|
labelWidth="115px" |
|
|
onValueChange={(values) => { |
|
|
onValueChange={(values) => { |
|
|
console.log(values) |
|
|
|
|
|
setFormData(values) |
|
|
setFormData(values) |
|
|
let setting = ["externalDomain", "cascadeType", "sip"] |
|
|
let setting = ["externalDomain", "cascadeType", "sip"] |
|
|
let b = {} |
|
|
let b = {} |
|
@ -227,15 +240,16 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
<Col span={14}> |
|
|
<Col span={14}> |
|
|
<Form.Select |
|
|
<Form.Select |
|
|
label="SIP编号:" |
|
|
label="SIP编号:" |
|
|
field="sip" |
|
|
field="streamId" |
|
|
|
|
|
disabled={cameraData.id ? true : false} |
|
|
initValue={parentCamera || ""} |
|
|
initValue={parentCamera || ""} |
|
|
placeholder="请选择SIP编号" |
|
|
placeholder="请选择SIP编号" |
|
|
style={{ width: 307 }} |
|
|
style={{ width: 307 }} |
|
|
rules={[{ required: true, message: "请选择SIP编号" }]} |
|
|
rules={[{ required: true, message: "请选择SIP编号" }]} |
|
|
> |
|
|
> |
|
|
{sip.map((item, index) => ( |
|
|
{sip.map((item, index) => ( |
|
|
<Form.Select.Option key={index} value={item.sipip}> |
|
|
<Form.Select.Option key={index} value={item.streamid}> |
|
|
{item.sipip} |
|
|
{item.streamid} |
|
|
</Form.Select.Option> |
|
|
</Form.Select.Option> |
|
|
))} |
|
|
))} |
|
|
</Form.Select> |
|
|
</Form.Select> |
|
@ -349,7 +363,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
<IconPlayCircle |
|
|
<IconPlayCircle |
|
|
size="extra-large" |
|
|
size="extra-large" |
|
|
style={{ color: "#1859C1" }} |
|
|
style={{ color: "#1859C1" }} |
|
|
onClick={(e) => playVideo(e)} |
|
|
onClick={(e) => playVideo(e, item.id)} |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -364,6 +378,15 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
|
|
|
|
|
</Row> |
|
|
</Row> |
|
|
</Form> |
|
|
</Form> |
|
|
|
|
|
{videoPlay ? |
|
|
|
|
|
<VideoPlayModal |
|
|
|
|
|
visible={true} |
|
|
|
|
|
videoObj={videoObj} |
|
|
|
|
|
close={() => { |
|
|
|
|
|
setVideoPlay(false) |
|
|
|
|
|
}} /> |
|
|
|
|
|
: "" |
|
|
|
|
|
} |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|