Pre Merge pull request !45 from kuxiao/master

pull/45/MERGE
kuxiao 2024-09-04 11:44:08 +00:00 committed by Gitee
commit 9165d6deb7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 17 additions and 0 deletions

View File

@ -39,7 +39,24 @@ export function getDictOpts(dictType: string) {
return getDictDatas(dictType)
}
/**
*
* @param dictType
*/
function determineType(dictType) {
if (dictType === "true" || dictType === "false") {
return "boolean";
} else if (!isNaN(parseFloat(dictType)) && parseFloat(input).toString() === input) {
return "number";
} else {
return "string";
}
}
export function getDictOptions(dictType: string, valueType?: 'string' | 'number' | 'boolean') {
if(!valueType){
valueType = determineType(dictType);
}
const dictOption: DictDataType[] = []
const dictOptions: DictDataType[] = getDictDatas(dictType)
if (dictOptions && dictOptions.length > 0) {