fix 实时监控收集
This commit is contained in:
@@ -88,3 +88,13 @@ export interface DemoQuery extends PageQuery {
|
|||||||
*/
|
*/
|
||||||
value?: string;
|
value?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DrawFrom {
|
||||||
|
x?: string | number;
|
||||||
|
|
||||||
|
y?: string | number;
|
||||||
|
|
||||||
|
w?: string | number;
|
||||||
|
|
||||||
|
h?: string | number;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import type { EquipmentList, DeviceInfoForm } from '@/api/equipmentList/types';
|
import type { EquipmentList, DeviceInfoForm } from '@/api/equipmentList/types';
|
||||||
import { AxiosPromise } from 'axios';
|
import { AxiosPromise } from 'axios';
|
||||||
import { DemoVO, DemoForm, DemoQuery } from '@/api/demo/demo/types';
|
import { DemoVO, DemoForm, DemoQuery, DrawFrom } from '@/api/demo/demo/types';
|
||||||
/**
|
/**
|
||||||
* 新增设备
|
* 新增设备
|
||||||
* @param data 设备数据
|
* @param data 设备数据
|
||||||
@@ -52,7 +52,7 @@ export const delDevice = (id: string | number | Array<string | number>) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 唤醒设备
|
* 激活设备
|
||||||
* @param id 单个主键或主键数组(与删除相同:POST + Query,ids=1,2,3)
|
* @param id 单个主键或主键数组(与删除相同:POST + Query,ids=1,2,3)
|
||||||
*/
|
*/
|
||||||
export const actDevice = (id: string | number | Array<string | number>) => {
|
export const actDevice = (id: string | number | Array<string | number>) => {
|
||||||
@@ -75,3 +75,16 @@ export const updateDeviceInfo = (data: DeviceInfoForm) => {
|
|||||||
data
|
data
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* todo绘制区域
|
||||||
|
* @param data 绘制信息
|
||||||
|
* /device/info/draw
|
||||||
|
*/
|
||||||
|
export const drawInfo = (data: DrawFrom) => {
|
||||||
|
return request({
|
||||||
|
url: '/device/info/draw',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -104,7 +104,11 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex w-full items-center justify-between gap-2 min-w-0 pr-8">
|
<div class="flex w-full items-center justify-between gap-2 min-w-0 pr-8">
|
||||||
<span class="truncate">实时监控-北门出入门监控</span>
|
<span class="truncate">实时监控-北门出入门监控</span>
|
||||||
<el-button type="primary" class="shrink-0" @click="drawImage()">绘制区域</el-button>
|
<div>
|
||||||
|
<el-button v-if="!drawStart" type="primary" class="shrink-0" @click="drawImage()">绘制区域</el-button>
|
||||||
|
<el-button v-if="drawStart" type="primary" class="shrink-0" @click="clearImage()">清空区域</el-button>
|
||||||
|
<el-button v-if="drawStart" type="primary" class="shrink-0" @click="saveImage()">保存区域</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="monitor-video-wrap">
|
<div class="monitor-video-wrap">
|
||||||
@@ -120,10 +124,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Demo" lang="ts">
|
<script setup name="Demo" lang="ts">
|
||||||
import { addEquipment, getDevicetList, getDeviceInfo, delDevice, actDevice, updateDeviceInfo } from '@/api/equipmentList/index';
|
import { addEquipment, getDevicetList, getDeviceInfo, delDevice, actDevice, updateDeviceInfo, drawInfo } from '@/api/equipmentList/index';
|
||||||
import { EquipmentList, DeviceInfoForm } from '@/api/equipmentList/types';
|
import { EquipmentList, DeviceInfoForm } from '@/api/equipmentList/types';
|
||||||
import { listDemo, getDemo, delDemo, addDemo, updateDemo } from '@/api/demo/demo';
|
import { listDemo, getDemo, delDemo, addDemo, updateDemo } from '@/api/demo/demo';
|
||||||
import { DemoVO, DemoQuery, DemoForm } from '@/api/demo/demo/types';
|
import { DemoVO, DemoQuery, DemoForm } from '@/api/demo/demo/types';
|
||||||
|
import { log } from 'node:console';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
@@ -336,6 +341,9 @@ const displayToVideoPixel = (px: number, py: number, video: HTMLVideoElement): {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 开始采集:视频上点击两个对角点 */
|
/** 开始采集:视频上点击两个对角点 */
|
||||||
|
const drawStart = ref(false);
|
||||||
|
const payload = ref();
|
||||||
|
|
||||||
const drawImage = () => {
|
const drawImage = () => {
|
||||||
resetMonitorDraw();
|
resetMonitorDraw();
|
||||||
monitorDrawCollecting.value = true;
|
monitorDrawCollecting.value = true;
|
||||||
@@ -395,17 +403,31 @@ const onMonitorDrawClick = (e: MouseEvent) => {
|
|||||||
const rectWidthPctOfWidth = (rw / VW) * 100;
|
const rectWidthPctOfWidth = (rw / VW) * 100;
|
||||||
const rectHeightPctOfHeight = (rh / VH) * 100;
|
const rectHeightPctOfHeight = (rh / VH) * 100;
|
||||||
|
|
||||||
const payload = {
|
payload.value = {
|
||||||
videoIntrinsicSize: { width: VW, height: VH },
|
// videoIntrinsicSize: { width: VW, height: VH },
|
||||||
firstPointTopOffset_pctOfVideoHeight: Number(firstTopPctOfHeight.toFixed(4)),
|
// firstPointTopOffset_pctOfVideoHeight: Number(firstTopPctOfHeight.toFixed(4)),
|
||||||
firstPointDistanceToRight_pctOfVideoWidth: Number(firstRightPctOfWidth.toFixed(4)),
|
// firstPointDistanceToRight_pctOfVideoWidth: Number(firstRightPctOfWidth.toFixed(4)),
|
||||||
rectWidth_pctOfVideoWidth: Number(rectWidthPctOfWidth.toFixed(4)),
|
// rectWidth_pctOfVideoWidth: Number(rectWidthPctOfWidth.toFixed(4)),
|
||||||
rectHeight_pctOfVideoHeight: Number(rectHeightPctOfHeight.toFixed(4))
|
// rectHeight_pctOfVideoHeight: Number(rectHeightPctOfHeight.toFixed(4))
|
||||||
|
x: Number(firstRightPctOfWidth.toFixed(4)),
|
||||||
|
y: Number(firstTopPctOfHeight.toFixed(4)),
|
||||||
|
w: Number(rectWidthPctOfWidth.toFixed(4)),
|
||||||
|
h: Number(rectHeightPctOfHeight.toFixed(4))
|
||||||
};
|
};
|
||||||
console.log('[监控区域] 四点百分比(相对视频原始宽高 videoWidth/videoHeight):', payload);
|
console.log('[监控区域] 四点百分比', payload.value);
|
||||||
proxy?.$modal.msgSuccess(
|
//proxy?.$modal.msgSuccess(`已采集(相对原视频):x右距${payload.value.x}% y顶距${payload.value.y}% w框宽${payload.value.w}% h框高${payload.value.h}%`);
|
||||||
`已采集(相对原视频):顶距${payload.firstPointTopOffset_pctOfVideoHeight}% 右距${payload.firstPointDistanceToRight_pctOfVideoWidth}% 框宽${payload.rectWidth_pctOfVideoWidth}% 框高${payload.rectHeight_pctOfVideoHeight}%`
|
drawStart.value = true;
|
||||||
);
|
};
|
||||||
|
|
||||||
|
const clearImage = () => {
|
||||||
|
payload.value = {};
|
||||||
|
console.log(payload.value);
|
||||||
|
drawStart.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveImage = async () => {
|
||||||
|
await drawInfo(payload.value);
|
||||||
|
drawStart.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
|
|||||||
Reference in New Issue
Block a user