xieb
2023-09-13 3667807a7b7418efc090ee3fa6a6b734bc3080bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { DeviceLogItem } from '/@/api/device-log'
import { bytesToSize } from '/@/utils/bytes'
import { formatUnixTime } from '/@/utils/time'
import {
  DATE_FORMAT_MINUTE
} from '/@/utils/constants'
 
export function useDeviceLogUploadDetail () {
  function getLogTime (deviceLog: DeviceLogItem): string {
    const startTime = formatUnixTime(deviceLog.start_time, DATE_FORMAT_MINUTE)
    const endTime = formatUnixTime(deviceLog.end_time, DATE_FORMAT_MINUTE)
    return `${startTime} — ${endTime}`
  }
 
  function getLogSize (size: number) {
    return bytesToSize(size)
  }
 
  return {
    getLogTime,
    getLogSize
  }
}