胡思旗
2023-08-29 b80ee8c883f279e843071e6b53ab9cddec3f88a0
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
  }
}