diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/src/api/monitor/media.ts b/src/api/monitor/media.ts index 4b91507..57034fd 100644 --- a/src/api/monitor/media.ts +++ b/src/api/monitor/media.ts @@ -21,8 +21,9 @@ } // 启用 -export function startBox(data: { app: string; stream: string }, accessToken: string) { +export function startBox(data: { app: string; stream: string }, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: 'api/proxy/start', headers: { 'access-token': accessToken }, method: 'get', @@ -31,8 +32,9 @@ } // 获取识别流地址 -export function getRecognitionUrl(data: { app: string; stream: string; mediaServerId: string }, accessToken: string) { +export function getRecognitionUrl(data: { app: string; stream: string; mediaServerId: string }, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: 'api/push/getPlayUrl', headers: { 'access-token': accessToken }, method: 'get', diff --git a/public/config/config.json b/public/config/config.json index 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/src/api/monitor/media.ts b/src/api/monitor/media.ts index 4b91507..57034fd 100644 --- a/src/api/monitor/media.ts +++ b/src/api/monitor/media.ts @@ -21,8 +21,9 @@ } // 启用 -export function startBox(data: { app: string; stream: string }, accessToken: string) { +export function startBox(data: { app: string; stream: string }, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: 'api/proxy/start', headers: { 'access-token': accessToken }, method: 'get', @@ -31,8 +32,9 @@ } // 获取识别流地址 -export function getRecognitionUrl(data: { app: string; stream: string; mediaServerId: string }, accessToken: string) { +export function getRecognitionUrl(data: { app: string; stream: string; mediaServerId: string }, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: 'api/push/getPlayUrl', headers: { 'access-token': accessToken }, method: 'get', diff --git a/src/router/modules/monitor.ts b/src/router/modules/monitor.ts index b8ed151..e269664 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 54966b0..1d590fe 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -10,7 +10,7 @@ "maxZoom": "18", "zoom": "15", "timeGap": 600000, - "systemType": "gm", + "systemType": "sm", "lineWidth": "3", "lineColor": "#1aa034", "lineColors": [ diff --git a/src/api/monitor/media.ts b/src/api/monitor/media.ts index 4b91507..57034fd 100644 --- a/src/api/monitor/media.ts +++ b/src/api/monitor/media.ts @@ -21,8 +21,9 @@ } // 启用 -export function startBox(data: { app: string; stream: string }, accessToken: string) { +export function startBox(data: { app: string; stream: string }, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: 'api/proxy/start', headers: { 'access-token': accessToken }, method: 'get', @@ -31,8 +32,9 @@ } // 获取识别流地址 -export function getRecognitionUrl(data: { app: string; stream: string; mediaServerId: string }, accessToken: string) { +export function getRecognitionUrl(data: { app: string; stream: string; mediaServerId: string }, accessToken: string, url = '') { return requestMedia({ + baseURL: url || window.localStorage.getItem('mediaBaseUrl') || '', url: 'api/push/getPlayUrl', headers: { 'access-token': accessToken }, method: 'get', diff --git a/src/router/modules/monitor.ts b/src/router/modules/monitor.ts index b8ed151..e269664 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 12080e1..315aea2 100644 --- a/src/views/alarm/policyConfig/videoPreview/videoPreview.vue +++ b/src/views/alarm/policyConfig/videoPreview/videoPreview.vue @@ -5,6 +5,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import dayjs from 'dayjs' import { zIndex } from 'html2canvas/dist/types/css/property-descriptors/z-index' +import { getDictByCode } from '@/api/system/dict' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getSecurityAlarmList } from '@/api/alarm/securityAlarm/securityAlarmList' import { createStream, sendHeart, stopStream } from '@/api/monitor/index-new-gm' @@ -81,9 +82,9 @@ function handleNodeClick(data: any, node: any, self: any) { console.log('设备信息', data) - if (data.device.deviceStatusName === '离线') { + if (data.type !== '3' && data.device.deviceStatusName === '离线') { ElMessage.warning(`设备 ${data.device.monitorName} 离线`) - return false + // return false } const now = new Date().getTime() @@ -91,6 +92,7 @@ if (data.children.length !== 0) { // 点击父亲 return } + // if (data.device.id === currentLeafId.value) { // return // } @@ -99,6 +101,12 @@ currentData.value = data.device title.value = data.device.monitorName?.replace('-', ' - ') recognitionGb.value = data.device.recognitionGb ? data.device.recognitionGb : '' + if (data.type === '3') { + if (!data.children.length) { + ElMessage.warning('此节点为分组,请双击摄像头!') + } + return false + } // -------------------------------区域绘制---------------------------------------- if (radio.value === '1') { // 原始流 if (systemType.value === 'sm') { // 商米流媒体 @@ -130,7 +138,7 @@ } if (systemType.value === 'sm') { // sm识别流 // 获取原始流 - fetchRecognitionUrl(data.device.boxId, data.device.recognitionGb, data.device.nvrIndexCode).then((res: any) => { + fetchRecognitionUrl(data.device.boxId, data.device.recognitionGb, data.device.nvrIndexCode, data.device.deptId).then((res: any) => { leafLoading.value = false mediaUrl.value = `${res}?token=${window.localStorage.getItem('token')}` jessibucaRef.value.play(mediaUrl.value) @@ -279,6 +287,16 @@ drawPoints.value = [] } } + +// -------------------------------------------字典------------------------------------------ +const wvpConfigList: any = ref([]) + +// 获取字典值 +async function getDict() { + // 是否加急 + const res = await getDictByCode('wvpConfig') + wvpConfigList.value = res.data +} // --------------------------------------------sm获取识别流地址----------------------------------------------- // 开启盒子设备流 async function controlBoxOpen(boxId: string, recognitionGb: string) { @@ -293,19 +311,28 @@ } // 启用 -async function handleStartBox(data: any) { +async function handleStartBox(data: any, url = '') { // 开启盒子设备流 - await startBox(data, mediaToken.value) + await startBox(data, mediaToken.value, url) } // 获取识别流地址 -async function fetchRecognitionUrl(boxId: string, recognitionGb: string, mediaServerId: string) { +async function fetchRecognitionUrl(boxId: string, recognitionGb: string, mediaServerId: string, deptId: string) { loading.value = true - await controlBoxOpen(boxId, recognitionGb) + // await controlBoxOpen(boxId, recognitionGb) + await getDict() + let url = '' + const index = wvpConfigList.value.findIndex((item: { name: string }) => item.name === deptId) + console.log('-----------wvpConfigList.value---------', wvpConfigList.value) + console.log('-----------index---------', index) + + if (index !== -1) { + url = `${wvpConfigList.value[0].value}://${wvpConfigList.value[index].value.replace('$', ':')}` + } await handleStartBox({ app: window.localStorage.getItem('appStreamUrl')!, stream: recognitionGb, // 识别流的设备国标号 - }) + }, url) const params = { app: window.localStorage.getItem('appStreamUrl')!, @@ -314,7 +341,7 @@ } // 开启盒子设备流 - const res = await getRecognitionUrl(params, mediaToken.value) + const res = await getRecognitionUrl(params, mediaToken.value, url) loading.value = false if (res && res.data) { return res.data.ws_flv || res.data.flv @@ -389,6 +416,12 @@ ElMessage.warning('请先选中一个摄像头') return false } + if (currentData.value.type === '3') { + if (!currentData.value.children.length) { + ElMessage.warning('此节点为分组,请双击摄像头!') + } + return false + } points.value = [] // 清除标注信息 drawPoints.value = [] @@ -429,7 +462,7 @@ } if (systemType.value === 'sm') { leafLoading.value = true - fetchRecognitionUrl(currentData.value.boxId, currentData.value.recognitionGb, currentData.value.mediaServerId).then((res: any) => { + fetchRecognitionUrl(currentData.value.boxId, currentData.value.recognitionGb, currentData.value.mediaServerId, currentData.value.deptId).then((res: any) => { leafLoading.value = false mediaUrl.value = res jessibucaRef.value.play(mediaUrl.value) @@ -737,7 +770,7 @@ - + 原始流