fix: move searchData to store
This commit is contained in:
parent
94d1af70ea
commit
0d0ba5068b
1 changed files with 36 additions and 0 deletions
|
|
@ -2,10 +2,42 @@ import { ref } from 'vue'
|
|||
import { defineStore } from 'pinia'
|
||||
import type { EhrFile } from '@/stores/tree-data'
|
||||
|
||||
export interface searchData {
|
||||
field: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface advSearchDataRow {
|
||||
op: 'AND' | 'OR'
|
||||
field: 'title' | 'keyword'
|
||||
value: string
|
||||
}
|
||||
|
||||
export interface advSearchDataField {
|
||||
keyword: string[]
|
||||
description: string
|
||||
}
|
||||
|
||||
export const useSearchDataStore = defineStore('searched', () => {
|
||||
const foundFile = ref<EhrFile[]>([])
|
||||
const isAdvSearchCall = ref<boolean>(false)
|
||||
const isSearch = ref<Boolean>(false)
|
||||
const isActFoundFile = ref<Boolean>(false)
|
||||
const searchData = ref<searchData>({
|
||||
field: 'title',
|
||||
value: '',
|
||||
})
|
||||
const advSearchDataRow = ref<advSearchDataRow[]>([
|
||||
{
|
||||
op: 'AND',
|
||||
field: 'title',
|
||||
value: '',
|
||||
},
|
||||
])
|
||||
const advSearchDataField = ref<advSearchDataField>({
|
||||
keyword: [],
|
||||
description: '',
|
||||
})
|
||||
|
||||
async function getFoundFile(data: EhrFile[]) {
|
||||
foundFile.value = data
|
||||
|
|
@ -15,6 +47,10 @@ export const useSearchDataStore = defineStore('searched', () => {
|
|||
foundFile,
|
||||
isSearch,
|
||||
isAdvSearchCall,
|
||||
isActFoundFile,
|
||||
searchData,
|
||||
advSearchDataRow,
|
||||
advSearchDataField,
|
||||
getFoundFile,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue