|
@@ -4,6 +4,7 @@ import { message } from 'ant-design-vue';
|
|
|
|
|
|
import Visual2DEditor from '@/components/visual-2d/Visual2DEditor.vue';
|
|
|
import Visual2DPreview from '@/components/visual-2d/Visual2DPreview.vue';
|
|
|
+import { useRefreshView } from '@/hooks/refresh-view';
|
|
|
import { useRequest } from '@/hooks/request';
|
|
|
import { t } from '@/i18n';
|
|
|
import { equipmentDetails, getGroupModuleInfo, getPageList, noPaginationDevicesList } from '@/api';
|
|
@@ -32,11 +33,14 @@ const visual2DEditorRef = useTemplateRef('visual2DEditor');
|
|
|
const visual2DPreviewRef = useTemplateRef('visual2DPreview');
|
|
|
|
|
|
const { isLoading, handleRequest } = useRequest();
|
|
|
+const { renderView, refreshView } = useRefreshView();
|
|
|
const moduleInfo = ref<GroupModuleInfo>();
|
|
|
const deviceList = ref<DeviceGroupTree[]>([]);
|
|
|
const deviceInfo = ref<EquipmentDetailsItem>();
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ refreshView();
|
|
|
+
|
|
|
handleRequest(async () => {
|
|
|
const groups = await getPageList();
|
|
|
const devices = await noPaginationDevicesList();
|
|
@@ -97,7 +101,14 @@ const transformGroupsAndDevices = (groups: DeviceGroupItem[], devices: AllDevice
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const checkModuleInfo = () => {
|
|
|
+ if (!moduleInfo.value?.leId) {
|
|
|
+ message.error(t('realTimeMonitor.templateDataNotFound'));
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const openEditor = () => {
|
|
|
+ checkModuleInfo();
|
|
|
visual2DEditorRef.value?.showView();
|
|
|
};
|
|
|
|
|
@@ -117,6 +128,7 @@ const openDevCtrlModal = (id: number) => {
|
|
|
};
|
|
|
|
|
|
const exportImg = () => {
|
|
|
+ checkModuleInfo();
|
|
|
visual2DPreviewRef.value?.exportImg();
|
|
|
};
|
|
|
|
|
@@ -135,15 +147,16 @@ defineExpose({
|
|
|
<div class="real-time-monitor-container">
|
|
|
<template v-if="moduleInfo?.leId">
|
|
|
<Visual2DPreview
|
|
|
+ v-if="renderView"
|
|
|
ref="visual2DPreview"
|
|
|
:info="moduleInfo"
|
|
|
:device-list="deviceList"
|
|
|
@click="deviceControlRef?.closeCtrlPanel"
|
|
|
@open-dev-ctrl-modal="openDevCtrlModal"
|
|
|
/>
|
|
|
- <Visual2DEditor ref="visual2DEditor" :info="moduleInfo" :device-list="deviceList" />
|
|
|
+ <Visual2DEditor ref="visual2DEditor" :info="moduleInfo" :device-list="deviceList" @close="refreshView" />
|
|
|
</template>
|
|
|
- <DeviceControl ref="deviceControl" />
|
|
|
+ <DeviceControl ref="deviceControl" :group-id="props.deviceGroupId" />
|
|
|
<DeviceCtrlModal ref="deviceCtrlModal" :info="deviceInfo" @open-dev-batch-exe="deviceBatchExeRef?.showView" />
|
|
|
<DeviceBatchExe ref="deviceBatchExe" :group-id="props.deviceGroupId" />
|
|
|
<ASpin v-if="isLoading" class="center-loading" :spinning="true" />
|