From 350d00bbcba851589f7c611c470165f82cda4c14 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 12 五月 2026 11:02:23 +0800
Subject: [PATCH] 修改文件上传
---
src/components/Dialog/FileList.vue | 48 +++++++++++++++++++++++-------------------------
1 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/src/components/Dialog/FileList.vue b/src/components/Dialog/FileList.vue
index 6e0ca23..139dbfb 100644
--- a/src/components/Dialog/FileList.vue
+++ b/src/components/Dialog/FileList.vue
@@ -129,22 +129,23 @@
const saveUpload = async () => {
// 妫�鏌ユ槸鍚︽湁鏂颁笂浼犵殑鏂囦欢
if (newFileList.value.length > 0) {
- try {
- await createAttachment({
- application: "file",
- recordType: props.recordType,
- recordId: props.recordId,
- storageBlobDTOs: [...newFileList.value, ...tableData.value],
- });
- newFileList.value = [];
- // 鍒锋柊鍒楄〃
- setList();
- } catch (error) {
- proxy?.$modal?.msgError("涓婁紶澶辫触");
- }
+ createAttachment({
+ application: "file",
+ recordType: props.recordType,
+ recordId: props.recordId,
+ storageBlobDTOs: [...newFileList.value, ...tableData.value],
+ }).then((res) => {
+ if (res && res.code === 200) {
+ proxy?.$modal?.msgSuccess("涓婁紶鎴愬姛");
+ newFileList.value = [];
+ // 鍒锋柊鍒楄〃
+ setList();
+ }
+ }).finally(() => {
+ uploadDialogVisible.value = false;
+ })
}
- uploadDialogVisible.value = false;
- };
+ }
const closeUpload = () => {
newFileList.value = [];
@@ -152,13 +153,12 @@
};
const handleDelete = async (row, index) => {
- try {
- await deleteAttachment([row.storageAttachmentId]);
- proxy?.$modal?.msgSuccess("鍒犻櫎鎴愬姛");
- setList();
- } catch (error) {
- proxy?.$modal?.msgError("鍒犻櫎澶辫触");
- }
+ deleteAttachment([row.storageAttachmentId]).then((res) => {
+ if (res && res.code === 200) {
+ proxy?.$modal?.msgSuccess("鍒犻櫎鎴愬姛");
+ setList();
+ }
+ })
};
const setList = () => {
@@ -166,9 +166,7 @@
recordType: props.recordType,
recordId: props.recordId,
}).then(res => {
- if (res && res.data) {
- tableData.value = res.data || [];
- }
+ tableData.value = (res && res.data) || [];
});
};
--
Gitblit v1.9.3