import { defineStore } from 'pinia' export const useStore = defineStore('chronic', { state: () => { return { // 字典 dict: [], //登录医生相关基本信息 authInfo: {}, // 刷新标记 refreshMark: 1, // 页面是否处于隐藏状态 documentHidden: false } }, getters: {}, actions: { getDict(dict) { if (!dict) return [] return this.dict[dict] || [] }, getDictValue(dict, value) { let array = [] if (typeof dict === 'string') { array = this.dict[dict] } else { array = dict } if (!array || !array.length) { return '' } if (value instanceof Array) { return value.map(v => { let temp = array.find(e => e.value == v) || {} return temp.name || '' }).filter(e => e).join('、') } let temp = array.find(e => e.value == value) || {} return temp.name || '' }, onRefreshMark() { this.refreshMark++ }, onDocumentHidden(value) { this.documentHidden = value } } })