From 14363b1ae7cb0d730158ec8dfbee55a85b2fc09f Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 12 五月 2026 15:23:17 +0800
Subject: [PATCH] feat(financial): 实现财务模块数据接口联调
---
src/components/Dialog/FileList.vue | 73 +++++++++++++++++++++---------------
1 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/src/components/Dialog/FileList.vue b/src/components/Dialog/FileList.vue
index 136ff8b..139dbfb 100644
--- a/src/components/Dialog/FileList.vue
+++ b/src/components/Dialog/FileList.vue
@@ -5,7 +5,8 @@
@close="handleClose"
class="attachment-dialog">
<!-- 宸ュ叿鏍� -->
- <div class="toolbar">
+ <div v-if="editable"
+ class="toolbar">
<el-button type="primary"
size="small"
@click="handleUpload">
@@ -16,10 +17,11 @@
<el-dialog v-model="uploadDialogVisible"
title="涓婁紶闄勪欢"
width="50%"
- @close="handleUploadClose">
+ @close="closeUpload">
<AttachmentUpload v-model:file-list="newFileList" />
<template #footer>
- <el-button @click="handleUploadClose">鍏抽棴</el-button>
+ <el-button @click="saveUpload">淇濆瓨</el-button>
+ <el-button @click="closeUpload">鍏抽棴</el-button>
</template>
</el-dialog>
<!-- 鏂囦欢鍒楄〃琛ㄦ牸 -->
@@ -40,11 +42,12 @@
<el-button link
type="primary"
size="small"
- :href="scope.row.downloadURL"
- class="download-link">
+ class="download-link"
+ @click="downloadFile(scope.row.downloadURL)">
涓嬭浇
</el-button>
- <el-button link
+ <el-button v-if="editable"
+ link
type="danger"
size="small"
@click="handleDelete(scope.row)">
@@ -93,6 +96,10 @@
type: Boolean,
default: true,
},
+ editable: {
+ type: Boolean,
+ default: true,
+ },
});
const emit = defineEmits(["close", "download", "upload", "delete"]);
@@ -119,34 +126,39 @@
uploadDialogVisible.value = true;
};
- const handleUploadClose = async () => {
+ 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;
+ })
}
+ }
+
+ const closeUpload = () => {
+ newFileList.value = [];
uploadDialogVisible.value = false;
};
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 = () => {
@@ -154,12 +166,13 @@
recordType: props.recordType,
recordId: props.recordId,
}).then(res => {
- if (res && res.data) {
- tableData.value = res.data || [];
- }
+ tableData.value = (res && res.data) || [];
});
};
+ const downloadFile = url => {
+ window.open(url, "_blank");
+ };
onMounted(() => {
setList();
});
--
Gitblit v1.9.3