diff --git a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/import.vue b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/import.vue index 91c8c71..e30c327 100644 --- a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/import.vue +++ b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/import.vue @@ -4,6 +4,7 @@ import { ref } from 'vue'; import { Page, VbenButton } from '@vben/common-ui'; import { BxsFile } from '@vben/icons'; +import type { UploadChangeParam } from 'antdv-next'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; @@ -33,14 +34,19 @@ const gridOptions: VxeTableGridOptions> = { const [Grid, gridApi] = useVbenVxeGrid({ gridOptions }); -function onFile(e: Event) { - const el = e.target as HTMLInputElement; - const file = el.files?.[0]; - if (!file) return; +function onFile(info: UploadChangeParam) { + // a-upload 的 @change 载荷是 UploadChangeParam { file, fileList }, + // 在 :before-upload="() => false"(禁止自动上传)时文件对象在 file.originFileObj 上, + // 不是 DOM Event,不能用 e.target.files(会抛 TypeError 导致无响应)。 + const { file } = info; + // 仅在选中文件后处理一次(removed 状态时跳过,避免清空预览) + if (file.status === 'removed') return; + const raw = file.originFileObj ?? file; + if (!raw) return; fileName.value = file.name; const reader = new FileReader(); reader.onload = () => parseCsv(String(reader.result || '')); - reader.readAsText(file); + reader.readAsText(raw as Blob); } function parseCsv(text: string) { diff --git a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/layout.vue b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/layout.vue index e29f16d..dcf6976 100644 --- a/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/layout.vue +++ b/deploy/fba/fba-ui-src/apps/web-antdv-next/src/views/iaop/studio/layout.vue @@ -1,8 +1,9 @@