| src/views/salesManagement/opportunityManagement/fileList.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/salesManagement/opportunityManagement/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/views/salesManagement/opportunityManagement/fileList.vue
@@ -17,20 +17,24 @@ <script setup> import { ref, getCurrentInstance } from 'vue' import filePreview from '@/components/filePreview/index.vue' import { ElMessageBox } from 'element-plus' import { delLedgerFile } from "@/api/salesManagement/salesLedger.js"; const emit = defineEmits(['refresh']) const dialogVisible = ref(false) const tableData = ref([]) const currentRowId = ref(null) const { proxy } = getCurrentInstance(); const filePreviewRef = ref() const handleClose = () => { dialogVisible.value = false } const open = (list) => { const open = (list, rowId = null) => { dialogVisible.value = true tableData.value = list currentRowId.value = rowId } const downLoadFile = (row) => { proxy.$download.name(row.url); @@ -40,10 +44,27 @@ filePreviewRef.value.open(row.url) } const delFile = (row) => { ElMessageBox.confirm('确定要删除该附件吗?', '删除确认', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', }).then(() => { let ids = []; ids.push(row.id); delLedgerFile(ids).then((res) => { if (res.code === 200) { proxy.$modal.msgSuccess("删除成功"); // 通知父组件刷新数据 emit('refresh', currentRowId.value); } else { proxy.$modal.msgError(res.msg || "删除失败"); } }).catch((error) => { console.error("删除附件失败:", error); proxy.$modal.msgError("删除失败,请稍后重试"); }); }).catch(() => { // 用户取消删除 }); } defineExpose({ src/views/salesManagement/opportunityManagement/index.vue
@@ -276,7 +276,7 @@ </el-dialog> <!-- 附件列表对话框 --> <FileList ref="fileListRef" /> <FileList ref="fileListRef" @refresh="handleFileListRefresh" /> </div> </template> @@ -349,6 +349,7 @@ // FileList组件引用 const fileListRef = ref(null) const currentAttachmentRow = ref(null) // 上传配置 const upload = reactive({ @@ -802,7 +803,24 @@ // 查看附件 function handleAttachment(row) { fileListRef.value.open(row.businessCommonFiles) currentAttachmentRow.value = row fileListRef.value.open(row.businessCommonFiles, row.id) } // 附件列表刷新 function handleFileListRefresh(rowId) { // 重新获取列表数据 getList() // 等待列表数据更新后,找到对应的行并更新附件列表 setTimeout(() => { if (currentAttachmentRow.value && tableData.value) { const updatedRow = tableData.value.find(item => item.id === currentAttachmentRow.value.id) if (updatedRow && updatedRow.businessCommonFiles) { currentAttachmentRow.value = updatedRow fileListRef.value.open(updatedRow.businessCommonFiles, updatedRow.id) } } }, 300) } onMounted(() => {