feat: 文件上传
parent
9b2fe7f3ac
commit
ecf98298a2
|
@ -2,7 +2,15 @@
|
|||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #toolbar>
|
||||
<a-button type="primary" :preIcon="IconEnum.UPLOAD" @click="handleAdd"> 上传文件 </a-button>
|
||||
<BasicUpload
|
||||
:maxSize="20"
|
||||
:maxNumber="10"
|
||||
@change="handleChange"
|
||||
:uploadParams="uploadParams"
|
||||
:api="uploadApi"
|
||||
class="my-5"
|
||||
:accept="['image/*']"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
|
@ -27,16 +35,25 @@
|
|||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="InfraFile">
|
||||
import { ref } from 'vue'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
import { IconEnum } from '@/enums/appEnum'
|
||||
import { BasicUpload } from '@/components/Upload'
|
||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||
import { deleteFile, getFilePage } from '@/api/infra/file'
|
||||
import { columns, searchFormSchema } from './file.data'
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
import { uploadApi } from '@/api/base/upload'
|
||||
|
||||
const { t } = useI18n()
|
||||
const { createMessage } = useMessage()
|
||||
|
||||
const uploadParams = ref({
|
||||
Authorization: 'Bearer ' + getAccessToken(),
|
||||
'tenant-id': getTenantId()
|
||||
})
|
||||
|
||||
const [registerTable, { reload }] = useTable({
|
||||
title: '文件列表',
|
||||
api: getFilePage,
|
||||
|
@ -53,8 +70,8 @@ const [registerTable, { reload }] = useTable({
|
|||
}
|
||||
})
|
||||
|
||||
function handleAdd() {
|
||||
console.info(1)
|
||||
function handleChange() {
|
||||
reload()
|
||||
}
|
||||
|
||||
async function handleDelete(record: Recordable) {
|
||||
|
|
Loading…
Reference in New Issue