diff --git a/App.jsx b/App.jsx
index 5ddaf05..8a9c1b0 100644
--- a/App.jsx
+++ b/App.jsx
@@ -3039,14 +3039,19 @@ function MainApp({ username, onLogout }) {
const files = e.dataTransfer.files && Array.from(e.dataTransfer.files);
if (files && files.length) setAttachmentFiles(files);
}
+ // 上传进度文字:按钮上显示"上传中 2/3 · 45%(8.6 / 19.0 MB)"
+ function uploadLabel(i, n, loaded, total) {
+ const mb = (x) => (x / 1048576).toFixed(1);
+ return `上传中${n > 1 ? ` ${i + 1}/${n}` : ''} · ${Math.floor(loaded / total * 100)}%(${mb(loaded)} / ${mb(total)} MB)`;
+ }
async function handleUploadAttachment(customerId, folderId) {
if (!attachmentFiles.length) { notify('请先选择文件'); return; }
setUploading(true);
const failed = [];
try {
- for (const file of attachmentFiles) {
+ for (const [i, file] of attachmentFiles.entries()) {
try {
- const res = await uploadFile(customerId, file);
+ const res = await uploadFile(customerId, file, (l, t) => setUploading(uploadLabel(i, attachmentFiles.length, l, t)));
const entry = {
fileName: res.fileName,
originalName: res.originalName,
@@ -3194,9 +3199,9 @@ function MainApp({ username, onLogout }) {
setSupplierUploading(true);
const failed = [];
try {
- for (const file of supplierAttachmentFiles) {
+ for (const [i, file] of supplierAttachmentFiles.entries()) {
try {
- const res = await uploadFile(supplierId, file);
+ const res = await uploadFile(supplierId, file, (l, t) => setSupplierUploading(uploadLabel(i, supplierAttachmentFiles.length, l, t)));
const entry = { fileName: res.fileName, originalName: res.originalName, note: supplierAttachmentNote.trim(), date: todayStr() };
setSuppliers(prev => prev.map(s => (s.id === supplierId ? { ...s, attachments: [entry, ...(s.attachments || [])] } : s)));
} catch (e) {
@@ -5771,7 +5776,7 @@ function SupplierDetail({
value={attachmentNote} onChange={e => setAttachmentNote(e.target.value)}
/>
@@ -6129,7 +6134,7 @@ function CustomerDetail({
value={attachmentNote} onChange={e => setAttachmentNote(e.target.value)}
/>