|
|
@ -6,7 +6,7 @@ import "./cameraModal.less"; |
|
|
|
import PerfectScrollbar from "perfect-scrollbar"; |
|
|
|
let equipmentScrollbar; |
|
|
|
|
|
|
|
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete, close }) { |
|
|
|
function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, testComplete, close, ashTrue, ashFalse }) { |
|
|
|
const form = useRef(); |
|
|
|
const { equipmentWarehouse } = actions; |
|
|
|
const [sip, setSip] = useState([]); |
|
|
@ -14,33 +14,27 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
const [CheckList, setCheckList] = useState([]); //nvr视频流多选 |
|
|
|
const [isAllChoose, setIsAllChoose] = useState(false); //全选 |
|
|
|
const [formData, setFormData] = useState() //表单数据 |
|
|
|
|
|
|
|
console.log(cameraData.externalDomain) |
|
|
|
useEffect(() => { |
|
|
|
dispatch(equipmentWarehouse.getCascadeSIP()).then((res) => { |
|
|
|
setSip(res.payload.data); |
|
|
|
if (cameraData) { |
|
|
|
if (cameraData.id) { |
|
|
|
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 (item.id == cameraData.gbId) { |
|
|
|
item = oneData; |
|
|
|
} |
|
|
|
if (index == 0) { |
|
|
|
item = modifyData; |
|
|
|
} |
|
|
|
if ( |
|
|
|
|
|
|
|
item.camera&&item.camera.name == cameraData.name |
|
|
|
|
|
|
|
) { |
|
|
|
item = oneData; |
|
|
|
} |
|
|
|
return item; |
|
|
|
}) |
|
|
|
setCascadeList(data) |
|
|
@ -69,7 +63,9 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
console.log(res.payload.data); |
|
|
|
let chooseList = []; |
|
|
|
let data = res.payload.data.map((item, index) => { |
|
|
|
item.change = false; |
|
|
|
if (item.camera) { |
|
|
|
item.name = item.camera.name; |
|
|
|
} |
|
|
|
return item; |
|
|
|
}) |
|
|
|
setCascadeList(data) |
|
|
@ -119,7 +115,8 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
function NvrChangeName (e, index, id) { |
|
|
|
//级联摄像头视频流获取修改名称 |
|
|
|
let NvrchangeList = JSON.parse(JSON.stringify(cascadeList)); |
|
|
|
if (!cameraData||cameraData.gbId==id) { |
|
|
|
console.log(!cameraData.gbId) |
|
|
|
if (!cameraData.gbId || cameraData.gbId == id) { |
|
|
|
NvrchangeList[index].change = true; |
|
|
|
setCascadeList(NvrchangeList); |
|
|
|
} |
|
|
@ -158,7 +155,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
e.stopPropagation(); |
|
|
|
} |
|
|
|
function onDisabled (id) { |
|
|
|
if (id==cameraData.gbId) { |
|
|
|
if (id == cameraData.gbId || !cameraData.gbId) { |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
return true; |
|
|
@ -180,15 +177,27 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<Form |
|
|
|
allowEmpty |
|
|
|
labelPosition="left" |
|
|
|
labelAlign="left" |
|
|
|
labelWidth="115px" |
|
|
|
onValueChange={(values) => { |
|
|
|
console.log(values); |
|
|
|
console.log(values) |
|
|
|
setFormData(values) |
|
|
|
let setting = ["externalDomain", "cascadeType", "sip"] |
|
|
|
let b = {} |
|
|
|
setting.map((item) => { |
|
|
|
if (values.hasOwnProperty(item)) { |
|
|
|
return b.true = values.hasOwnProperty(item) |
|
|
|
} else { |
|
|
|
return b.false = values.hasOwnProperty(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
Object.keys(b).length == 1 ? ashTrue() : ashFalse() |
|
|
|
|
|
|
|
}} |
|
|
|
initValues={{ |
|
|
|
externalDomain: cameraData.externalDomain || "" |
|
|
|
}} |
|
|
|
getFormApi={(formApi) => (form.current = formApi)} |
|
|
|
> |
|
|
|
<Row> |
|
|
@ -197,7 +206,6 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
field="externalDomain" |
|
|
|
label="外域名称:" |
|
|
|
maxLength="36" |
|
|
|
initValue={cameraData.externalDomain || ""} |
|
|
|
placeholder="请输入外域 名称,例如“xxx市级平台”" |
|
|
|
style={{ width: 307 }} |
|
|
|
rules={[{ required: true, message: "请输入外域名称" }]} |
|
|
@ -246,7 +254,7 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes |
|
|
|
<Radio |
|
|
|
checked={isAllChoose} |
|
|
|
mode="advanced" |
|
|
|
disabled={cameraData ? true : false} |
|
|
|
disabled={cameraData.gbId ? true : false} |
|
|
|
onChange={(e) => allChoose(e)} |
|
|
|
aria-label="全选" |
|
|
|
> |
|
|
|