2 changed files with 122 additions and 1 deletions
@ -1,3 +1,56 @@
|
||||
<template> |
||||
<div>开发中</div> |
||||
<div> |
||||
<BasicTable @register="registerTable"> |
||||
<template #bodyCell="{ column, record }"> |
||||
<template v-if="column.key === 'action'"> |
||||
<TableAction |
||||
:actions="[ |
||||
{ |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
label: '强退', |
||||
popConfirm: { |
||||
title: '是否确认强退', |
||||
placement: 'left', |
||||
confirm: handleDelete.bind(null, record) |
||||
} |
||||
} |
||||
]" |
||||
/> |
||||
</template> |
||||
</template> |
||||
</BasicTable> |
||||
</div> |
||||
</template> |
||||
<script lang="ts" setup name="Token"> |
||||
import { BasicTable, useTable, TableAction } from '@/components/Table' |
||||
import { deleteAccessTokenApi, getAccessTokenPageApi } from '@/api/system/oauth2/token' |
||||
import { columns, searchFormSchema } from './token.data' |
||||
import { useMessage } from '@/hooks/web/useMessage' |
||||
|
||||
const { createMessage } = useMessage() |
||||
const [registerTable, { reload }] = useTable({ |
||||
title: 'Token列表', |
||||
api: getAccessTokenPageApi, |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema |
||||
}, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 100, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
fixed: 'right' |
||||
} |
||||
}) |
||||
|
||||
async function handleDelete(record: Recordable) { |
||||
await deleteAccessTokenApi(record.id) |
||||
createMessage.success('删除成功') |
||||
reload() |
||||
} |
||||
</script> |
||||
|
@ -0,0 +1,68 @@
|
||||
import { BasicColumn, FormSchema, useRender } from '@/components/Table' |
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
||||
|
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '访问令牌', |
||||
dataIndex: 'accessToken', |
||||
width: 300 |
||||
}, |
||||
{ |
||||
title: '刷新令牌', |
||||
dataIndex: 'refreshToken', |
||||
width: 300 |
||||
}, |
||||
{ |
||||
title: '用户编号', |
||||
dataIndex: 'userId', |
||||
width: 100 |
||||
}, |
||||
{ |
||||
title: '用户类型', |
||||
dataIndex: 'userType', |
||||
width: 120, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDict(text, DICT_TYPE.USER_TYPE) |
||||
} |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDate(text) |
||||
} |
||||
}, |
||||
{ |
||||
title: '过期时间', |
||||
dataIndex: 'expiresTime', |
||||
width: 180, |
||||
customRender: ({ text }) => { |
||||
return useRender.renderDate(text) |
||||
} |
||||
} |
||||
] |
||||
|
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
label: '用户编号', |
||||
field: 'userId', |
||||
component: 'Input', |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '客户端编号', |
||||
field: 'clientId', |
||||
component: 'Input', |
||||
colProps: { span: 8 } |
||||
}, |
||||
{ |
||||
label: '用户类型', |
||||
field: 'userType', |
||||
component: 'Select', |
||||
componentProps: { |
||||
options: getIntDictOptions(DICT_TYPE.USER_TYPE) |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
] |
Reference in new issue