const customRender = (self, type) => {
  return (text, data) => {
    if (self.options[type] && Array.isArray(self.options[type])) {
      let value = self.options[type].find((item) => item.value === text)
      return value ? value.label : text
    }
    return text
  }
}

//预约单

  // appointmentDate:"[string] 预约日期"
  // appointmentId:"[string] 预约单ID"
  // appointmentNo:"[string] 预约单号"
  // appointmentType:"[integer] 预约类型"
  // appointmentTypeName:"[string] 预约类型名称"
  // branchAddress:"[string] 仓库详细地址"
  // branchCode:"[string] 仓库编码"
  // branchId:"[integer] 仓库ID"
  // branchName:"[string] 仓库名称"
  // callNumber:"[string] 叫号号码"
  // callNumberTime:"[string] 叫号时间"

  // createperson:"[string] 创建人"
  // createtime:"[string] 创建时间"
  // driverCode:"[string] 司机编码"
  // driverId:"[integer] 司机ID"
  // driverName:"[string] 司机名称 "
  // driverPhoneNumber:"[string] 司机手机号"
  // enterpriseId:"[integer] 企业ID"
  // enterpriseName:"[string] 企业名称"
  // platformCode:"[string] 月台编号"
  // queueNumber:"[string] 取号号码"
  // reserveNumberTime:"[string] 预约时间"
  // shipbillId:"[string] 运单ID"
  // status:"[integer] 预约状态"
  // statusName:"[string] 预约状态名称"
  // totalPcs:"[number] 总件数"
  // totalVolume:"[number] 总体积"
  // totalWeight:"[number] 总重量"
  // updateperson:"[string] 修改人"
  // updatetime:"[string] 修改时间"
  // urgentQuantity:"[integer] 紧急运单数量"


export const setAppointmentColumns = (self) => {
  return [
    { dataIndex: 'shipbillIds', title: '运单ID', width: 100 ,hidden: true },
    { dataIndex: 'reserveNumber', title: '预约号',width: 100  },
    { dataIndex: 'appointmentTypeName', title: '预约类型',width: 100  },
    { dataIndex: 'statusName', title: '预约状态' ,width: 100 },
    { dataIndex: 'tallyStatusName', title: '理货状态',width: 100  },
    { dataIndex: 'queueNumber', title: '排队号',width: 100  },
    {
      dataIndex: 'queueNumberTime',
      title: '取号时间',
      width: 150
    },
    {
      dataIndex: 'urgentShipbill',
      title: '是否包含紧急订单',
      align: 'center',
      width: 100
    },

    { dataIndex: 'branchName', title: '预约地点', width: 120 },
    { dataIndex: 'loadingBillNo', title: '派车单号', width: 120 },
    { dataIndex: 'branchAddress', title: '预约位置', width: 80 },

    { dataIndex: 'appointmentTime', title: '预约时间', width: 150 },
    {
      dataIndex: 'driverName',
      title: '预约司机',
    },
    { dataIndex: 'driverPhoneNumber', title: '预约电话', width: 120 },
    {
      dataIndex: 'vehiclePlateNumber',
      title: '车牌号',
      width: 100
    },

    {
      dataIndex: 'carrierName',
      title: '承运商',
      width: 100
    },

    { dataIndex: 'shipbillQuantity', title: '运单数', width: 120 },

    { dataIndex: 'totalPcs', title: '总件数', width: 120 },

    { dataIndex: 'memo', title: '备注', width: 120 },
    { dataIndex: 'createperson', title: '创建人', width: 100 },
    { dataIndex: 'createtime', title: '创建时间', width: 150 },
    { dataIndex: 'updateperson', title: '修改人', width: 100 },
    { dataIndex: 'updatetime', title: '修改时间', width: 150 },
    {
      key: 'operation',
      title: '操作',
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' },
      ...self.operation
    }
  ]
}
