Skip to content

Commit de44df6

Browse files
committed
修复文件管理数量刷新问题
1 parent 0289b6b commit de44df6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/views/system/file/main/FileAsideStatistics.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { FileTypeList } from '@/constant/file'
2626
import { useChart } from '@/hooks'
2727
import { type FileStatisticsResp, getFileStatistics } from '@/apis/system'
2828
import { formatFileSize } from '@/utils'
29+
import mittBus from '@/utils/mitt'
2930
3031
use([TitleComponent, TooltipComponent, LegendComponent, PieChart, CanvasRenderer])
3132
@@ -106,6 +107,9 @@ const getStatisticsData = async () => {
106107
107108
onMounted(() => {
108109
getStatisticsData()
110+
mittBus.on('file-total-refresh', () => {
111+
getStatisticsData()
112+
})
109113
})
110114
</script>
111115

src/views/system/file/main/FileMain/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ import { type FileItem, type FileQuery, deleteFile, listFile, uploadFile } from
103103
import { ImageTypes, OfficeTypes } from '@/constant/file'
104104
import 'viewerjs/dist/viewer.css'
105105
import { downloadByUrl } from '@/utils/downloadFile'
106-
106+
import mittBus from '@/utils/mitt'
107107
import type { ExcelConfig } from '@/components/FilePreview/type'
108108
109109
const FilePreview = defineAsyncComponent(() => import('@/components/FilePreview/index.vue'))
@@ -195,6 +195,7 @@ const handleRightMenuClick = async (mode: string, fileInfo: FileItem) => {
195195
await deleteFile(fileInfo.id)
196196
Message.success('删除成功')
197197
search()
198+
mittBus.emit('file-total-refresh')
198199
},
199200
})
200201
} else if (mode === 'rename') {
@@ -221,6 +222,7 @@ const handleMulDelete = () => {
221222
await deleteFile(selectedFileIds.value)
222223
Message.success('删除成功')
223224
search()
225+
mittBus.emit('file-total-refresh')
224226
},
225227
})
226228
}
@@ -240,6 +242,8 @@ const handleUpload = (options: RequestOption) => {
240242
search()
241243
} catch (error) {
242244
onError(error)
245+
} finally {
246+
mittBus.emit('file-total-refresh')
243247
}
244248
})()
245249
return {

0 commit comments

Comments
 (0)