refactor: clean about search
This commit is contained in:
parent
74c5115e95
commit
aa63e9c8c5
3 changed files with 17 additions and 4 deletions
|
|
@ -1,5 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
import { useTreeDataStore, type TreeDataFolder } from '@/stores/tree-data'
|
import { useTreeDataStore, type TreeDataFolder } from '@/stores/tree-data'
|
||||||
|
import { useSearchDataStore } from '@/stores/searched-data'
|
||||||
|
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||||
|
|
||||||
|
const { isSearch } = storeToRefs(useSearchDataStore())
|
||||||
|
const { isPreview } = storeToRefs(useFileInfoStore())
|
||||||
const { getFolder } = useTreeDataStore()
|
const { getFolder } = useTreeDataStore()
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
|
|
@ -17,7 +23,13 @@ const props = withDefaults(
|
||||||
<div>
|
<div>
|
||||||
<q-list v-for="folder in data" class="rounded-borders">
|
<q-list v-for="folder in data" class="rounded-borders">
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
@click="() => getFolder(folder.pathname, false)"
|
@click="
|
||||||
|
() => {
|
||||||
|
getFolder(folder.pathname, false)
|
||||||
|
isSearch = false
|
||||||
|
isPreview = false
|
||||||
|
}
|
||||||
|
"
|
||||||
:header-inset-level="level * 0.25"
|
:header-inset-level="level * 0.25"
|
||||||
:group="level.toString()"
|
:group="level.toString()"
|
||||||
:hide-expand-icon="level === 4"
|
:hide-expand-icon="level === 4"
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,9 @@ import { useSearchDataStore } from '@/stores/searched-data'
|
||||||
import { useLoader } from '@/stores/loader'
|
import { useLoader } from '@/stores/loader'
|
||||||
|
|
||||||
const loaderStore = useLoader()
|
const loaderStore = useLoader()
|
||||||
const { isSearch } = storeToRefs(useSearchDataStore())
|
const { isSearch, isAdvSearchCall } = storeToRefs(useSearchDataStore())
|
||||||
const { getFoundFile } = useSearchDataStore()
|
const { getFoundFile } = useSearchDataStore()
|
||||||
const advSearchComp = ref<InstanceType<typeof AdvancedSearch>>()
|
const advSearchComp = ref<InstanceType<typeof AdvancedSearch>>()
|
||||||
const isAdvSearchCall = ref<boolean>(false)
|
|
||||||
const optionsField = [
|
const optionsField = [
|
||||||
{ label: 'ชื่อเรื่อง (title)', value: 'title' },
|
{ label: 'ชื่อเรื่อง (title)', value: 'title' },
|
||||||
{ label: 'คำสำคัญ (keyword)', value: 'keyword' },
|
{ label: 'คำสำคัญ (keyword)', value: 'keyword' },
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import type { EhrFile } from '@/stores/tree-data'
|
||||||
|
|
||||||
export const useSearchDataStore = defineStore('searched', () => {
|
export const useSearchDataStore = defineStore('searched', () => {
|
||||||
const foundFile = ref<EhrFile[]>([])
|
const foundFile = ref<EhrFile[]>([])
|
||||||
|
const isAdvSearchCall = ref<boolean>(false)
|
||||||
const isSearch = ref<Boolean>(false)
|
const isSearch = ref<Boolean>(false)
|
||||||
|
|
||||||
async function getFoundFile(data: EhrFile[]) {
|
async function getFoundFile(data: EhrFile[]) {
|
||||||
|
|
@ -11,8 +12,9 @@ export const useSearchDataStore = defineStore('searched', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isSearch,
|
|
||||||
foundFile,
|
foundFile,
|
||||||
|
isSearch,
|
||||||
|
isAdvSearchCall,
|
||||||
getFoundFile,
|
getFoundFile,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue