diff --git a/public/config/config.json b/public/config/config.json index 9110c3f..54966b0 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "sm", + "systemType": "gm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ @@ -65,7 +65,7 @@ "useApprovalDesc": "是否使用审批", "useApproval": "true", "useGatewayDesc": "sm是否走网关", - "useGateway": "false", + "useGateway": "true", "isOpenDebugDesc": "视频播放插件是否开启debug", "isOpenDebug": "true" } diff --git a/public/config/config.json b/public/config/config.json index 9110c3f..54966b0 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "sm", + "systemType": "gm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ @@ -65,7 +65,7 @@ "useApprovalDesc": "是否使用审批", "useApproval": "true", "useGatewayDesc": "sm是否走网关", - "useGateway": "false", + "useGateway": "true", "isOpenDebugDesc": "视频播放插件是否开启debug", "isOpenDebug": "true" } diff --git a/src/router/modules/monitor.ts b/src/router/modules/monitor.ts index e269664..b8ed151 100644 --- a/src/router/modules/monitor.ts +++ b/src/router/modules/monitor.ts @@ -22,8 +22,8 @@ // import('@/views/monitor/realTime/index-noPlugin-single.vue'), // SDK单路 // import('@/views/monitor/realTime/index-noPlugin.vue'), // SDK4路 // import('@/views/monitor/realTime/index-isc-single.vue'), // isc - import('@/views/monitor/realTime/index-media-single.vue'), // 商流媒体单路 - // import('@/views/monitor/realTime/index-new-gm-plugin.vue'), // 国 + // import('@/views/monitor/realTime/index-media-single.vue'), // 商流媒体单路 + import('@/views/monitor/realTime/index-new-gm-plugin.vue'), // 国 meta: { title: '实时监控', auth: '/realTime', diff --git a/public/config/config.json b/public/config/config.json index 9110c3f..54966b0 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "sm", + "systemType": "gm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ @@ -65,7 +65,7 @@ "useApprovalDesc": "是否使用审批", "useApproval": "true", "useGatewayDesc": "sm是否走网关", - "useGateway": "false", + "useGateway": "true", "isOpenDebugDesc": "视频播放插件是否开启debug", "isOpenDebug": "true" } diff --git a/src/router/modules/monitor.ts b/src/router/modules/monitor.ts index e269664..b8ed151 100644 --- a/src/router/modules/monitor.ts +++ b/src/router/modules/monitor.ts @@ -22,8 +22,8 @@ // import('@/views/monitor/realTime/index-noPlugin-single.vue'), // SDK单路 // import('@/views/monitor/realTime/index-noPlugin.vue'), // SDK4路 // import('@/views/monitor/realTime/index-isc-single.vue'), // isc - import('@/views/monitor/realTime/index-media-single.vue'), // 商流媒体单路 - // import('@/views/monitor/realTime/index-new-gm-plugin.vue'), // 国 + // import('@/views/monitor/realTime/index-media-single.vue'), // 商流媒体单路 + import('@/views/monitor/realTime/index-new-gm-plugin.vue'), // 国 meta: { title: '实时监控', auth: '/realTime', diff --git a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue index d72a44e..12080e1 100644 --- a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue +++ b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue @@ -83,7 +83,7 @@ if (data.device.deviceStatusName === '离线') { ElMessage.warning(`设备 ${data.device.monitorName} 离线`) - // return false + return false } const now = new Date().getTime() diff --git a/public/config/config.json b/public/config/config.json index 9110c3f..54966b0 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "sm", + "systemType": "gm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ @@ -65,7 +65,7 @@ "useApprovalDesc": "是否使用审批", "useApproval": "true", "useGatewayDesc": "sm是否走网关", - "useGateway": "false", + "useGateway": "true", "isOpenDebugDesc": "视频播放插件是否开启debug", "isOpenDebug": "true" } diff --git a/src/router/modules/monitor.ts b/src/router/modules/monitor.ts index e269664..b8ed151 100644 --- a/src/router/modules/monitor.ts +++ b/src/router/modules/monitor.ts @@ -22,8 +22,8 @@ // import('@/views/monitor/realTime/index-noPlugin-single.vue'), // SDK单路 // import('@/views/monitor/realTime/index-noPlugin.vue'), // SDK4路 // import('@/views/monitor/realTime/index-isc-single.vue'), // isc - import('@/views/monitor/realTime/index-media-single.vue'), // 商流媒体单路 - // import('@/views/monitor/realTime/index-new-gm-plugin.vue'), // 国 + // import('@/views/monitor/realTime/index-media-single.vue'), // 商流媒体单路 + import('@/views/monitor/realTime/index-new-gm-plugin.vue'), // 国 meta: { title: '实时监控', auth: '/realTime', diff --git a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue index d72a44e..12080e1 100644 --- a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue +++ b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue @@ -83,7 +83,7 @@ if (data.device.deviceStatusName === '离线') { ElMessage.warning(`设备 ${data.device.monitorName} 离线`) - // return false + return false } const now = new Date().getTime() diff --git a/src/views/monitor/realTime/index-new-gm-plugin.vue b/src/views/monitor/realTime/index-new-gm-plugin.vue index ddf5179..29b7d0c 100644 --- a/src/views/monitor/realTime/index-new-gm-plugin.vue +++ b/src/views/monitor/realTime/index-new-gm-plugin.vue @@ -161,7 +161,7 @@ } } -function handleNodeClick(data: any, node: any, self: any, isDrag = false) { +function handleNodeClick(data: any, node: any, self: any) { console.log('获取设备信息', data) if (data.device.deviceStatusName === '离线') { ElMessage.warning(`设备 ${data.device.monitorName} 离线`) @@ -169,95 +169,97 @@ } const now = new Date().getTime() - if (now - treeClickCount < 300 || isDrag) { // 双击事件的判断,300毫秒内重复点击 - if (data && data.children && data.children?.length !== 0) { // 点击父亲 + if (now - treeClickCount < 300) { // 双击事件的判断,300毫秒内重复点击 + paly(data) + } + treeClickCount = now +} + +function paly(data: any) { + if (data && data.children && data.children?.length !== 0) { // 点击父亲 + return + } + // 不播放重复的视频 + for (let i = 0; i < currentIndex; i++) { // 前面有 + if (currentData.value[i].id === data.device.id) { + ElMessage.warning('当前选中摄像头正在播放') return } - // 不播放重复的视频 - for (let i = 0; i < currentIndex; i++) { // 前面有 - if (currentData.value[i].id === data.device.id) { - ElMessage.warning('当前选中摄像头正在播放') - return - } - } + } - // 这里处理双击事件 - if (videoCount.value === 4 && currentIndex === 4) { - currentIndex = 0 - } - leafLoading.value = true + // 这里处理双击事件 + if (videoCount.value === 4 && currentIndex === 4) { + currentIndex = 0 + } + leafLoading.value = true + if (videoCount.value === 4) { + showLoadingTextSplit4.value[currentIndex] = true + loadingTestSplit4.value[currentIndex] = '视频加载中,请稍等...' + } + else { + showLoadingText.value = true + loadingTest.value = '视频加载中,请稍等...' + } + + currentLeafId.value = data.device.id + + // 先停心跳 + if (timers.value[currentIndex]) { + clearInterval(timers.value[currentIndex]) + } + + // 播下一个流先停止上一个流 + if (currentStreamId.value[currentIndex]) { + handleStopStream(currentStreamId.value[currentIndex]) + } + + console.log('currentIndex', currentIndex) + + // -------------------------------区域绘制--------------------------------------------- + // if (currentData.value[currentIndex] && currentData.value[currentIndex].deviceBoundaryDTOS && currentData.value[currentIndex].deviceBoundaryDTOS.length) { + // draw(currentData.value[currentIndex].deviceBoundaryDTOS.filter((item: { boundary: string }) => item.boundary)) + if (data.device && data.device.deviceBoundaryDTOS && data.device.deviceBoundaryDTOS.length) { + draw(data.device.deviceBoundaryDTOS.filter((item: { boundary: string }) => item.boundary)) + } + else { + points.value = [] + drawPoints.value = [] + } + // 获取视频流接口 + fetchStream(data.device.cameraIndexCode).then(async (res: any) => { + leafLoading.value = false if (videoCount.value === 4) { - showLoadingTextSplit4.value[currentIndex] = true - loadingTestSplit4.value[currentIndex] = '视频加载中,请稍等...' + showLoadingTextSplit4.value[currentIndex] = false } else { - showLoadingText.value = true - loadingTest.value = '视频加载中,请稍等...' + showLoadingText.value = false } - currentLeafId.value = data.device.id - - // 先停心跳 - if (timers.value[currentIndex]) { - clearInterval(timers.value[currentIndex]) + const { url, createStreamResponseId } = res + videoUrl.value[currentIndex] = `${url}?token=${window.localStorage.getItem('token')}` + jessibucaRef.value[currentIndex]?.changeUrl(videoUrl.value[currentIndex]) + title.value[currentIndex] = data.device.monitorName.replace('-', ' - ') + currentData.value[currentIndex] = data.device + // 记录正在播的流的国标号 + currentStreamId.value[currentIndex] = createStreamResponseId + // ------------------------------------------------------------------------------------ + // 发送心跳 + timers.value[currentIndex] = setInterval(() => { + handleSendHeart(createStreamResponseId[currentIndex]) + }, Number(window.localStorage.getItem('timeGap'))) + if (videoCount.value === 4) { + currentIndex++ } - - // 播下一个流先停止上一个流 - if (currentStreamId.value[currentIndex]) { - handleStopStream(currentStreamId.value[currentIndex]) - } - - console.log('currentIndex', currentIndex) - - // -------------------------------区域绘制--------------------------------------------- - // if (currentData.value[currentIndex] && currentData.value[currentIndex].deviceBoundaryDTOS && currentData.value[currentIndex].deviceBoundaryDTOS.length) { - // draw(currentData.value[currentIndex].deviceBoundaryDTOS.filter((item: { boundary: string }) => item.boundary)) - if (data.device && data.device.deviceBoundaryDTOS && data.device.deviceBoundaryDTOS.length) { - draw(data.device.deviceBoundaryDTOS.filter((item: { boundary: string }) => item.boundary)) + }).catch(() => { + // ElMessage.warning('未获取到流!请联系管理员!') + leafLoading.value = false + if (videoCount.value === 1) { + loadingTest.value = '未获取到流!请联系管理员!' } else { - points.value = [] - drawPoints.value = [] + loadingTestSplit4.value[currentIndex] = '未获取到流!请联系管理员!' } - // 获取视频流接口 - fetchStream(data.device.cameraIndexCode).then(async (res: any) => { - leafLoading.value = false - if (videoCount.value === 4) { - showLoadingTextSplit4.value[currentIndex] = false - } - else { - showLoadingText.value = false - } - - const { url, createStreamResponseId } = res - videoUrl.value[currentIndex] = `${url}?token=${window.localStorage.getItem('token')}` - jessibucaRef.value[currentIndex]?.changeUrl(videoUrl.value[currentIndex]) - title.value[currentIndex] = data.device.monitorName.replace('-', ' - ') - currentData.value[currentIndex] = data.device - // 记录正在播的流的国标号 - currentStreamId.value[currentIndex] = createStreamResponseId - // ------------------------------------------------------------------------------------ - // 发送心跳 - timers.value[currentIndex] = setInterval(() => { - handleSendHeart(createStreamResponseId[currentIndex]) - }, Number(window.localStorage.getItem('timeGap'))) - if (videoCount.value === 4) { - currentIndex++ - } - }).catch(() => { - // ElMessage.warning('未获取到流!请联系管理员!') - leafLoading.value = false - if (videoCount.value === 1) { - loadingTest.value = '未获取到流!请联系管理员!' - } - else { - loadingTestSplit4.value[currentIndex] = '未获取到流!请联系管理员!' - } - }) - } - if (!isDrag) { - treeClickCount = now - } + }) } const testurl = { @@ -442,7 +444,13 @@ event.preventDefault() const deviceData = JSON.parse(event.dataTransfer?.getData('text/plain') as string) if (deviceData) { - handleNodeClick({ device: { ...deviceData } }, null, null, true) + // handleNodeClick({ device: { ...deviceData } }, null, null, true) + console.log('拖拽获取的数据', deviceData); + if (deviceData.deviceStatusName === '离线') { + ElMessage.warning(`设备 ${deviceData.monitorName} 离线`) + return false + } + paly({ device: { ...deviceData } }) } else { ElMessage.warning('请拖拽摄像头')