Explorar o código

[Feat 0000]智能通风数据中心首页前后端接口联调

wangkeyi hai 3 días
pai
achega
fbae3ac154

+ 1 - 1
.env.development

@@ -6,7 +6,7 @@ VITE_PUBLIC_PATH = /
 
 # 跨域代理,您可以配置多个 ,请注意,没有换行符
 #VITE_PROXY = [["/jeecgboot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
-VITE_PROXY = [["/sw","http://182.92.126.35:6008"],["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"], ["/python", "http://127.0.0.1:8008"], ["/tun2D", "http://127.0.0.1:8088/micro-vent-2dModal/tun2D"],["/dataCenter", "http://192.168.1.88:10999"]]
+VITE_PROXY = [["/sw","http://182.92.126.35:6008"],["/jeecgsystem","http://182.92.126.35:9999"],["/upload","http://182.92.126.35:9999/upload"],["/documents", "http://182.92.126.35:9050"],["/modelreq", "http://182.92.126.35:9999"],["/webRtc", "http://182.92.126.35:8051"], ["/python", "http://127.0.0.1:8008"], ["/tun2D", "http://127.0.0.1:8088/micro-vent-2dModal/tun2D"],["/dataCenter", "http://192.168.1.88:10999"],["/sjzx", "http://192.168.1.88:8062/"]]
 # VITE_PROXY = [["/jeecgsystem","http://192.168.183.88:9999"],["/upload","http://192.168.183.88:9999/upload"],["/documents", "http://192.168.183.88:9050"],["/modelreq", "http://192.168.183.88:9999"],["/webRtc", "http://192.168.183.88:8051"]]
 # VITE_PROXY = [["/jeecgsystem","http://10.10.150.72:9999"],["/upload","http://localhost:3300/upload"],["/documents", "http://10.10.150.72:9050"],["/modelreq", "http://10.10.150.72:9999"],["/webRtc", "http://192.168.183.216:8051"]]
 # VITE_PROXY = [["/jeecgsystem","http://192.168.1.8:9999"],["/upload","http://localhost:3300/upload"]]

+ 29 - 29
src/components/vent/ventBox1.vue

@@ -36,37 +36,37 @@
     // }
   }
 
-  @{theme-deepblue} {
-    .vent-box1-bg {
-      --image-box1-top: url('/@/assets/images/themify/deepblue/vent/border/box2-top.png');
-      --image-box1-bottom: none;
-      // --image-box1-bottom: url('/@/assets/images/themify/deepblue/vent/border/box1-bottom.png');
-      --container-color: #0e223b;
-      // --container-image: linear-gradient(#3df6ff00, #2c3f59, #3df6ff00);
-      --container-image: none;
-    }
+  // @{theme-deepblue} {
+  //   .vent-box1-bg {
+  //     --image-box1-top: url('/@/assets/images/themify/deepblue/vent/border/box2-top.png');
+  //     --image-box1-bottom: none;
+  //     // --image-box1-bottom: url('/@/assets/images/themify/deepblue/vent/border/box1-bottom.png');
+  //     --container-color: #0e223b;
+  //     // --container-image: linear-gradient(#3df6ff00, #2c3f59, #3df6ff00);
+  //     --container-image: none;
+  //   }
 
-    .vent-box1-bg {
-      border: 1px solid #3a4b5f;
-      border-radius: 10px;
-      background: var(--container-color) no-repeat;
-      padding-top: 5px;
+  //   .vent-box1-bg {
+  //     border: 1px solid #3a4b5f;
+  //     border-radius: 10px;
+  //     background: var(--container-color) no-repeat;
+  //     padding-top: 5px;
 
-      .box1-top {
-        height: 35px;
-        background: var(--image-box1-top) no-repeat;
-        background-size: 94% 25px;
-        background-position: center center;
-        margin-bottom: 5px;
-        .title {
-          height: 100%;
-          padding-left: 8%;
-          justify-content: flex-start;
-          align-items: center;
-        }
-      }
-    }
-  }
+  //     .box1-top {
+  //       height: 35px;
+  //       background: var(--image-box1-top) no-repeat;
+  //       background-size: 94% 25px;
+  //       background-position: center center;
+  //       margin-bottom: 5px;
+  //       .title {
+  //         height: 100%;
+  //         padding-left: 8%;
+  //         justify-content: flex-start;
+  //         align-items: center;
+  //       }
+  //     }
+  //   }
+  // }
 
   .vent-box1-bg {
     --image-box1-top: url('/@/assets/images/vent/border/box1-top.png');

+ 68 - 14
src/views/vent/dataCenter/infoCenter/index.vue

@@ -4,42 +4,42 @@
     <div class="company-content">
       <div class="content-item item-1">
         <infoBox class="infoBox1">
-          <template #title> 系统数据量 </template>
+          <template #title> 设备数据量 </template>
           <template #container>
             <div class="content-wrapper wrapper-1 grid">
               <div class="data-item">
                 <div class="item-icon icon1"></div>
                 <div>
-                  <div class="label">接入系统数量</div>
-                  <div class="value">262 </div>
+                  <div class="label">接入设备数量</div>
+                  <div class="value">{{ deviceData.deviceCount }} </div>
                 </div>
               </div>
               <div class="data-item">
                 <div class="item-icon icon2"></div>
                 <div>
                   <div class="label">接入点位数量</div>
-                  <div class="value status-normal">14521</div>
+                  <div class="value status-normal">{{ deviceData.monitorParamsCount }}</div>
                 </div>
               </div>
               <div class="data-item">
                 <div class="item-icon icon3"></div>
                 <div>
                   <div class="label">数据存储量</div>
-                  <div class="value status-normal">14521</div>
+                  <div class="value status-normal">{{ deviceData.databaseDiskUsage }}</div>
                 </div>
               </div>
               <div class="data-item">
                 <div class="item-icon icon4"></div>
                 <div>
                   <div class="label">消息总数量(条)</div>
-                  <div class="value status-normal">14521</div>
+                  <div class="value status-normal">{{ deviceData.collectTotalNum }}</div>
                 </div>
               </div>
               <div class="data-item">
                 <div class="item-icon icon5"></div>
                 <div>
                   <div class="label">共享接口数量</div>
-                  <div class="value status-normal">14521</div>
+                  <div class="value status-normal">0</div>
                 </div>
               </div>
             </div>
@@ -51,7 +51,7 @@
           <template #title> 每日采集数据量 </template>
           <template #container>
             <div class="content-wrapper">
-              <CustomChart :chart-config="dailyNumOption" :chart-data="dailyNumData" height="250px" />
+              <CustomChart :chart-config="dailyNumOption" :chart-data="deviceData" height="245px" />
             </div>
           </template>
         </infoBox>
@@ -59,17 +59,17 @@
           <template #title> 系统数据量排名 </template>
           <template #container>
             <div class="content-wrapper">
-              <a-table size="small" :dataSource="sysData" :columns="sysDataColumn" :pagination="false" />
+              <a-table size="small" :dataSource="deviceData.collectDataByStationList" :columns="sysDataColumn" :pagination="false" />
             </div>
           </template>
         </infoBox>
       </div>
       <div class="content-item item-3">
         <infoBox class="infoBox4">
-          <template #title> 系统接入情况 </template>
+          <template #title> 设备接入情况 </template>
           <template #container>
             <div class="content-wrapper">
-              <a-table size="small" :dataSource="accessStatusData" :columns="accessStatusColumn" :pagination="false">
+              <a-table size="small" :dataSource="accessStatusData" :columns="accessStatusColumn" :pagination="pagination" @change="pageChange">
                 <template #action="{ record }">
                   <div class="option-cont">
                     <div class="view-icon"></div>
@@ -85,16 +85,67 @@
   </div>
 </template>
 <script lang="ts" setup>
-  import { ref } from 'vue';
+  import { ref, onMounted, reactive } from 'vue';
   import customHeader from '/@/components/vent/customHeader.vue';
   import infoBox from './components/infoBox.vue';
-  import { sysDataColumn, sysData, accessStatusColumn, accessStatusData, dailyNumOption, dailyNumData } from './infoCenter.data';
+  import { sysDataColumn, accessStatusColumn, dailyNumOption } from './infoCenter.data';
   import CustomChart from '@/views/vent/home/configurable/components/detail/CustomChart.vue';
+  import { getDeviceAll, getHomepageSummaryIndexes } from './infoCenter.api';
   let mainTitle = ref('智能通风数据中心');
-
+  //分页参数配置
+  const pagination = reactive({
+    current: 1, // 当前页码
+    pageSize: 5, // 每页显示条数
+    total: 0, // 总条目数,后端返回
+    // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
+  });
+  // 设备接入情况数据
+  const accessStatusData = ref([]);
+  // 数据中心首页设备数据
+  const deviceData = ref({
+    monitorParamsCount: 0,
+    deviceCount: 0,
+    databaseDiskUsage: 0,
+    collectTotalNum: 0,
+    collectDataByStationList: [],
+    collectDataByDayList: [],
+  });
+  // 查看数据
   function viewData(record) {
     console.log(record);
   }
+  //分页切换
+  const pageChange = async (val) => {
+    pagination.current = val.current;
+    pagination.pageSize = val.pageSize;
+    const res = await getDeviceAll({
+      pageNo: pagination.current,
+      pageSize: pagination.pageSize,
+    });
+    accessStatusData.value = res.records; // 赋值给响应式变量
+    pagination.total = res.total; // 更新总条数
+  };
+  // 获取设备数据接口
+  const fetchDeviceData = async () => {
+    try {
+      // 获取首页汇总指标数据
+      deviceData.value = await getHomepageSummaryIndexes();
+      // 获取设备接入情况数据
+      const response = await getDeviceAll({
+        pageNo: pagination.current,
+        pageSize: pagination.pageSize,
+      });
+      accessStatusData.value = response.records; // 赋值给响应式变量
+      pagination.total = response.total; // 更新总条数
+    } catch (error) {
+      console.error('获取设备数据失败:', error);
+    }
+  };
+
+  // 页面挂载时调用接口获取数据
+  onMounted(async () => {
+    await fetchDeviceData();
+  });
 </script>
 <style lang="less" scoped>
   @font-face {
@@ -191,6 +242,9 @@
             }
           }
         }
+        .box-container {
+          overflow: hidden;
+        }
       }
       .infoBox1 {
         background-color: var(--image-border1) no-repeat;

+ 26 - 0
src/views/vent/dataCenter/infoCenter/infoCenter.api.ts

@@ -0,0 +1,26 @@
+import { defHttp } from '/@/utils/http/axios';
+
+enum Api {
+  getDeviceAll = '/dataCenter/compute/deviceData/getDeviceAll',
+  getHomepageSummaryIndexes = '/sjzx/modelreq/safety/homepage/getHomepageSummaryIndexes',
+}
+//数据列表
+export const getDeviceAll = (params) =>
+  defHttp.post({
+    headers: {
+      'X-Access-Token':
+        'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNzU5ODQxMTcwfQ.fHaM3l-d88tUSLOs8sstXsDuSCn6Agbj_EMZMgV6waw',
+    },
+    url: Api.getDeviceAll,
+    params,
+  });
+
+//首页数据详情
+export const getHomepageSummaryIndexes = () =>
+  defHttp.get({
+    headers: {
+      'X-Access-Token':
+        'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNzU5ODQxMTcwfQ.fHaM3l-d88tUSLOs8sstXsDuSCn6Agbj_EMZMgV6waw',
+    },
+    url: Api.getHomepageSummaryIndexes,
+  });

+ 59 - 93
src/views/vent/dataCenter/infoCenter/infoCenter.data.ts

@@ -45,7 +45,7 @@ export const sysDataColumn: BasicColumn[] = [
                 position: 'absolute',
                 top: '50%',
                 left: '50%',
-                transform: 'translate(-50%, -50%)', 
+                transform: 'translate(-50%, -50%)',
                 color: '#fff',
                 fontSize: '14px',
                 fontWeight: 'bold',
@@ -58,41 +58,20 @@ export const sysDataColumn: BasicColumn[] = [
     },
   },
   {
-    title: '系统名称',
-    dataIndex: 'sysName',
+    title: '设备id',
+    dataIndex: 'sub_id',
     align: 'center',
+    ifShow: false,
   },
   {
-    title: '数量',
-    dataIndex: 'sysNum',
+    title: '设备名称',
+    dataIndex: 'strName',
     align: 'center',
   },
-];
-// 系统接入情况数据
-export const sysData = [
-  {
-    sysName: 'wscc',
-    sysNum: 32,
-  },
-  {
-    sysName: 'wscc',
-    sysNum: 33,
-  },
-  {
-    sysName: 'wscc',
-    sysNum: 34,
-  },
   {
-    sysName: 'wscc',
-    sysNum: 35,
-  },
-  {
-    sysName: 'wscc',
-    sysNum: 35,
-  },
-  {
-    sysName: 'wscc',
-    sysNum: 35,
+    title: '数量',
+    dataIndex: 'total_num',
+    align: 'center',
   },
 ];
 
@@ -104,24 +83,24 @@ export const accessStatusColumn: BasicColumn[] = [
     customRender: ({ index }: { index: number }) => `${index + 1}`,
   },
   {
-    title: '系统名称',
-    dataIndex: 'sysName',
+    title: '设备名称',
+    dataIndex: 'devicekind_dictText',
     align: 'center',
   },
 
   {
-    title: '系统接入时间',
-    dataIndex: 'accessTime',
+    title: '设备接入时间',
+    dataIndex: 'createTime',
     align: 'center',
   },
   {
     title: '点位数量',
-    dataIndex: 'pointNum',
+    dataIndex: 'monitorPointNum',
     align: 'center',
   },
   {
     title: '运行状态',
-    dataIndex: 'runStatus',
+    dataIndex: 'netStatus',
     align: 'center',
   },
   {
@@ -137,37 +116,6 @@ export const accessStatusColumn: BasicColumn[] = [
     slots: { customRender: 'action' },
   },
 ];
-// 系统接入情况数据
-export const accessStatusData = [
-  {
-    sysName: '1',
-    accessTime: '2025.10.01',
-    pointNum: 32,
-    runStatus: '1',
-    dataUpdateTime: '2025.10.01',
-  },
-  {
-    sysName: '2',
-    accessTime: '2025.10.02',
-    pointNum: 32,
-    runStatus: '2',
-    dataUpdateTime: '2025.10.02',
-  },
-  {
-    sysName: '3',
-    accessTime: '2025.10.02',
-    pointNum: 32,
-    runStatus: '3',
-    dataUpdateTime: '2025.10.02',
-  },
-  {
-    sysName: '3',
-    accessTime: '2025.10.02',
-    pointNum: 32,
-    runStatus: '3',
-    dataUpdateTime: '2025.10.02',
-  },
-];
 // 每日采集数据表格属性
 export const dailyNumOption: ModuleDataChart = {
   type: 'bar',
@@ -175,54 +123,72 @@ export const dailyNumOption: ModuleDataChart = {
   legend: { show: false },
   xAxis: [{ show: true }],
   yAxis: [{ show: true, name: '', position: 'left' }],
-  series: [{ readFrom: 'history', xprop: 'time', yprop: 'val', label: '' }],
+  series: [{ readFrom: 'collectDataByDayList', xprop: 'day', yprop: 'total_count', label: '' }],
 };
-// 每日采集数据
-export const dailyNumData = {
-  history: [
+
+export const deviceData = {
+  monitorParamsCount: 1727,
+  deviceCount: 4,
+  databaseDiskUsage: 10165,
+  collectDataByStationList: [
+    {
+      sub_id: '1696417397868986370',
+      strName: '调试http协议束管',
+      total_num: 258,
+    },
     {
-      time: '2025-10-13',
-      val: '113',
+      sub_id: '1696417397868986370',
+      strName: '调试http协议束管',
+      total_num: 256,
     },
     {
-      time: '2025-10-14',
-      val: '153',
+      sub_id: '1696417397868986370',
+      strName: '调试http协议束管',
+      total_num: 254,
     },
     {
-      time: '2025-10-15',
-      val: '163',
+      sub_id: '1696417397868986370',
+      strName: '调试http协议束管',
+      total_num: 252,
+    },
+  ],
+  collectTotalNum: 258,
+  collectDataByDayList: [
+    {
+      day: '2025-10-29',
+      total_count: '30',
     },
     {
-      time: '2025-10-16',
-      val: '193',
+      day: '2025-10-30',
+      total_count: '165',
     },
     {
-      time: '2025-10-17',
-      val: '203',
+      day: '2025-10-31',
+      total_count: '63',
     },
     {
-      time: '2025-10-18',
-      val: '203',
+      day: '2025-11-01',
+      total_count: '30',
     },
     {
-      time: '2025-10-19',
-      val: '223',
+      day: '2025-11-02',
+      total_count: '165',
     },
     {
-      time: '2025-10-20',
-      val: '183',
+      day: '2025-11-03',
+      total_count: '63',
     },
     {
-      time: '2025-10-21',
-      val: '153',
+      day: '2025-11-04',
+      total_count: '30',
     },
     {
-      time: '2025-10-22',
-      val: '183',
+      day: '2025-11-05',
+      total_count: '165',
     },
     {
-      time: '2025-10-23',
-      val: '153',
+      day: '2025-11-06',
+      total_count: '63',
     },
   ],
 };