瀏覽代碼

Merge branch 'master' of http://182.92.126.35:3000/hrx/mky-vent-base

hongrunxia 9 月之前
父節點
當前提交
c287b7ec54
共有 1 個文件被更改,包括 31 次插入14 次删除
  1. 31 14
      src/views/vent/home/billboard/index.vue

+ 31 - 14
src/views/vent/home/billboard/index.vue

@@ -5,10 +5,13 @@
       <div class="main-title">{{ mainTitle }}</div>
     </div>
     <a-row class="company-content" :gutter="10">
-      <a-col v-for="(item, i) in shownBillboards" :key="`svvhbi-${i}`" :span="6">
+      <!-- <a-col v-for="(item, i) in shownBillboards" :key="`svvhbi-${i}`" :span="6">
         <BaseCard :title="item.orgname || '/'" @open="openHandler(item.ip)">
           <component :is="componentMap[billboardType]" :data="item" />
         </BaseCard>
+      </a-col> -->
+      <a-col v-for="(render, i) in shownBillboards" :key="`svvhbi-${i}`" :span="6">
+        <component :is="render" />
       </a-col>
     </a-row>
     <!-- <div v-if="showBtn" style="position: absolute; top: 0; left: 0">
@@ -33,10 +36,9 @@
    * 支持的看板类型如下:'DustStatus'、'FireStatus'、'FileOverview'、'VentilationStatus'、'GasStatus'、'Summary'
    *
    */
-  import { computed, onMounted, ref } from 'vue';
+  import { VNode, computed, h, onMounted, ref } from 'vue';
   import BaseCard from './components/BaseCard.vue';
   import ArrowButton from './components/ArrowButton.vue';
-  import { BillboardType } from './billboard.data';
   // import { useRoute } from 'vue-router';
   import { getSummary } from './billboard.api';
   import { useSSO } from '/@/hooks/vent/useSSO';
@@ -64,24 +66,30 @@
     FireStatus,
     Summary,
   };
-  // 组件Map,不同type需要跳转到不同的矿端页面
-  const routePathMap = {
-    DustStatus: '/dust/warn/home',
-    FileOverview: '/fileManager/fileDetail/home',
-    VentilationStatus: '/micro-vent-3dModal/dashboard/analysis',
-    GasStatus: '/gas/warn/home',
-    FireStatus: '/fire/warn/home',
-    Summary: undefined,
-  };
 
   const mainTitle = '国能神东一通三防管控平台';
 
   // 看板相关的基础配置
-  const billboards = ref<BillboardType[]>([]);
+  const billboards = ref<(() => VNode)[]>([]);
 
   function fetchBillboards() {
     getSummary().then((r) => {
-      billboards.value = r;
+      billboards.value = r.map((el) => {
+        return () =>
+          h(
+            BaseCard,
+            {
+              title: el.orgname || '/',
+              onOpen: () => openHandler(el.ip),
+            },
+            {
+              default: () =>
+                h(componentMap[props.billboardType], {
+                  data: el,
+                }),
+            }
+          );
+      });
     });
   }
 
@@ -104,6 +112,15 @@
   // const billboardType = ref('DustStatus');
   // const showBtn = ref(true);
 
+  // 组件Map,不同type需要跳转到不同的矿端页面
+  const routePathMap = {
+    DustStatus: '/dust/warn/home',
+    FileOverview: '/fileManager/fileDetail/home',
+    VentilationStatus: '/micro-vent-3dModal/dashboard/analysis',
+    GasStatus: '/gas/warn/home',
+    FireStatus: '/fire/warn/home',
+    Summary: undefined,
+  };
   // 页面跳转
   function openHandler(ip: string) {
     const url = `http://${ip}:8092/login`;