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
  }
}

//发货方
export const setShipperColumns = (self) => {
  return [
    { dataIndex: 'id', title: 'id', hidden: true,width: 100  },
    { dataIndex: 'shipperUnitName', title: '发货方单位',width: 100  },
    { dataIndex: 'shipperName', title: '发货方',width: 100  },
    { dataIndex: 'shipperPhoneNumber', title: '手机号' ,width: 150 },
    { dataIndex: 'shipperLandlineNumber', title: '座机号',width: 100  },
    {
      dataIndex: 'shipperProvinceCityDistrict',
      title: '始发地',
      width: 100
    },

    {
      dataIndex: 'shipperAddress',
      title: '详细地址',
      align: 'center',
      width: 150
    },
    {
      dataIndex: 'estimatedPickupTime',
      title: '预计提货时间',
      width: 150
    },
    {
      dataIndex: 'carrierName',
      title: '承运商',
      width: 100
    },

    {
      dataIndex: 'driverName',
      title: '司机',
      width: 100
    },
    {
      dataIndex: 'vehiclePlateNumber',
      title: '车牌号',
      width: 100
    },
    { dataIndex: 'count', title: '运单数', width: 120 },
    // { dataIndex: 'shipbillQty', title: '运单数', width: 120 },
    { dataIndex: 'totalWholePiece', title: '总整件数', width: 120 },
    { dataIndex: 'totalLclPiece', title: '总拼箱数', width: 80 },
    { dataIndex: 'totalPcs', title: '总件数', width: 120 },
    { dataIndex: 'totalWeight', title: '总重量', width: 120 },
    { dataIndex: 'totalVolume', title: '总体积', width: 120 },
    {
      key: 'operation',
      title: '操作',
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' },
      ...self.operation
    }
  ]
}
