import { ElButton } from 'element-plus'

import Switch from '#/components/Switch'
// import { ElButton, ElSwitch, ElPopconfirm } from 'element-plus'
import filterDate from '#/hooks/filterDate'

export default (event: { [key: string]: any }): TableColumn[] => [
  { label: '名称', prop: 'name', 'min-width': 200 },
  { label: '编码', prop: 'code', 'min-width': 200 },
  { label: '备注', prop: 'remark', 'min-width': 200 },
  {
    label: '状态',
    prop: 'status',
    'min-width': 110,
    render: (h, scope) => {
      return (
        <Switch
          active-value={0}
          before-change={() => event.updateState(scope.row)}
          inactive-value={1}
          loading={scope.row.loading}
          v-model={scope.row.status}
        />
      )
    },
  },
  {
    label: '创建时间',
    width: 160,
    'show-overflow-tooltip': true,
    render: (h, scope) => filterDate(scope.row.createTime),
  },
  {
    label: '操作',
    'min-width': 380,
    render: (h, scope) => {
      return (
        <div>
          <ElButton
            onClick={() => event.handleClick(1, scope.row)}
            type="primary"
          >
            编辑
          </ElButton>
          <ElButton
            onClick={() => event.handleClick(0, scope.row)}
            type="primary"
          >
            查看详情
          </ElButton>
          <ElButton
            onClick={() => event.handleClick(3, scope.row)}
            type="primary"
          >
            子集
          </ElButton>
          <ElButton onClick={() => event.handleClick(2, scope.row)}>
            删除
          </ElButton>
        </div>
      )
    },
  },
]
