|
|
@ -18,19 +18,27 @@ export const CHECK_CORRECT: CheckResult = { |
|
|
|
export function checkIllegalStrings(value: string): CheckResult { |
|
|
|
export function checkIllegalStrings(value: string): CheckResult { |
|
|
|
// 后端传入的校验开关,如果没传,那也默认开启
|
|
|
|
// 后端传入的校验开关,如果没传,那也默认开启
|
|
|
|
const enabled = Dec.system.enableParameterVerify ?? true; |
|
|
|
const enabled = Dec.system.enableParameterVerify ?? true; |
|
|
|
|
|
|
|
let result = CHECK_CORRECT; |
|
|
|
if (enabled) { |
|
|
|
if (enabled) { |
|
|
|
const illegalStringIndex = ILLEGAL_STRINGS.findIndex(s => value.includes(s)); |
|
|
|
// 关键字不区分大小写
|
|
|
|
if (illegalStringIndex === -1) { |
|
|
|
ILLEGAL_STRINGS.every(s => { |
|
|
|
return CHECK_CORRECT; |
|
|
|
const sIndex = value.toLowerCase().indexOf(s); |
|
|
|
} |
|
|
|
if (sIndex !== -1) { |
|
|
|
|
|
|
|
result = { |
|
|
|
|
|
|
|
legal: false, |
|
|
|
|
|
|
|
errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${value.substr(sIndex, s.length)}`, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return false; |
|
|
|
legal: false, |
|
|
|
} |
|
|
|
errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${ILLEGAL_STRINGS[illegalStringIndex]}`, |
|
|
|
|
|
|
|
}; |
|
|
|
return true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return CHECK_CORRECT; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function checkIllegalStringsInWidgetAndShowError(widget: any) { |
|
|
|
export function checkIllegalStringsInWidgetAndShowError(widget: any) { |
|
|
|