fix: Ð޸´Ԥ¾¯ÉèÖÃÖÐãÐֵΪ null µ¼Öºó¶Ë 500 ±ÀÀ£µÄÎÊÌ⣬²¢Ôö¼Óǰºó¶˰²ȫУÑé

This commit is contained in:
DXC
2026-03-11 17:06:19 +08:00
parent 25fbb293df
commit 6b932f79a8
2 changed files with 21 additions and 8 deletions

View File

@ -1204,13 +1204,23 @@ const submitWarning = async () => {
await warningFormRef.value.validate();
// 安全转换数值null/undefined 默认转为 0
const yellow = Number(warningForm.yellowThreshold) || 0;
const red = Number(warningForm.redThreshold) || 0;
// 逻辑校验:启用预警时,黄色阈值必须大于红色阈值
if (warningForm.isEnabled && yellow !== 0 && red !== 0 && yellow <= red) {
ElMessage.warning('黄色阈值必须大于红色阈值');
return;
}
warningLoading.value = true;
try {
const data = warningDialog.selectedIds.map(baseId => ({
baseId,
isEnabled: warningForm.isEnabled,
redThreshold: warningForm.redThreshold,
yellowThreshold: warningForm.yellowThreshold
redThreshold: red,
yellowThreshold: yellow
}));
await batchSetWarning(data);