mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-09 18:59:26 +08:00
修复文件管理数量刷新问题
This commit is contained in:
@@ -26,6 +26,7 @@ import { FileTypeList } from '@/constant/file'
|
|||||||
import { useChart } from '@/hooks'
|
import { useChart } from '@/hooks'
|
||||||
import { type FileStatisticsResp, getFileStatistics } from '@/apis/system'
|
import { type FileStatisticsResp, getFileStatistics } from '@/apis/system'
|
||||||
import { formatFileSize } from '@/utils'
|
import { formatFileSize } from '@/utils'
|
||||||
|
import mittBus from '@/utils/mitt'
|
||||||
|
|
||||||
use([TitleComponent, TooltipComponent, LegendComponent, PieChart, CanvasRenderer])
|
use([TitleComponent, TooltipComponent, LegendComponent, PieChart, CanvasRenderer])
|
||||||
|
|
||||||
@@ -106,6 +107,9 @@ const getStatisticsData = async () => {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getStatisticsData()
|
getStatisticsData()
|
||||||
|
mittBus.on('file-total-refresh', () => {
|
||||||
|
getStatisticsData()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -103,7 +103,7 @@ import { type FileItem, type FileQuery, deleteFile, listFile, uploadFile } from
|
|||||||
import { ImageTypes, OfficeTypes } from '@/constant/file'
|
import { ImageTypes, OfficeTypes } from '@/constant/file'
|
||||||
import 'viewerjs/dist/viewer.css'
|
import 'viewerjs/dist/viewer.css'
|
||||||
import { downloadByUrl } from '@/utils/downloadFile'
|
import { downloadByUrl } from '@/utils/downloadFile'
|
||||||
|
import mittBus from '@/utils/mitt'
|
||||||
import type { ExcelConfig } from '@/components/FilePreview/type'
|
import type { ExcelConfig } from '@/components/FilePreview/type'
|
||||||
|
|
||||||
const FilePreview = defineAsyncComponent(() => import('@/components/FilePreview/index.vue'))
|
const FilePreview = defineAsyncComponent(() => import('@/components/FilePreview/index.vue'))
|
||||||
@@ -195,6 +195,7 @@ const handleRightMenuClick = async (mode: string, fileInfo: FileItem) => {
|
|||||||
await deleteFile(fileInfo.id)
|
await deleteFile(fileInfo.id)
|
||||||
Message.success('删除成功')
|
Message.success('删除成功')
|
||||||
search()
|
search()
|
||||||
|
mittBus.emit('file-total-refresh')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else if (mode === 'rename') {
|
} else if (mode === 'rename') {
|
||||||
@@ -221,6 +222,7 @@ const handleMulDelete = () => {
|
|||||||
await deleteFile(selectedFileIds.value)
|
await deleteFile(selectedFileIds.value)
|
||||||
Message.success('删除成功')
|
Message.success('删除成功')
|
||||||
search()
|
search()
|
||||||
|
mittBus.emit('file-total-refresh')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -240,6 +242,8 @@ const handleUpload = (options: RequestOption) => {
|
|||||||
search()
|
search()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
onError(error)
|
onError(error)
|
||||||
|
} finally {
|
||||||
|
mittBus.emit('file-total-refresh')
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
return {
|
return {
|
||||||
|
Reference in New Issue
Block a user