feat: 新增文件管理

This commit is contained in:
2024-04-12 22:10:30 +08:00
parent 9c9a29ae05
commit df14bd00dd
22 changed files with 1203 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { updateFile, type FileItem } from '@/apis'
import { ref, h } from 'vue'
import { Modal, Message } from '@arco-design/web-vue'
import ModalContent from './ModalContent.vue'
export function openFileRenameModal(data: FileItem) {
const ModalContentRef = ref<InstanceType<typeof ModalContent>>()
return Modal.open({
title: '重命名',
modalAnimationName: 'el-fade',
modalStyle: { maxWidth: '450px' },
width: '90%',
content: () =>
h(ModalContent, {
ref: (e) => {
ModalContentRef.value = e as any
}
}),
onBeforeOk: async () => {
const isInvalid = await ModalContentRef.value?.formRef?.validate()
if (isInvalid) return false
await updateFile({ name: data.name }, data.id)
Message.success('重命名成功')
return true
}
})
}