export const setMainColumns = (self, expData = []) => {
  return [
    { dataIndex: 'code', title: '承运商编码', width: 120, },
    { dataIndex: 'name', title: '承运商名称', width: 120, },
    { dataIndex: 'shortName', title: '承运商简称', width: 120, },
    { dataIndex: 'departmentName', title: '所属部门', width: 120, },
    { dataIndex: 'cooperativeNatureName', title: '合作性质', width: 120, },
    { dataIndex: 'statusName', title: '状态', width: 120, },
    { dataIndex: 'taxRegisterNumber', title: '税务登记号', width: 120, },
    { dataIndex: 'businessLicenseNumber', title: '营业执照号', width: 120, },
    { dataIndex: 'roadPermit', title: '道路许可证', width: 120, },
    { dataIndex: 'memo', title: '备注', width: 120, },
    { dataIndex: 'carrierSysFlagName', title: '系统标志', width: 120 },
    { dataIndex: 'contact', title: '联系人', width: 120, },
    { dataIndex: 'phoneNumber', title: '手机号', width: 120, },
    { dataIndex: 'landlineNumber', title: '座机号', width: 120, },
    { dataIndex: 'email', title: '邮箱', width: 120, },
    { dataIndex: 'postCode', title: '邮编', width: 120, },
    { dataIndex: 'provinceName', title: '省', width: 120, },
    { dataIndex: 'cityName', title: '市', width: 120, },
    { dataIndex: 'districtName', title: '区', width: 120, },
    { dataIndex: 'address', title: '详细地址', width: 120, },
    { 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: 'bankName', title: '开户行', width: 120, },
    { dataIndex: 'bankAccount', title: '银行账号', width: 120, },
    { dataIndex: 'established', title: '成立时间', width: 120, },
    { dataIndex: 'registeredAddress', title: '注册地址', width: 120, },
    ...expData,
    { dataIndex: 'createperson', title: '创建人', width: 120, },
    { dataIndex: 'createtime', title: '创建时间', width: 120, },
    { dataIndex: 'updateperson', title: '修改人', width: 120, },
    { dataIndex: 'updatetime', title: '修改时间', width: 120, },
    { key: 'operation', title: '操作', fixed: 'right', width: 200, align: 'center', scopedSlots: { customRender: 'operation' }, },
  ]
}

export const setDriverColumns = (self, expData = []) => {
  return [
    { dataIndex: 'code', title: '司机编码', width: 120, },
    { dataIndex: 'name', title: '司机名称', width: 120, },
    { dataIndex: 'departmentName', title: '部门', width: 120, },
    { dataIndex: 'typeName', title: '归属', width: 120, },
    { dataIndex: 'phoneNumber', title: '手机号', width: 120, },
    { dataIndex: 'memo', title: '备注', width: 120, },
    ...expData,
  ]
}

export const setDeliverymanColumns = (self, expData = []) => {
  return [
    { dataIndex: 'code', title: '送货员编码', width: 120, },
    { dataIndex: 'name', title: '送货员名称', width: 120, },
    { dataIndex: 'departmentName', title: '部门', width: 120, },
    { dataIndex: 'typeName', title: '归属', width: 120, },
    { dataIndex: 'phoneNumber', title: '手机号', width: 120, },
    { dataIndex: 'memo', title: '备注', width: 120, },
    ...expData,
  ]
}

export const setVehicleInfoColumns = (self, expData = []) => {
  return [
    { dataIndex: 'code', title: '车辆编码', width: 120, },
    { dataIndex: 'plateNumber', title: '车牌号', width: 120, },
    { dataIndex: 'departmentName', title: '部门', width: 120, },
    { dataIndex: 'typeName', title: '归属', width: 120, },
    { dataIndex: 'vehicleTypeCode', title: '车型编码', width: 120, },
    { dataIndex: 'vehicleTypeName', title: '车型名称', width: 120, },
    { dataIndex: 'brandName', title: '品牌', width: 120, },
    { dataIndex: 'vehicleTypeCategoryName', title: '类别', width: 120, },
    { dataIndex: 'length', title: '长(m)', width: 120, },
    { dataIndex: 'width', title: '宽(m)', width: 120, },
    { dataIndex: 'height', title: '高(m)', width: 120, },
    { dataIndex: 'maxMileage', title: '最大行驶里程(km)', width: 120, },
    { dataIndex: 'weight', title: '载重(kg)', width: 120, },
    { dataIndex: 'volume', title: '载方(m³)', width: 120, },
    { dataIndex: 'mileageManagementName', title: '里程管理', width: 120, },
    { dataIndex: 'memo', title: '备注', width: 120, },
    ...expData,
  ]
}

export const setContainerInfoColumns = (self, expData = []) => {
  return [
    { dataIndex: 'code', title: '容器编码', width: 120, },
    { dataIndex: 'name', title: '容器名称', width: 120, },
    { dataIndex: 'typeName', title: '容器类型', width: 120, },
    { dataIndex: 'departmentName', title: '部门', width: 120, },
    { dataIndex: 'length', title: '长(m)', width: 120, },
    { dataIndex: 'width', title: '宽(m)', width: 120, },
    { dataIndex: 'height', title: '高(m)', width: 120, },
    { dataIndex: 'weight', title: '重量(kg)', width: 120, },
    { dataIndex: 'volume', title: '体积(m³)', width: 120, },
    { dataIndex: 'belongToName', title: '归属', width: 120, },
    { dataIndex: 'memo', title: '备注', width: 120, },
    ...expData,
  ]
}

export const setDeviceInfoColumns = (self, expData = []) => {
  return [
    { dataIndex: 'code', title: '设备编码', width: 120, },
    { dataIndex: 'name', title: '设备名称', width: 120, },
    { dataIndex: 'typeName', title: '设备类型', width: 120, },
    { dataIndex: 'companyName', title: '设备生产厂商', width: 120, },
    { dataIndex: 'departmentName', title: '部门', width: 120, },
    { dataIndex: 'belongToName', title: '归属', width: 120, },
    { dataIndex: 'memo', title: '备注', width: 120, },
    ...expData,
  ]
}

import { UPCLOUD_RDC_TMS_IMAGE_HOST } from '@/config/serviceSettings.js';

export const setPaperInfoColumns = (self, expData = []) => {
  let operationList = self.listType === 'view' ? [] : [{ key: 'operation', title: '操作', fixed: 'right', width: 120, align: 'center', scopedSlots: { customRender: 'operation' }, }]
  return [
    {
      dataIndex: 'picture',
      title: '照片',
      width: 100,
      align: 'center',
      customRender(text, data) {
        let picture = text ? text.split(',') : ''
        if (Array.isArray(picture)) {

          return self._c('a-avatar', {
            attrs: {
              shape: 'square',
              src: picture[0] ? UPCLOUD_RDC_TMS_IMAGE_HOST + '/' + picture[0] : '',
              size: 60
            },
            style: 'border:1px solid #e8e8e8;backgroundColor: #fff',
            on: {
              click: () => {
                if (!picture[0]) return;

                self.previewImage = UPCLOUD_RDC_TMS_IMAGE_HOST + '/' + picture[0];
                self.previewVisible = true;
              }
            },
            scopedSlots: {
              icon() {
                return !picture[0] ? self._c('a-icon', { attrs: { type: 'picture', theme: 'twoTone' } }) : undefined;
              }
            }
          });
        }
        return '';
      }
    },
    { dataIndex: 'code', title: '证件号码', width: 120, },
    { dataIndex: 'typeName', title: '证件类型', width: 120, },
    {
      dataIndex: 'status',
      title: '状态',
      align: 'center',
      customRender: (text, data) => {
        return self._c('a-badge', {
          attrs: {
            color: text > 0 ? 'cyan' : 'red',
            text: text > 0 ? '启用' : '停用'
          }
        });
      }
    },
    { dataIndex: 'issuingAuthority', title: '发证机关', width: 120, },
    { dataIndex: 'issuingDate', title: '发证日期', width: 120, },
    { dataIndex: 'startDate', title: '有效期始', width: 120, },
    { dataIndex: 'endDate', title: '有效期止', width: 120, },
    { dataIndex: 'createperson', title: '登记人', width: 120, },
    { dataIndex: 'createtime', title: '登记时间', width: 120, },
    { dataIndex: 'memo', title: '备注', width: 120, },
    ...expData,
  ].concat(operationList)
}
