// 轨迹点
export const setPointColumns = (self, expData = []) => {
  return [
    {
      dataIndex: 'vehiclePlateNumber',
      title: '车牌号',
      width: 120,
      // sorter: (a, b) => {
      //   if (!a.vehiclePlateNumber || !b.vehiclePlateNumber) return
      //   return a.vehiclePlateNumber.replace(/[^0-9]/gi, '') - b.vehiclePlateNumber.replace(/[^0-9]/gi, '')
      // },
    },
    {
      dataIndex: 'driverName',
      title: '司机',
      width: 120,
      // sorter: (a, b) => {
      //   return a.driverName.length - b.driverName.length
      // },
    },
    {
      dataIndex: 'driverPhoneNumber',
      title: '司机手机号',
      width: 120,
      // sorter: (a, b) => {
      //   return a.driverPhoneNumber - b.driverPhoneNumber
      // },
    },
    {
      dataIndex: 'gpsDate',
      title: '定位时间',
      width: 120,
      // sorter: (a, b) => {
      //   return +new Date(a.gpsDate) - +new Date(b.gpsDate)
      // },
    },
    {
      dataIndex: 'currentVelocity',
      title: '速度（KM/H）',
      width: 120,
      // sorter: (a, b) => {
      //   return a.currentVelocity - b.currentVelocity
      // },
    },
    {
      dataIndex: 'placeName',
      title: '位置',
      width: 120,
      // sorter: (a, b) => {
      //   return a.placeName != b.placeName
      // },
    },
    {
      dataIndex: 'longitude',
      title: '经度',
      width: 120,
      // sorter: (a, b) => {
      //   return a.longitude - b.longitude
      // },
    },
    {
      dataIndex: 'latitude',
      title: '纬度',
      width: 120,
      // sorter: (a, b) => {
      //   return a.latitude - b.latitude
      // },
    },
  ]
}

// 报警
export const setAlertColumns = (self, expData = []) => {
  return [
    {
      dataIndex: 'vehiclePlateNumber',
      title: '车牌号',
      width: 120,
      sorter: (a, b) => {
        if (!a.vehiclePlateNumber || !b.vehiclePlateNumber) return
        return a.vehiclePlateNumber.replace(/[^0-9]/gi, '') - b.vehiclePlateNumber.replace(/[^0-9]/gi, '')
      },
    },
    {
      dataIndex: 'driverName',
      title: '司机',
      width: 120,
      sorter: (a, b) => {
        return a.driverName.length - b.driverName.length
      },
    },
    {
      dataIndex: 'driverPhoneNumber',
      title: '司机手机号',
      width: 120,
      sorter: (a, b) => {
        return a.driverPhoneNumber - b.driverPhoneNumber
      },
    },
    {
      dataIndex: 'alarmType',
      title: '报警类型',
      width: 120,
      sorter: (a, b) => {
        return a.alarmType - b.alarmType
      },
    },
    {
      dataIndex: 'alarmContent',
      title: '报警内容',
      width: 120,
      sorter: (a, b) => {
        return a.alarmContent - b.alarmContent
      },
    },
    {
      dataIndex: 'duration',
      title: '持续时长(s)',
      width: 120,
      sorter: (a, b) => {
        return a.duration - b.duration
      },
    },
    {
      dataIndex: 'startTime',
      title: '开始时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.startTime) - +new Date(b.startTime)
      },
    },
    {
      dataIndex: 'endTime',
      title: '结束时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.endTime) - +new Date(b.endTime)
      },
    },
    {
      dataIndex: 'startPlacename',
      title: '开始位置',
      width: 120,
      sorter: (a, b) => {
        return a.startPlacename != b.startPlacename
      },
    },
    {
      dataIndex: 'startLon',
      title: '开始位置经度',
      width: 120,
      sorter: (a, b) => {
        return a.startLon - b.startLon
      },
    },
    {
      dataIndex: 'startLat',
      title: '开始位置纬度',
      width: 120,
      sorter: (a, b) => {
        return a.startLat - b.startLat
      },
    },
    {
      dataIndex: 'endPlacename',
      title: '结束位置',
      width: 120,
      sorter: (a, b) => {
        return a.endPlacename != b.endPlacename
      },
    },
    {
      dataIndex: 'endLon',
      title: '结束位置经度',
      width: 120,
      sorter: (a, b) => {
        return a.endLon - b.endLon
      },
    },
    {
      dataIndex: 'endLat',
      title: '结束位置纬度',
      width: 120,
      sorter: (a, b) => {
        return a.endLat - b.endLat
      },
    },
  ]
}