import { ElButton, ElInput, ElInputNumber } from 'element-plus'

import Switch from '#/components/Switch'

export default (event: { [key: string]: any }): TableColumn[] => [
  {
    label: '编码',
    prop: 'code',
    render: (h, scope) => {
      return <ElInput v-model={scope.row.code} />
    },
  },
  {
    label: '值',
    prop: 'value',
    render: (h, scope) => {
      return <ElInput v-model={scope.row.value} />
    },
  },
  {
    label: '备注',
    prop: 'remark',
    render: (h, scope) => {
      return <ElInput v-model={scope.row.remark} />
    },
  },
  {
    label: '状态',
    prop: 'status',
    width: 100,
    render: (h, scope) => {
      return (
        <Switch
          active-value={0}
          inactive-value={1}
          loading={scope.row.loading}
          v-model={scope.row.status}
          // before-change={() => event.updateState(scope.row)}
        />
      )
    },
  },
  {
    label: '排序',
    prop: 'sort',
    width: 150,
    render: (h, scope) => {
      return (
        <ElInputNumber
          max={1000}
          min={-1}
          size="small"
          v-model={scope.row.sort}
        />
      )
    },
  },
  {
    label: '操作',
    width: 150,
    render: (h, scope) => (
      <ElButton
        onClick={() => event.removeSub(scope.row)}
        size="small"
        text
        type="danger"
      >
        删除
      </ElButton>
    ),
  },
  // {
  //     label: '操作',

  //     width: 150,
  //     render: (h, scope) => {
  //         let Dom = [
  //             <ElButton
  //                 type='primary'
  //                 size='small'
  //                 onClick={() => event.handleClick(1, scope.row)}
  //                 text>
  //                 {scope.row.id ? '保存' : '新增'}
  //             </ElButton>,
  //         ]
  //         if (scope.row.id) {
  //             Dom.push(
  //                 <ElPopconfirm
  //                     width='160px'
  //                     title='确定要删除此行?'
  //                     onConfirm={() => event.handleClick(0, scope.row)}>
  //                     {{
  //                         reference: () => (
  //                             <ElButton type='primary' size='small' text>
  //                                 删除
  //                             </ElButton>
  //                         ),
  //                     }}
  //                 </ElPopconfirm>
  //             )
  //         }
  //         return Dom
  //     },
  // },
]
