Compare commits
6 Commits
dddaaddd4d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9771164cf5 | |||
| 7e13025e3b | |||
| ed25910679 | |||
| 9449c48327 | |||
| d16c821783 | |||
| 7c9b51a6de |
@@ -6,10 +6,14 @@ import { h, ref } from 'vue';
|
|||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { Button, Image, message, Modal, Tag } from 'ant-design-vue';
|
import { Image, message, Modal, Tag } from 'ant-design-vue';
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getAlert, getAlertPage, handleAlert } from '#/api/aiot/alarm';
|
import {
|
||||||
|
getAlert,
|
||||||
|
getAlertPage,
|
||||||
|
handleAlert,
|
||||||
|
} from '#/api/aiot/alarm';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ALERT_LEVEL_OPTIONS,
|
ALERT_LEVEL_OPTIONS,
|
||||||
@@ -117,37 +121,61 @@ async function handleView(row: AiotAlarmApi.Alert) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 处理告警 */
|
/** 处理告警 — "处理"弹窗(支持备注) */
|
||||||
async function handleProcess(row: AiotAlarmApi.Alert, status: string) {
|
const handleModalVisible = ref(false);
|
||||||
const statusText = status === 'handled' ? '处理' : '忽略';
|
const handleModalRow = ref<AiotAlarmApi.Alert | null>(null);
|
||||||
Modal.confirm({
|
const handleRemark = ref('');
|
||||||
title: `${statusText}告警`,
|
const handleSubmitting = ref(false);
|
||||||
content: h('div', [
|
|
||||||
h('p', `确定要${statusText}该告警吗?`),
|
|
||||||
h('p', { class: 'text-gray-500 text-sm' }, `告警编号:${row.alertNo}`),
|
|
||||||
h('textarea', {
|
|
||||||
id: 'processRemark',
|
|
||||||
class: 'ant-input mt-2',
|
|
||||||
rows: 3,
|
|
||||||
placeholder: '请输入处理备注(可选)',
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
async onOk() {
|
|
||||||
const textarea = document.querySelector(
|
|
||||||
'#processRemark',
|
|
||||||
) as HTMLTextAreaElement;
|
|
||||||
const remark = textarea?.value || '';
|
|
||||||
|
|
||||||
|
function openHandleModal(row: AiotAlarmApi.Alert) {
|
||||||
|
handleModalRow.value = row;
|
||||||
|
handleRemark.value = '';
|
||||||
|
handleModalVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitHandle() {
|
||||||
|
const row = handleModalRow.value;
|
||||||
|
if (!row) return;
|
||||||
|
|
||||||
|
handleSubmitting.value = true;
|
||||||
|
try {
|
||||||
|
await handleAlert(
|
||||||
|
row.alarmId || row.id!,
|
||||||
|
'handled',
|
||||||
|
handleRemark.value || undefined,
|
||||||
|
);
|
||||||
|
message.success('处理成功');
|
||||||
|
handleModalVisible.value = false;
|
||||||
|
handleRefresh();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('处理失败:', error);
|
||||||
|
message.error('处理失败');
|
||||||
|
} finally {
|
||||||
|
handleSubmitting.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 处理告警 — "误报"确认弹窗 */
|
||||||
|
function handleFalseAlarm(row: AiotAlarmApi.Alert) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '标记误报',
|
||||||
|
content: h('div', [
|
||||||
|
h('p', '确定要将该告警标记为误报吗?'),
|
||||||
|
h('p', { class: 'text-gray-500 text-sm' }, `告警编号:${row.alertNo}`),
|
||||||
|
]),
|
||||||
|
okText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
async onOk() {
|
||||||
const hideLoading = message.loading({
|
const hideLoading = message.loading({
|
||||||
content: '正在处理...',
|
content: '正在处理...',
|
||||||
duration: 0,
|
duration: 0,
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await handleAlert(row.alarmId || row.id!, status, remark);
|
await handleAlert(row.alarmId || row.id!, 'ignored');
|
||||||
message.success(`${statusText}成功`);
|
message.success('已标记为误报');
|
||||||
handleRefresh();
|
handleRefresh();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`${statusText}失败:`, error);
|
console.error('标记误报失败:', error);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
@@ -272,14 +300,14 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
label: '处理',
|
label: '处理',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
icon: ACTION_ICON.EDIT,
|
icon: ACTION_ICON.EDIT,
|
||||||
onClick: handleProcess.bind(null, row, 'handled'),
|
onClick: openHandleModal.bind(null, row),
|
||||||
ifShow: row.status === 'pending',
|
ifShow: row.status === 'pending',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '忽略',
|
label: '误报',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
danger: true,
|
danger: true,
|
||||||
onClick: handleProcess.bind(null, row, 'ignored'),
|
onClick: handleFalseAlarm.bind(null, row),
|
||||||
ifShow: row.status === 'pending',
|
ifShow: row.status === 'pending',
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
@@ -409,5 +437,30 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
<!-- 处理告警弹窗 -->
|
||||||
|
<Modal
|
||||||
|
v-model:open="handleModalVisible"
|
||||||
|
title="处理告警"
|
||||||
|
:confirm-loading="handleSubmitting"
|
||||||
|
ok-text="确认处理"
|
||||||
|
cancel-text="取消"
|
||||||
|
@ok="submitHandle"
|
||||||
|
>
|
||||||
|
<div v-if="handleModalRow" class="space-y-4">
|
||||||
|
<div class="text-gray-500 text-sm">
|
||||||
|
告警编号:{{ handleModalRow.alertNo }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="mb-1 text-sm">处理备注</div>
|
||||||
|
<textarea
|
||||||
|
v-model="handleRemark"
|
||||||
|
class="ant-input w-full"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="请输入处理备注(可选)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
'draw-cancelled': [];
|
||||||
|
'roi-deleted': [roiId: string];
|
||||||
'roi-drawn': [data: { roi_type: string; coordinates: string }];
|
'roi-drawn': [data: { roi_type: string; coordinates: string }];
|
||||||
'roi-selected': [roiId: string | null];
|
'roi-selected': [roiId: string | null];
|
||||||
'roi-deleted': [roiId: string];
|
|
||||||
'snap-status': [ok: boolean];
|
'snap-status': [ok: boolean];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@@ -31,19 +32,20 @@ let ctx: CanvasRenderingContext2D | null = null;
|
|||||||
let canvasWidth = 0;
|
let canvasWidth = 0;
|
||||||
let canvasHeight = 0;
|
let canvasHeight = 0;
|
||||||
|
|
||||||
const isDrawing = ref(false);
|
|
||||||
let startPoint: { x: number; y: number } | null = null;
|
|
||||||
let currentPoint: { x: number; y: number } | null = null;
|
|
||||||
const polygonPoints = ref<{ x: number; y: number }[]>([]);
|
const polygonPoints = ref<{ x: number; y: number }[]>([]);
|
||||||
|
let mouseMovePoint: { x: number; y: number } | null = null;
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const errorMsg = ref('');
|
const errorMsg = ref('');
|
||||||
|
|
||||||
watch(() => props.rois, () => redraw(), { deep: true });
|
watch(() => props.rois, () => redraw(), { deep: true });
|
||||||
watch(() => props.selectedRoiId, () => redraw());
|
watch(() => props.selectedRoiId, () => redraw());
|
||||||
watch(() => props.drawMode, () => {
|
watch(() => props.drawMode, (newVal) => {
|
||||||
polygonPoints.value = [];
|
polygonPoints.value = [];
|
||||||
isDrawing.value = false;
|
mouseMovePoint = null;
|
||||||
redraw();
|
redraw();
|
||||||
|
if (newVal && wrapper.value) {
|
||||||
|
wrapper.value.focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
watch(() => props.snapUrl, () => {
|
watch(() => props.snapUrl, () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
@@ -86,7 +88,6 @@ function onImageError() {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
errorMsg.value = '截图加载失败,请确认摄像头拉流地址是否有效';
|
errorMsg.value = '截图加载失败,请确认摄像头拉流地址是否有效';
|
||||||
emit('snap-status', false);
|
emit('snap-status', false);
|
||||||
// 关键:截图失败也初始化 canvas,使 ROI 区域可见可操作
|
|
||||||
nextTick(() => initCanvas());
|
nextTick(() => initCanvas());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,72 +144,88 @@ function getCanvasPoint(e: MouseEvent) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- 鼠标事件 ----
|
||||||
|
|
||||||
function onMouseDown(e: MouseEvent) {
|
function onMouseDown(e: MouseEvent) {
|
||||||
if (e.button !== 0) return;
|
if (e.button !== 0) return;
|
||||||
const pt = getCanvasPoint(e);
|
const pt = getCanvasPoint(e);
|
||||||
|
|
||||||
if (props.drawMode === 'rectangle') {
|
if (props.drawMode === 'polygon') {
|
||||||
isDrawing.value = true;
|
|
||||||
startPoint = pt;
|
|
||||||
currentPoint = pt;
|
|
||||||
} else if (props.drawMode === 'polygon') {
|
|
||||||
polygonPoints.value.push(pt);
|
polygonPoints.value.push(pt);
|
||||||
redraw();
|
redraw();
|
||||||
drawPolygonInProgress();
|
drawPolygonInProgress();
|
||||||
} else {
|
} else if (!props.drawMode) {
|
||||||
const clickedRoi = findRoiAtPoint(pt);
|
const clickedRoi = findRoiAtPoint(pt);
|
||||||
emit('roi-selected', clickedRoi?.roiId ?? null);
|
emit('roi-selected', clickedRoi?.roiId ?? null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseMove(e: MouseEvent) {
|
function onMouseMove(e: MouseEvent) {
|
||||||
if (!isDrawing.value || props.drawMode !== 'rectangle') return;
|
if (props.drawMode !== 'polygon' || polygonPoints.value.length === 0) return;
|
||||||
currentPoint = getCanvasPoint(e);
|
mouseMovePoint = getCanvasPoint(e);
|
||||||
redraw();
|
|
||||||
drawRectInProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMouseUp(e: MouseEvent) {
|
|
||||||
if (!isDrawing.value || props.drawMode !== 'rectangle') return;
|
|
||||||
isDrawing.value = false;
|
|
||||||
const endPoint = getCanvasPoint(e);
|
|
||||||
const x = Math.min(startPoint!.x, endPoint.x);
|
|
||||||
const y = Math.min(startPoint!.y, endPoint.y);
|
|
||||||
const w = Math.abs(endPoint.x - startPoint!.x);
|
|
||||||
const h = Math.abs(endPoint.y - startPoint!.y);
|
|
||||||
if (w > 0.01 && h > 0.01) {
|
|
||||||
emit('roi-drawn', {
|
|
||||||
roi_type: 'rectangle',
|
|
||||||
coordinates: JSON.stringify({ x, y, w, h }),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
startPoint = null;
|
|
||||||
currentPoint = null;
|
|
||||||
redraw();
|
redraw();
|
||||||
|
drawPolygonInProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDoubleClick() {
|
function onDoubleClick() {
|
||||||
if (props.drawMode === 'polygon' && polygonPoints.value.length >= 3) {
|
if (props.drawMode === 'polygon' && polygonPoints.value.length >= 3) {
|
||||||
emit('roi-drawn', {
|
finishPolygon();
|
||||||
roi_type: 'polygon',
|
|
||||||
coordinates: JSON.stringify(
|
|
||||||
polygonPoints.value.map((p) => ({ x: p.x, y: p.y })),
|
|
||||||
),
|
|
||||||
});
|
|
||||||
polygonPoints.value = [];
|
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onContextMenu(e: MouseEvent) {
|
function onContextMenu(e: MouseEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (props.drawMode === 'polygon' && polygonPoints.value.length >= 3) {
|
||||||
|
finishPolygon();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!props.drawMode) {
|
||||||
const pt = getCanvasPoint(e);
|
const pt = getCanvasPoint(e);
|
||||||
const roi = findRoiAtPoint(pt);
|
const roi = findRoiAtPoint(pt);
|
||||||
if (roi?.roiId) {
|
if (roi?.roiId) {
|
||||||
emit('roi-deleted', roi.roiId);
|
emit('roi-deleted', roi.roiId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- 键盘事件 ----
|
||||||
|
|
||||||
|
function onKeyDown(e: KeyboardEvent) {
|
||||||
|
if (props.drawMode === 'polygon') {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
polygonPoints.value = [];
|
||||||
|
mouseMovePoint = null;
|
||||||
|
emit('draw-cancelled');
|
||||||
|
redraw();
|
||||||
|
} else if ((e.ctrlKey && e.key === 'z') || e.key === 'Backspace') {
|
||||||
|
e.preventDefault();
|
||||||
|
if (polygonPoints.value.length > 0) {
|
||||||
|
polygonPoints.value.pop();
|
||||||
|
redraw();
|
||||||
|
if (polygonPoints.value.length > 0) {
|
||||||
|
drawPolygonInProgress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- 多边形完成(公开方法,供父组件调用) ----
|
||||||
|
|
||||||
|
function finishPolygon() {
|
||||||
|
if (polygonPoints.value.length < 3) return;
|
||||||
|
const points = polygonPoints.value.map((p) => ({ x: p.x, y: p.y }));
|
||||||
|
emit('roi-drawn', {
|
||||||
|
roi_type: 'polygon',
|
||||||
|
coordinates: JSON.stringify(points),
|
||||||
|
});
|
||||||
|
polygonPoints.value = [];
|
||||||
|
mouseMovePoint = null;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- ROI 查找 ----
|
||||||
|
|
||||||
function findRoiAtPoint(pt: { x: number; y: number }) {
|
function findRoiAtPoint(pt: { x: number; y: number }) {
|
||||||
for (let i = props.rois.length - 1; i >= 0; i--) {
|
for (let i = props.rois.length - 1; i >= 0; i--) {
|
||||||
const roi = props.rois[i]!;
|
const roi = props.rois[i]!;
|
||||||
@@ -217,7 +234,8 @@ function findRoiAtPoint(pt: { x: number; y: number }) {
|
|||||||
typeof roi.coordinates === 'string'
|
typeof roi.coordinates === 'string'
|
||||||
? JSON.parse(roi.coordinates)
|
? JSON.parse(roi.coordinates)
|
||||||
: roi.coordinates;
|
: roi.coordinates;
|
||||||
if (roi.roiType === 'rectangle') {
|
const type = roi.roiType;
|
||||||
|
if (type === 'rectangle' || type === 'fullscreen') {
|
||||||
if (
|
if (
|
||||||
pt.x >= coords.x &&
|
pt.x >= coords.x &&
|
||||||
pt.x <= coords.x + coords.w &&
|
pt.x <= coords.x + coords.w &&
|
||||||
@@ -226,7 +244,7 @@ function findRoiAtPoint(pt: { x: number; y: number }) {
|
|||||||
) {
|
) {
|
||||||
return roi;
|
return roi;
|
||||||
}
|
}
|
||||||
} else if (roi.roiType === 'polygon') {
|
} else if (type === 'polygon') {
|
||||||
if (isPointInPolygon(pt, coords)) return roi;
|
if (isPointInPolygon(pt, coords)) return roi;
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -254,6 +272,8 @@ function isPointInPolygon(
|
|||||||
return inside;
|
return inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- 绘制 ----
|
||||||
|
|
||||||
function redraw() {
|
function redraw() {
|
||||||
if (!ctx) return;
|
if (!ctx) return;
|
||||||
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
||||||
@@ -266,12 +286,13 @@ function redraw() {
|
|||||||
: roi.coordinates;
|
: roi.coordinates;
|
||||||
const color = roi.color || '#FF0000';
|
const color = roi.color || '#FF0000';
|
||||||
const isSelected = roi.roiId === props.selectedRoiId;
|
const isSelected = roi.roiId === props.selectedRoiId;
|
||||||
|
const type = roi.roiType;
|
||||||
|
|
||||||
ctx!.strokeStyle = color;
|
ctx!.strokeStyle = color;
|
||||||
ctx!.lineWidth = isSelected ? 3 : 2;
|
ctx!.lineWidth = isSelected ? 3 : 2;
|
||||||
ctx!.fillStyle = `${color}33`;
|
ctx!.fillStyle = `${color}33`;
|
||||||
|
|
||||||
if (roi.roiType === 'rectangle') {
|
if (type === 'rectangle' || type === 'fullscreen') {
|
||||||
const rx = coords.x * canvasWidth;
|
const rx = coords.x * canvasWidth;
|
||||||
const ry = coords.y * canvasHeight;
|
const ry = coords.y * canvasHeight;
|
||||||
const rw = coords.w * canvasWidth;
|
const rw = coords.w * canvasWidth;
|
||||||
@@ -283,7 +304,7 @@ function redraw() {
|
|||||||
ctx!.font = '12px Arial';
|
ctx!.font = '12px Arial';
|
||||||
ctx!.fillText(roi.name, rx + 4, ry + 14);
|
ctx!.fillText(roi.name, rx + 4, ry + 14);
|
||||||
}
|
}
|
||||||
} else if (roi.roiType === 'polygon') {
|
} else if (type === 'polygon') {
|
||||||
ctx!.beginPath();
|
ctx!.beginPath();
|
||||||
coords.forEach((p: { x: number; y: number }, idx: number) => {
|
coords.forEach((p: { x: number; y: number }, idx: number) => {
|
||||||
const px = p.x * canvasWidth;
|
const px = p.x * canvasWidth;
|
||||||
@@ -310,19 +331,6 @@ function redraw() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawRectInProgress() {
|
|
||||||
if (!startPoint || !currentPoint || !ctx) return;
|
|
||||||
const x = Math.min(startPoint.x, currentPoint.x) * canvasWidth;
|
|
||||||
const y = Math.min(startPoint.y, currentPoint.y) * canvasHeight;
|
|
||||||
const w = Math.abs(currentPoint.x - startPoint.x) * canvasWidth;
|
|
||||||
const h = Math.abs(currentPoint.y - startPoint.y) * canvasHeight;
|
|
||||||
ctx.strokeStyle = '#00FF00';
|
|
||||||
ctx.lineWidth = 2;
|
|
||||||
ctx.setLineDash([5, 5]);
|
|
||||||
ctx.strokeRect(x, y, w, h);
|
|
||||||
ctx.setLineDash([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawPolygonInProgress() {
|
function drawPolygonInProgress() {
|
||||||
if (polygonPoints.value.length < 1 || !ctx) return;
|
if (polygonPoints.value.length < 1 || !ctx) return;
|
||||||
ctx.strokeStyle = '#00FF00';
|
ctx.strokeStyle = '#00FF00';
|
||||||
@@ -335,15 +343,31 @@ function drawPolygonInProgress() {
|
|||||||
if (idx === 0) ctx!.moveTo(px, py);
|
if (idx === 0) ctx!.moveTo(px, py);
|
||||||
else ctx!.lineTo(px, py);
|
else ctx!.lineTo(px, py);
|
||||||
ctx!.fillStyle = '#00FF00';
|
ctx!.fillStyle = '#00FF00';
|
||||||
ctx!.fillRect(px - 3, py - 3, 6, 6);
|
ctx!.fillRect(px - 4, py - 4, 8, 8);
|
||||||
});
|
});
|
||||||
|
// 鼠标跟随线
|
||||||
|
if (mouseMovePoint) {
|
||||||
|
ctx.lineTo(
|
||||||
|
mouseMovePoint.x * canvasWidth,
|
||||||
|
mouseMovePoint.y * canvasHeight,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 首尾闭合预览线
|
||||||
|
if (polygonPoints.value.length >= 3) {
|
||||||
|
const first = polygonPoints.value[0]!;
|
||||||
|
const last = mouseMovePoint || polygonPoints.value[polygonPoints.value.length - 1]!;
|
||||||
|
ctx.moveTo(last.x * canvasWidth, last.y * canvasHeight);
|
||||||
|
ctx.lineTo(first.x * canvasWidth, first.y * canvasHeight);
|
||||||
|
}
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
ctx.setLineDash([]);
|
ctx.setLineDash([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ polygonPoints, finishPolygon, redraw, drawPolygonInProgress });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="wrapper" class="roi-canvas-wrapper">
|
<div ref="wrapper" class="roi-canvas-wrapper" tabindex="0" @keydown="onKeyDown">
|
||||||
<img
|
<img
|
||||||
v-if="snapUrl"
|
v-if="snapUrl"
|
||||||
:src="snapUrl"
|
:src="snapUrl"
|
||||||
@@ -358,12 +382,16 @@ function drawPolygonInProgress() {
|
|||||||
<canvas
|
<canvas
|
||||||
ref="canvas"
|
ref="canvas"
|
||||||
class="roi-overlay"
|
class="roi-overlay"
|
||||||
|
:class="{ drawing: drawMode === 'polygon' }"
|
||||||
@mousedown="onMouseDown"
|
@mousedown="onMouseDown"
|
||||||
@mousemove="onMouseMove"
|
@mousemove="onMouseMove"
|
||||||
@mouseup="onMouseUp"
|
|
||||||
@dblclick="onDoubleClick"
|
@dblclick="onDoubleClick"
|
||||||
@contextmenu="onContextMenu"
|
@contextmenu="onContextMenu"
|
||||||
/>
|
/>
|
||||||
|
<!-- 绘制中浮动提示条 -->
|
||||||
|
<div v-if="drawMode === 'polygon'" class="draw-hint-bar">
|
||||||
|
单击添加顶点 | 双击或右键完成选区 | Esc取消 | Ctrl+Z撤销
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -374,6 +402,7 @@ function drawPolygonInProgress() {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
background: #000;
|
background: #000;
|
||||||
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-image {
|
.bg-image {
|
||||||
@@ -396,6 +425,24 @@ function drawPolygonInProgress() {
|
|||||||
|
|
||||||
.roi-overlay {
|
.roi-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roi-overlay.drawing {
|
||||||
cursor: crosshair;
|
cursor: crosshair;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.draw-hint-bar {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
color: #fff;
|
||||||
|
padding: 6px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
white-space: nowrap;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* ROI 区域配置页面
|
* ROI 区域配置页面
|
||||||
*
|
*
|
||||||
* 功能:摄像头截图展示、ROI 区域绘制(矩形/多边形)、ROI 属性编辑、
|
* 功能:摄像头截图展示、ROI 区域绘制(全图/自定义多边形)、ROI 属性编辑、
|
||||||
* 算法绑定管理、配置推送到边缘端
|
* 算法绑定管理、配置推送到边缘端
|
||||||
* 后端:WVP 视频平台 AiRoi / AiConfig API
|
* 后端:WVP 视频平台 AiRoi / AiConfig API
|
||||||
*/
|
*/
|
||||||
@@ -65,31 +65,26 @@ const selectedRoiId = ref<null | string>(null);
|
|||||||
const selectedRoiBindings = ref<AiotDeviceApi.RoiAlgoBinding[]>([]);
|
const selectedRoiBindings = ref<AiotDeviceApi.RoiAlgoBinding[]>([]);
|
||||||
const snapUrl = ref('');
|
const snapUrl = ref('');
|
||||||
const snapOk = ref(false);
|
const snapOk = ref(false);
|
||||||
|
const panelVisible = ref(false);
|
||||||
const edgeDevices = ref<Array<{ deviceId: string }>>([]);
|
const roiCanvasRef = ref<InstanceType<typeof RoiCanvas> | null>(null);
|
||||||
|
|
||||||
async function loadEdgeDevices() {
|
|
||||||
try {
|
|
||||||
const list = await wvpRequestClient.get<Array<{ deviceId: string }>>('/aiot/device/device/list');
|
|
||||||
edgeDevices.value = (list as any) || [];
|
|
||||||
} catch {
|
|
||||||
edgeDevices.value = [{ deviceId: 'edge' }];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedRoi = computed(() => {
|
const selectedRoi = computed(() => {
|
||||||
if (!selectedRoiId.value) return null;
|
if (!selectedRoiId.value) return null;
|
||||||
return roiList.value.find((r) => r.roiId === selectedRoiId.value) || null;
|
return roiList.value.find((r) => r.roiId === selectedRoiId.value) || null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isDrawing = computed(() => drawMode.value === 'polygon');
|
||||||
|
|
||||||
|
const polygonPointCount = computed(() => {
|
||||||
|
return roiCanvasRef.value?.polygonPoints?.length ?? 0;
|
||||||
|
});
|
||||||
|
|
||||||
// ==================== 初始化 ====================
|
// ==================== 初始化 ====================
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
loadEdgeDevices();
|
|
||||||
const q = route.query;
|
const q = route.query;
|
||||||
if (q.cameraCode) {
|
if (q.cameraCode) {
|
||||||
cameraCode.value = String(q.cameraCode);
|
cameraCode.value = String(q.cameraCode);
|
||||||
// 加载摄像头信息以获取应用名
|
|
||||||
await loadCurrentCamera();
|
await loadCurrentCamera();
|
||||||
await buildSnapUrl();
|
await buildSnapUrl();
|
||||||
loadRois();
|
loadRois();
|
||||||
@@ -121,7 +116,7 @@ async function loadCameraOptions() {
|
|||||||
const list = res.list || [];
|
const list = res.list || [];
|
||||||
cameraOptions.value = list.map((cam: AiotDeviceApi.Camera) => ({
|
cameraOptions.value = list.map((cam: AiotDeviceApi.Camera) => ({
|
||||||
value: cam.cameraCode || '',
|
value: cam.cameraCode || '',
|
||||||
label: `${cam.app || cam.stream}${cam.srcUrl ? ` (${cam.srcUrl})` : ''}`,
|
label: `${cam.cameraName || cam.app || cam.stream}${cam.srcUrl ? ` (${cam.srcUrl})` : ''}`,
|
||||||
camera: cam,
|
camera: cam,
|
||||||
}));
|
}));
|
||||||
} catch {
|
} catch {
|
||||||
@@ -146,6 +141,20 @@ function goBack() {
|
|||||||
router.push('/aiot/device/camera');
|
router.push('/aiot/device/camera');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==================== ROI 类型标签 ====================
|
||||||
|
|
||||||
|
function getRoiTagColor(roi: AiotDeviceApi.Roi) {
|
||||||
|
if (roi.roiType === 'fullscreen') return 'orange';
|
||||||
|
if (roi.roiType === 'rectangle') return 'blue';
|
||||||
|
return 'green';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRoiTagLabel(roi: AiotDeviceApi.Roi) {
|
||||||
|
if (roi.roiType === 'fullscreen') return '全图';
|
||||||
|
if (roi.roiType === 'rectangle') return '矩形';
|
||||||
|
return '自定义';
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== 截图 ====================
|
// ==================== 截图 ====================
|
||||||
|
|
||||||
async function buildSnapUrl(force = false) {
|
async function buildSnapUrl(force = false) {
|
||||||
@@ -188,42 +197,98 @@ async function loadRoiDetail() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== ROI 绘制 ====================
|
// ==================== 全图 ====================
|
||||||
|
|
||||||
|
function addFullscreen() {
|
||||||
|
const hasFullscreen = roiList.value.some((r) => r.roiType === 'fullscreen');
|
||||||
|
if (hasFullscreen) {
|
||||||
|
message.warning('已存在全图选区');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '新建全图选区',
|
||||||
|
content: '将创建覆盖整张图片的选区',
|
||||||
|
async onOk() {
|
||||||
|
const newRoi: Partial<AiotDeviceApi.Roi> = {
|
||||||
|
cameraId: cameraCode.value,
|
||||||
|
name: `全图-${roiList.value.length + 1}`,
|
||||||
|
roiType: 'fullscreen',
|
||||||
|
coordinates: JSON.stringify({ x: 0, y: 0, w: 1, h: 1 }),
|
||||||
|
color: '#FF0000',
|
||||||
|
priority: 0,
|
||||||
|
enabled: 1,
|
||||||
|
description: '',
|
||||||
|
deviceId: '',
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
await saveRoi(newRoi);
|
||||||
|
message.success('全图选区已创建');
|
||||||
|
loadRois();
|
||||||
|
} catch {
|
||||||
|
message.error('保存失败');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 自定义选区(多边形绘制) ====================
|
||||||
|
|
||||||
function startDraw(mode: string) {
|
function startDraw(mode: string) {
|
||||||
drawMode.value = mode;
|
drawMode.value = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function finishDraw() {
|
||||||
|
roiCanvasRef.value?.finishPolygon();
|
||||||
|
}
|
||||||
|
|
||||||
|
function undoPoint() {
|
||||||
|
if (roiCanvasRef.value && roiCanvasRef.value.polygonPoints.length > 0) {
|
||||||
|
roiCanvasRef.value.polygonPoints.pop();
|
||||||
|
roiCanvasRef.value.redraw();
|
||||||
|
if (roiCanvasRef.value.polygonPoints.length > 0) {
|
||||||
|
roiCanvasRef.value.drawPolygonInProgress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelDraw() {
|
||||||
|
drawMode.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDrawCancelled() {
|
||||||
|
drawMode.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
async function onRoiDrawn(data: { coordinates: string; roi_type: string }) {
|
async function onRoiDrawn(data: { coordinates: string; roi_type: string }) {
|
||||||
drawMode.value = null;
|
drawMode.value = null;
|
||||||
|
const roiName = `ROI-${roiList.value.length + 1}`;
|
||||||
const newRoi: Partial<AiotDeviceApi.Roi> = {
|
const newRoi: Partial<AiotDeviceApi.Roi> = {
|
||||||
cameraId: cameraCode.value,
|
cameraId: cameraCode.value,
|
||||||
name: `ROI-${roiList.value.length + 1}`,
|
name: roiName,
|
||||||
roiType: data.roi_type,
|
roiType: data.roi_type,
|
||||||
coordinates: data.coordinates,
|
coordinates: data.coordinates,
|
||||||
color: '#FF0000',
|
color: '#FF0000',
|
||||||
priority: 0,
|
priority: 0,
|
||||||
enabled: 1,
|
enabled: 1,
|
||||||
description: '',
|
description: '',
|
||||||
deviceId: edgeDevices.value[0]?.deviceId || 'edge', // 默认关联边缘设备
|
deviceId: '',
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await saveRoi(newRoi);
|
await saveRoi(newRoi);
|
||||||
message.success('ROI已保存');
|
message.success('选区已保存');
|
||||||
loadRois();
|
loadRois();
|
||||||
} catch {
|
} catch {
|
||||||
message.error('保存失败');
|
message.error('保存失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== ROI 选择 ====================
|
// ==================== ROI 选择与面板 ====================
|
||||||
|
|
||||||
function onRoiSelected(roiId: null | string) {
|
function onRoiSelected(roiId: null | string) {
|
||||||
selectedRoiId.value = roiId;
|
selectedRoiId.value = roiId;
|
||||||
if (roiId) {
|
if (roiId) {
|
||||||
|
panelVisible.value = true;
|
||||||
loadRoiDetail();
|
loadRoiDetail();
|
||||||
} else {
|
|
||||||
selectedRoiBindings.value = [];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +297,12 @@ function selectRoi(roi: AiotDeviceApi.Roi) {
|
|||||||
loadRoiDetail();
|
loadRoiDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closePanel() {
|
||||||
|
panelVisible.value = false;
|
||||||
|
selectedRoiId.value = null;
|
||||||
|
selectedRoiBindings.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
// ==================== ROI 编辑 ====================
|
// ==================== ROI 编辑 ====================
|
||||||
|
|
||||||
async function updateRoiData(roi: AiotDeviceApi.Roi) {
|
async function updateRoiData(roi: AiotDeviceApi.Roi) {
|
||||||
@@ -246,7 +317,13 @@ async function updateRoiData(roi: AiotDeviceApi.Roi) {
|
|||||||
// ==================== ROI 删除 ====================
|
// ==================== ROI 删除 ====================
|
||||||
|
|
||||||
function onRoiDeleted(roiId: string) {
|
function onRoiDeleted(roiId: string) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定删除该ROI?关联的算法绑定也将删除。',
|
||||||
|
async onOk() {
|
||||||
doDeleteRoi(roiId);
|
doDeleteRoi(roiId);
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDeleteRoi(roi: AiotDeviceApi.Roi) {
|
function handleDeleteRoi(roi: AiotDeviceApi.Roi) {
|
||||||
@@ -267,7 +344,10 @@ async function doDeleteRoi(roiId: string) {
|
|||||||
selectedRoiId.value = null;
|
selectedRoiId.value = null;
|
||||||
selectedRoiBindings.value = [];
|
selectedRoiBindings.value = [];
|
||||||
}
|
}
|
||||||
loadRois();
|
await loadRois();
|
||||||
|
if (roiList.value.length === 0) {
|
||||||
|
panelVisible.value = false;
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
message.error('删除失败');
|
message.error('删除失败');
|
||||||
}
|
}
|
||||||
@@ -316,40 +396,43 @@ function handlePush() {
|
|||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<Button size="small" @click="goBack">返回</Button>
|
<Button size="small" @click="goBack">返回</Button>
|
||||||
<h3>{{ currentCamera?.app || cameraCode }} - ROI配置</h3>
|
<h3>{{ currentCamera?.cameraName || currentCamera?.app || cameraCode }} - ROI配置</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
<Button
|
<!-- 默认工具栏 -->
|
||||||
size="small"
|
<template v-if="!isDrawing">
|
||||||
type="primary"
|
<Button size="small" type="primary" @click="addFullscreen">
|
||||||
:disabled="drawMode === 'rectangle'"
|
全图
|
||||||
@click="startDraw('rectangle')"
|
|
||||||
>
|
|
||||||
画矩形
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button size="small" type="primary" @click="startDraw('polygon')">
|
||||||
size="small"
|
自定义选区
|
||||||
type="primary"
|
|
||||||
:disabled="drawMode === 'polygon'"
|
|
||||||
@click="startDraw('polygon')"
|
|
||||||
>
|
|
||||||
画多边形
|
|
||||||
</Button>
|
|
||||||
<Button size="small" :disabled="!drawMode" @click="drawMode = null">
|
|
||||||
取消绘制
|
|
||||||
</Button>
|
</Button>
|
||||||
<Button size="small" @click="refreshSnap">刷新截图</Button>
|
<Button size="small" @click="refreshSnap">刷新截图</Button>
|
||||||
<Button size="small" type="default" @click="handlePush">
|
<Button size="small" type="default" @click="handlePush">
|
||||||
推送到边缘端
|
推送到边缘端
|
||||||
</Button>
|
</Button>
|
||||||
|
</template>
|
||||||
|
<!-- 绘制中工具栏 -->
|
||||||
|
<template v-else>
|
||||||
|
<Button size="small" type="primary" :disabled="polygonPointCount < 3" @click="finishDraw">
|
||||||
|
完成选区
|
||||||
|
</Button>
|
||||||
|
<Button size="small" :disabled="polygonPointCount === 0" @click="undoPoint">
|
||||||
|
撤销上一点
|
||||||
|
</Button>
|
||||||
|
<Button size="small" danger @click="cancelDraw">
|
||||||
|
取消绘制
|
||||||
|
</Button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 主内容区:左侧画布 + 右侧面板 -->
|
<!-- 主内容区:左侧画布 + 右侧面板 -->
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<!-- 画布区域 -->
|
<!-- 画布区域 -->
|
||||||
<div class="canvas-panel">
|
<div :class="['canvas-panel', { 'panel-open': panelVisible }]">
|
||||||
<RoiCanvas
|
<RoiCanvas
|
||||||
|
ref="roiCanvasRef"
|
||||||
:rois="roiList"
|
:rois="roiList"
|
||||||
:draw-mode="drawMode"
|
:draw-mode="drawMode"
|
||||||
:selected-roi-id="selectedRoiId"
|
:selected-roi-id="selectedRoiId"
|
||||||
@@ -357,18 +440,26 @@ function handlePush() {
|
|||||||
@roi-drawn="onRoiDrawn"
|
@roi-drawn="onRoiDrawn"
|
||||||
@roi-selected="onRoiSelected"
|
@roi-selected="onRoiSelected"
|
||||||
@roi-deleted="onRoiDeleted"
|
@roi-deleted="onRoiDeleted"
|
||||||
|
@draw-cancelled="onDrawCancelled"
|
||||||
@snap-status="onSnapStatus"
|
@snap-status="onSnapStatus"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 右侧面板 -->
|
<!-- 右侧面板 -->
|
||||||
<div class="side-panel">
|
<transition name="slide-panel">
|
||||||
|
<div v-if="panelVisible" class="side-panel">
|
||||||
|
<div class="panel-close">
|
||||||
|
<Button size="small" shape="circle" @click="closePanel">
|
||||||
|
✕
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- ROI 列表 -->
|
<!-- ROI 列表 -->
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<span>ROI列表 ({{ roiList.length }})</span>
|
<span>ROI列表 ({{ roiList.length }})</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="roiList.length === 0" class="empty-tip">
|
<div v-if="roiList.length === 0" class="empty-tip">
|
||||||
暂无ROI,请在左侧画面上绘制
|
暂无ROI,请使用上方按钮添加
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="roi in roiList"
|
v-for="roi in roiList"
|
||||||
@@ -383,10 +474,10 @@ function handlePush() {
|
|||||||
/>
|
/>
|
||||||
<span class="roi-name">{{ roi.name || '未命名' }}</span>
|
<span class="roi-name">{{ roi.name || '未命名' }}</span>
|
||||||
<Tag
|
<Tag
|
||||||
:color="roi.roiType === 'rectangle' ? 'blue' : 'green'"
|
:color="getRoiTagColor(roi)"
|
||||||
style="margin-right: 0"
|
style="margin-right: 0"
|
||||||
>
|
>
|
||||||
{{ roi.roiType === 'rectangle' ? '矩形' : '多边形' }}
|
{{ getRoiTagLabel(roi) }}
|
||||||
</Tag>
|
</Tag>
|
||||||
<Switch
|
<Switch
|
||||||
:checked="roi.enabled === 1"
|
:checked="roi.enabled === 1"
|
||||||
@@ -429,20 +520,6 @@ function handlePush() {
|
|||||||
@blur="updateRoiData(selectedRoi!)"
|
@blur="updateRoiData(selectedRoi!)"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="边缘设备">
|
|
||||||
<Select
|
|
||||||
v-model:value="selectedRoi.deviceId"
|
|
||||||
placeholder="选择边缘设备"
|
|
||||||
@change="updateRoiData(selectedRoi!)"
|
|
||||||
>
|
|
||||||
<Select.Option v-for="dev in edgeDevices" :key="dev.deviceId" :value="dev.deviceId">
|
|
||||||
{{ dev.deviceId }}
|
|
||||||
</Select.Option>
|
|
||||||
</Select>
|
|
||||||
<div style="margin-top: 4px; font-size: 12px; color: #999">
|
|
||||||
关联的边缘推理节点
|
|
||||||
</div>
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label="颜色">
|
<Form.Item label="颜色">
|
||||||
<Input
|
<Input
|
||||||
v-model:value="selectedRoi.color"
|
v-model:value="selectedRoi.color"
|
||||||
@@ -458,9 +535,6 @@ function handlePush() {
|
|||||||
:max="100"
|
:max="100"
|
||||||
@change="updateRoiData(selectedRoi!)"
|
@change="updateRoiData(selectedRoi!)"
|
||||||
/>
|
/>
|
||||||
<div style="margin-top: 4px; font-size: 12px; color: #999">
|
|
||||||
数值越大优先级越高(0-100),多个ROI重叠时优先处理高优先级区域
|
|
||||||
</div>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="描述">
|
<Form.Item label="描述">
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
@@ -485,6 +559,7 @@ function handlePush() {
|
|||||||
点击左侧ROI区域或列表项查看详情
|
点击左侧ROI区域或列表项查看详情
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -513,6 +588,7 @@ function handlePush() {
|
|||||||
|
|
||||||
.header-left h3 {
|
.header-left h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-right {
|
.header-right {
|
||||||
@@ -523,15 +599,21 @@ function handlePush() {
|
|||||||
.main-content {
|
.main-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
gap: 12px;
|
gap: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.canvas-panel {
|
.canvas-panel {
|
||||||
flex: 6;
|
flex: 1;
|
||||||
background: #000;
|
background: #000;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
transition: flex 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvas-panel.panel-open {
|
||||||
|
flex: 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.side-panel {
|
.side-panel {
|
||||||
@@ -539,8 +621,28 @@ function handlePush() {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid #f0f0f0;
|
border: 1px solid #f0f0f0;
|
||||||
border-radius: 4px;
|
border-radius: 0 4px 4px 0;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
|
margin-left: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-close {
|
||||||
|
text-align: right;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 面板滑入动画 */
|
||||||
|
.slide-panel-enter-active,
|
||||||
|
.slide-panel-leave-active {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slide-panel-enter-from,
|
||||||
|
.slide-panel-leave-to {
|
||||||
|
flex: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
overflow: hidden;
|
||||||
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-header {
|
.section-header {
|
||||||
|
|||||||
Reference in New Issue
Block a user