import { useStore } from '@/tumour/store/index.js' /** * 获取字典值 * @param {String | Array} dict * @param {String} value * @returns */ export function getDictValue(dict, value) { const store = useStore() let array = [] if (typeof dict === 'string') { array = store.getDict(dict) } else { array = dict } if (!array || !array.length) { return '' } let temp = array.find(e => e.value == value) || {} return temp.name || '' } /** * 获取字典数组 * @param {String} dict */ export function getDict(dict) { const store = useStore() return store.getDict(dict) || myDict()[dict] || [] } // 自定义字典 function myDict() { return { MY001: [ { name: '-', value: '-' }, { name: '±', value: '±' }, { name: '+', value: '+' }, { name: '++', value: '++' }, { name: '+++', value: '+++' }, { name: '++++', value: '++++' } ] } }