fix: check fileName2long? & close after submit

This commit is contained in:
puri-ph4tt 2023-11-30 16:47:29 +07:00
parent bb59390063
commit 0511d4285f
4 changed files with 36 additions and 13 deletions

View file

@ -96,7 +96,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
currentPath.value = pathname
const res = await axiosClient.get<EhrFolder[]>(
`${apiEndpoint}${requestPath}`
`${apiEndpoint}${requestPath}`,
)
const list = res.data.map((v) => ({
@ -248,7 +248,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
description: string
keyword: string
category: string
}
},
) {
loader.show()
@ -268,7 +268,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
{
file: file.name,
...metadata,
}
},
)
if (res && res.data.upload) {
@ -297,7 +297,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
keyword: string
category: string
},
file?: File
file?: File,
) {
loader.show()
@ -312,7 +312,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
const res = await axiosClient.patch<{ upload: string }>(
`${apiEndpoint}${requestPath}`,
{ file: file?.name, ...metadata }
{ file: file?.name, ...metadata },
)
if (res && res.data.upload) {
@ -362,6 +362,10 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
return currentFile.value.some((element) => element.fileName === fileName)
}
function checkFileName(fileName: string) {
return fileName.length >= 85
}
return {
data,
currentFolder,
@ -380,5 +384,6 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
deleteFolder,
editFolder,
checkFile,
checkFileName,
}
})