/**
 * @desc
 * @author linyuanjie
 * @date 2021/6/3
*/

export const tableOptions = {
  "align":'center',
  "menuAlign":"center",
  "indexLabel": "序号",
  "index": true,
  "selection": false,
  "border":true,
  "addBtn": false,
  "editBtn":false,
  "delBtn":false,
  "viewBtn":false,
  "menuLeft": true,
  "menu": false,
  "searchMenuSpan": 4,
  "searchLabelWidth": "90",
  // "labelWidth": "130",
  "header": true,
  column:[
    {
      type: "input",
      label: '客户名称',
      prop: 'customerName',
      search: true,
      searchSpan: 5
    },
    {
      type: "select",
      label: '客户类别',
      prop: 'customerType',
      search: true,
      searchSpan: 5,
      dicUrl: '/admin/dict/type/customer_type',
      props: {
        label: 'label',
        value: 'value'
      }
    },
    {
      type: "input",
      label: '客户经理',
      prop: 'customerManager',
      search: true,
      searchSpan: 5
    },
    {
      type: "input",
      label: '所属渠道',
      prop: 'channelName',
      search: true,
      searchSpan: 5
    },
    {
      label:'当月业绩',
      children: [
        {
          label: '新增用户',
          prop: 'MNU',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: '活跃用户',
          prop: 'MAU',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: 'GMV1',
          prop: 'gmv1',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: 'GMV2',
          prop: 'gmv2',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: '要易收益',
          prop: 'income',
          slot: true,
          align: 'right',
          minWidth: '100'
        }
      ]
    }
  ]
}

// 动态生成tableOptions1
export function generateTableOption1 (startMonth, endMonth) {
  let tableOptions1 = {
    "align":'center',
    "menuAlign":"center",
    // "indexLabel": "序号",
    // "index": true,
    "selection": false,
    "border":true,
    "addBtn": false,
    "editBtn":false,
    "delBtn":false,
    "viewBtn":false,
    // "menuLeft": true,
    "menuRight": true,
    "menu": false,
    // "labelWidth": "130",
    // "header": true,
    refreshBtn: false,
    columnBtn: false,
    searchBtn: false,
    height: '500',
    column:[
      {
        label: '序号',
        prop: 'salesIndex',
        slot: true
      },
      {
        type: "input",
        label: '客户名称',
        prop: 'customerName',
        minWidth: '200'
      },
      {
        type: "select",
        label: '客户类别',
        prop: 'customerType',
        dicUrl: '/admin/dict/type/customer_type',
        width: '80',
        props: {
          label: 'label',
          value: 'value'
        }
      },
      {
        type: "input",
        label: '客户经理',
        prop: 'customerManager',
        width: '80'
      },
      {
        type: "input",
        label: '所属渠道',
        prop: 'channelName',
        width: '200'
      }
    ]
  }
  for (let i = startMonth; i < endMonth + 1; i++) {
    tableOptions1.column.push({
      label: i + '月',
      children: [
        {
          label: '新增用户',
          prop: 'M' + i + 'MNU',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: '活跃用户',
          prop: 'M' + i + 'MAU',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: 'GMV1',
          prop: 'M' + i + 'gmv1',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: 'GMV2',
          prop: 'M' + i + 'gmv2',
          slot: true,
          align: 'right',
          minWidth: '100'
        },
        {
          label: '要易收益',
          prop: 'M' + i + 'income',
          slot: true,
          align: 'right',
          minWidth: '100'
        }
      ]
    })
  }
  return tableOptions1
}
