
import {stationAttr} from '@/blocks/components/searchModalConfig'



export const setMainColumns = (_this) => {

  return [
    // { dataIndex: 'id', title: 'id',hidden:true},
    { dataIndex: 'startingStationId', title: '始发站点Id',hidden:true},
    {
      ...stationAttr,
      tableConfig: {
        ...stationAttr.tableConfig,
        remoteBefore: (vNode, reposts) => {
          reposts.data.excludeId =_this.excludeId
        },
        getCheckboxProps: (record) => ({
          props: {
            disabled: _this.excludeId.includes(record.id)
          },
        })
      },
      targetValueKey:'code',
      dataIndex: 'startingStationCode',
      title: '始发站点编码',
      type: 'searchModal',
      required:true,

      on: {
        change: ({value,record}) => {
          if (!value) {
             record.startingStationName=''
             record.startingStationCode=''
            record.startingStationId = ''
            return false
          }
        },
        ok(event, txt, option,name,index,record) {
          let data=option[0]
          record.startingStationName=data.name
          record.startingStationCode=data.code
          record.startingStationId=data.id
          record.distance=data.distance
        }
      }
    },
    { dataIndex: 'startingStationName', title: '始发站点名称',readOnly: true,placeholder: '请选择站点编码'},
    { dataIndex: 'distance', title: '距离（KM）',type:'number' },
    {
      title: () => {
          return _this._c('a-icon', {
            style: 'font-size: 16px',
            attrs: {
              type: 'plus-circle',
              'data-value': 'params',
            },
            on: { click: _this.addtableformRow },
          })
      },
      width: 40,
      align: 'center',
      key: 'operation',
      scopedSlots: { customRender: 'operation' },
    }
  ];
};
