|
|
|
@ -16,7 +16,7 @@ import {ColumnDrawer as DeviceCategoryColumnDrawer} from "@/pages/Device/DeviceC
|
|
|
|
|
import {
|
|
|
|
|
deleteDeviceDeleteDevice,
|
|
|
|
|
postDeviceGetDeviceList,
|
|
|
|
|
deleteDeviceDeleteDeviceByIds
|
|
|
|
|
deleteDeviceDeleteDeviceByIds, postDeviceOpenRtspCamera, postDeviceCloseRtspCamera
|
|
|
|
|
} from '@/services/device/Device';
|
|
|
|
|
import {PlusOutlined, RedoOutlined} from '@ant-design/icons';
|
|
|
|
|
import type {ActionType, ProColumns} from '@ant-design/pro-components';
|
|
|
|
@ -73,8 +73,8 @@ const DeviceList: React.FC = () => {
|
|
|
|
|
const [hasInit, setHasInit] = useState<boolean>(false)
|
|
|
|
|
const [nodeTreeData, setNodeTreeData] = React.useState<DataNode[]>([]);
|
|
|
|
|
const [selectNodes, setSelectNodes] = React.useState<any[]>([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [videoOpening, setVideoOpening] = useState<boolean>(false);
|
|
|
|
|
const [videoServerParam, setVideoServerParam] = useState<API.RtspRes>({})
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
postDeviceGroupGetDeviceGroupTree().then((resp) => {
|
|
|
|
|
setNodeTreeData(resp.data.tree)
|
|
|
|
@ -86,7 +86,13 @@ const DeviceList: React.FC = () => {
|
|
|
|
|
const handleVideoModal = ()=>{
|
|
|
|
|
if (videoModalOpen) {
|
|
|
|
|
setVideoModalOpen(false)
|
|
|
|
|
if (videoServerParam?.pid || 0) {
|
|
|
|
|
postDeviceCloseRtspCamera({pid: videoServerParam.pid}).then((resp) => {
|
|
|
|
|
console.log(resp)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
setCurrentRow(undefined)
|
|
|
|
|
setVideoServerParam({})
|
|
|
|
|
} else {
|
|
|
|
|
setVideoModalOpen(true)
|
|
|
|
|
}
|
|
|
|
@ -394,8 +400,24 @@ const DeviceList: React.FC = () => {
|
|
|
|
|
<a
|
|
|
|
|
key="video"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setVideoModalOpen(true);
|
|
|
|
|
setCurrentRow(record);
|
|
|
|
|
setVideoOpening(true)
|
|
|
|
|
if (record.param) {
|
|
|
|
|
postDeviceOpenRtspCamera({url: record.param}).then((resp) => {
|
|
|
|
|
setVideoServerParam(resp.data)
|
|
|
|
|
setVideoOpening(false)
|
|
|
|
|
setVideoModalOpen(true);
|
|
|
|
|
console.log(resp.data)
|
|
|
|
|
setCurrentRow(record);
|
|
|
|
|
}).catch(()=>{
|
|
|
|
|
setVideoOpening(false)
|
|
|
|
|
message.error(intl.formatMessage({id: 'common.open_failure', defaultMessage: '$$$'}))
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
setVideoOpening(false)
|
|
|
|
|
message.error(intl.formatMessage({id: 'common.open_failure', defaultMessage: '$$$'}))
|
|
|
|
|
}
|
|
|
|
|
// setVideoModalOpen(true);
|
|
|
|
|
// setCurrentRow(record);
|
|
|
|
|
}}>
|
|
|
|
|
<FormattedMessage id="common.open_video" defaultMessage="$$$" />
|
|
|
|
|
</a>
|
|
|
|
@ -430,6 +452,10 @@ const DeviceList: React.FC = () => {
|
|
|
|
|
id: 'pages.searchTable.title',
|
|
|
|
|
defaultMessage: '$$$',
|
|
|
|
|
})}
|
|
|
|
|
loading={{tip: intl.formatMessage({
|
|
|
|
|
id: 'common.video_opening',
|
|
|
|
|
defaultMessage: '$$$'
|
|
|
|
|
}), spinning: videoOpening}}
|
|
|
|
|
options={{fullScreen: true, setting: true, density: true, reload: true}}
|
|
|
|
|
actionRef={actionRef}
|
|
|
|
|
rowKey="key"
|
|
|
|
@ -612,6 +638,7 @@ const DeviceList: React.FC = () => {
|
|
|
|
|
<VideoModal modalOpen={videoModalOpen}
|
|
|
|
|
handleModal={handleVideoModal}
|
|
|
|
|
values={currentRow || {}}
|
|
|
|
|
videoServerParam={videoServerParam}
|
|
|
|
|
reload={actionRef.current?.reload}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|