From c85984f7e4fdc9ad982de4bae7c4d2f27c0d7fd1 Mon Sep 17 00:00:00 2001 From: bot_dev1 Date: Thu, 6 Aug 2026 16:08:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(#187):=20=E4=BF=AE=E5=A4=8D=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E9=85=8D=E7=BD=AE=E5=8F=B0=E4=B8=A4=E5=A4=84=E4=BA=A4?= =?UTF-8?q?=E4=BA=92=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. studio/import.vue CSV 上传失效:onFile 原按 DOM Event 取 e.target.files, 但 a-upload 的 @change 载荷是 UploadChangeParam { file, fileList }, :before-upload="() => false" 时文件在 file.originFileObj 上,导致必抛 TypeError 无响应。改为从 info.file.originFileObj 取文件对象。 2. studio/layout.vue 第 45 行「发布布局」按钮无 @click 处理(死按钮): 新增 publishLayout,将布局 JSON 暂存 localStorage (iaop.studio.layout.v1),与 version.vue 版本发布联动; version.vue 发布时读取并打包该布局。 layoutJson 改为 computed,模板同步更新。 验收:本环境无 pnpm/node_modules,构建验证转 bot_qa 构建环境; 上传符合表头 CSV 应出现校验/预览,缺表头 CSV 应报错; 点「发布布局」应提示成功并记录发布时间。 --- .../src/views/iaop/studio/import.vue | 16 +++++++---- .../src/views/iaop/studio/layout.vue | 28 ++++++++++++++++--- .../src/views/iaop/studio/version.vue | 7 +++-- 3 files changed, 40 insertions(+), 11 deletions(-) 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 @@