门禁可视化页面修改

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, AccessControlForm,
AccessControlQuery, AccessControlQuery,
AccessControlVO, 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 { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request' import { requestClient } from '#/api/request';
/** /**
* *
@ -18,7 +18,7 @@ export function accessControlList(params?: AccessControlQuery) {
return requestClient.get<PageResult<AccessControlVO>>( return requestClient.get<PageResult<AccessControlVO>>(
'/sis/accessControl/list', '/sis/accessControl/list',
{ params }, { params },
) );
} }
/** /**
@ -27,7 +27,7 @@ export function accessControlList(params?: AccessControlQuery) {
* @returns * @returns
*/ */
export function accessControlExport(params?: AccessControlQuery) { 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 * @returns
*/ */
export function accessControlInfo(id: ID) { 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 * @returns void
*/ */
export function accessControlAdd(data: AccessControlForm) { 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 * @returns void
*/ */
export function accessControlUpdate(data: AccessControlForm) { 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 * @returns void
*/ */
export function accessControlRemove(id: ID | IDS) { 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 * @returns void
*/ */
export function queryTree() { 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 * @returns void
*/ */
export function accessControlSync() { 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 { onMounted, ref, toRaw } from 'vue';
import { SyncOutlined } from '@ant-design/icons-vue'; import { SyncOutlined } from '@ant-design/icons-vue';
import { InputSearch, message, Skeleton, Tree } from 'ant-design-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'; import type { TreeNode } from '#/api/common';
defineOptions({ inheritAttrs: false }); defineOptions({ inheritAttrs: false });
@ -57,13 +57,14 @@ function open() {
const acArr = checkNodeData(); const acArr = checkNodeData();
if (acArr) { if (acArr) {
console.log(acArr); console.log(acArr);
remoteOpenDoor({ acIds: acArr, type: 0 });
} }
} }
function close() { function close() {
const acArr = checkNodeData(); const acArr = checkNodeData();
if (acArr) { if (acArr) {
console.log(acArr); remoteOpenDoor({ acIds: acArr, type: 1 });
} }
} }
@ -71,6 +72,7 @@ function alwaysOpen() {
const acArr = checkNodeData(); const acArr = checkNodeData();
if (acArr) { if (acArr) {
console.log(acArr); console.log(acArr);
remoteOpenDoor({ acIds: acArr, type: 2 });
} }
} }
@ -78,6 +80,7 @@ function reSet() {
const acArr = checkNodeData(); const acArr = checkNodeData();
if (acArr) { if (acArr) {
console.log(acArr); console.log(acArr);
remoteOpenDoor({ acIds: acArr, type: 4 });
} }
} }
@ -92,7 +95,7 @@ function checkNodeData() {
arr.forEach((item) => { arr.forEach((item) => {
const node: any = checkData[item]; const node: any = checkData[item];
if (node.level == 5) { if (node.level == 5) {
acArr.push(node); acArr.push(node.id);
} }
}); });
if (!acArr || acArr.length === 0) { if (!acArr || acArr.length === 0) {
@ -116,8 +119,8 @@ function onTreeCheck(_keys: any, nodes: any) {
delete checkData[id]; delete checkData[id];
} }
}); });
const nodes = toRaw(checkedNodes); const data = toRaw(checkedNodes);
emit('checked', nodes); emit('checked', checked, data);
} }
onMounted(loadChannelTree); onMounted(loadChannelTree);

View File

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