import myClass from './Class.js'
export function customRow(record, index) {
  const {colorTagFontColor, colorTagBgdColor } = record
    if (colorTagBgdColor || colorTagFontColor) {
      return {
        class:'sign',
        style: {
          [colorTagBgdColor && 'background']: colorTagBgdColor+' !important',
          [colorTagFontColor && 'color']: colorTagFontColor,
        }
      }
    }
}
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
  }
}
let consignee = new myClass({ name: '收货方', key: 'consignee', customRender })
let shipper = new myClass({ name: '发货方', key: 'shipper', customRender })

// 运单
export const setMainColumns = (self, expData = [], tableExtend = { scheduledTableArray: [] }) => {
  return [
    {
      dataIndex: 'shipbillNo',
      sorter: (a, b) => {
        if (!a.shipbillNo || !b.shipbillNo) return
        return a.shipbillNo.replace(/[^0-9]/gi, '') - b.shipbillNo.replace(/[^0-9]/gi, '')
      },
      title: '运单号',
      width:200,
      customRender: (txt, record) => {
        const { recordTagWord,colorTagFontColor } = record
      let text= self._c(
          'a',
          {
            attrs: {
              href: 'javascript:void(0)',
            },
            style: {[colorTagFontColor&&'color']: colorTagFontColor},
            on: {
              click: (event) => {
                event.stopPropagation()
                return self.toView(record)
              },
            },
          },
          [self._v(txt)])
        if (recordTagWord) {
          return self._c('a-space', {}, [text, self._c('a-badge', {
            attrs: {
              numberStyle:{boxShadow:'none'},
              count: recordTagWord,
              overflowCount:Infinity
            }
          },
          )])
        } else {
          return text
        }

      },
    },
    {
      dataIndex: 'cargoOwnerName',
      title: '货主',
      width: 120,
      sorter: (a, b) => {
        return a.cargoOwnerName != b.cargoOwnerName
      },
    },
    {
      dataIndex: 'carriersName',
      title: '承运商',
      width: 120,
      sorter: (a, b) => {
        return a.carriersName != b.carriersName
      },
    },
    {
      dataIndex: 'orderNo',
      title: '订单号',
      width: 120,
      sorter: (a, b) => {
        if (!a.orderNo || !b.orderNo) {
          return
        }
        return a.orderNo.replace(/[^0-9]/gi, '') - b.orderNo.replace(/[^0-9]/gi, '')
      },
    },
    ...tableExtend.scheduledTableArray,
    {
      dataIndex: 'wmsOrderNo',
      title: 'WMS单号',
      width: 120,
      sorter: (a, b) => {
        return a.wmsOrderNo != b.wmsOrderNo
      },
    },
    {
      dataIndex: 'orderTypeName',
      title: '订单类型',
      width: 120,
      sorter: (a, b) => {
        return a.orderType - b.orderType
      },
    },
    {
      dataIndex: 'orderBusinessTypeName',
      title: '业务类型',
      width: 120,
      sorter: (a, b) => {
        return a.orderBusinessType - b.orderBusinessType
      },
    },
    {
      dataIndex: 'deliveryMethodTypeName',
      title: '配送方式',
      width: 120,
      sorter: (a, b) => {
        return a.deliveryMethodType - b.deliveryMethodType
      },
    },
    {
      dataIndex: 'transportTypeName',
      title: '运输模式',
      width: 120,
      sorter: (a, b) => {
        return a.transportType - b.transportType
      },
    },
    {
      dataIndex: 'temperatureRequirementName',
      title: '温度要求',
      width: 120,
      sorter: (a, b) => {
        return a.temperatureRequirement - b.temperatureRequirement
      },
    },
    {
      dataIndex: 'lineName',
      title: '线路',
      width: 120,
      sorter: (a, b) => {
        return ~~a.lineId - ~~b.lineId
      },
    },
    {
      dataIndex: 'memo',
      title: '备注',
      width: 120,
      sorter: (a, b) => {
        return a.memo == b.memo
      },
    },
    ...expData,
    {
      dataIndex: 'orderDate',
      title: '订单下单日期',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.orderDate) - +new Date(b.orderDate)
      },
    },
    {
      dataIndex: 'estimatedPickupStartTime',
      title: '预计提货时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.estimatedPickupStartTime) - +new Date(b.estimatedPickupStartTime)
      },
    },
    {
      dataIndex: 'estimatedDeliveryStartTime',
      title: '预计送达时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.estimatedDeliveryStartTime) - +new Date(b.estimatedDeliveryStartTime)
      },
    },
    {
      dataIndex: 'transportAging',
      title: '时效',
      width: 120,
      sorter: (a, b) => {
        return a.transportAging - b.transportAging
      },
    },
    {
      dataIndex: 'lineDirectionName',
      title: '方向',
      width: 80,
      sorter: (a, b) => {
        return a.lineDirection - b.lineDirection
      },
    },
    ...shipper.init(self), //发
    ...consignee.init(self), //收
    {
      dataIndex: 'totalPcs',
      title: '总件数',
      width: 120,
      sorter: (a, b) => {
        return a.totalPcs - b.totalPcs
      },
    },
    {
      dataIndex: 'totalWeight',
      title: '总重量',
      width: 120,
      sorter: (a, b) => {
        return a.totalWeight - b.totalWeight
      },
    },
    {
      dataIndex: 'totalVolume',
      title: '总体积',
      width: 120,
      sorter: (a, b) => {
        return a.totalVolume - b.totalVolume
      },
    },
    {
      dataIndex: 'packageWholePiece',
      title: '整件数',
      width: 120,
      sorter: (a, b) => {
        return a.packageWholePiece - b.packageWholePiece
      },
    },
    {
      dataIndex: 'packageLclPiece',
      title: '拼箱数',
      width: 120,
      sorter: (a, b) => {
        return a.packageLclPiece - b.packageLclPiece
      },
    },
    {
      dataIndex: 'packageTotalWeight',
      title: '包裹总重量',
      width: 120,
      sorter: (a, b) => {
        return a.packageTotalWeight - b.packageTotalWeight
      },
    },
    {
      dataIndex: 'packageTotalVolume',
      title: '包裹总体积',
      width: 120,
      sorter: (a, b) => {
        return a.packageTotalVolume - b.packageTotalVolume
      },
    },
    {
      dataIndex: 'createperson',
      title: '创建人',
      width: 120,
      sorter: (a, b) => {
        return a.createperson.length - b.createperson.length
      },
    },
    {
      dataIndex: 'createtime',
      title: '创建时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.createtime) - +new Date(b.createtime)
      },
    },
    {
      dataIndex: 'updateperson',
      title: '修改人',
      width: 120,
      sorter: (a, b) => {
        return a.updateperson.length - b.updateperson.length
      },
    },
    {
      dataIndex: 'updatetime',
      title: '修改时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.updatetime) - +new Date(b.updatetime)
      },
    },

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

// 商品
export const setGoodsColums = (self, expData = []) => {
  return [
    {
      dataIndex: 'itemCode',
      title: '商品编码',
      width: 120,
      sorter: (a, b) => {
        return a.itemCode.replace(/[^0-9]/gi, '') - b.itemCode.replace(/[^0-9]/gi, '')
      },
    },
    {
      dataIndex: 'itemName',
      title: '商品名称',
      width: 120,
      sorter: (a, b) => {
        return a.itemName.length - b.itemName.length
      },
    },
    {
      dataIndex: 'itemCategoryName',
      title: '商品品类',
      width: 120,
      sorter: (a, b) => {
        return a.itemCategory - b.itemCategory
      },
    },
    {
      dataIndex: 'packTypeName',
      title: '包装类型',
      width: 120,
      sorter: (a, b) => {
        return a.packType - b.packType
      },
    },
    {
      dataIndex: 'cargoThermosphereName',
      title: '货物温层',
      width: 120,
      sorter: (a, b) => {
        return a.cargoThermosphere - b.cargoThermosphere
      },
    },
    {
      dataIndex: 'pcs',
      title: '件数',
      width: 120,
      sorter: (a, b) => {
        return a.pcs - b.pcs
      },
    },
    {
      dataIndex: 'weight',
      title: '重量',
      width: 120,
      sorter: (a, b) => {
        return a.weight - b.weight
      },
    },
    {
      dataIndex: 'volume',
      title: '体积',
      width: 120,
      sorter: (a, b) => {
        return a.volume - b.volume
      },
    },
    {
      dataIndex: 'memo',
      title: '备注',
      width: 120,
      sorter: (a, b) => {
        return a.memo.length - b.memo.length
      },
    },
    {
      dataIndex: 'branchName',
      title: '默认存放仓库',
      width: 120,
      sorter: (a, b) => {
        return a.branchName.length - b.branchName.length
      },
    },
    {
      dataIndex: 'inventoryPcs',
      title: '库存数量',
      width: 120,
      sorter: (a, b) => {
        return a.inventoryPcs - b.inventoryPcs
      },
    },
    {
      dataIndex: 'stagingLocation',
      title: '暂存位',
      width: 120,
      sorter: (a, b) => {
        return a.stagingLocation.length - b.stagingLocation.length
      },
    },
    ...expData
  ]
}

// 包装
export const setPackColums = (self, expData = []) => {
  return [
    {
      dataIndex: 'packageCode',
      title: '包裹号',
      width: 120,
      sorter: (a, b) => {
        return a.packageCode.replace(/[^0-9]/gi, '') - b.packageCode.replace(/[^0-9]/gi, '')
      },
    },
    {
      dataIndex: 'packageTypeName',
      title: '包裹类型',
      width: 120,
      sorter: (a, b) => {
        return a.packageType - b.packageType
      },
    },
    {
      dataIndex: 'pcs',
      title: '数量',
      width: 120,
      sorter: (a, b) => {
        return a.pcs - b.pcs
      },
    },
    {
      dataIndex: 'weight',
      title: '重量',
      width: 120,
      sorter: (a, b) => {
        return a.weight - b.weight
      },
    },
    {
      dataIndex: 'volume',
      title: '体积',
      width: 120,
      sorter: (a, b) => {
        return a.volume - b.volume
      },
    },
    {
      dataIndex: 'storageCache',
      title: '暂存区',
      width: 120,
      sorter: (a, b) => {
        return a.storageCache.length - b.storageCache.length
      },
    },
    {
      dataIndex: 'memo',
      title: '备注',
      width: 120,
      sorter: (a, b) => {
        return a.memo.length - b.memo.length
      },
    },
    {
      dataIndex: 'deviceCompanyName',
      title: '关联设备类型',
      width: 120,
      sorter: (a, b) => {
        return a.deviceCompanyName.length - b.deviceCompanyName.length
      },
    },
    {
      dataIndex: 'deviceCode',
      title: '关联设备编号',
      width: 120,
      sorter: (a, b) => {
        return a.deviceCode.replace(/[^0-9]/gi, '') - b.deviceCode.replace(/[^0-9]/gi, '')
      },
    },
  ]
}

// 派车单 仅【已派车】页面使用
export const setLoadingColumns = (self, expData = []) => {
  return [
    {
      dataIndex: 'loadingBillNo',
      sorter: (a, b) => {
        if (!a.loadingBillNo || !b.loadingBillNo) return
        return a.loadingBillNo.replace(/[^0-9]/gi, '') - b.loadingBillNo.replace(/[^0-9]/gi, '')
      },
      title: '派车单号',
      width: 120,
      customRender: (txt, record) => {
        return self._c(
          'a',
          {
            attrs: {
              href: 'javascript:void(0)',
            },
            on: {
              click: (event) => {
                event.stopPropagation()
                return self.toView(record)
              },
            },
          },
          [self._v(txt)]
        )
      },
    },
    {
      dataIndex: 'groupName',
      title: '分组名称',
      width: 120,
      sorter: (a, b) => {
        return a.groupName.length - b.groupName.length
      },
    },
    {
      dataIndex: 'statusName',
      title: '派车单状态',
      width: 120,
      sorter: (a, b) => {
        return a.status - b.status
      },
    },
    {
      dataIndex: 'carrierSysFlagName',
      title: '系统标志',
      width: 120,
      sorter: (a, b) => {
        return a.carrierSysFlag - b.carrierSysFlag
      },
    },
    {
      dataIndex: 'cargoOwnerNumber',
      title: '总货主数',
      width: 120,
      sorter: (a, b) => {
        return a.cargoOwnerNumber - b.cargoOwnerNumber
      },
    },
    {
      dataIndex: 'shipbillNumber',
      title: '运单数',
      width: 120,
      sorter: (a, b) => {
        return a.shipbillNumber - b.shipbillNumber
      },
    },
    {
      dataIndex: 'coldShipbillNumber',
      title: '冷链运单数',
      width: 120,
      sorter: (a, b) => {
        return a.coldShipbillNumber - b.coldShipbillNumber
      },
    },
    {
      dataIndex: 'urgentShipbillNumber',
      title: '紧急运单数',
      width: 120,
      sorter: (a, b) => {
        return a.urgentShipbillNumber - b.urgentShipbillNumber
      },
    },
    {
      dataIndex: 'vehicleTypeCategoryName',
      title: '车辆类别',
      width: 120,
      sorter: (a, b) => {
        return a.vehicleTypeCategory - b.vehicleTypeCategory
      },
    },
    {
      dataIndex: 'vehicleDeviceName',
      title: '设备号',
      width: 120,
      sorter: (a, b) => {
        return a.vehicleDeviceCode - b.vehicleDeviceCode
      },
    },
    {
      dataIndex: 'containerName',
      title: '容器号',
      width: 120,
      sorter: (a, b) => {
        return a.containerCode - b.containerCode
      },
    },
    // {
    //   dataIndex: 'pickupStations',
    //   title: '提货点数',
    //   width: 120,
    //   sorter: (a, b) => {
    //     return a.pickupStations - b.pickupStations
    //   },
    // },
    // {
    //   dataIndex: 'deliveryStations',
    //   title: '送货点数',
    //   width: 120,
    //   sorter: (a, b) => {
    //     return a.deliveryStations - b.deliveryStations
    //   },
    // },
    {
      dataIndex: 'customerNumber',
      title: '客户数',
      width: 120,
      sorter: (a, b) => {
        return a.customerNumber - b.customerNumber
      },
    },
    {
      dataIndex: 'totalStations',
      title: '总站数',
      width: 120,
      sorter: (a, b) => {
        return a.totalStations - b.totalStations
      },
    },
    {
      dataIndex: 'totalWholePiece',
      title: '总整件数',
      width: 120,
      sorter: (a, b) => {
        return a.totalWholePiece - b.totalWholePiece
      },
    },
    {
      dataIndex: 'totalLclPiece',
      title: '总拼箱数',
      width: 120,
      sorter: (a, b) => {
        return a.totalLclPiece - b.totalLclPiece
      },
    },
    {
      dataIndex: 'totalPcs',
      title: '总件数',
      width: 120,
      sorter: (a, b) => {
        return a.totalPcs - b.totalPcs
      },
    },
    {
      dataIndex: 'totalWeight',
      title: '总重量',
      width: 120,
      sorter: (a, b) => {
        return a.totalWeight - b.totalWeight
      },
    },
    {
      dataIndex: 'totalVolume',
      title: '总体积',
      width: 120,
      sorter: (a, b) => {
        return a.totalVolume - b.totalVolume
      },
    },
    {
      dataIndex: 'totalDeliveryPcs',
      title: '提货总件数',
      width: 120,
      sorter: (a, b) => {
        return a.totalDeliveryPcs - b.totalDeliveryPcs
      },
    },
    {
      dataIndex: 'totalDeliveryWeight',
      title: '提货总重量',
      width: 120,
      sorter: (a, b) => {
        return a.totalDeliveryWeight - b.totalDeliveryWeight
      },
    },
    {
      dataIndex: 'totalDeliveryVolume',
      title: '提货总体积',
      width: 120,
      sorter: (a, b) => {
        return a.totalDeliveryVolume - b.totalDeliveryVolume
      },
    },
    {
      dataIndex: 'totalMileage',
      title: '总里程数',
      width: 120,
      sorter: (a, b) => {
        return a.totalMileage - b.totalMileage
      },
    },
    {
      dataIndex: 'driverName',
      title: '司机姓名',
      width: 120,
      sorter: (a, b) => {
        return a.driverName.length - b.driverName.length
      },
    },
    {
      dataIndex: 'driverPhoneNumber',
      title: '司机手机号',
      width: 120,
      sorter: (a, b) => {
        return a.driverPhoneNumber - b.driverPhoneNumber
      },
    },
    {
      dataIndex: 'deliverymanName',
      title: '送货员姓名',
      width: 120,
      sorter: (a, b) => {
        return a.deliverymanName.length - b.deliverymanName.length
      },
    },
    {
      dataIndex: 'deliverymanPhoneNumber',
      title: '送货员手机号',
      width: 120,
      sorter: (a, b) => {
        return a.deliverymanPhoneNumber - b.deliverymanPhoneNumber
      },
    },
    {
      dataIndex: 'vehiclePlateNumber',
      title: '车牌号',
      width: 120,
      sorter: (a, b) => {
        if (!a.vehiclePlateNumber || !b.vehiclePlateNumber) return
        return a.vehiclePlateNumber.replace(/[^0-9]/gi, '') - b.vehiclePlateNumber.replace(/[^0-9]/gi, '')
      },
    },
    {
      dataIndex: 'vehicleAscriptionName',
      title: '车辆归属',
      width: 120,
      sorter: (a, b) => {
        return a.vehicleAscription - b.vehicleAscription
      },
    },
    {
      dataIndex: 'vehicleTypeName',
      title: '车型',
      width: 120,
      sorter: (a, b) => {
        return a.vehicleType - b.vehicleType
      },
    },
    {
      dataIndex: 'volumeLoadingRate',
      title: '配载体积装载率',
      width: 120,
      sorter: (a, b) => {
        return a.volumeLoadingRate - b.volumeLoadingRate
      },
    },
    {
      dataIndex: 'weightLoadingRate',
      title: '配载重量装载率',
      width: 120,
      sorter: (a, b) => {
        return a.weightLoadingRate - b.weightLoadingRate
      },
    },
    {
      dataIndex: 'memo',
      title: '备注',
      width: 120,
      sorter: (a, b) => {
        return a.memo.length - b.memo.length
      },
    },
    ...expData,
    {
      dataIndex: 'createperson',
      title: '创建人',
      width: 120,
      sorter: (a, b) => {
        return a.createperson.length - b.createperson.length
      },
    },
    {
      dataIndex: 'createtime',
      title: '创建时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.createtime) - +new Date(b.createtime)
      },
    },
    {
      dataIndex: 'updateperson',
      title: '修改人',
      width: 120,
      sorter: (a, b) => {
        return a.updateperson.length - b.updateperson.length
      },
    },
    {
      dataIndex: 'updatetime',
      title: '修改时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.updatetime) - +new Date(b.updatetime)
      },
    },

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

// 托运单 仅【已托运】页面使用
export const setConsignedColumns = (self, expData = []) => {
  return [
    {
      dataIndex: 'loadingBillNo',
      sorter: (a, b) => {
        if (!a.loadingBillNo || !b.loadingBillNo) return
        return a.loadingBillNo.replace(/[^0-9]/gi, '') - b.loadingBillNo.replace(/[^0-9]/gi, '')
      },
      title: '托运单号',
      width: 120,
      customRender: (txt, record) => {
        return self._c(
          'a',
          {
            attrs: {
              href: 'javascript:void(0)',
            },
            on: {
              click: (event) => {
                event.stopPropagation()
                return self.toView(record)
              },
            },
          },
          [self._v(txt)]
        )
      },
    },
    {
      dataIndex: 'groupName',
      title: '分组名称',
      width: 120,
      sorter: (a, b) => {
        return a.groupName.length - b.groupName.length
      },
    },
    {
      dataIndex: 'statusName',
      title: '托运单状态',
      width: 120,
      sorter: (a, b) => {
        return a.status - b.status
      },
    },
    {
      dataIndex: 'carrierSysFlagName',
      title: '系统标志',
      width: 120,
      sorter: (a, b) => {
        return a.carrierSysFlag - b.carrierSysFlag
      },
    },
    {
      dataIndex: 'shipbillNumber',
      title: '运单数',
      width: 120,
      sorter: (a, b) => {
        return a.shipbillNumber - b.shipbillNumber
      },
    },
    {
      dataIndex: 'pickupStations',
      title: '提货点数',
      width: 120,
      sorter: (a, b) => {
        return a.pickupStations - b.pickupStations
      },
    },
    {
      dataIndex: 'deliveryStations',
      title: '送货点数',
      width: 120,
      sorter: (a, b) => {
        return a.deliveryStations - b.deliveryStations
      },
    },
    {
      dataIndex: 'totalStations',
      title: '总站数',
      width: 120,
      sorter: (a, b) => {
        return a.totalStations - b.totalStations
      },
    },
    {
      dataIndex: 'customerNumber',
      title: '客户数',
      width: 120,
      sorter: (a, b) => {
        return a.customerNumber - b.customerNumber
      },
    },
    {
      dataIndex: 'totalWholePiece',
      title: '总整件数',
      width: 120,
      sorter: (a, b) => {
        return a.totalWholePiece - b.totalWholePiece
      },
    },
    {
      dataIndex: 'totalLclPiece',
      title: '总拼箱数',
      width: 120,
      sorter: (a, b) => {
        return a.totalLclPiece - b.totalLclPiece
      },
    },
    {
      dataIndex: 'totalPcs',
      title: '总件数',
      width: 120,
      sorter: (a, b) => {
        return a.totalPcs - b.totalPcs
      },
    },
    {
      dataIndex: 'totalWeight',
      title: '总重量',
      width: 120,
      sorter: (a, b) => {
        return a.totalWeight - b.totalWeight
      },
    },
    {
      dataIndex: 'totalVolume',
      title: '总体积',
      width: 120,
      sorter: (a, b) => {
        return a.totalVolume - b.totalVolume
      },
    },
    {
      dataIndex: 'totalMileage',
      title: '总里程数',
      width: 120,
      sorter: (a, b) => {
        return a.totalMileage - b.totalMileage
      },
    },
    {
      dataIndex: 'driverName',
      title: '司机姓名',
      width: 120,
      sorter: (a, b) => {
        return a.driverName.length - b.driverName.length
      },
    },
    {
      dataIndex: 'driverPhoneNumber',
      title: '司机手机号',
      width: 120,
      sorter: (a, b) => {
        return a.driverPhoneNumber - b.driverPhoneNumber
      },
    },
    {
      dataIndex: 'deliverymanName',
      title: '送货员姓名',
      width: 120,
      sorter: (a, b) => {
        return a.deliverymanName.length - b.deliverymanName.length
      },
    },
    {
      dataIndex: 'deliverymanPhoneNumber',
      title: '送货员手机号',
      width: 120,
      sorter: (a, b) => {
        return a.deliverymanPhoneNumber - b.deliverymanPhoneNumber
      },
    },
    {
      dataIndex: 'vehiclePlateNumber',
      title: '车牌号',
      width: 120,
      sorter: (a, b) => {
        if (!a.vehiclePlateNumber || !b.vehiclePlateNumber) return
        return a.vehiclePlateNumber.replace(/[^0-9]/gi, '') - b.vehiclePlateNumber.replace(/[^0-9]/gi, '')
      },
    },
    {
      dataIndex: 'vehicleTypeName',
      title: '车型',
      width: 120,
      sorter: (a, b) => {
        return a.vehicleType - b.vehicleType
      },
    },
    {
      dataIndex: 'volumeLoadingRate',
      title: '配载体积装载率',
      width: 120,
      sorter: (a, b) => {
        return a.volumeLoadingRate - b.volumeLoadingRate
      },
    },
    {
      dataIndex: 'weightLoadingRate',
      title: '配载重量装载率',
      width: 120,
      sorter: (a, b) => {
        return a.weightLoadingRate - b.weightLoadingRate
      },
    },
    {
      dataIndex: 'memo',
      title: '备注',
      width: 120,
      sorter: (a, b) => {
        return a.memo.length - b.memo.length
      },
    },
    ...expData,
    {
      dataIndex: 'createperson',
      title: '创建人',
      width: 120,
      sorter: (a, b) => {
        return a.createperson.length - b.createperson.length
      },
    },
    {
      dataIndex: 'createtime',
      title: '创建时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.createtime) - +new Date(b.createtime)
      },
    },
    {
      dataIndex: 'updateperson',
      title: '修改人',
      width: 120,
      sorter: (a, b) => {
        return a.updateperson.length - b.updateperson.length
      },
    },
    {
      dataIndex: 'updatetime',
      title: '修改时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.updatetime) - +new Date(b.updatetime)
      },
    },

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



//简单调度运单
export const setSchedulingColumns = (self, expData = [], tableExtend = { scheduledTableArray: [] }) => {
  return [
    {
      dataIndex: 'shipbillNo',
      sorter: (a, b) => {
        if (!a.shipbillNo || !b.shipbillNo) return
        return a.shipbillNo.replace(/[^0-9]/gi, '') - b.shipbillNo.replace(/[^0-9]/gi, '')
      },
      title: '运单号',
      width:200,
      customRender: (txt, record) => {
        const { recordTagWord } = record
      let text= self._v(txt)
        if (recordTagWord) {
          return self._c('a-space', {}, [text, self._c('a-badge', {
            attrs: {
              numberStyle:{boxShadow:'none'},
              count: recordTagWord,
              overflowCount:Infinity

            }
          })])
        } else {
          return  self._c(
            'span',
            {},
            [text]
          )
        }

      },
    },
    {
      dataIndex: 'cargoOwnerName',
      title: '货主',
      width: 120,
      sorter: (a, b) => {
        return a.cargoOwnerName != b.cargoOwnerName
      },
    },
    {
      dataIndex: 'orderNo',
      title: '订单号',
      width: 120,
      sorter: (a, b) => {
        if (!a.orderNo || !b.orderNo) {
          return
        }
        return a.orderNo.replace(/[^0-9]/gi, '') - b.orderNo.replace(/[^0-9]/gi, '')
      },
    },
    ...tableExtend.scheduledTableArray,
    {
      dataIndex: 'wmsOrderNo',
      title: 'WMS单号',
      width: 120,
      sorter: (a, b) => {
        return a.wmsOrderNo != b.wmsOrderNo
      },
    },
    {
      dataIndex: 'orderTypeName',
      title: '订单类型',
      width: 120,
      sorter: (a, b) => {
        return a.orderType - b.orderType
      },
    },
    {
      dataIndex: 'orderBusinessTypeName',
      title: '业务类型',
      width: 120,
      sorter: (a, b) => {
        return a.orderBusinessType - b.orderBusinessType
      },
    },
    {
      dataIndex: 'deliveryMethodTypeName',
      title: '配送方式',
      width: 120,
      sorter: (a, b) => {
        return a.deliveryMethodType - b.deliveryMethodType
      },
    },
    {
      dataIndex: 'transportTypeName',
      title: '运输模式',
      width: 120,
      sorter: (a, b) => {
        return a.transportType - b.transportType
      },
    },
    {
      dataIndex: 'temperatureRequirementName',
      title: '温度要求',
      width: 120,
      sorter: (a, b) => {
        return a.temperatureRequirement - b.temperatureRequirement
      },
    },
    {
      dataIndex: 'lineName',
      title: '线路',
      width: 120,
      sorter: (a, b) => {
        return ~~a.lineId - ~~b.lineId
      },
    },
    {
      dataIndex: 'memo',
      title: '备注',
      width: 120,
      sorter: (a, b) => {
        return a.memo == b.memo
      },
    },
    {
      dataIndex: 'orderDate',
      title: '订单下单日期',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.orderDate) - +new Date(b.orderDate)
      },
    },
    {
      dataIndex: 'estimatedPickupStartTime',
      title: '预计提货时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.estimatedPickupStartTime) - +new Date(b.estimatedPickupStartTime)
      },
    },
    {
      dataIndex: 'estimatedDeliveryStartTime',
      title: '预计送达时间',
      width: 120,
      sorter: (a, b) => {
        return +new Date(a.estimatedDeliveryStartTime) - +new Date(b.estimatedDeliveryStartTime)
      },
    },
    {
      dataIndex: 'transportAging',
      title: '时效',
      width: 120,
      sorter: (a, b) => {
        return a.transportAging - b.transportAging
      },
    },
    {
      dataIndex: 'lineDirectionName',
      title: '方向',
      width: 80,
      sorter: (a, b) => {
        return a.lineDirection - b.lineDirection
      },
    },
    ...shipper.init(self), //发
    ...consignee.init(self), //收
    {
      dataIndex: 'totalPcs',
      title: '总件数',
      width: 120,
      sorter: (a, b) => {
        return a.totalPcs - b.totalPcs
      },
    },
    {
      dataIndex: 'totalWeight',
      title: '总重量',
      width: 120,
      sorter: (a, b) => {
        return a.totalWeight - b.totalWeight
      },
    },
    {
      dataIndex: 'totalVolume',
      title: '总体积',
      width: 120,
      sorter: (a, b) => {
        return a.totalVolume - b.totalVolume
      },
    },
    {
      dataIndex: 'packageWholePiece',
      title: '整件数',
      width: 120,
      sorter: (a, b) => {
        return a.packageWholePiece - b.packageWholePiece
      },
    },
    {
      dataIndex: 'packageLclPiece',
      title: '拼箱数',
      width: 120,
      sorter: (a, b) => {
        return a.packageLclPiece - b.packageLclPiece
      },
    },
    {
      dataIndex: 'packageTotalWeight',
      title: '包裹总重量',
      width: 120,
      sorter: (a, b) => {
        return a.packageTotalWeight - b.packageTotalWeight
      },
    },
    {
      dataIndex: 'packageTotalVolume',
      title: '包裹总体积',
      width: 120,
      sorter: (a, b) => {
        return a.packageTotalVolume - b.packageTotalVolume
      },
    },
    ...expData,



  ]
}