Przeglądaj źródła

1. 添加巷道地图页设备监测列表显示隐藏动画

hongrunxia 10 miesięcy temu
rodzic
commit
bc7092de61

+ 1 - 1
src/App.vue

@@ -2,7 +2,7 @@
   <AdaptiveContainer :options="{ width: width, height: height }" style="overflow-y: hidden">
     <ConfigProvider :locale="getAntdLocale" prefixCls="zxm">
       <AppProvider>
-        <RouterView v-if="!isReload" />
+        <RouterView />
       </AppProvider>
     </ConfigProvider>
   </AdaptiveContainer>

+ 3 - 3
src/components/vent/micro/needAir.vue

@@ -19,9 +19,9 @@
         });
       });
 
-      onBeforeUnmount(() => {
-        unmountMicroApps(['/micro-need-air']);
-      });
+      // onBeforeUnmount(() => {
+      //   unmountMicroApps(['/micro-need-air']);
+      // });
 
       return { loading };
     },

+ 6 - 4
src/components/vent/micro/ventModal.vue

@@ -6,7 +6,7 @@
 </template>
 <script lang="ts">
   import { ref, onMounted, onBeforeUnmount, defineComponent } from 'vue';
-  import { unmountMicroApps, mountMicroApp } from '/@/qiankun';
+  import { unmountMicroApps, mountMicroApp, activeApps } from '/@/qiankun';
   import { resetMicroContentWH } from '/@/utils/domUtils';
 
   export default defineComponent({
@@ -14,15 +14,17 @@
     setup() {
       const loading = ref(true);
       onMounted(() => {
+        debugger;
+        // 判断子应用是否存在,不存在注册
         mountMicroApp('/micro-vent-3dModal');
         resetMicroContentWH('micro-vent-3dModal', () => {
           loading.value = false;
         });
       });
 
-      onBeforeUnmount(() => {
-        unmountMicroApps(['/micro-vent-3dModal']);
-      });
+      // onBeforeUnmount(() => {
+      //   unmountMicroApps(['/micro-vent-3dModal']);
+      // });
 
       return { loading };
     },

+ 6 - 1
src/qiankun/index.ts

@@ -25,7 +25,11 @@ function filterApps() {
 const mountMicroApp = (path, toPath?) => {
   const microApps = filterApps();
   const app = microApps.find((item) => path.startsWith(item['activeRule']));
+  debugger;
   if (app) {
+    if (activeApps[app['activeRule']]) {
+      return;
+    }
     const instance = activeApps[app['activeRule']];
     console.log('子应用实例--------------->', instance);
     if (instance) {
@@ -56,6 +60,7 @@ const mountMicroApp = (path, toPath?) => {
 
 // 卸载app的方法
 const unmountMicroApps = async (multipleApp) => {
+  debugger;
   for (const key in activeApps) {
     const isExist = multipleApp.some((name) => name == key);
     if (isExist) {
@@ -66,4 +71,4 @@ const unmountMicroApps = async (multipleApp) => {
   }
 };
 
-export { mountMicroApp, unmountMicroApps };
+export { mountMicroApp, unmountMicroApps, activeApps };

+ 20 - 27
src/views/vent/monitorManager/deviceMonitor/index.vue

@@ -1,17 +1,17 @@
 <template>
   <div class="scene-box">
-    <template v-if="isShow && routerParam !== 'timesolution' && routerParam !== 'home' && routerParam !== 'model3D' && routerParam !== 'none'">
+    <template v-if="isShow && routerParam !== 'timesolution' && routerParam !== 'home' && routerParam !== 'model3D'">
       <!-- <Emergency ref="NetworkRef" v-if="deviceKind === 'emergency'" :pageResult="pageResult" @changePageType="changePageType" />
       <DeviceVue ref="DeviceRef" v-else :pageData="pageData" /> -->
       <DeviceVue ref="DeviceRef" :pageData="pageData" />
     </template>
     <Network ref="NetworkRef" v-if="routerParam === 'timesolution'" :pageResult="pageResult" @changePageType="changePageType" />
+    <VentModal style="width: 100%; height: 100%; position: absolute" />
   </div>
-  <VentModal style="width: 100%; height: 100%; position: absolute" />
 </template>
 
-<script setup lang="ts" name="device-monitor">
-  import { ref, onMounted, watch } from 'vue';
+<script setup lang="ts">
+  import { ref, onMounted, watch, onUnmounted } from 'vue';
   import DeviceVue from './components/device/index.vue';
   import Network from './components/network/index.vue';
   import Emergency from './components/emergency/index.vue';
@@ -19,7 +19,7 @@
   import { useRoute } from 'vue-router';
   import { onBeforeUnmount } from 'vue';
   import VentModal from '/@/components/vent/micro/ventModal.vue';
-  import { nextTick } from 'vue';
+  import { unmountMicroApps } from '/@/qiankun';
 
   const route = useRoute();
   const actions = getActions();
@@ -32,39 +32,29 @@
   const pageData = ref({});
   const pageResult = ref({});
 
+  // actions.setGlobalState({ url: { path: '/micro-vent-3dModal/dashboard/analysis', query: { type, deviceType } } });
+
   const changePageType = (pageType) => {
+    console.log('页面类型', pageType);
     routerParam.value = pageType;
     actions.setGlobalState({ pageObj: { pageType: pageType } });
   };
 
   watch(
     () => route.fullPath,
-    () => {
-      const { type, deviceType, deviceid } = route.query;
-      if (type === 'tunMonitor') {
-        setTimeout(
-          () => {
-            routerParam.value = 'tunMonitor';
-            pageData.value = { pageType: deviceType, deviceid };
-          },
-          routerParam.value == 'home' ? 2000 : 0
-        );
-      } else if (type === 'network') {
-        routerParam.value = 'network';
-        pageData.value = {};
-      } else if (!type) {
-        routerParam.value = 'home';
-        pageData.value = {};
-      } else {
-        setTimeout(() => {
-          routerParam.value = 'none';
-          pageData.value = {};
-        }, 3000);
-      }
+    (fullPath) => {
+      debugger;
+      // const { type, deviceType } = routeVal.query
+      // if (type === 'tunMonitor') {
+      //   pageData.value = { pageType: deviceType }
+      //   actions.setGlobalState({ pageObj: { pageType: deviceType } });
+      // }
+      console.log('fullPath------------------->', fullPath);
     }
   );
 
   onMounted(() => {
+    debugger;
     const { type, deviceType, topage } = route.query;
     deviceKind.value = deviceType as string;
     if (!topage) {
@@ -113,6 +103,9 @@
   onBeforeUnmount(async () => {
     //
   });
+  onUnmounted(() => {
+    // unmountMicroApps(['/micro-vent-3dModal']);
+  });
 </script>
 
 <style lang="less" scoped>