Browse Source

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

2、添加专注模式和画布锁定
master
Fuyuu 1 year ago
parent
commit
9c8fb603ce
  1. 8
      src/views/military/modules/ai/aiMonitorArea/DtAiMonitorAreaList.vue
  2. 13
      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) {
videoVisible.value = true;
//
getCameraInfo(record);
getCameraInfo(record).then(() => {
//
videoVisible.value = true;
});
}
//
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
rtspUrl.value = res.preRtsp;
});

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

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

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

@ -4,7 +4,14 @@
<a-row>
<a-col :span="24">
<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-form-item>
</a-col>
@ -45,12 +52,12 @@
<a-col :span="24">
<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-col>
<a-col :span="24">
<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-col>
<!-- <a-col :span="24">
@ -96,13 +103,15 @@
//
import SelectCom from '../selectCom/SelectCom.vue';
//
const cameraTree = ref(null);
//
const cameraList: any = ref([]);
// rtsp
const rtspUrl = ref('');
//
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
rtspUrl.value = res.preRtsp;
});
@ -179,9 +188,9 @@
)
.then((res) => {
if (res.success) {
console.log(res.result);
// console.log(res.result);
cameraList.value = handleCameraTree(res.result);
// console.log(cameraList);
}
});
}
@ -194,7 +203,7 @@
let item = data[i];
obj.title = item.name;
obj.value = obj.key = item.id;
// obj.selectable = false;
obj.disabled = item.children ? true : false;
if (item.children && item.children.length > 0) {
obj.children = [];
// obj.key = i + 1;
@ -236,9 +245,10 @@
const videoVisible = ref(false);
//
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
:keyboard="false"
:maskClosable="false"
:mask="false"
:forceRender="true"
:visible="visible"
:title="title"
@ -22,7 +21,7 @@
</a-row>
<a-row class="operate_area">
<div>
<a-space :size="18">
<a-space :size="12">
<a-button shape="round" size="middle" @click="change(0)"> <ApiOutlined /> 退出创建</a-button>
<a-button type="primary" shape="circle" size="large" @click="change(1)" title="创建矩形">
<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="创建圆">
<img class="icon_style" src="./assets/circle_icon.png" />
</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-space>
</div>
@ -58,7 +59,7 @@
</template>
<script lang="ts" setup>
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 props = defineProps({
title: {
@ -93,6 +94,10 @@
const { ipcRenderer } = require('electron');
// DOM
const mpegPlayer = ref();
//
const playOption = ref({
decodeFirstFrame: true,
});
//
const msg = ref('');
//
@ -101,7 +106,7 @@
const open = () => {
const res = ipcRenderer.sendSync('openRtsp', props.videoUrl);
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;
};
@ -127,12 +132,18 @@
function change(num: any) {
instance.createType = num;
}
//
//
function clear() {
instance.setData([]);
}
//
function onFocus() {
instance.setFocusMode(!instance.focusMode);
}
// /
function lock() {
instance.lock = !instance.lock;
}
//
function save() {
/* 保存绘制数据,用于回显 */
@ -236,18 +247,11 @@
}
}
watch(
() => props.videoUrl,
(newVal, oldVal) => {
open();
}
);
onMounted(() => {
//
open();
//
document.addEventListener('keydown', changeSelect);
//
// open();
//
if (props.labelData == '') {
option.value = [];
@ -274,7 +278,7 @@
instance.ctrlRadius = 4;
//
instance.on('load', (src: any) => {
console.log('image load', src);
// console.log('image load', src);
});
//
@ -308,11 +312,11 @@
// });
//
instance.on('select', (shape: any) => {
console.log('选中', shape);
// console.log('', shape);
});
//
instance.on('updated', (result: any) => {
console.log('更新', result);
// console.log('', result);
});
});
//

Loading…
Cancel
Save