import { customRef } from 'vue'

const status = ['任务待分配', '任务已分配', '飞手已接单', '任务飞行中', '任务已完成']

export default function(data) {
  const list = [
    {
      label: '分配人',
      value: data.distributeUserName
    },
    {
      label: '分配飞手时间',
      value: data.distributeTime
    },
    {
      label: '飞手',
      value: data.flightHandName
    },
    {
      label: '飞手接单时间',
      value: data.ordersTime
    },
    {
      label: '飞手接单状态',
      value: status[(data.pilotStatus / 5) - 1]
    },
    {
      label: '飞行开始时间',
      value: data.flightStartTime,
      current: 4
    },
    {
      label: '飞行结束时间',
      value: data.flightEndTime,
      current: 4
    }
  ]
  return customRef((track, trigger) => {
    return {
      get() {
        track()
        return list
      }
    }
  })
}
