|
@ -8,7 +8,6 @@ |
|
|
<a-modal |
|
|
<a-modal |
|
|
:keyboard="false" |
|
|
:keyboard="false" |
|
|
:maskClosable="false" |
|
|
:maskClosable="false" |
|
|
:mask="false" |
|
|
|
|
|
:forceRender="true" |
|
|
:forceRender="true" |
|
|
:visible="visible" |
|
|
:visible="visible" |
|
|
:title="title" |
|
|
:title="title" |
|
@ -22,7 +21,7 @@ |
|
|
</a-row> |
|
|
</a-row> |
|
|
<a-row class="operate_area"> |
|
|
<a-row class="operate_area"> |
|
|
<div> |
|
|
<div> |
|
|
<a-space :size="18"> |
|
|
<a-space :size="12"> |
|
|
<a-button shape="round" size="middle" @click="change(0)"> <ApiOutlined /> 退出创建</a-button> |
|
|
<a-button shape="round" size="middle" @click="change(0)"> <ApiOutlined /> 退出创建</a-button> |
|
|
<a-button type="primary" shape="circle" size="large" @click="change(1)" title="创建矩形"> |
|
|
<a-button type="primary" shape="circle" size="large" @click="change(1)" title="创建矩形"> |
|
|
<img class="icon_style" src="./assets/rect_icon.png" /> |
|
|
<img class="icon_style" src="./assets/rect_icon.png" /> |
|
@ -39,6 +38,8 @@ |
|
|
<a-button type="primary" shape="circle" size="large" @click="change(5)" title="创建圆"> |
|
|
<a-button type="primary" shape="circle" size="large" @click="change(5)" title="创建圆"> |
|
|
<img class="icon_style" src="./assets/circle_icon.png" /> |
|
|
<img class="icon_style" src="./assets/circle_icon.png" /> |
|
|
</a-button> |
|
|
</a-button> |
|
|
|
|
|
<a-button type="primary" shape="round" size="middle" @click="onFocus()"><AimOutlined />专注模式</a-button> |
|
|
|
|
|
<a-button type="primary" shape="round" size="middle" @click="lock()"><LinkOutlined />锁定/解锁</a-button> |
|
|
<a-button type="primary" shape="round" danger size="middle" @click="clear()"> <FormatPainterOutlined />清除标注 </a-button> |
|
|
<a-button type="primary" shape="round" danger size="middle" @click="clear()"> <FormatPainterOutlined />清除标注 </a-button> |
|
|
</a-space> |
|
|
</a-space> |
|
|
</div> |
|
|
</div> |
|
@ -58,7 +59,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { ref, getCurrentInstance, onMounted, onBeforeUnmount, nextTick, watch } from 'vue'; |
|
|
import { ref, getCurrentInstance, onMounted, onBeforeUnmount, nextTick, watch } from 'vue'; |
|
|
import { ApiOutlined, FormatPainterOutlined } from '@ant-design/icons-vue'; |
|
|
import { ApiOutlined, FormatPainterOutlined, AimOutlined, LinkOutlined } from '@ant-design/icons-vue'; |
|
|
const { proxy }: any = getCurrentInstance(); |
|
|
const { proxy }: any = getCurrentInstance(); |
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
title: { |
|
|
title: { |
|
@ -93,6 +94,10 @@ |
|
|
const { ipcRenderer } = require('electron'); |
|
|
const { ipcRenderer } = require('electron'); |
|
|
// DOM承载实例 |
|
|
// DOM承载实例 |
|
|
const mpegPlayer = ref(); |
|
|
const mpegPlayer = ref(); |
|
|
|
|
|
// 参数配置对象 |
|
|
|
|
|
const playOption = ref({ |
|
|
|
|
|
decodeFirstFrame: true, |
|
|
|
|
|
}); |
|
|
// 消息 |
|
|
// 消息 |
|
|
const msg = ref(''); |
|
|
const msg = ref(''); |
|
|
// 播放容器 |
|
|
// 播放容器 |
|
@ -101,7 +106,7 @@ |
|
|
const open = () => { |
|
|
const open = () => { |
|
|
const res = ipcRenderer.sendSync('openRtsp', props.videoUrl); |
|
|
const res = ipcRenderer.sendSync('openRtsp', props.videoUrl); |
|
|
if (res.code === 200) { |
|
|
if (res.code === 200) { |
|
|
player.value = new MpegPlayer.VideoElement(mpegPlayer.value, res.ws); |
|
|
player.value = new MpegPlayer.VideoElement(mpegPlayer.value, res.ws, playOption); |
|
|
} |
|
|
} |
|
|
msg.value = res.msg; |
|
|
msg.value = res.msg; |
|
|
}; |
|
|
}; |
|
@ -127,12 +132,18 @@ |
|
|
function change(num: any) { |
|
|
function change(num: any) { |
|
|
instance.createType = num; |
|
|
instance.createType = num; |
|
|
} |
|
|
} |
|
|
|
|
|
// 清除标注数据 |
|
|
// 清楚标注数据 |
|
|
|
|
|
function clear() { |
|
|
function clear() { |
|
|
instance.setData([]); |
|
|
instance.setData([]); |
|
|
} |
|
|
} |
|
|
|
|
|
// 专注模式 |
|
|
|
|
|
function onFocus() { |
|
|
|
|
|
instance.setFocusMode(!instance.focusMode); |
|
|
|
|
|
} |
|
|
|
|
|
// 锁定/解锁画布 |
|
|
|
|
|
function lock() { |
|
|
|
|
|
instance.lock = !instance.lock; |
|
|
|
|
|
} |
|
|
// 保存数据 |
|
|
// 保存数据 |
|
|
function save() { |
|
|
function save() { |
|
|
/* 保存绘制数据,用于回显 */ |
|
|
/* 保存绘制数据,用于回显 */ |
|
@ -236,18 +247,11 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
() => props.videoUrl, |
|
|
|
|
|
(newVal, oldVal) => { |
|
|
|
|
|
open(); |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
|
|
|
// 播放视频 |
|
|
|
|
|
open(); |
|
|
// 添加键盘事件监听 |
|
|
// 添加键盘事件监听 |
|
|
document.addEventListener('keydown', changeSelect); |
|
|
document.addEventListener('keydown', changeSelect); |
|
|
//打开窗口就打开监控 |
|
|
|
|
|
// open(); |
|
|
|
|
|
// 载入绘图数据 |
|
|
// 载入绘图数据 |
|
|
if (props.labelData == '') { |
|
|
if (props.labelData == '') { |
|
|
option.value = []; |
|
|
option.value = []; |
|
@ -274,7 +278,7 @@ |
|
|
instance.ctrlRadius = 4; |
|
|
instance.ctrlRadius = 4; |
|
|
// 图片加载完成 |
|
|
// 图片加载完成 |
|
|
instance.on('load', (src: any) => { |
|
|
instance.on('load', (src: any) => { |
|
|
console.log('image load', src); |
|
|
// console.log('image load', src); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 添加 |
|
|
// 添加 |
|
@ -308,11 +312,11 @@ |
|
|
// }); |
|
|
// }); |
|
|
// 选中 |
|
|
// 选中 |
|
|
instance.on('select', (shape: any) => { |
|
|
instance.on('select', (shape: any) => { |
|
|
console.log('选中', shape); |
|
|
// console.log('选中', shape); |
|
|
}); |
|
|
}); |
|
|
// 更新 |
|
|
// 更新 |
|
|
instance.on('updated', (result: any) => { |
|
|
instance.on('updated', (result: any) => { |
|
|
console.log('更新', result); |
|
|
// console.log('更新', result); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
// 在组件卸载时移除事件监听 |
|
|
// 在组件卸载时移除事件监听 |
|
|