Browse Source

1、修改视频播放和地址获取的逻辑顺序

2、添加专注模式和画布锁定
master
Fuyuu 9 months ago
parent
commit
9c8fb603ce
  1. 8
      src/views/military/modules/ai/aiMonitorArea/DtAiMonitorAreaList.vue
  2. 11
      src/views/military/modules/ai/aiMonitorArea/checkCom/CheckCom.vue
  3. 28
      src/views/military/modules/ai/aiMonitorArea/components/DtAiMonitorAreaForm.vue
  4. 42
      src/views/military/modules/ai/aiMonitorArea/selectCom/SelectCom.vue

8
src/views/military/modules/ai/aiMonitorArea/DtAiMonitorAreaList.vue

@ -75,14 +75,16 @@
// //
function videoCheck(record) { function videoCheck(record) {
videoVisible.value = true;
// //
getCameraInfo(record); getCameraInfo(record).then(() => {
//
videoVisible.value = true;
});
} }
// //
function getCameraInfo(record) { function getCameraInfo(record) {
defHttp.get({ url: '/military/camera/setting/queryById', params: { id: record.cameraId } }).then((res) => { return defHttp.get({ url: '/military/camera/setting/queryById', params: { id: record.cameraId } }).then((res) => {
// rtsp // rtsp
rtspUrl.value = res.preRtsp; rtspUrl.value = res.preRtsp;
}); });

11
src/views/military/modules/ai/aiMonitorArea/checkCom/CheckCom.vue

@ -49,7 +49,7 @@
const res = ipcRenderer.sendSync('closeRtsp', props.videoUrl); const res = ipcRenderer.sendSync('closeRtsp', props.videoUrl);
msg.value = res.msg; msg.value = res.msg;
}; };
//
function handleCancel() { function handleCancel() {
nextTick(() => { nextTick(() => {
// //
@ -58,13 +58,10 @@
close(); close();
}); });
} }
//
watch( onMounted(() => {
() => props.videoUrl,
(newVal, oldVal) => {
open(); open();
} });
);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.mpegPlayer { .mpegPlayer {

28
src/views/military/modules/ai/aiMonitorArea/components/DtAiMonitorAreaForm.vue

@ -4,7 +4,14 @@
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="监控相机" v-bind="validateInfos.cameraId"> <a-form-item label="监控相机" v-bind="validateInfos.cameraId">
<a-tree-select v-model:value="formData.cameraId" allow-clear :treeData="cameraList" :disabled="disabled" placeholder="请选择监控相机"> <a-tree-select
ref="cameraTree"
v-model:value="formData.cameraId"
allow-clear
:treeData="cameraList"
:disabled="disabled"
placeholder="请选择监控相机"
>
</a-tree-select> </a-tree-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -45,12 +52,12 @@
<a-col :span="24"> <a-col :span="24">
<a-form-item label="模型范围数据" v-bind="validateInfos.areaData"> <a-form-item label="模型范围数据" v-bind="validateInfos.areaData">
<a-textarea v-model:value="formData.areaData" rows="4" placeholder="请输入模型范围数据" :disabled="disabled" /> <a-textarea v-model:value="formData.areaData" :rows="4" placeholder="请输入模型范围数据" :disabled="disabled" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="画图数据" v-bind="validateInfos.drawdata"> <a-form-item label="画图数据" v-bind="validateInfos.drawdata">
<a-textarea v-model:value="formData.drawdata" rows="4" placeholder="请输入画图数据" :disabled="disabled"></a-textarea> <a-textarea v-model:value="formData.drawdata" :rows="4" placeholder="请输入画图数据" :disabled="disabled"></a-textarea>
</a-form-item> </a-form-item>
</a-col> </a-col>
<!-- <a-col :span="24"> <!-- <a-col :span="24">
@ -96,13 +103,15 @@
// //
import SelectCom from '../selectCom/SelectCom.vue'; import SelectCom from '../selectCom/SelectCom.vue';
//
const cameraTree = ref(null);
// //
const cameraList: any = ref([]); const cameraList: any = ref([]);
// rtsp // rtsp
const rtspUrl = ref(''); const rtspUrl = ref('');
// //
function getCameraInfo() { function getCameraInfo() {
defHttp.get({ url: '/military/camera/setting/queryById', params: { id: formData.cameraId } }).then((res) => { return defHttp.get({ url: '/military/camera/setting/queryById', params: { id: formData.cameraId } }).then((res) => {
// rtsp // rtsp
rtspUrl.value = res.preRtsp; rtspUrl.value = res.preRtsp;
}); });
@ -179,9 +188,9 @@
) )
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
console.log(res.result); // console.log(res.result);
cameraList.value = handleCameraTree(res.result); cameraList.value = handleCameraTree(res.result);
// console.log(cameraList);
} }
}); });
} }
@ -194,7 +203,7 @@
let item = data[i]; let item = data[i];
obj.title = item.name; obj.title = item.name;
obj.value = obj.key = item.id; obj.value = obj.key = item.id;
// obj.selectable = false; obj.disabled = item.children ? true : false;
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
obj.children = []; obj.children = [];
// obj.key = i + 1; // obj.key = i + 1;
@ -236,9 +245,10 @@
const videoVisible = ref(false); const videoVisible = ref(false);
// //
function videoShow() { function videoShow() {
videoVisible.value = true;
// //
getCameraInfo(); getCameraInfo().then(() => {
videoVisible.value = true;
});
} }
// //

42
src/views/military/modules/ai/aiMonitorArea/selectCom/SelectCom.vue

@ -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);
}); });
}); });
// //

Loading…
Cancel
Save