Pārlūkot izejas kodu

feat: 设备详情新增历史进出时间统计查看接口对接;

liujia 3 nedēļas atpakaļ
vecāks
revīzija
2970ab8

+ 2 - 0
components.d.ts

@@ -47,6 +47,7 @@ declare module 'vue' {
     AResult: typeof import('ant-design-vue/es')['Result']
     ASelect: typeof import('ant-design-vue/es')['Select']
     ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
+    ASkeleton: typeof import('ant-design-vue/es')['Skeleton']
     ASpace: typeof import('ant-design-vue/es')['Space']
     ASpin: typeof import('ant-design-vue/es')['Spin']
     ASteps: typeof import('ant-design-vue/es')['Steps']
@@ -56,6 +57,7 @@ declare module 'vue' {
     ATag: typeof import('ant-design-vue/es')['Tag']
     ATimeRangePicker: typeof import('ant-design-vue/es')['TimeRangePicker']
     ATooltip: typeof import('ant-design-vue/es')['Tooltip']
+    ATree: typeof import('ant-design-vue/es')['Tree']
     AUploadDragger: typeof import('ant-design-vue/es')['UploadDragger']
     BaseAreaViewer: typeof import('./src/components/baseAreaViewer/index.vue')['default']
     BaseCard: typeof import('./src/components/baseCard/index.vue')['default']

+ 7 - 0
src/api/stats/index.ts

@@ -44,3 +44,10 @@ export const statsDeviceOnlineQuery = (
 ): Promise<ResponseData<TYPE.StatsDeviceOnlineQueryData>> => {
   return request.post('/stats/OnoffRecord', params)
 }
+
+// 历史进出统计
+export const statsInoutHistoryQuery = (
+  params: TYPE.StatsInoutHistoryQueryParams
+): Promise<ResponseData<TYPE.StatsInoutHistoryQueryData>> => {
+  return request.post('/stats/inOutEventQuery', params)
+}

+ 24 - 0
src/api/stats/types.ts

@@ -193,3 +193,27 @@ export interface StatsDeviceOnlineQueryData {
   outTotalPageNum: boolean
   totalPageNum: number
 }
+
+export interface StatsInoutHistoryQueryParams {
+  pageNo: number // 页码
+  pageSize: number // 每页条数
+  devId?: ID // 设备ID
+  createTimeStart: string // 起始时间 格式yyyy-MM-dd
+  createTimeEnd: string // 结束时间 格式yyyy-MM-dd
+}
+
+export type StatsInoutHistoryQueryDataRow = {
+  perIoId: ID // 进出事件主键
+  tenantId: ID // 租户ID
+  devId: ID // 设备ID
+  enterTime: string // 进入时间
+  leaveTime: string // 离开时间
+}
+export interface StatsInoutHistoryQueryData {
+  rows: StatsInoutHistoryQueryDataRow[]
+  total: number
+  pageNum: number
+  pageSize: number
+  outTotalPageNum: boolean
+  totalPageNum: number
+}

+ 10 - 2
src/views/device/detail/index.vue

@@ -131,6 +131,14 @@
               >
                 上下线
               </a-button>
+              <a-button
+                v-if="detailState.clientId"
+                type="link"
+                size="small"
+                @click="viewDeviceHistoryInfo('inout')"
+              >
+                历史进出
+              </a-button>
             </a-space>
           </info-item>
         </info-item-group>
@@ -469,9 +477,9 @@ const roomConfigHandler = (type: 'base' | 'area') => {
 }
 
 const statsDrawerOpen = ref<boolean>(false)
-const statsDrawerType = ref<'online' | 'fall' | 'alarm'>('fall')
+const statsDrawerType = ref<'online' | 'fall' | 'alarm' | 'inout'>('fall')
 // 查看设备历史信息
-const viewDeviceHistoryInfo = (type: 'online' | 'fall' | 'alarm') => {
+const viewDeviceHistoryInfo = (type: 'online' | 'fall' | 'alarm' | 'inout') => {
   console.log('viewDeviceHistoryInfo')
   statsDrawerOpen.value = true
   statsDrawerType.value = type