From 17d39a0208dca5b976e53065816a9c0fb57e36b7 Mon Sep 17 00:00:00 2001 From: wkc <978997012@qq.com> Date: Tue, 10 Mar 2026 11:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=B5=81=E6=B0=B4=E5=BC=B9=E7=AA=97=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/detail/UploadData.vue | 1 + .../unit/upload-data-batch-upload.test.js | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 ruoyi-ui/tests/unit/upload-data-batch-upload.test.js diff --git a/ruoyi-ui/src/views/ccdiProject/components/detail/UploadData.vue b/ruoyi-ui/src/views/ccdiProject/components/detail/UploadData.vue index 7a23272..2e3dc5e 100644 --- a/ruoyi-ui/src/views/ccdiProject/components/detail/UploadData.vue +++ b/ruoyi-ui/src/views/ccdiProject/components/detail/UploadData.vue @@ -245,6 +245,7 @@ multiple :auto-upload="false" :on-change="handleBatchFileChange" + :show-file-list="false" :file-list="selectedFiles" > diff --git a/ruoyi-ui/tests/unit/upload-data-batch-upload.test.js b/ruoyi-ui/tests/unit/upload-data-batch-upload.test.js new file mode 100644 index 0000000..911d314 --- /dev/null +++ b/ruoyi-ui/tests/unit/upload-data-batch-upload.test.js @@ -0,0 +1,31 @@ +const assert = require("assert"); +const fs = require("fs"); +const path = require("path"); + +const componentPath = path.resolve( + __dirname, + "../../src/views/ccdiProject/components/detail/UploadData.vue" +); +const source = fs.readFileSync(componentPath, "utf8"); + +const dialogIndex = source.indexOf(':visible.sync="batchUploadDialogVisible"'); +assert.notStrictEqual(dialogIndex, -1, "未找到批量上传流水文件弹窗"); + +const dialogEndIndex = source.indexOf("", dialogIndex); +assert.notStrictEqual(dialogEndIndex, -1, "未找到批量上传流水文件弹窗结束标签"); + +const dialogSource = source.slice(dialogIndex, dialogEndIndex); +const uploadMatch = dialogSource.match(//); +assert(uploadMatch, "未找到批量上传区域的 el-upload 组件"); + +assert( + /(:show-file-list|show-file-list)\s*=\s*"false"/.test(uploadMatch[1]), + "批量上传区域必须关闭 el-upload 默认文件列表,避免与自定义文件列表重复显示" +); + +assert( + /class="selected-files"/.test(dialogSource), + "批量上传弹窗应保留自定义已选文件列表" +); + +console.log("upload-data-batch-upload test passed");