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