flx:修改海康监控插件展示

This commit is contained in:
Rain_ 2025-12-09 09:18:05 +08:00
parent 3a53405feb
commit d8986921d5
12 changed files with 1035 additions and 907 deletions

View File

@ -62,3 +62,7 @@ export const getAllModule = (params?: any) => {
export const getScreenAuthModuleAndMenuApi = (params?: any) => { export const getScreenAuthModuleAndMenuApi = (params?: any) => {
return http.get(BASEURL + "/xmgl/screenAuth/getModuleAndMenu", params); return http.get(BASEURL + "/xmgl/screenAuth/getModuleAndMenu", params);
}; };
export const getUserConfigListApi = (params?: any) => {
return http.get(BASEURL + "/xmgl/userConfig/list", params);
};

View File

@ -59,7 +59,8 @@ export const GlobalStore = defineStore({
tabsIcon: false, tabsIcon: false,
// 页脚 // 页脚
footer: false footer: false
} },
forceH5Play: 0,
}), }),
getters: {}, getters: {},
actions: { actions: {
@ -67,6 +68,9 @@ export const GlobalStore = defineStore({
setSN(sn: string | null) { setSN(sn: string | null) {
this.sn = sn; this.sn = sn;
}, },
setForceH5Play(forceH5Play: number | null) {
this.forceH5Play = forceH5Play;
},
// setToken // setToken
setToken(token: string | null) { setToken(token: string | null) {
this.token = token; this.token = token;

View File

@ -19,6 +19,7 @@ export interface GlobalState {
isManager: string | null; isManager: string | null;
isIframe: boolean | null; isIframe: boolean | null;
userId: string | null; userId: string | null;
forceH5Play: number | null;
} }
/* themeConfigProp */ /* themeConfigProp */

View File

@ -315,3 +315,8 @@ export function filterEnum(
export const getAssetsFile = (url: string) => { export const getAssetsFile = (url: string) => {
return new URL(`../assets/images/${url}`, import.meta.url).href return new URL(`../assets/images/${url}`, import.meta.url).href
} }
// 判断当前系统是不是windows系统
export function isWindows() {
return navigator.userAgent.indexOf('Windows') !== -1;
}

View File

@ -42,7 +42,7 @@ import { ref, reactive, onMounted, onBeforeUnmount } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { Login } from "@/api/interface"; import { Login } from "@/api/interface";
import { ElMessage, ElNotification } from "element-plus"; import { ElMessage, ElNotification } from "element-plus";
import { loginApi, jumpLoginApi } from "@/api/modules/login"; import { loginApi, jumpLoginApi, getUserConfigListApi } from "@/api/modules/login";
import { GlobalStore } from "@/stores"; import { GlobalStore } from "@/stores";
import { TabsStore } from "@/stores/modules/tabs"; import { TabsStore } from "@/stores/modules/tabs";
import { KeepAliveStore } from "@/stores/modules/keepAlive"; import { KeepAliveStore } from "@/stores/modules/keepAlive";
@ -86,7 +86,7 @@ const login = (formEl: FormInstance | undefined) => {
globalStore.setAccountType(result.accountType); globalStore.setAccountType(result.accountType);
globalStore.setProjectDateAuth(result.menuAuthority); globalStore.setProjectDateAuth(result.menuAuthority);
globalStore.setIsManager(result.isManager); // globalStore.setIsManager(result.isManager); //
getUserConfigList(result.userId);
// 2. // 2.
// await initDynamicRouter(); // await initDynamicRouter();
// router.push(arr[result.accountType - 1]); // router.push(arr[result.accountType - 1]);
@ -176,6 +176,17 @@ onMounted(async () => {
} }
}; };
}); });
const getUserConfigList = (userId: string) => {
getUserConfigListApi({
userId: userId,
}).then((res: any) => {
if (res.code === 200) {
if (res.result instanceof Array && res.result.length > 0) {
globalStore.setProjectDateAuth(res.result[0].forceH5Play);
}
}
});
};
// loginenter // loginenter
onBeforeUnmount(() => { onBeforeUnmount(() => {
document.onkeydown = null; document.onkeydown = null;

View File

@ -392,6 +392,7 @@ const getPreviewUrl = row => {
let tempCode = row.monitoringNumber; let tempCode = row.monitoringNumber;
const param = { const param = {
cameraIndexCode: tempCode, cameraIndexCode: tempCode,
streamType: row.defaultStreamType && row.eIndex < 4 ? row.defaultStreamType : "",
// streamType: row.defaultStreamType == 2 ? 0 : row.defaultStreamType, // streamType: row.defaultStreamType == 2 ? 0 : row.defaultStreamType,
type: window.location.protocol.includes("https") ? "wss" : "ws", type: window.location.protocol.includes("https") ? "wss" : "ws",
transmode: 1, transmode: 1,

View File

@ -39,6 +39,7 @@ const getPreviewUrl = (row) => {
const param = { const param = {
cameraIndexCode: tempCode, cameraIndexCode: tempCode,
type: window.location.protocol.includes("https") ? "wss" : "ws", type: window.location.protocol.includes("https") ? "wss" : "ws",
streamType: row.defaultStreamType && row.eIndex < 4 ? row.defaultStreamType : "",
transmode: 1, transmode: 1,
itemId: row.itemId, itemId: row.itemId,
projectSn: row.projectSn, projectSn: row.projectSn,
@ -95,8 +96,11 @@ onMounted(() => {
layout.value = tempLayout layout.value = tempLayout
if (props.devList.length > 0) { if (props.devList.length > 0) {
props.devList.forEach(element => { props.devList.forEach((element, index) => {
play(element) play({
...element,
eIndex: index,
})
}) })
} }
}) })
@ -110,21 +114,30 @@ onBeforeUnmount(() => {
// //
// watch(() => props.devList, (newVal) => { // watch(() => props.devList, (newVal) => {
// if (newVal.length > 0) { // if (newVal.length > 0) {
// newVal.forEach(element => { // newVal.forEach((element, index) => {
// play(element) // play({
// ...element,
// eIndex: index,
// })
// }) // })
// } // }
// }) // })
const isVisible = computed(() => {
watch(() => props.equipmentDialog, (newVal) => { return {
equipmentDialog: props.equipmentDialog,
visibleDialog: props.visibleDialog,
}
})
watch(() => isVisible, (newVal) => {
console.log("我进来了", videoPlugin.value,)
if (videoPlugin.value) { if (videoPlugin.value) {
if (newVal) { if (newVal.value.equipmentDialog || newVal.value.visibleDialog) {
videoPlugin.value.hidePluginWindow() videoPlugin.value.hidePluginWindow()
} else { } else {
videoPlugin.value.showPluginWindow() videoPlugin.value.showPluginWindow()
} }
} }
}) }, { deep: true })
</script> </script>
<style scoped> <style scoped>

View File

@ -162,7 +162,7 @@ class VideoPlugin {
} }
} }
openVideo(cameraIndexCode, streamMode, winIndex) { openVideo(cameraIndexCode, streamMode, winIndex = 0) {
const transMode = 1; // TCP const transMode = 1; // TCP
const gpuMode = 0; // 不启用GPU硬解 const gpuMode = 0; // 不启用GPU硬解
// 添加调试信息 // 添加调试信息
@ -177,7 +177,7 @@ class VideoPlugin {
funcName: "startPreview", funcName: "startPreview",
argument: JSON.stringify({ argument: JSON.stringify({
cameraIndexCode: cameraIndexCode, cameraIndexCode: cameraIndexCode,
streamMode: streamMode == 2 ? 0 : streamMode, streamMode: streamMode == 2 && (winIndex > 4) ? 0 : 1,
transMode: transMode, transMode: transMode,
gpuMode: gpuMode, gpuMode: gpuMode,
wndId: winIndex || -1, wndId: winIndex || -1,

View File

@ -113,6 +113,7 @@
v-model="policeCameraItemInfo.deviceState" v-model="policeCameraItemInfo.deviceState"
clearable clearable
placeholder="请选择" placeholder="请选择"
@visible-change="visibleChange"
> >
<el-option <el-option
v-for="(item, index) in deviceStateList" v-for="(item, index) in deviceStateList"
@ -277,8 +278,17 @@
:autoplay="true" :autoplay="true"
:controls="true" :controls="true"
/> --> /> -->
<IscPlayer <div v-if="isWindows() && store.forceH5Play == 0" class="videoOverview" :id="`videoOverview${item.itemId}`">
v-if="videoConfig.enableNotPlugin == 1" <IscPlugin
:devList="[item]"
:itemId="item.itemId"
:type="'1x1'"
:equipmentDialog="equipmentDialog"
:visibleDialog="visibleDialog"
></IscPlugin>
</div>
<IscPlayer
v-else
:devList="[ :devList="[
{ {
...item, ...item,
@ -288,14 +298,6 @@
:key="'player-' + item.itemId" :key="'player-' + item.itemId"
:playerId="'player-' + item.itemId" :playerId="'player-' + item.itemId"
/> />
<div v-else class="videoOverview" :id="`videoOverview${item.itemId}`">
<IscPlugin
:devList="[item]"
:itemId="item.itemId"
:type="'1x1'"
:equipmentDialog="equipmentDialog"
></IscPlugin>
</div>
</div> </div>
<div class="hls-video_title" @click="onEquipmentClick(item)"> <div class="hls-video_title" @click="onEquipmentClick(item)">
<div>设备详情</div> <div>设备详情</div>
@ -637,6 +639,7 @@ import {
selectAllProjectInfoList, selectAllProjectInfoList,
} from "@/api/modules/workTicket"; } from "@/api/modules/workTicket";
import { getUseProjectVideoConfigApi } from "@/api/modules/tower"; import { getUseProjectVideoConfigApi } from "@/api/modules/tower";
import { isWindows } from "@/utils/util";
import dayjs from "dayjs"; import dayjs from "dayjs";
import duration from "dayjs/plugin/duration"; import duration from "dayjs/plugin/duration";
dayjs.extend(duration); dayjs.extend(duration);
@ -804,6 +807,10 @@ const onViewAllClick = () => {
const equipmentDialog = ref(false); const equipmentDialog = ref(false);
const equipmentDetail = ref({}); const equipmentDetail = ref({});
const visibleDialog = ref(false);
const visibleChange = (val) => {
visibleDialog.value = val;
};
// //
const onEquipmentClick = (row) => { const onEquipmentClick = (row) => {
equipmentDetail.value = row; equipmentDetail.value = row;

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,8 @@
<div class="left" :class="{ hide: !isExpand }"> <div class="left" :class="{ hide: !isExpand }">
<div <div
:class="{ :class="{
control_scroll: videoConfigInfo.enableNotPlugin == 1 && isDragging, control_scroll: (!isWindows() || store.forceH5Play == 1) && isDragging,
control_scrolloff: videoConfigInfo.enableNotPlugin == 1 && !isDragging control_scrolloff: (!isWindows() || store.forceH5Play == 1) && !isDragging
}" }"
class="videoListBig" class="videoListBig"
> >
@ -78,8 +78,8 @@
</div> </div>
<div <div
class="control_main" class="control_main"
:class="{ 'mt-20': videoConfigInfo.enableNotPlugin == 1 && isDragging }" :class="{ 'mt-20': (!isWindows() || store.forceH5Play == 1) && isDragging }"
v-if="videoConfigInfo.enableNotPlugin == 1" v-if="(!isWindows() || store.forceH5Play == 1)"
> >
<div class="control-card"> <div class="control-card">
<div class="control-title"> <div class="control-title">
@ -174,7 +174,7 @@
<DHPlayer :devList="dhVideoList" v-else-if="videoType === 4" ref="dhplayer"></DHPlayer> <DHPlayer :devList="dhVideoList" v-else-if="videoType === 4" ref="dhplayer"></DHPlayer>
<!-- 播放海康 --> <!-- 播放海康 -->
<div v-else ref="playWndBox" style="width: 100%; height: 100%"> <div v-else ref="playWndBox" style="width: 100%; height: 100%">
<div v-if="infor.enableNotPlugin != 1" id="playWnd" class="playWnd" style="width: 100%; height: 100%"></div> <div v-if="isWindows() && store.forceH5Play == 0" id="playWnd" class="playWnd" style="width: 100%; height: 100%"></div>
<!-- :style="{ <!-- :style="{
height: playWndHeight + 'px', height: playWndHeight + 'px',
width: playWndWidth + 'xp' width: playWndWidth + 'xp'
@ -201,6 +201,7 @@ import { GlobalStore } from "@/stores";
import { getUseProjectVideoConfigApi } from "@/api/modules/tower"; import { getUseProjectVideoConfigApi } from "@/api/modules/tower";
import { selectProjectVideoListApi, selectProjectVideoGroupApi, getSafeHatSessionApi } from "@/api/modules/video"; import { selectProjectVideoListApi, selectProjectVideoGroupApi, getSafeHatSessionApi } from "@/api/modules/video";
import { COMPANY } from "@/config/config"; import { COMPANY } from "@/config/config";
import { isWindows } from "@/utils/util";
import emitter from "./mitt"; import emitter from "./mitt";
const defaultProps = { const defaultProps = {
children: "children", children: "children",
@ -387,7 +388,7 @@ const checkVideo = async (item: any) => {
console.log(item, "item11222"); console.log(item, "item11222");
videoInfo.value = item; videoInfo.value = item;
dhVideoList.value = [item]; dhVideoList.value = [item];
if (videoConfigInfo.value.enableNotPlugin == 1) return; if (isWindows() && store.forceH5Play == 1) return;
if (videoType.value !== 1 && videoType.value !== 4) { if (videoType.value !== 1 && videoType.value !== 4) {
previewVideo(cameraIndexCode.value, item.defaultStreamType); previewVideo(cameraIndexCode.value, item.defaultStreamType);
} }
@ -417,18 +418,20 @@ const getVideoList = async () => {
}, []); }, []);
let arr = findVideoByTree(res.result.videoList, []); let arr = findVideoByTree(res.result.videoList, []);
if (arr.length > 0) { if (arr.length > 0) {
console.log(111223344, infor.value.enableNotPlugin == 1); // console.log(111223344, infor.value.enableNotPlugin == 1);
if (infor.value.enableNotPlugin == 1) { if (isWindows() && store.forceH5Play == 0) {
dhVideoList.value = recursiveFilterList(res.result.videoList); console.log(11122334455, arr[0]);
} else {
handleVideoConfig(arr[0]); handleVideoConfig(arr[0]);
} else {
const dataList = recursiveFilterList(res.result.videoList);
dhVideoList.value = dataList;
} }
} }
console.log("objData", objData.value); console.log("objData", objData.value);
}; };
const recursiveFilterList = (dataList: any, resultList: any[] = []) => { const recursiveFilterList = (dataList: any, resultList: any[] = []) => {
return dataList.reduce((prev: any, cur: any) => { return dataList.reduce((prev: any, cur: any) => {
console.log("当前的列表", cur); // console.log("", cur);
if (resultList.length >= 4) return prev; if (resultList.length >= 4) return prev;
if (cur.children && cur.children.length > 0) { if (cur.children && cur.children.length > 0) {
recursiveFilterList(cur.children, resultList); recursiveFilterList(cur.children, resultList);
@ -476,8 +479,7 @@ const handleVideoConfig = (videoData: any) => {
} else if (videoData.videoType === 4) { } else if (videoData.videoType === 4) {
dhVideoList.value = [videoData]; dhVideoList.value = [videoData];
} else { } else {
console.log(88887777, infor.value.enableNotPlugin); if (isWindows() && store.forceH5Play == 0) {
if (infor.value.enableNotPlugin != 1) {
initPlugin(); initPlugin();
} else { } else {
console.log(88887777, videoData); console.log(88887777, videoData);

View File

@ -456,7 +456,8 @@ const getPreviewUrl = row => {
let tempCode = row.serialNumber; let tempCode = row.serialNumber;
const param = { const param = {
cameraIndexCode: tempCode, cameraIndexCode: tempCode,
streamType: row.defaultStreamType == 2 ? 0 : row.defaultStreamType, // streamType: row.defaultStreamType == 2 ? 0 : row.defaultStreamType,
streamType: row.defaultStreamType && row.eIndex < 4 ? row.defaultStreamType : "",
type: window.location.protocol.includes("https") ? "wss" : "ws", type: window.location.protocol.includes("https") ? "wss" : "ws",
transmode: 1, transmode: 1,
itemId: row.itemId itemId: row.itemId