import { upcloud_base_strategy,  } from "@/config/serviceSettings";
const tablecolumns = function(that) {
  return {
    //策略表
    MainTable: {
      // /strategy/v1/page
      remoteUrl: {
        url: upcloud_base_strategy + '/strategy/v1/page',
        headers: {
          'Content-Type': 'application/JSON'
        },
        method: 'get'
      },
      ref: 'MainTable',
      rowkey: 'id',
      columns: [
        {
          title: '策略分类',
          dataIndex: 'category',
          key: 'category'
        },
        {
          title: '企业id',
          dataIndex: 'enterpriseId',
          key: 'enterpriseId',
          hidden: true
        },
        {
          title: '货主ID',
          dataIndex: 'cargoOwnerId',
          key: 'cargoOwnerId',
          hidden: true
        },
        {
          title: '货主',
          dataIndex: 'cargoOwnerName',
          width: 260,
          key: 'cargoOwnerName'
        },
        {
          title: '仓ID',
          dataIndex: 'warehouseId',
          hidden: true,
          key: 'warehouseId'
        },
        {
          title: '仓',
          dataIndex: 'warehouseName',
          key: 'warehouseName'
        },
        {
          title: '策略名称',
          key: 'name',
          dataIndex: 'name'
        },
        {
          title: '可用状态',
          key: 'enable',
          dataIndex: 'enable',
          scopedSlots: { customRender: 'enable' }
        },

        {
          title: '操作',
          key: 'operation',
          scopedSlots: { customRender: 'operation' },
          align: 'center'
        }
      ]
    },
    RuleTable: {
      remoteUrl: {
        url: upcloud_base_strategy + '/rule/v1/page',
        headers: {
          'Content-Type': 'application/JSON'
        },
        method: 'get'
      },
      ref: 'rule',
      rowkey: 'id',
      columns: [
        {
          title: '优先级',
          dataIndex: 'priority',
          key: 'priority'
        },
        {
          title: '规则名称',
          dataIndex: 'name',
          key: 'name'
        },
        {
          title: '规则状态',
          dataIndex: 'disabled',
          key: 'disabled',
          scopedSlots: { customRender: 'disabled' }
        },

        {
          title: '操作',
          key: 'operation',
          align: 'center',
          scopedSlots: { customRender: 'operation' }
        }
      ]
    },
    modalItems: {
      ref: 'modelFormType',
      items: [
        {
          type: 'input',
          name: 'name',
          label: '规则名称',
          required: true,
          value: '',
          labelCol: { span: 6 },
          span: 24
        }
      ]
    }
  }
}

export default tablecolumns
