refactor: refaceFile
This commit is contained in:
parent
774b8fb2fd
commit
963c08160e
2 changed files with 39 additions and 9 deletions
|
|
@ -363,6 +363,26 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
|||
return fileName.length >= 85
|
||||
}
|
||||
|
||||
async function refaceFile(pathname: string) {
|
||||
const pathArray: string[] = pathname.split('/').filter(Boolean)
|
||||
|
||||
if (pathArray.length <= 2) {
|
||||
currentFile.value = []
|
||||
return loader.hide()
|
||||
}
|
||||
|
||||
let requestPath = `cabinet/${pathArray[0]}/drawer/${pathArray[1]}`
|
||||
if (pathArray.length >= 3) requestPath += `/folder/${pathArray[2]}`
|
||||
if (pathArray.length >= 4) requestPath += `/subfolder/${pathArray[3]}`
|
||||
requestPath += '/file'
|
||||
|
||||
const res = await axiosClient.get<EhrFile[]>(`${apiEndpoint}${requestPath}`)
|
||||
|
||||
currentFile.value = res.data
|
||||
|
||||
listDataFile.value = currentFile.value
|
||||
}
|
||||
|
||||
return {
|
||||
data,
|
||||
currentFolder,
|
||||
|
|
@ -382,5 +402,6 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
|||
editFolder,
|
||||
checkFile,
|
||||
checkFileName,
|
||||
refaceFile,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue