feat: search in current position
This commit is contained in:
parent
e73b51880f
commit
1cca7d45a0
2 changed files with 20 additions and 3 deletions
|
|
@ -105,7 +105,14 @@ const folderFormComponent = ref<InstanceType<typeof FolderFormWrapper>>()
|
||||||
>
|
>
|
||||||
<q-icon name="arrow_back" size="1rem" color="primary" />
|
<q-icon name="arrow_back" size="1rem" color="primary" />
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<span v-if="isSearch">ผลการค้นหา</span>
|
<span v-if="isSearch">
|
||||||
|
ผลการค้นหา
|
||||||
|
<span class="text-grey text-body2 q-ml-md">{{
|
||||||
|
mode === 'admin' &&
|
||||||
|
currentInfo.path !== '/' &&
|
||||||
|
currentInfo.path.split('/').join(' / ')
|
||||||
|
}}</span>
|
||||||
|
</span>
|
||||||
<q-breadcrumbs
|
<q-breadcrumbs
|
||||||
v-if="!isSearch"
|
v-if="!isSearch"
|
||||||
active-color="grey"
|
active-color="grey"
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,11 @@ import { useLoader } from '@/stores/loader'
|
||||||
import { useFileInfoStore } from '@/stores/file-info-data'
|
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||||
|
|
||||||
import AdvancedSearch from '@/modules/01_user/components/AdvancedSearch.vue'
|
import AdvancedSearch from '@/modules/01_user/components/AdvancedSearch.vue'
|
||||||
|
import useStorage from '@/stores/storage'
|
||||||
|
|
||||||
const loaderStore = useLoader()
|
const loaderStore = useLoader()
|
||||||
|
const storageStore = useStorage()
|
||||||
|
const { currentInfo } = storeToRefs(storageStore)
|
||||||
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
const { isFilePreview } = storeToRefs(useFileInfoStore())
|
||||||
const {
|
const {
|
||||||
isExact,
|
isExact,
|
||||||
|
|
@ -29,8 +32,9 @@ const optionsField = [
|
||||||
{ label: 'เนื้อหาในไฟล์ (content)', value: 'attachment.content' },
|
{ label: 'เนื้อหาในไฟล์ (content)', value: 'attachment.content' },
|
||||||
]
|
]
|
||||||
const submitSearchData = ref<{
|
const submitSearchData = ref<{
|
||||||
AND: { field: string; value: string; exact: boolean }[]
|
AND: { field: string; value: string; exact?: boolean }[]
|
||||||
OR: { field: string; value: string; exact: boolean }[]
|
OR: { field: string; value: string; exact?: boolean }[]
|
||||||
|
exact?: boolean
|
||||||
}>({
|
}>({
|
||||||
AND: [],
|
AND: [],
|
||||||
OR: [],
|
OR: [],
|
||||||
|
|
@ -61,6 +65,12 @@ async function submitSearch() {
|
||||||
value: mime.getType(searchData.value.value) || '',
|
value: mime.getType(searchData.value.value) || '',
|
||||||
exact: true,
|
exact: true,
|
||||||
})
|
})
|
||||||
|
if (currentInfo.value.path !== '/') {
|
||||||
|
submitSearchData.value.AND.push({
|
||||||
|
field: 'path',
|
||||||
|
value: currentInfo.value.path,
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
submitSearchData.value.OR.push({
|
submitSearchData.value.OR.push({
|
||||||
field: searchData.value.field,
|
field: searchData.value.field,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue