fix: drawer opened when enter another level

This commit is contained in:
oat 2023-12-01 15:30:43 +07:00
parent bf26cdfb41
commit 0b9b1db8f4

View file

@ -15,13 +15,12 @@ const props = withDefaults(
defineProps<{ action: boolean; viewMode: 'view_list' | 'view_module' }>(), defineProps<{ action: boolean; viewMode: 'view_list' | 'view_module' }>(),
{ {
action: false, action: false,
} },
) )
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
const { getFileInfo, getFileNameFormat } = useFileInfoStore() const { getFileInfo, getFileNameFormat } = useFileInfoStore()
const { currentFolder, currentFile, currentDept, currentPath } = storeToRefs( const { currentFolder, currentFile, currentDept, currentPath } =
useTreeDataStore() storeToRefs(useTreeDataStore())
)
const { const {
createFolder, createFolder,
editFolder, editFolder,
@ -37,8 +36,8 @@ const currentIcon = computed(() =>
currentDept.value === 0 currentDept.value === 0
? 'mdi-file-cabinet' ? 'mdi-file-cabinet'
: currentDept.value === 1 : currentDept.value === 1
? 'inbox' ? 'inbox'
: 'o_folder_open' : 'o_folder_open',
) )
const dialogDeleteState = ref<boolean>(false) const dialogDeleteState = ref<boolean>(false)
@ -113,7 +112,7 @@ function triggerFileEdit(
keyword: string[] keyword: string[]
category: string[] category: string[]
}, },
pathname: string pathname: string,
) { ) {
fileFormState.value = true fileFormState.value = true
fileFormType.value = 'edit' fileFormType.value = 'edit'
@ -137,7 +136,7 @@ async function submitFileForm(
keyword: string[] keyword: string[]
category: string[] category: string[]
}, },
force = false force = false,
) { ) {
currentParam.value = value currentParam.value = value
@ -162,7 +161,7 @@ async function submitFileForm(
keyword: value.keyword, keyword: value.keyword,
category: value.category, category: value.category,
}, },
value.file value.file,
) )
} }
fileFormData.value = {} fileFormData.value = {}
@ -187,7 +186,11 @@ async function submitFileForm(
padding: currentDept > 2 ? '.5rem 0' : '.5rem', padding: currentDept > 2 ? '.5rem 0' : '.5rem',
}" }"
class="box" class="box"
@click="() => getFolder(value.pathname)" @click="
() => {
;(folderFormState = false), getFolder(value.pathname)
}
"
> >
<div class="q-px-md flex items-center justify-center"> <div class="q-px-md flex items-center justify-center">
<q-icon <q-icon
@ -310,7 +313,7 @@ async function submitFileForm(
keyword: value.keyword, keyword: value.keyword,
category: value.category, category: value.category,
}, },
value.pathname value.pathname,
) )
" "
@delete="() => triggerFileDelete(value.pathname)" @delete="() => triggerFileDelete(value.pathname)"
@ -421,7 +424,7 @@ async function submitFileForm(
.add-button { .add-button {
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 40%; right: 30%;
background-color: white; background-color: white;
} }