From a1ace0cf9a7c0182c266327dc2bec42eadb9aadf Mon Sep 17 00:00:00 2001 From: wuzilong <704541015@qq.com> Date: Mon, 14 Sep 2026 11:32:20 +0800 Subject: [PATCH] feat(miniprogram): show remark-based names on reimburse apply attachments Co-authored-by: Cursor --- miniprogram/pages/bx/reimburse/apply.vue | 14 +++++++++- miniprogram/pages/bx/reimburse/detail.vue | 20 +++++++++++--- miniprogram/styles/bx-theme.scss | 32 +++++++++++++++++++++++ 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/miniprogram/pages/bx/reimburse/apply.vue b/miniprogram/pages/bx/reimburse/apply.vue index 9ce292035..e7bee79fa 100644 --- a/miniprogram/pages/bx/reimburse/apply.vue +++ b/miniprogram/pages/bx/reimburse/apply.vue @@ -167,9 +167,10 @@ {{ uploading ? '上传中…' : '上传图片' }} - + × + {{ attachmentDisplayName(file, idx) }} 暂无附件(可选) @@ -264,6 +265,7 @@ import { formatExpenseName } from '@/utils/bxFormat' import { getSafeAreaStyle } from '@/utils/safeArea' +import { buildApplyAttachmentDisplayName } from '@/utils/bxAttachmentDisplayName' const safeAreaStyle = getSafeAreaStyle() @@ -339,6 +341,14 @@ function money(v) { }) } +function attachmentDisplayName(file, index) { + return buildApplyAttachmentDisplayName({ + remark: form.remark || '', + originalFileName: file.fileName || '', + index1: index + 1 + }) +} + function lineExpenseDisplay(id) { if (id === '' || id == null) return '' const name = formatExpenseName(id, flatList.value) @@ -589,6 +599,7 @@ async function uploadOne(filePath) { id: id || pendingId, previewUrl, localPath: filePath, + fileName: data.fileName || data.file_name || '', _pending: false, _existing: false } @@ -696,6 +707,7 @@ async function loadEditData(id) { mapped.push({ id: String(a.id), previewUrl, + fileName: a.fileName || a.file_name || '', _pending: false, _existing: true }) diff --git a/miniprogram/pages/bx/reimburse/detail.vue b/miniprogram/pages/bx/reimburse/detail.vue index 715ca8aac..851afbb75 100644 --- a/miniprogram/pages/bx/reimburse/detail.vue +++ b/miniprogram/pages/bx/reimburse/detail.vue @@ -137,9 +137,9 @@ 申请附件 文件 + {{ attachmentDisplayName(file, idx) }} 暂无申请附件 @@ -239,6 +240,7 @@ import { } from '@/utils/bxFormat' import { getSafeAreaStyle } from '@/utils/safeArea' import { useUserStore } from '@/stores/user' +import { buildApplyAttachmentDisplayName } from '@/utils/bxAttachmentDisplayName' const safeAreaStyle = getSafeAreaStyle() const userStore = useUserStore() @@ -298,6 +300,14 @@ function previewAtt(file) { uni.previewImage({ urls: [file.previewUrl], current: file.previewUrl }) } +function attachmentDisplayName(file, index) { + return buildApplyAttachmentDisplayName({ + remark: detail.value?.remark || '', + originalFileName: file.fileName || '', + index1: index + 1 + }) +} + async function loadExpenseFlat() { try { const res = await expenseItemApi.tree() @@ -340,7 +350,11 @@ async function loadDetail() { try { const attRes = await attachmentApi.listByBiz('reimburse_apply', id) - const list = (attRes.data || []).map((a) => ({ ...a, previewUrl: '' })) + const list = (attRes.data || []).map((a) => ({ + ...a, + fileName: a.fileName || a.file_name || '', + previewUrl: '' + })) await Promise.all( list .filter((a) => (a.fileType || '').startsWith('image/')) diff --git a/miniprogram/styles/bx-theme.scss b/miniprogram/styles/bx-theme.scss index a43b90396..f66d66c9b 100644 --- a/miniprogram/styles/bx-theme.scss +++ b/miniprogram/styles/bx-theme.scss @@ -594,6 +594,38 @@ height: 100%; } +.bx-page .att-img--with-name { + height: auto; + overflow: visible; + background: transparent; + border: none; +} + +.bx-page .att-img--with-name image, +.bx-page .att-img--with-name > .detail-section-empty { + display: block; + width: 72px; + height: 72px; + border-radius: 8px; + overflow: hidden; + background: var(--bg); + border: 1px solid var(--border); + box-sizing: border-box; +} + +.bx-page .att-img__name { + display: block; + width: 72px; + margin-top: 4px; + font-size: 11px; + line-height: 1.3; + color: var(--text-muted, #64748b); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-align: center; +} + .bx-page .att-img .del { position: absolute; top: 2px;