|
@@ -36,7 +36,7 @@
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ref, onMounted, onBeforeUnmount, watch } from 'vue';
|
|
import { ref, onMounted, onBeforeUnmount, watch } from 'vue';
|
|
|
- import { ElMessage } from 'element-plus';
|
|
|
|
|
|
|
+ import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
import { useGlobSetting } from '@/hooks/setting';
|
|
import { useGlobSetting } from '@/hooks/setting';
|
|
|
import DefaultTip from '../components/DefaultTip.vue';
|
|
import DefaultTip from '../components/DefaultTip.vue';
|
|
|
import urlJoin from 'url-join';
|
|
import urlJoin from 'url-join';
|
|
@@ -44,9 +44,14 @@
|
|
|
import favoritesImgSrc from '@/assets/camera/favorites.png';
|
|
import favoritesImgSrc from '@/assets/camera/favorites.png';
|
|
|
import { TipPositionEnum, camerasGroupType } from '../type';
|
|
import { TipPositionEnum, camerasGroupType } from '../type';
|
|
|
import { cloneDeep } from 'lodash-es';
|
|
import { cloneDeep } from 'lodash-es';
|
|
|
|
|
+ import useMiniMap from '../use-mini-map';
|
|
|
|
|
+ import { storeToRefs } from 'pinia';
|
|
|
|
|
|
|
|
const globSetting = useGlobSetting();
|
|
const globSetting = useGlobSetting();
|
|
|
|
|
|
|
|
|
|
+ const miniMap = useMiniMap();
|
|
|
|
|
+ const { shopCameraList } = storeToRefs(miniMap);
|
|
|
|
|
+
|
|
|
const emit = defineEmits(['changeDefaultCamera', 'sendCameraId']);
|
|
const emit = defineEmits(['changeDefaultCamera', 'sendCameraId']);
|
|
|
|
|
|
|
|
const camImg = new Image();
|
|
const camImg = new Image();
|
|
@@ -313,11 +318,27 @@
|
|
|
const handleKeyDown = (e) => {
|
|
const handleKeyDown = (e) => {
|
|
|
if (e.keyCode === 46 || e.code === 'Delete') {
|
|
if (e.keyCode === 46 || e.code === 'Delete') {
|
|
|
if (lastClickedGroupId.value === defaultCameraId.value) {
|
|
if (lastClickedGroupId.value === defaultCameraId.value) {
|
|
|
- ElMessage.error({
|
|
|
|
|
- message: '无法删除默认相机',
|
|
|
|
|
- });
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ // ElMessage.error({
|
|
|
|
|
+ // message: '无法删除默认相机',
|
|
|
|
|
+ // });
|
|
|
|
|
+ // return;
|
|
|
|
|
+ ElMessageBox.confirm('此相机为默认相机,您确认要删除此相机?', 'Warning', {
|
|
|
|
|
+ confirmButtonText: '确认',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ const index = cameras.value.findIndex((item) => item.id === lastClickedGroupId.value);
|
|
|
|
|
+ index >= 0 && cameras.value.splice(index, 1);
|
|
|
|
|
+ lastClickedGroupId.value = '';
|
|
|
|
|
+
|
|
|
|
|
+ //取消transformer
|
|
|
|
|
+ const transformerNode = transformer.value.getNode();
|
|
|
|
|
+ transformerNode.nodes([]);
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const index = cameras.value.findIndex((item) => item.id === lastClickedGroupId.value);
|
|
const index = cameras.value.findIndex((item) => item.id === lastClickedGroupId.value);
|
|
|
index >= 0 && cameras.value.splice(index, 1);
|
|
index >= 0 && cameras.value.splice(index, 1);
|
|
|
lastClickedGroupId.value = '';
|
|
lastClickedGroupId.value = '';
|
|
@@ -340,12 +361,25 @@
|
|
|
/** 导入布局json */
|
|
/** 导入布局json */
|
|
|
const createMap = (layout) => {
|
|
const createMap = (layout) => {
|
|
|
addBg(layout.bgImgUrl).then((_res) => {
|
|
addBg(layout.bgImgUrl).then((_res) => {
|
|
|
|
|
+ const unExitList = [] as any[];
|
|
|
stageConfig.value = layout.stageConfig;
|
|
stageConfig.value = layout.stageConfig;
|
|
|
defaultCameraId.value = layout.defaultCameraId;
|
|
defaultCameraId.value = layout.defaultCameraId;
|
|
|
- layout.cameraList = layout.cameraList?.map((item) => {
|
|
|
|
|
- item.config.image = camImg;
|
|
|
|
|
- return item;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ layout.cameraList = layout.cameraList
|
|
|
|
|
+ ?.map((item) => {
|
|
|
|
|
+ item.config.image = camImg;
|
|
|
|
|
+ return item;
|
|
|
|
|
+ })
|
|
|
|
|
+ ?.filter((cam) => {
|
|
|
|
|
+ if (shopCameraList.value.findIndex((x) => x.code === cam.code) >= 0) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ unExitList.push(cam.code);
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (unExitList.length > 0) {
|
|
|
|
|
+ ElMessage.warning('部分相机不存在,已为您删除!');
|
|
|
|
|
+ }
|
|
|
cameras.value = layout.cameraList;
|
|
cameras.value = layout.cameraList;
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|