门禁可视化页面修改

This commit is contained in:
lxj
2025-08-07 09:48:58 +08:00
parent 6d6646ed3b
commit e0cf2f99f9
3 changed files with 51 additions and 43 deletions

View File

@@ -2,7 +2,7 @@
import { onMounted, ref, toRaw } from 'vue';
import { SyncOutlined } from '@ant-design/icons-vue';
import { InputSearch, message, Skeleton, Tree } from 'ant-design-vue';
import { queryTree } from '#/api/sis/accessControl';
import { queryTree, remoteOpenDoor } from '#/api/sis/accessControl';
import type { TreeNode } from '#/api/common';
defineOptions({ inheritAttrs: false });
@@ -57,13 +57,14 @@ function open() {
const acArr = checkNodeData();
if (acArr) {
console.log(acArr);
remoteOpenDoor({ acIds: acArr, type: 0 });
}
}
function close() {
const acArr = checkNodeData();
if (acArr) {
console.log(acArr);
remoteOpenDoor({ acIds: acArr, type: 1 });
}
}
@@ -71,6 +72,7 @@ function alwaysOpen() {
const acArr = checkNodeData();
if (acArr) {
console.log(acArr);
remoteOpenDoor({ acIds: acArr, type: 2 });
}
}
@@ -78,6 +80,7 @@ function reSet() {
const acArr = checkNodeData();
if (acArr) {
console.log(acArr);
remoteOpenDoor({ acIds: acArr, type: 4 });
}
}
@@ -92,7 +95,7 @@ function checkNodeData() {
arr.forEach((item) => {
const node: any = checkData[item];
if (node.level == 5) {
acArr.push(node);
acArr.push(node.id);
}
});
if (!acArr || acArr.length === 0) {
@@ -116,8 +119,8 @@ function onTreeCheck(_keys: any, nodes: any) {
delete checkData[id];
}
});
const nodes = toRaw(checkedNodes);
emit('checked', nodes);
const data = toRaw(checkedNodes);
emit('checked', checked, data);
}
onMounted(loadChannelTree);

View File

@@ -1,7 +1,7 @@
<template>
<Page :auto-content-height="true">
<div class="flex h-full gap-[8px]">
<DpTree class="h-[87vh] w-[300px]" @check="onNodeChecked" />
<DpTree class="h-[87vh] w-[300px]" @checked="onNodeChecked" />
<div class="bg-background flex-1">
<div class="video-play-area flex h-full flex-wrap">
<div
@@ -28,9 +28,9 @@
import DpTree from './dp-tree.vue';
import { Page } from '@vben/common-ui';
import { ref } from 'vue';
import mpegts from "mpegts.js";
import {addStreamProxy} from "#/api/sis/stream";
import {message} from "ant-design-vue";
import mpegts from 'mpegts.js';
import { addStreamProxy } from '#/api/sis/stream';
import { message } from 'ant-design-vue';
/**
* 屏幕播放器数量
@@ -61,14 +61,28 @@ const setItemRef = (el: any) => {
}
};
function onNodeChecked(nodes: any[]) {
console.log(nodes);
function onNodeChecked(checked, nodes: any[]) {
if (checked) {
console.log(nodes);
nodes.forEach((node: any) => {
const { data, level } = node;
// 只播放视频节点
if (level == 6) {
const index =
currentSelectPlayerIndex.value === -1
? 0
: currentSelectPlayerIndex.value;
doPlayer(data, index);
}
});
} else {
}
}
// 播放器数据, 每一个位置代表页面上行的一个矩形
const playerList: any[] = [];
/**
* 开始播放视频流
* @param nodeData 播放的节点数据
@@ -77,24 +91,13 @@ const playerList: any[] = [];
function doPlayer(nodeData: any, index: number = 0) {
console.log('index=', index);
if (mpegts.isSupported()) {
let params = {};
// if (nodeData.nvrIp) {
// params = {
// videoIp: nodeData.nvrIp,
// videoPort: nodeData.nvrPort,
// factoryNo: nodeData.nvrFactoryNo,
// account: nodeData.nvrAccount,
// pwd: nodeData.nvrPwd,
// channelId: nodeData.nvrChannelNo,
// };
// } else {
params = {
const params = {
videoIp: nodeData.deviceIp,
videoPort: nodeData.devicePort,
videoPort: 554,
factoryNo: nodeData.factoryNo,
account: nodeData.deviceAccount,
pwd: nodeData.devicePwd,
channelId: nodeData.channelNo,
channelId: nodeData.channelNo ? nodeData.channelNo : 101,
};
// }
addStreamProxy(params).then((res) => {
@@ -136,7 +139,6 @@ function doPlayer(nodeData: any, index: number = 0) {
}
}
function changeElPlayer(playerInfo: any, index: number) {
const playerData = playerInfo.data;
const oldPlayer = playerInfo.player;
@@ -173,7 +175,6 @@ function changeElPlayer(playerInfo: any, index: number) {
}
}
function closePlayVieo(plInfo: any) {
if (plInfo) {
try {
@@ -201,9 +202,6 @@ function closePlayer(index: number) {
}
}
}
</script>
<style>
.player {