@@ -2,6 +2,8 @@ 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, DrawFrom } from '@/api/demo/demo/types';
|
import { DemoVO, DemoForm, DemoQuery, DrawFrom } from '@/api/demo/demo/types';
|
||||||
|
import { AlarmAreaData } from '@/api/equipmentList/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增设备
|
* 新增设备
|
||||||
* @param data 设备数据
|
* @param data 设备数据
|
||||||
@@ -78,12 +80,12 @@ export const updateDeviceInfo = (data: DeviceInfoForm) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* todo绘制区域
|
* todo绘制区域
|
||||||
* @param data 绘制信息
|
* @param data 绘制信息数组
|
||||||
* /device/info/draw
|
* /haikang/isup/device/motion-detection
|
||||||
*/
|
*/
|
||||||
export const drawInfo = (data: DrawFrom) => {
|
export const drawInfo = (data: AlarmAreaData[]) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/device/info/draw',
|
url: '/haikang/isup/device/motion-detection',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,4 +21,24 @@ export interface DeviceInfoForm extends BaseEntity {
|
|||||||
isDelete?: number;
|
isDelete?: number;
|
||||||
/** 若依扩展参数 */
|
/** 若依扩展参数 */
|
||||||
params?: Record<string, Record<string, unknown>>;
|
params?: Record<string, Record<string, unknown>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DeviceInfo {
|
||||||
|
id?: number;
|
||||||
|
code?: string;
|
||||||
|
name?: string;
|
||||||
|
monitoringArea?: string;
|
||||||
|
status?: number | string;
|
||||||
|
model?: string;
|
||||||
|
isDrawArea?: number | string;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 报警区域数据类型
|
||||||
|
export interface AlarmAreaData {
|
||||||
|
deviceId: number;
|
||||||
|
x1: number;
|
||||||
|
y1: number;
|
||||||
|
x2: number;
|
||||||
|
y2: number;
|
||||||
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@
|
|||||||
|
|
||||||
<script setup name="Demo" lang="ts">
|
<script setup name="Demo" lang="ts">
|
||||||
import { addEquipment, getDevicetList, getDeviceInfo, delDevice, actDevice, updateDeviceInfo, drawInfo } 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, AlarmAreaData } 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';
|
import { log } from 'node:console';
|
||||||
@@ -355,7 +355,8 @@ const displayToVideoPixel = (px: number, py: number, video: HTMLVideoElement): {
|
|||||||
|
|
||||||
/** 开始采集:视频上点击两个对角点 */
|
/** 开始采集:视频上点击两个对角点 */
|
||||||
const drawStart = ref(false);
|
const drawStart = ref(false);
|
||||||
const payload = ref();
|
|
||||||
|
const payload = ref<AlarmAreaData[]>([]);
|
||||||
|
|
||||||
const drawImage = () => {
|
const drawImage = () => {
|
||||||
resetMonitorDraw();
|
resetMonitorDraw();
|
||||||
@@ -410,20 +411,24 @@ const onMonitorDrawClick = (e: MouseEvent) => {
|
|||||||
const point2RightPctOfWidth = ((VW - v2.vx) / VW) * 1000;
|
const point2RightPctOfWidth = ((VW - v2.vx) / VW) * 1000;
|
||||||
const point2TopPctOfHeight = (v2.vy / VH) * 1000;
|
const point2TopPctOfHeight = (v2.vy / VH) * 1000;
|
||||||
|
|
||||||
payload.value = {
|
// 添加新的报警区域到数组
|
||||||
|
const newArea: AlarmAreaData = {
|
||||||
|
deviceId: form.value.id,
|
||||||
x1: Number(point1RightPctOfWidth.toFixed(4)),
|
x1: Number(point1RightPctOfWidth.toFixed(4)),
|
||||||
y1: Number(point1TopPctOfHeight.toFixed(4)),
|
y1: Number(point1TopPctOfHeight.toFixed(4)),
|
||||||
x2: Number(point2RightPctOfWidth.toFixed(4)),
|
x2: Number(point2RightPctOfWidth.toFixed(4)),
|
||||||
y2: Number(point2TopPctOfHeight.toFixed(4))
|
y2: Number(point2TopPctOfHeight.toFixed(4))
|
||||||
};
|
};
|
||||||
console.log('[监控区域] 两点千分比坐标', payload.value);
|
payload.value.push(newArea);
|
||||||
|
console.log('[监控区域] 两点千分比坐标', newArea);
|
||||||
|
console.log('[监控区域] 所有报警区域', payload.value);
|
||||||
//proxy?.$modal.msgSuccess(`已采集(相对原视频):x右距${payload.value.x}% y顶距${payload.value.y}% w框宽${payload.value.w}% h框高${payload.value.h}%`);
|
//proxy?.$modal.msgSuccess(`已采集(相对原视频):x右距${payload.value.x}% y顶距${payload.value.y}% w框宽${payload.value.w}% h框高${payload.value.h}%`);
|
||||||
seeSee.value = 1;
|
seeSee.value = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearImage = () => {
|
const clearImage = () => {
|
||||||
payload.value = {};
|
payload.value = [];
|
||||||
console.log(payload.value);
|
console.log('[清空区域] 当前报警区域列表', payload.value);
|
||||||
drawStart.value = false;
|
drawStart.value = false;
|
||||||
seeSee.value = 0;
|
seeSee.value = 0;
|
||||||
// 清除绘制的矩形图案
|
// 清除绘制的矩形图案
|
||||||
@@ -432,6 +437,8 @@ const clearImage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const saveImage = async () => {
|
const saveImage = async () => {
|
||||||
|
console.log('[保存区域] 准备保存的报警区域列表', payload.value);
|
||||||
|
|
||||||
await drawInfo(payload.value);
|
await drawInfo(payload.value);
|
||||||
drawStart.value = false;
|
drawStart.value = false;
|
||||||
seeSee.value = 0;
|
seeSee.value = 0;
|
||||||
@@ -536,11 +543,12 @@ onMounted(() => {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transform: translate(-50%, -100%);
|
transform: translateX(-50%);
|
||||||
margin-top: -6px;
|
|
||||||
color: #2563eb;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fff;
|
||||||
|
background: rgba(37, 99, 235, 0.85);
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user