You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
465 B
TypeScript

2 years ago
import { DictValueEnumObj } from "@/components/DictTag";
import { ProSchemaValueEnumObj, ProSchemaValueEnumType } from "@ant-design/pro-components";
export function getValueEnumLabel(options: DictValueEnumObj | ProSchemaValueEnumObj, val: string | number | undefined, value?: string) {
2 years ago
if (val !== undefined) {
const data = options[val] as ProSchemaValueEnumType;
if(data) {
return data.text;
}
}
return value?value:val;
2 years ago
}