refactor: migrate to storage

refactor: migrate to storage
This commit is contained in:
Methapon2001 2023-12-11 15:51:59 +07:00
parent 4bdf1f620b
commit cc87de5995
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
12 changed files with 388 additions and 879 deletions

View file

@ -2,19 +2,19 @@ import { ref } from 'vue'
import { defineStore } from 'pinia'
import mime from 'mime'
import type { EhrFile } from '@/stores/tree-data'
import type { StorageFile } from '@/stores/storage'
export interface MimeMap {
[key: string]: { icon: string; color: string }
}
export interface TypeSetting {
export interface IconMap {
[key: string]: { icon: string; color: string }
}
export const useFileInfoStore = defineStore('info', () => {
const isFilePreview = ref<Boolean>(false)
const fileInfo = ref<EhrFile>()
const fileIcon: TypeSetting = {
const fileInfo = ref<StorageFile>()
const fileIcon: IconMap = {
word: { icon: 'mdi-file-word-outline', color: 'blue-11' },
excel: { icon: 'mdi-file-excel-outline', color: 'green-4' },
powerpoint: { icon: 'mdi-file-powerpoint-outline', color: 'orange-4' },
@ -100,7 +100,7 @@ export const useFileInfoStore = defineStore('info', () => {
return sizeNumber.toFixed(2) + ' ' + units[i]
}
function getFileInfo(data: EhrFile) {
function getFileInfo(data: StorageFile) {
isFilePreview.value = true
fileInfo.value = data
}

View file

@ -1,45 +1,45 @@
import { ref } from 'vue'
import { defineStore } from 'pinia'
import type { EhrFile } from '@/stores/tree-data'
import type { StorageFile } from '@/stores/storage'
export interface searchData {
export interface Search {
field: string
value: string
}
export interface advSearchDataRow {
export interface AdvancedSearch {
op: 'AND' | 'OR'
field: 'title' | 'keyword'
value: string
}
export interface advSearchDataField {
export interface AdvancedSearchFields {
keyword: string[]
description: string
}
export const useSearchDataStore = defineStore('searched', () => {
const foundFile = ref<EhrFile[]>([])
const foundFile = ref<StorageFile[]>([])
const isAdvSearchCall = ref<boolean>(false)
const isSearch = ref<Boolean>(false)
const isActFoundFile = ref<Boolean>(false)
const searchData = ref<searchData>({
const searchData = ref<Search>({
field: 'title',
value: '',
})
const advSearchDataRow = ref<advSearchDataRow[]>([
const advSearchDataRow = ref<AdvancedSearch[]>([
{
op: 'AND',
field: 'title',
value: '',
},
])
const advSearchDataField = ref<advSearchDataField>({
const advSearchDataField = ref<AdvancedSearchFields>({
keyword: [],
description: '',
})
async function getFoundFile(data: EhrFile[]) {
async function getFoundFile(data: StorageFile[]) {
foundFile.value = data
}