|
|
@ -13,21 +13,21 @@ const dictStore = useDictStoreWithOut() |
|
|
|
* @returns {*|Array} 数据字典数组 |
|
|
|
*/ |
|
|
|
export interface DictDataType { |
|
|
|
dictType: string |
|
|
|
label: string |
|
|
|
value: string | number | boolean |
|
|
|
colorType: ElementPlusInfoType | '' |
|
|
|
cssClass: string |
|
|
|
dictType : string |
|
|
|
label : string |
|
|
|
value : string | number | boolean |
|
|
|
colorType : ElementPlusInfoType | '' |
|
|
|
cssClass : string |
|
|
|
} |
|
|
|
|
|
|
|
export const getDictOptions = (dictType: string) => { |
|
|
|
export const getDictOptions = (dictType : string) => { |
|
|
|
return dictStore.getDictByType(dictType) || [] |
|
|
|
} |
|
|
|
|
|
|
|
export const getIntDictOptions = (dictType: string) => { |
|
|
|
const dictOption: DictDataType[] = [] |
|
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType) |
|
|
|
dictOptions.forEach((dict: DictDataType) => { |
|
|
|
export const getIntDictOptions = (dictType : string) => { |
|
|
|
const dictOption : DictDataType[] = [] |
|
|
|
const dictOptions : DictDataType[] = getDictOptions(dictType) |
|
|
|
dictOptions.forEach((dict : DictDataType) => { |
|
|
|
dictOption.push({ |
|
|
|
...dict, |
|
|
|
value: parseInt(dict.value + '') |
|
|
@ -36,10 +36,10 @@ export const getIntDictOptions = (dictType: string) => { |
|
|
|
return dictOption |
|
|
|
} |
|
|
|
|
|
|
|
export const getStrDictOptions = (dictType: string) => { |
|
|
|
const dictOption: DictDataType[] = [] |
|
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType) |
|
|
|
dictOptions.forEach((dict: DictDataType) => { |
|
|
|
export const getStrDictOptions = (dictType : string) => { |
|
|
|
const dictOption : DictDataType[] = [] |
|
|
|
const dictOptions : DictDataType[] = getDictOptions(dictType) |
|
|
|
dictOptions.forEach((dict : DictDataType) => { |
|
|
|
dictOption.push({ |
|
|
|
...dict, |
|
|
|
value: dict.value + '' |
|
|
@ -48,10 +48,10 @@ export const getStrDictOptions = (dictType: string) => { |
|
|
|
return dictOption |
|
|
|
} |
|
|
|
|
|
|
|
export const getBoolDictOptions = (dictType: string) => { |
|
|
|
const dictOption: DictDataType[] = [] |
|
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType) |
|
|
|
dictOptions.forEach((dict: DictDataType) => { |
|
|
|
export const getBoolDictOptions = (dictType : string) => { |
|
|
|
const dictOption : DictDataType[] = [] |
|
|
|
const dictOptions : DictDataType[] = getDictOptions(dictType) |
|
|
|
dictOptions.forEach((dict : DictDataType) => { |
|
|
|
dictOption.push({ |
|
|
|
...dict, |
|
|
|
value: dict.value + '' === 'true' |
|
|
@ -66,8 +66,8 @@ export const getBoolDictOptions = (dictType: string) => { |
|
|
|
* @param value 字典值 |
|
|
|
* @return DictDataType 字典对象 |
|
|
|
*/ |
|
|
|
export const getDictObj = (dictType: string, value: any): DictDataType | undefined => { |
|
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType) |
|
|
|
export const getDictObj = (dictType : string, value : any) : DictDataType | undefined => { |
|
|
|
const dictOptions : DictDataType[] = getDictOptions(dictType) |
|
|
|
for (const dict of dictOptions) { |
|
|
|
if (dict.value === value + '') { |
|
|
|
return dict |
|
|
@ -82,10 +82,10 @@ export const getDictObj = (dictType: string, value: any): DictDataType | undefin |
|
|
|
* @param value 字典数据的值 |
|
|
|
* @return 字典名称 |
|
|
|
*/ |
|
|
|
export const getDictLabel = (dictType: string, value: any): string => { |
|
|
|
const dictOptions: DictDataType[] = getDictOptions(dictType) |
|
|
|
export const getDictLabel = (dictType : string, value : any) : string => { |
|
|
|
const dictOptions : DictDataType[] = getDictOptions(dictType) |
|
|
|
const dictLabel = ref('') |
|
|
|
dictOptions.forEach((dict: DictDataType) => { |
|
|
|
dictOptions.forEach((dict : DictDataType) => { |
|
|
|
if (dict.value === value + '') { |
|
|
|
dictLabel.value = dict.label |
|
|
|
} |
|
|
@ -277,7 +277,7 @@ export enum DICT_TYPE { |
|
|
|
DEVICE_MOLD_TYPE = 'device_mold_type', // 设备/模具类型
|
|
|
|
TRANSACTION_TYPE = 'transaction_Type', // 事务类型
|
|
|
|
RESULT = 'result', // 事务类型
|
|
|
|
|
|
|
|
REQUEST_APPLY = 'class_type', // 班组类型
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|