export const bindBMSColumns = (self)=>[
  {
    dataIndex: 'expenseCode',
    title: '费用编码',
    ellipsis: true,
  },
  {
    dataIndex: 'expenseName',
    title: '费用名称',
    ellipsis: true,
  },
  {
    dataIndex: 'expenseAccountName',
    title: '费用科目',
    ellipsis: true,
  },
];

/** 绑定车辆*/

export const bindCarColumns = (self) => {
  return [
    { dataIndex: 'vehicleId', title: '车辆ID', width: 100, hidden: true },
    { dataIndex: 'vehicleCode', title: '车辆编码' },
    { dataIndex: 'vehiclePlateNumber', title: '车牌号' },
    { dataIndex: 'vehicleAscriptionName', title: '归属', width: 60 },
    { dataIndex: 'affiliationName', title: '隶属机构', width: 100 },
    { dataIndex: 'vehicleTypeName', title: '车型名称', width: 100 },
    { dataIndex: 'brand', title: '品牌', width: 100 },
    { dataIndex: 'vehicleType', title: '类别', width: 100 },
    { dataIndex: 'length', title: '长(m)', width: 100 },
    { dataIndex: 'width', title: '宽(m)', width: 100 },
    { dataIndex: 'weight', title: '载重(kg)', width: 100 },
    { dataIndex: 'volume', title: '载方(m³)', width: 100 }
  ];
};

/** 已绑司机*/
export const carManColumns = (self) => {
  return [
    ...bindCarColumns(self),
    {
      key: 'operation',
      get hidden() {
        return self.st === 3 ? true : false
      },
      title: '操作',
      width: 100,
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' }
    }
  ];
};
/** 常跑线路*/
export const carLinkColumns = (self) => {
  return [
    { dataIndex: 'lineId', title: 'ID', hidden: true },
    { dataIndex: 'lineCode', title: '线路编码' },
    { dataIndex: 'lineName', title: '线路名称' },
    { dataIndex: 'startLineName', title: '线路起点' },
    { dataIndex: 'endLineName', title: '线路终点' },
    { dataIndex: 'totalMileage', title: '总里程数(公里)' },
    { dataIndex: 'memo', title: '备注' }
  ];
};
import { UPCLOUD_RDC_TMS_IMAGE_HOST } from '@/config/serviceSettings.js'

/** 证件资料 certificate*/
export const certificateColumns = (self) => {
  return [
    { dataIndex: 'id', title: 'ID', hidden: true },
    {
      dataIndex: 'picture',
      title: '照片',
      width: 50,
      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.$refs.updateFormModal.previewVisible = true;
                self.$refs.updateFormModal.previewImage =UPCLOUD_RDC_TMS_IMAGE_HOST+'/'+picture[0];
              }
            },
            scopedSlots: {
              icon() {
                return !picture[0]? self._c('a-icon', { attrs: { type: 'picture', theme: 'twoTone' } }) : undefined;
              }
            }
          });
        }
        return '';
      }
    },
    {
      dataIndex: 'code',
      title: '证件号码'
    },
    {
      dataIndex: 'type',
      title: '证件类型',
      customRender: (text, data) => {
        return ['身份证', '行驶证', '驾驶证'][+text - 1];
      }
    },
    {
      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: '发证机关' },
    { dataIndex: 'issuingDate', title: '发证日期' },
    { dataIndex: 'startDate', title: '有效期始', width: 100 },
    { dataIndex: 'endDate', title: '有效期止', width: 100 },
    { dataIndex: 'memo', title: '备注' },

    {
      key: 'operation',
      title: '操作',
      get width() {
        return self.st === 3 ? 60 : 180;
      },
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' }
    }
  ];
};
