import { useUserInfo } from '/@/stores/userInfo';
const stores = useUserInfo();
// 用于在 Table 中把字段的代码转换为名称,示例如下:
/*
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
[{{di("字典名代码", scope.row.credentialsType)?.code}}]{{di("字典名代码", scope.row.credentialsType)?.value}}
*/
export function getDictDataItem(dicName: string, dicItemCode: any): any {
return stores.getDictItemByCode(dicName, dicItemCode);
}
export function getDictValByLabel(dicName: string, dicItemCode: any): any {
return stores.getDictValByLabel(dicName, dicItemCode);
}
export function getDictLabelByVal(dicName: string, dicItemValue: any): any {
return stores.getDictLabelByVal(dicName, dicItemValue);
}
export function getDictLabelByCode(dicName: string, dicItemCode: any): any {
return stores.getDictItemByCode(dicName, dicItemCode);
}
// select 控件使用,用于获取字典列表,示例如下:
/*
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
*/
export function getDictType(dicName: string): any {
return stores.dictList[dicName];
}
export function getDictDataList(dicName: string): any {
return stores.getDictDatasByCode(dicName);
}
// 获取数字类型的
export function getDictDataListInt(dicName: string): any {
return stores.getDictIntDatasByCode(dicName);
}