feat: add export

dev-v5
xingyu4j 2024-12-18 15:35:33 +08:00
parent d5dab14d8b
commit e27e7d1991
1 changed files with 3 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import {
type PostVO, type PostVO,
} from '#/api/system/post'; } from '#/api/system/post';
import { ActionButtons, IconEnum } from '#/components/action-buttons'; import { ActionButtons, IconEnum } from '#/components/action-buttons';
import { downloadByData } from '#/utils/file/download';
import { columns, formSchema } from './post.data'; import { columns, formSchema } from './post.data';
import PostForm from './post-form.vue'; import PostForm from './post-form.vue';
@ -74,7 +75,8 @@ async function handleDelete(id: number) {
} }
// TODO // TODO
async function handleExport() { async function handleExport() {
await exportPost(tableApi.formApi.form.values); const res = await exportPost(tableApi.formApi.form.values);
downloadByData(res.data, '导出岗位.xls');
} }
</script> </script>
@ -93,8 +95,6 @@ async function handleExport() {
}, },
{ {
label: $t('page.action.export'), label: $t('page.action.export'),
class:
'bg-green-500 text-white border-green-400 hover:bg-green-400 hover:!text-white hover:!border-green-400 active:!bg-green-600 active:!text-white active:!border-green-600',
icon: IconEnum.EXPORT, icon: IconEnum.EXPORT,
auth: ['system:post:export'], auth: ['system:post:export'],
onClick: handleExport.bind(null), onClick: handleExport.bind(null),