|
@@ -43,8 +43,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
- import { computed, onMounted, onUnmounted, ref } from 'vue';
|
|
|
|
|
- import { useRoute } from 'vue-router';
|
|
|
|
|
|
|
+ import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
|
|
|
|
+ import { useRoute, useRouter } from 'vue-router';
|
|
|
import OverviewView from './components/OverviewView.vue';
|
|
import OverviewView from './components/OverviewView.vue';
|
|
|
import MonitorView from './components/MonitorView.vue';
|
|
import MonitorView from './components/MonitorView.vue';
|
|
|
import ManualView from './components/ManualView.vue';
|
|
import ManualView from './components/ManualView.vue';
|
|
@@ -58,6 +58,7 @@
|
|
|
import type { SafetyScene } from './evaluation.config';
|
|
import type { SafetyScene } from './evaluation.config';
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
|
|
+ const router = useRouter();
|
|
|
const rootRef = ref<HTMLElement>();
|
|
const rootRef = ref<HTMLElement>();
|
|
|
const activeTab = ref(0);
|
|
const activeTab = ref(0);
|
|
|
const pageTitle = '张家峁煤自燃监测预警';
|
|
const pageTitle = '张家峁煤自燃监测预警';
|
|
@@ -166,13 +167,37 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
scenes.value = list.length ? list : [{ ...FALLBACK_SCENE }];
|
|
scenes.value = list.length ? list : [{ ...FALLBACK_SCENE }];
|
|
|
- const queryScene = (route.query.systemID || route.query.manageSystemId || route.query.sceneId) as string;
|
|
|
|
|
|
|
+ // sysID 为当前定位参数,优先于旧版入口携带的场景参数
|
|
|
|
|
+ const queryScene = (route.query.sysID || route.query.systemID || route.query.manageSystemId || route.query.sceneId || route.query.deviceid) as string;
|
|
|
if (queryScene && !scenes.value.some((scene) => scene.id === queryScene)) {
|
|
if (queryScene && !scenes.value.some((scene) => scene.id === queryScene)) {
|
|
|
scenes.value.unshift({ id: queryScene, systemname: '当前场景' });
|
|
scenes.value.unshift({ id: queryScene, systemname: '当前场景' });
|
|
|
}
|
|
}
|
|
|
manageSystemId.value = queryScene || scenes.value[0]?.id || '';
|
|
manageSystemId.value = queryScene || scenes.value[0]?.id || '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 场景切换时通过路由参数通知三维模型定位到对应场景 */
|
|
|
|
|
+ function locateSceneInModel(scene?: SafetyScene) {
|
|
|
|
|
+ const sysID = scene?.id || manageSystemId.value;
|
|
|
|
|
+ if (!sysID) return;
|
|
|
|
|
+
|
|
|
|
|
+ const currentSysID = Array.isArray(route.query.sysID) ? route.query.sysID[0] : route.query.sysID;
|
|
|
|
|
+ // 旧版参数(type/deviceType/deviceid)会切到子应用带工具栏的模型页,这里一并清掉
|
|
|
|
|
+ const hasLegacyQuery = route.query.type === 'tunMonitor' || !!(route.query.deviceType || route.query.deviceid);
|
|
|
|
|
+ if (!hasLegacyQuery && currentSysID === sysID) return;
|
|
|
|
|
+
|
|
|
|
|
+ const query: Record<string, any> = { ...route.query, sysID };
|
|
|
|
|
+ if (query.type === 'tunMonitor') delete query.type;
|
|
|
|
|
+ delete query.deviceType;
|
|
|
|
|
+ delete query.deviceid;
|
|
|
|
|
+
|
|
|
|
|
+ router.replace({ path: route.path, query });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ watch(manageSystemId, (id) => {
|
|
|
|
|
+ if (!id) return;
|
|
|
|
|
+ locateSceneInModel(scenes.value.find((scene) => scene.id === id));
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
function initDataInterval() {
|
|
function initDataInterval() {
|
|
|
clearInterval(dataInterval);
|
|
clearInterval(dataInterval);
|
|
|
dataInterval = window.setInterval(() => {
|
|
dataInterval = window.setInterval(() => {
|