import { column } from "@/types/column"
import { eRole } from "@/types/role"
const columns:Array<column> = 
[
  {
    title: '创建日期',
    align:'center',
    dataIndex: 'created_at',
    scopedSlots: { customRender: 'created_at' },
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  // {
  //   title:'uid',
  //   align:'center',
  //   dataIndex:'uuid',
  //   role:[
  //     eRole.superManager,
  //     eRole.firstLevel_branch,
  //     eRole.secondary_branch,
  //     eRole.firstLevel_sub_branch,
  //     eRole.firstLevel_sub_clientManager,
  //     eRole.secondary_sub_branch,
  //     eRole.secondary_sub_clientManager,
  //   ]
  // },
  {
    title:'姓名',
    align:'center',
    dataIndex: 'user_name',
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title:'岗位角色',
    align:'center',
    dataIndex: 'role',
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title: '手机号',
    align:'center',
    dataIndex: 'phone',
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title: '所在机构层级',
    align:'center',
    dataIndex: 'level',
    scopedSlots: { customRender: 'level' },
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title: '所属二级支行',
    align:'center',
    dataIndex: 'second_sub_branch',
    role:[
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title: '所属一级支行',
    align:'center',
    dataIndex: 'first_sub_branch',
    role:[
      eRole.firstLevel_sub_branch,
      eRole.secondary_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title: '所属二级分行',
    align:'center',
    dataIndex: 'second_branch',
    role:[
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title: '所属一级分行',
    align:'center',
    dataIndex: 'first_branch',
    role:[
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title:'一级支行客户名单',
    align:'center',
    scopedSlots: { customRender: 'firstSubClient' },
    role:[
      eRole.firstLevel_sub_clientManager
    ]
  },
  {
    title:'二级支行客户名单',
    align:'center',
    scopedSlots: { customRender: 'secondarySubClient' },
    role:[
      eRole.secondary_sub_clientManager
    ]
  },
  {
    title:'一级支行客户经理',
    align:'center',
    scopedSlots: { customRender: 'firstSubClientManager' },
    role:[
    ]
  },
  {
    title:'二级支行管理员',
    align:'center',
    scopedSlots: { customRender: 'secondarySubManager' },
    role:[
      eRole.firstLevel_sub_branch,
    ]
  },
  {
    title:'二级支行客户经理',
    align:'center',
    scopedSlots: { customRender: 'secondarySubClientManager' },
    role:[
      eRole.secondary_sub_branch,
    ]
  },
  {
    title:'一级支行管理员',
    align:'center',
    scopedSlots: { customRender: 'firstSubManager' },
    role:[
      eRole.secondary_branch,
    ]
  },
  {
    title:'一级支行客户经理',
    align:'center',
    scopedSlots: { customRender: 'firstSubClientManager' },
    role:[
      eRole.secondary_branch
    ]
  },
  {
    title:'二级分行管理员',
    align:'center',
    scopedSlots: { customRender: 'secondaryManager' },
    role:[
      eRole.firstLevel_branch
    ]
  },
  {
    title:'详细地址',
    align:'center',
    dataIndex: 'location',
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title:'操作uid',
    align:'center',
    dataIndex: 'operator_name',
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title:'状态',
    align:'center',
    dataIndex: 'status',
    scopedSlots: { customRender: 'status' },
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
  {
    title:'操作',
    align:'center',
    scopedSlots: { customRender: 'action' },
    role:[
      eRole.superManager,
      eRole.firstLevel_branch,
      eRole.secondary_branch,
      eRole.firstLevel_sub_branch,
      eRole.firstLevel_sub_clientManager,
      eRole.secondary_sub_branch,
      eRole.secondary_sub_clientManager,
    ]
  },
]

export function getColumns(role:eRole):Array<column>{
  return columns.filter(col=>{
    return col.role?.includes(role)
  })
}

