fix: deleteFile
This commit is contained in:
parent
b600fcf940
commit
7be84e9953
2 changed files with 11 additions and 7 deletions
|
|
@ -394,7 +394,7 @@ async function submitFileForm(
|
||||||
@confirm="
|
@confirm="
|
||||||
() =>
|
() =>
|
||||||
deleteFormType &&
|
deleteFormType &&
|
||||||
(deleteFolder(deleteFormPath), deleteFile(deleteFormPath))
|
{ deleteFolder, deleteFile }[deleteFormType](deleteFormPath)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ export interface TreeDataFolder {
|
||||||
|
|
||||||
export const useTreeDataStore = defineStore('changeCabinet', () => {
|
export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
const loader = useLoader()
|
const loader = useLoader()
|
||||||
|
const indexToRemove = ref<number>()
|
||||||
|
const fileNameRemove = ref<string>('')
|
||||||
|
|
||||||
const data = ref<TreeDataFolder[]>([])
|
const data = ref<TreeDataFolder[]>([])
|
||||||
const currentFolder = ref<TreeDataFolder[]>([])
|
const currentFolder = ref<TreeDataFolder[]>([])
|
||||||
|
|
@ -94,7 +96,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
currentPath.value = pathname
|
currentPath.value = pathname
|
||||||
|
|
||||||
const res = await axiosClient.get<EhrFolder[]>(
|
const res = await axiosClient.get<EhrFolder[]>(
|
||||||
`${apiEndpoint}${requestPath}`,
|
`${apiEndpoint}${requestPath}`
|
||||||
)
|
)
|
||||||
|
|
||||||
const list = res.data.map((v) => ({
|
const list = res.data.map((v) => ({
|
||||||
|
|
@ -154,6 +156,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
const res = await axiosClient.get<EhrFile[]>(`${apiEndpoint}${requestPath}`)
|
const res = await axiosClient.get<EhrFile[]>(`${apiEndpoint}${requestPath}`)
|
||||||
|
|
||||||
currentFile.value = res.data
|
currentFile.value = res.data
|
||||||
|
|
||||||
listDataFile.value = currentFile.value
|
listDataFile.value = currentFile.value
|
||||||
|
|
||||||
return loader.hide()
|
return loader.hide()
|
||||||
|
|
@ -245,7 +248,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
description: string
|
description: string
|
||||||
keyword: string
|
keyword: string
|
||||||
category: string
|
category: string
|
||||||
},
|
}
|
||||||
) {
|
) {
|
||||||
loader.show()
|
loader.show()
|
||||||
|
|
||||||
|
|
@ -265,7 +268,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
{
|
{
|
||||||
file: file.name,
|
file: file.name,
|
||||||
...metadata,
|
...metadata,
|
||||||
},
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (res && res.data.upload) {
|
if (res && res.data.upload) {
|
||||||
|
|
@ -294,7 +297,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
keyword: string
|
keyword: string
|
||||||
category: string
|
category: string
|
||||||
},
|
},
|
||||||
file?: File,
|
file?: File
|
||||||
) {
|
) {
|
||||||
loader.show()
|
loader.show()
|
||||||
|
|
||||||
|
|
@ -309,7 +312,7 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
|
|
||||||
const res = await axiosClient.patch<{ upload: string }>(
|
const res = await axiosClient.patch<{ upload: string }>(
|
||||||
`${apiEndpoint}${requestPath}`,
|
`${apiEndpoint}${requestPath}`,
|
||||||
{ file: file?.name, ...metadata },
|
{ file: file?.name, ...metadata }
|
||||||
)
|
)
|
||||||
|
|
||||||
if (res && res.data.upload) {
|
if (res && res.data.upload) {
|
||||||
|
|
@ -342,7 +345,6 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
if (pathArray.length >= 5) requestPath += `/subfolder/${pathArray[3]}`
|
if (pathArray.length >= 5) requestPath += `/subfolder/${pathArray[3]}`
|
||||||
requestPath += `/file/${pathArray.at(-1)}`
|
requestPath += `/file/${pathArray.at(-1)}`
|
||||||
|
|
||||||
console.log(requestPath, pathArray)
|
|
||||||
await axiosClient.delete(`${apiEndpoint}${requestPath}`)
|
await axiosClient.delete(`${apiEndpoint}${requestPath}`)
|
||||||
|
|
||||||
if (currentDept.value === 0) {
|
if (currentDept.value === 0) {
|
||||||
|
|
@ -351,6 +353,8 @@ export const useTreeDataStore = defineStore('changeCabinet', () => {
|
||||||
|
|
||||||
await getFile(currentPath.value)
|
await getFile(currentPath.value)
|
||||||
|
|
||||||
|
currentFile.value = currentFile.value.filter((v) => v.pathname !== pathname)
|
||||||
|
|
||||||
return loader.hide()
|
return loader.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue