fix: дԤ¾¯ÉèÖÃÖÐãÐֵΪ null µ¼Öºó¶Ë 500 ±ÀÀ£µÄÎÊÌ⣬²¢Ôö¼Óǰºó¶˰²ȫУÑé
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user