refactor: update notification from 99136ef7
This commit is contained in:
parent
8badbc4a22
commit
e08850b90e
1 changed files with 18 additions and 13 deletions
|
|
@ -9,9 +9,8 @@ import FileForm from './FileForm.vue'
|
|||
import FolderForm from './FolderForm.vue'
|
||||
|
||||
const { getFormatDate, getSize, getType, getFileInfo } = useFileInfoStore()
|
||||
const { listDataFile, listDataFolder, currentDept, currentPath } = storeToRefs(
|
||||
useTreeDataStore()
|
||||
)
|
||||
const { listDataFile, listDataFolder, currentDept, currentPath } =
|
||||
storeToRefs(useTreeDataStore())
|
||||
const {
|
||||
createFolder,
|
||||
editFolder,
|
||||
|
|
@ -20,6 +19,7 @@ const {
|
|||
uploadFile,
|
||||
updateFile,
|
||||
deleteFile,
|
||||
checkFile,
|
||||
} = useTreeDataStore()
|
||||
|
||||
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
||||
|
|
@ -32,18 +32,18 @@ const currentLevel = computed(() =>
|
|||
currentDept.value === 0
|
||||
? 'ตู้จัดเก็บเอกสาร'
|
||||
: currentDept.value === 1
|
||||
? 'ลิ้นชัก'
|
||||
: currentDept.value === 2
|
||||
? 'แฟ้ม'
|
||||
: 'แฟ้มย่อย'
|
||||
? 'ลิ้นชัก'
|
||||
: currentDept.value === 2
|
||||
? 'แฟ้ม'
|
||||
: 'แฟ้มย่อย',
|
||||
)
|
||||
|
||||
const currentIcon = computed(() =>
|
||||
currentDept.value === 0
|
||||
? 'mdi-file-cabinet'
|
||||
: currentDept.value === 1
|
||||
? 'inbox'
|
||||
: 'o_folder_open'
|
||||
? 'inbox'
|
||||
: 'o_folder_open',
|
||||
)
|
||||
|
||||
const folderFormState = ref<boolean>(false)
|
||||
|
|
@ -52,6 +52,7 @@ const folderFormData = ref<{
|
|||
name?: string
|
||||
}>({})
|
||||
const folderFormType = ref<'edit' | 'create'>('create')
|
||||
const fileFormError = ref<{ fileExist?: boolean }>({})
|
||||
const fileFormState = ref<boolean>(false)
|
||||
const fileFormPath = ref<string>('')
|
||||
const fileFormData = ref<{
|
||||
|
|
@ -100,7 +101,7 @@ function triggerFileEdit(
|
|||
keyword: string
|
||||
category: string
|
||||
},
|
||||
pathname: string
|
||||
pathname: string,
|
||||
) {
|
||||
fileFormState.value = true
|
||||
fileFormType.value = 'edit'
|
||||
|
|
@ -137,7 +138,7 @@ async function submitFileForm(value: {
|
|||
keyword: value.keyword,
|
||||
category: value.category,
|
||||
},
|
||||
value.file
|
||||
value.file,
|
||||
)
|
||||
}
|
||||
fileFormData.value = {}
|
||||
|
|
@ -294,7 +295,7 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
@click.stop="
|
||||
triggerFolderEdit(
|
||||
actionsRow.row.name,
|
||||
actionsRow.row.pathname
|
||||
actionsRow.row.pathname,
|
||||
)
|
||||
"
|
||||
/>
|
||||
|
|
@ -348,7 +349,9 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
style="width: 50%"
|
||||
@click="
|
||||
() => {
|
||||
currentDept >= 3 ? getFileInfo(nameRow.row) : getFolder(nameRow.row.pathname);
|
||||
currentDept >= 3
|
||||
? getFileInfo(nameRow.row)
|
||||
: getFolder(nameRow.row.pathname)
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
@ -403,11 +406,13 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
|||
|
||||
<file-form
|
||||
:mode="fileFormType"
|
||||
:error="fileFormError"
|
||||
v-model:open="fileFormState"
|
||||
v-model:title="fileFormData.title"
|
||||
v-model:description="fileFormData.description"
|
||||
v-model:keyword="fileFormData.keyword"
|
||||
v-model:category="fileFormData.category"
|
||||
@filechange="(name: string) => (fileFormError.fileExist = checkFile(name))"
|
||||
@submit="submitFileForm"
|
||||
/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue