修复字典键值为bool类型和字符串类型时,下拉列表逻辑Bug

pull/44/head
zqx 2024-09-04 19:15:15 +08:00
parent fe80ad76d5
commit f67b0b2579
1 changed files with 17 additions and 1 deletions

View File

@ -39,8 +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') {
debugger
if(!valueType){
valueType = determineType(dictType);
}
const dictOption: DictDataType[] = []
const dictOptions: DictDataType[] = getDictDatas(dictType)
if (dictOptions && dictOptions.length > 0) {