修复字典键值为bool类型和字符串类型时,下拉列表逻辑Bug
parent
fe80ad76d5
commit
f67b0b2579
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue