//根据value获取中文名称，datas数据集合，text数据值
function getSelectValue(datas, text) {
  var str = text
  if (text == null) {
    str = ''
  } else if (datas == null) {
    str = text
  } else {
    for (var i = 0; i < datas.length; i++) {
      if (datas[i].value == text) str = datas[i].text
    }
  }
  return str
}
export const setMainColumns = (self,expData) => {

  return [
    { dataIndex: 'cargoOwnerId', title: 'id', width: 120, hidden: true },
    { dataIndex: 'cargoOwnerCode', title: '货主编码', width: 120 },
    { dataIndex: 'cargoOwnerName', title: '货主名称', width: 120 },
    { dataIndex: 'cargoOwnerShortName', title: '货主简称', width: 120 },
    { dataIndex: 'departmentName', title: '部门',width: 200 },
    { dataIndex: 'memo', title: '备注', width: 120 },
    { dataIndex: 'statusName', title: '状态', width: 120 },
    { dataIndex: 'contact', title: '联系人', width: 120 },
    { dataIndex: 'phoneNumber', title: '手机号', width: 120 },
    { dataIndex: 'landlineNumber', title: '座机号', width: 120 },
    { dataIndex: 'mail', title: '邮箱', width: 120 },
    {
      dataIndex: 'provinceCityDistrict',
      title: '省市区',
      width: 220,
      customRender: (text, data) => {
        const { provinceName, cityName, districtName } = data
        let arr = [provinceName, cityName, districtName].filter((item) => item && item)
        return arr.join('-')
      },
    },
    // { dataIndex: 'postCode', title: '邮编', width: 120 },
    // { dataIndex: 'provinceName', title: '省', width: 120 },
    // { dataIndex: 'cityName', title: '市', width: 120 },
    // { dataIndex: 'districtName', title: '区', width: 120 },
    { dataIndex: 'address', title: '详细地址'},
    { dataIndex: 'longitude', title: '经度', width: 120 },
    { dataIndex: 'latitude', title: '纬度', width: 120 },
    { dataIndex: 'legalman', title: '法人代表', width: 120 },
    { dataIndex: 'invoice', title: '发票抬头', width: 120 },
    { dataIndex: 'invoiceTaxNumber', title: '税号', width: 120 },
    { dataIndex: 'registeredCapital', title: '注册资金', width: 120 },
    {
      dataIndex: 'bank',
      title: '开户行',
      width: 120,
      customRender(txt, record) {
        if (self.options.BANK) {
          let p = self.options.BANK.find((item) => String(item.value) === String(txt))
          return p && p.label
        }
      },
    },
    { dataIndex: 'bankAccount', title: '银行账号', width: 120 },
    { dataIndex: 'established', title: '成立时间', width: 120 },
    { dataIndex: 'registeredAddress', title: '注册地址', width: 120 },
    ...expData,
    { dataIndex: 'createperson', title: '创建人', width: 120 },
    { dataIndex: 'createtime', title: '创建时间' },
    { dataIndex: 'updateperson', title: '修改人' },
    { dataIndex: 'updatetime', title: '修改时间' },

    {
      key: 'operation',
      title: '操作',
      width: 240,
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' },
    },
  ]
}
