Ver Fonte

feat: 设备列表展示今日进出次数;

liujia há 3 semanas atrás
pai
commit
a8737f7
2 ficheiros alterados com 33 adições e 34 exclusões
  1. 26 26
      src/views/device/list/const.ts
  2. 7 8
      src/views/device/list/index.vue

+ 26 - 26
src/views/device/list/const.ts

@@ -3,24 +3,18 @@ import type { SelectProps } from 'ant-design-vue'
 // 设备列表表头
 export const columns = [
   {
-    title: '设备ID / 设备名称',
+    title: '设备ID\n设备名称',
     dataIndex: 'info',
     key: 'info',
     align: 'center',
+    customHeaderCell: () => {
+      return {
+        style: {
+          whiteSpace: 'pre-line',
+        },
+      }
+    },
   },
-  // {
-  //   title: '设备ID',
-  //   dataIndex: 'clientId',
-  //   key: 'clientId',
-  //   align: 'center',
-  // },
-  // {
-  //   title: '设备名称',
-  //   dataIndex: 'devName',
-  //   key: 'devName',
-  //   align: 'center',
-  //   width: 300,
-  // },
   {
     title: '固件版本',
     key: 'hardware',
@@ -29,18 +23,18 @@ export const columns = [
     width: 200,
   },
   {
-    title: '设备状态 / 活动状态',
-    key: 'online',
+    title: '设备状态\n活动状态',
     dataIndex: 'online',
+    key: 'online',
     align: 'center',
+    customHeaderCell: () => {
+      return {
+        style: {
+          whiteSpace: 'pre-line',
+        },
+      }
+    },
   },
-  // {
-  //   title: '活动状态',
-  //   key: 'activeState',
-  //   dataIndex: 'activeState',
-  //   align: 'center',
-  //   width: 200,
-  // },
   {
     title: '归属租户',
     key: 'tenantName',
@@ -49,10 +43,17 @@ export const columns = [
     width: 300,
   },
   {
-    title: '今日掉线次数',
-    key: 'offlineCount',
+    title: '今日掉线次数\n今日进出次数',
     dataIndex: 'offlineCount',
+    key: 'offlineCount',
     align: 'center',
+    customHeaderCell: () => {
+      return {
+        style: {
+          whiteSpace: 'pre-line',
+        },
+      }
+    },
     width: 150,
   },
   {
@@ -60,7 +61,6 @@ export const columns = [
     key: 'action',
     dataIndex: 'action',
     align: 'center',
-    // fixed: 'right',
     width: 150,
   },
 ]

+ 7 - 8
src/views/device/list/index.vue

@@ -93,12 +93,11 @@
               <a-tag v-else :bordered="false" color="#ccc">无</a-tag>
             </a-space>
           </template>
-          <!-- <template v-if="column.key === 'activeState'">
-            <a-tag v-if="isToday(record.presenceChangeTime)" :bordered="false" color="green"
-              >有</a-tag
-            >
-            <a-tag v-else :bordered="false" color="#ccc">无</a-tag>
-          </template> -->
+          <template v-if="column.key === 'offlineCount'">
+            <div>{{ record.offlineCount }}</div>
+            <div>{{ record.inOutCount }}</div>
+          </template>
+
           <template v-if="column.key === 'action'">
             <a-button type="link" @click="detailHandler(record.devId, record.clientId)"
               >查看详情</a-button
@@ -241,7 +240,7 @@ const fetchList = async () => {
     const allDeviceRes = await deviceAPI.getDeviceList({
       pageNo: current.value,
       pageSize: pageSize.value,
-      clientId: searchState.deviceId,
+      clientId: '',
       devName: searchState.deviceName,
       createTimeStart: searchState.createTimeStart,
       createTimeEnd: searchState.createTimeEnd,
@@ -250,7 +249,7 @@ const fetchList = async () => {
     const onlineDeviceRes = await deviceAPI.getDeviceList({
       pageNo: current.value,
       pageSize: pageSize.value,
-      clientId: searchState.deviceId,
+      clientId: '',
       devName: searchState.deviceName,
       createTimeStart: searchState.createTimeStart,
       createTimeEnd: searchState.createTimeEnd,