import { BasicColumn } from '/@/components/Table/src/types/table'
import { Icon } from '/@/components/Icon/index'
import { ProjectAccountItem } from '/@/api/sys/model/projectModel'
export function getTableColumns(fn: (item: ProjectAccountItem) => void, hasPermission: boolean): BasicColumn[] {
  return [
    {
      dataIndex: 'account',
      title: '账号',
      customRender: ({ text, record }) => (
        <div>
          {record.boolAdmin ? <Icon icon="clarity:administrator-solid" /> : null}
          {text}
        </div>
      )
    },
    {
      dataIndex: 'name',
      title: '姓名'
    },
    {
      dataIndex: 'company',
      title: '单位'
    },
    {
      dataIndex: 'position',
      title: '角色/职位'
    },
    {
      dataIndex: 'mobile',
      title: '手机',
      width: '10%'
    },
    {
      dataIndex: 'telephone',
      title: '电话',
      width: '10%'
    },
    {
      dataIndex: 'action',
      title: '操作',
      customRender: ({ record }) => (
        <div>
          {hasPermission && (
            <a-button type="primary" onClick={() => fn(record)}>
              编辑
            </a-button>
          )}
        </div>
      )
    }
  ]
}
