import { ElButton, ElPopconfirm } from 'element-plus'

export default (event: { [key: string]: any }): TableColumn[] => [
  {
    label: '类别',
    prop: 'assistType',
    render: (h, scope) => {
      return (
        <div>
          {scope.row.assistType === 1 ? (
            <span>词根</span>
          ) : scope.row.assistType === 2 ? (
            <span>联想</span>
          ) : (
            <span>谐音</span>
          )}
        </div>
      )
    },
  },
  {
    label: '助记内容',
    prop: 'assistText',
  },
  {
    label: '操作',
    width: 300,
    render: (h, scope) => {
      return (
        <div>
          <ElButton
            type="primary"
            onClick={() => event.handleClick(1, scope.row)}
          >
            编辑
          </ElButton>
          <ElPopconfirm
            width="160px"
            title="确定要删除此行?"
            onConfirm={() => event.handleClick(2, scope.row)}
          >
            {{
              reference: () => (
                <ElButton v-show={!scope.row.hasOwnProperty('children')}>
                  删除
                </ElButton>
              ),
            }}
          </ElPopconfirm>
        </div>
      )
    },
  },
]
