export function area(labelname = '区域', span = 24, required = true, name = 'startRegion') {
  return {
    title: labelname,
    type: 'searchModal',
    dataIndex: 'areaNo',
    width: 200,
    targetClick: true,
    targetValueKey: name,
    span: span,
    // label: labelname,
    required: required,
    targetClick: true,
    targetValueKey: 'areaNo',
    value: '',
    remoteUrl: {
      url: '/api/upcloud-base-wh-dev-mysql-eistest/storeArea/getAll-storeArea',
    },
    doneBefore: function (res) {
      console.log(res)
      //   res.data.list = res.data.list.filter(item => item.areaType == 10)
      return res
    },

    on: {
      search: () => {
        //   this.params = { name: 'hdwss' }
      },
      change: (event, value, rowData, form) => {},
    },

    tableConfig: {
      rowKey: 'areaNo',
      remoteBefore: function (vnode, remoteUrl) {
        console.log(remoteUrl)

        // remoteUrl.params.areaType = 20
        return remoteUrl
      },
      columns: [
        {
          dataIndex: 'areaNo',
          title: '区域编号',
        },
        {
          title: '区域类别',
          dataIndex: 'areaType',
          align: 'center',
          key: 'areaType',
          customRender(text) {
            text == 10 && (text = '区域')
            text == 20 && (text = '接驳口')
            return text
          },
        },
      ],
    },
  }
}

export function stationNo(labelname = '站台编号', span = 24, required = true, name = 'stationNo') {
  return {
    title: labelname,
    type: 'searchModal',
    dataIndex: 'stationNo',
    width: 200,
    targetClick: true,
    targetValueKey: name,
    span: span,
    // label: labelname,
    required: required,
    targetClick: true,
    targetValueKey: 'stationNo',
    value: '',
    remoteUrl: {
      url: '/api/upcloud-base-wh-dev-mysql-eistest/eisStationService/station/platform',
      method: 'post',
    },
    doneBefore: function (res) {
      console.log(res)
      //   res.data.list = res.data.list.filter(item => item.areaType == 10)
      return res
    },

    on: {
      search: () => {
        //   this.params = { name: 'hdwss' }
      },
      change: (event, value, rowData, form) => {},
    },

    tableConfig: {
      rowKey: 'stationNo',
      remoteBefore: function (vnode, remoteUrl) {
        console.log(remoteUrl)
        // remoteUrl.method = 'post'
        // remoteUrl.params.areaType = 20
        return remoteUrl
      },
      columns: [
        {
          dataIndex: 'stationNo',
          title: '站台编号',
          key: 'stationNo',
        },
        {
          title: '站台区域',
          dataIndex: 'areaNo',
          align: 'center',
          key: 'areaNo',
          //   customRender(text) {
          //     text == 10 && (text = '区域')
          //     text == 20 && (text = '接驳口')
          //     return text
          //   },
        },
      ],
    },
  }
}
//   export  area
