From a0a4cc7a8d67893c8f8b2b27f9535ccb84590b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Thu, 19 Mar 2026 17:19:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(credit):=20=E6=9B=B4=E6=96=B0=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E7=BC=96=E8=BE=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 替换城市输入框为省市区级联选择组件 - 新增步骤下拉选择框用于流程状态管理 - 集成文件选择组件替代原有文件路径输入框 - 实现文件上传和删除功能 - 添加文件列表管理和同步逻辑 - 优化搜索组件中关键词搜索框位置 - 完善查询参数过滤逻辑支持数组和单一值处理 --- .../SelectFile/components/select-data.vue | 45 ++++++++++++++++--- src/components/SelectFile/index.vue | 38 +++++++++++++++- 2 files changed, 75 insertions(+), 8 deletions(-) diff --git a/src/components/SelectFile/components/select-data.vue b/src/components/SelectFile/components/select-data.vue index 978b38d..ce456f9 100644 --- a/src/components/SelectFile/components/select-data.vue +++ b/src/components/SelectFile/components/select-data.vue @@ -34,9 +34,9 @@ @@ -46,6 +46,19 @@ 上传图片 + + + + 上传文件 + + { const { file } = item; - if (!file.type.startsWith('image') && props.type != 'video') { - message.error('只能选择图片'); - return; - } if (props.type == 'video') { + if (!file.type.startsWith('video')) { + message.error('只能选择视频'); + return; + } if (file.size / 1024 / 1024 > 100) { message.error('大小不能超过 100MB'); return; } + } else if (props.type == 'image') { + if (!file.type.startsWith('image')) { + message.error('只能选择图片'); + return; + } + if (file.size / 1024 / 1024 > 10) { + message.error('大小不能超过 10MB'); + return; + } } else { + // 默认:允许图片/文档等附件 + const isAllowed = + file.type.startsWith('image') || + file.type.startsWith('application') || + file.type.startsWith('text') || + file.type === 'application/octet-stream' || + file.type === ''; + if (!isAllowed) { + message.error('只能选择图片或文件'); + return; + } if (file.size / 1024 / 1024 > 10) { message.error('大小不能超过 10MB'); return; diff --git a/src/components/SelectFile/index.vue b/src/components/SelectFile/index.vue index c0af394..13a6074 100644 --- a/src/components/SelectFile/index.vue +++ b/src/components/SelectFile/index.vue @@ -16,7 +16,16 @@
- + + + {{ item.name || guessNameFromUrl(item.url) }} + @@ -47,7 +56,7 @@ import { PlusOutlined, CloseOutlined, - YoutubeOutlined + FileOutlined } from '@ant-design/icons-vue'; import { ref } from 'vue'; import SelectData from './components/select-data.vue'; @@ -98,6 +107,16 @@ const onDeleteItem = (index: number) => { emit('del', index); }; + + const guessNameFromUrl = (url: string) => { + const cleanUrl = (url?.split('?')[0] ?? '').trim(); + const last = cleanUrl.split('/').pop() || ''; + try { + return decodeURIComponent(last) || url; + } catch { + return last || url; + } + };