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'
|
import FolderForm from './FolderForm.vue'
|
||||||
|
|
||||||
const { getFormatDate, getSize, getType, getFileInfo } = useFileInfoStore()
|
const { getFormatDate, getSize, getType, getFileInfo } = useFileInfoStore()
|
||||||
const { listDataFile, listDataFolder, currentDept, currentPath } = storeToRefs(
|
const { listDataFile, listDataFolder, currentDept, currentPath } =
|
||||||
useTreeDataStore()
|
storeToRefs(useTreeDataStore())
|
||||||
)
|
|
||||||
const {
|
const {
|
||||||
createFolder,
|
createFolder,
|
||||||
editFolder,
|
editFolder,
|
||||||
|
|
@ -20,6 +19,7 @@ const {
|
||||||
uploadFile,
|
uploadFile,
|
||||||
updateFile,
|
updateFile,
|
||||||
deleteFile,
|
deleteFile,
|
||||||
|
checkFile,
|
||||||
} = useTreeDataStore()
|
} = useTreeDataStore()
|
||||||
|
|
||||||
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย'] as const
|
||||||
|
|
@ -32,18 +32,18 @@ const currentLevel = computed(() =>
|
||||||
currentDept.value === 0
|
currentDept.value === 0
|
||||||
? 'ตู้จัดเก็บเอกสาร'
|
? 'ตู้จัดเก็บเอกสาร'
|
||||||
: currentDept.value === 1
|
: currentDept.value === 1
|
||||||
? 'ลิ้นชัก'
|
? 'ลิ้นชัก'
|
||||||
: currentDept.value === 2
|
: currentDept.value === 2
|
||||||
? 'แฟ้ม'
|
? 'แฟ้ม'
|
||||||
: 'แฟ้มย่อย'
|
: 'แฟ้มย่อย',
|
||||||
)
|
)
|
||||||
|
|
||||||
const currentIcon = computed(() =>
|
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 folderFormState = ref<boolean>(false)
|
const folderFormState = ref<boolean>(false)
|
||||||
|
|
@ -52,6 +52,7 @@ const folderFormData = ref<{
|
||||||
name?: string
|
name?: string
|
||||||
}>({})
|
}>({})
|
||||||
const folderFormType = ref<'edit' | 'create'>('create')
|
const folderFormType = ref<'edit' | 'create'>('create')
|
||||||
|
const fileFormError = ref<{ fileExist?: boolean }>({})
|
||||||
const fileFormState = ref<boolean>(false)
|
const fileFormState = ref<boolean>(false)
|
||||||
const fileFormPath = ref<string>('')
|
const fileFormPath = ref<string>('')
|
||||||
const fileFormData = ref<{
|
const fileFormData = ref<{
|
||||||
|
|
@ -100,7 +101,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 +138,7 @@ async function submitFileForm(value: {
|
||||||
keyword: value.keyword,
|
keyword: value.keyword,
|
||||||
category: value.category,
|
category: value.category,
|
||||||
},
|
},
|
||||||
value.file
|
value.file,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
fileFormData.value = {}
|
fileFormData.value = {}
|
||||||
|
|
@ -294,7 +295,7 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
||||||
@click.stop="
|
@click.stop="
|
||||||
triggerFolderEdit(
|
triggerFolderEdit(
|
||||||
actionsRow.row.name,
|
actionsRow.row.name,
|
||||||
actionsRow.row.pathname
|
actionsRow.row.pathname,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
@ -348,7 +349,9 @@ const onRowClick = (evt: Event, row: TreeDataFolder, index: number) => {
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
@click="
|
@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
|
<file-form
|
||||||
:mode="fileFormType"
|
:mode="fileFormType"
|
||||||
|
:error="fileFormError"
|
||||||
v-model:open="fileFormState"
|
v-model:open="fileFormState"
|
||||||
v-model:title="fileFormData.title"
|
v-model:title="fileFormData.title"
|
||||||
v-model:description="fileFormData.description"
|
v-model:description="fileFormData.description"
|
||||||
v-model:keyword="fileFormData.keyword"
|
v-model:keyword="fileFormData.keyword"
|
||||||
v-model:category="fileFormData.category"
|
v-model:category="fileFormData.category"
|
||||||
|
@filechange="(name: string) => (fileFormError.fileExist = checkFile(name))"
|
||||||
@submit="submitFileForm"
|
@submit="submitFileForm"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue