门禁可视化页面修改

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,12 +2,12 @@ import type {
AccessControlForm,
AccessControlQuery,
AccessControlVO,
} from './model'
} from './model';
import type { ID, IDS, PageResult, TreeNode } from '#/api/common'
import type { ID, IDS, PageResult, TreeNode } from '#/api/common';
import { commonExport } from '#/api/helper'
import { requestClient } from '#/api/request'
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
*
@ -18,7 +18,7 @@ export function accessControlList(params?: AccessControlQuery) {
return requestClient.get<PageResult<AccessControlVO>>(
'/sis/accessControl/list',
{ params },
)
);
}
/**
@ -27,7 +27,7 @@ export function accessControlList(params?: AccessControlQuery) {
* @returns
*/
export function accessControlExport(params?: AccessControlQuery) {
return commonExport('/sis/accessControl/export', params ?? {})
return commonExport('/sis/accessControl/export', params ?? {});
}
/**
@ -36,7 +36,7 @@ export function accessControlExport(params?: AccessControlQuery) {
* @returns
*/
export function accessControlInfo(id: ID) {
return requestClient.get<AccessControlVO>(`/sis/accessControl/${id}`)
return requestClient.get<AccessControlVO>(`/sis/accessControl/${id}`);
}
/**
@ -45,7 +45,7 @@ export function accessControlInfo(id: ID) {
* @returns void
*/
export function accessControlAdd(data: AccessControlForm) {
return requestClient.postWithMsg<void>('/sis/accessControl', data)
return requestClient.postWithMsg<void>('/sis/accessControl', data);
}
/**
@ -54,7 +54,7 @@ export function accessControlAdd(data: AccessControlForm) {
* @returns void
*/
export function accessControlUpdate(data: AccessControlForm) {
return requestClient.putWithMsg<void>('/sis/accessControl', data)
return requestClient.putWithMsg<void>('/sis/accessControl', data);
}
/**
@ -63,7 +63,7 @@ export function accessControlUpdate(data: AccessControlForm) {
* @returns void
*/
export function accessControlRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/sis/accessControl/${id}`)
return requestClient.deleteWithMsg<void>(`/sis/accessControl/${id}`);
}
/**
@ -71,7 +71,7 @@ export function accessControlRemove(id: ID | IDS) {
* @returns void
*/
export function queryTree() {
return requestClient.get<TreeNode<Number>[]>(`/sis/accessControl/tree`)
return requestClient.get<TreeNode<Number>[]>(`/sis/accessControl/tree`);
}
/**
@ -79,5 +79,12 @@ export function queryTree() {
* @returns void
*/
export function accessControlSync() {
return requestClient.get<void>(`/sis/accessControl/sync`)
return requestClient.get<void>(`/sis/accessControl/sync`);
}
export function remoteOpenDoor(params: any) {
return requestClient.post<void>(
`/sis/accessControl/e8/remoteOpenDoor`,
params,
);
}

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[]) {
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 {