/** 绑定车辆*/

// affiliationCode: "2"
// affiliationId: "0000000004"
// affiliationName: "2"
// brand: 1
// height: 3
// length: 100
// driverCode: "2222"
// driverId: "00000003"
// driverPlateNumber: "12333"
// driverType: 1
// driverTypeCategory: 1
// driverTypeCode: "W003"
// driverTypeId: "10000003"
// driverTypeName: "测试003"
// volume: 22
// weight: 20

export const bindCarColumns = self => {
  return [
    {
      dataIndex: 'driverCode',
      title: '司机编码'
    },
    {
      dataIndex: 'driverName',
      title: '司机姓名'
    },
    {
      dataIndex: 'driverTypeName',
      title: '归属'
    },
    {
      dataIndex: 'affiliationName',
      title: '隶属机构'
    },
    {
      dataIndex: 'phoneNumber',
      align: 'center',
      title: '手机号'
    },
    {
      dataIndex: 'driverMemo',
      title: '备注'
    }
  ]
}

/** 已绑司机*/
export const carManColumns = self => {
  return [
    ...bindCarColumns(self),
    {
      get hidden() {
        return self.st === 3 ? true : false
      },
      key: 'operation',
      title: '操作',
      width: 100,
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' }
    }
  ]
}
/** 常跑线路*/
export const carLinkColumns = self => {
  return [
    { dataIndex: 'code', title: '线路编码' },
    { dataIndex: 'name', 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: 'plateNumber', title: '车牌号', hidden: false },
    {
      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.length > 0 ?UPCLOUD_RDC_TMS_IMAGE_HOST+'/'+picture[0] : '',
              size: 60
            },
            style: picture.length === 0 && 'border:1px solid #e8e8e8;backgroundColor: #fff',
            on: {
              click: () => {
                if (!picture) return
                self.$refs.updateFormModal.previewVisible = true
                self.$refs.updateFormModal.previewImage =UPCLOUD_RDC_TMS_IMAGE_HOST+'/'+picture[0];
              }
            },
            scopedSlots: {
              icon() {
                return picture.length === 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' }
    }
  ]
}



//设备信息
export const setEquipmentCol = self => {
  return [
    { dataIndex: 'deviceId', title: '设备ID',hidden: true},
    { dataIndex: 'deviceCode', title: '设备编码' },
    { dataIndex: 'deviceName', title: '设备名称' },
    { dataIndex: 'typeName', title: '设备类型' },
    { dataIndex: 'companyName', title: '设备生产厂商' },
    { dataIndex: 'departmentName', title: '部门' },
    { dataIndex: 'belongToName', title: '归属' },
    { dataIndex: 'affiliationName', title: '隶属机构' },
    { dataIndex: 'memo', title: '备注' },
    {
      get hidden() {
        return self.st === 3 ? true : false
      },
      key: 'operation',
      title: '操作',
      width: 100,
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' }
    }
  ]
}
export const setEquipmentPopCol = self => {
  return [
    { dataIndex: 'id', title: '设备ID',hidden: true},
    { dataIndex: 'code', title: '设备编码' },
    { dataIndex: 'name', title: '设备名称' },
    { dataIndex: 'typeName', title: '设备类型' },
    { dataIndex: 'companyName', title: '设备生产厂商' },
    { dataIndex: 'departmentName', title: '部门' },
    { dataIndex: 'belongToName', title: '归属' },
    { dataIndex: 'affiliationName', title: '隶属机构' },
    { dataIndex: 'memo', title: '备注' }

  ]
}
//容器信息
export const setContainerCol = self => {
  return [
    { dataIndex: 'id', title: '容器ID',hidden: true},
    { dataIndex: 'code', title: '容器编码' },
    { dataIndex: 'name', title: '容器名称' },
    { dataIndex: 'typeName', title: '容器类型' },
    { dataIndex: 'departmentName', title: '部门' },
    { dataIndex: 'length', title: '长(m)' },
    { dataIndex: 'width', title: '宽(m)' },
    { dataIndex: 'height', title: '高(m)' },

    { dataIndex: 'volume', title: '体积(m³)' },
    { dataIndex: 'weight', title: '重量(kg)' },
    { dataIndex: 'belongToName', title: '归属' },
    { dataIndex: 'affiliationName', title: '隶属机构' },
    { dataIndex: 'memo', title: '备注' },
    {
      get hidden() {
        return self.st === 3 ? true : false
      },
      key: 'operation',
      title: '操作',
      width: 100,
      fixed: 'right',
      align: 'center',
      scopedSlots: { customRender: 'operation' }
    }
  ]
}

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

}
