|
|
@@ -287,17 +287,22 @@ const TopoDetail = (props) => {
|
|
|
|
|
|
// 根据compare_type判断是否触发告警
|
|
|
const isAlarmTriggered = (value, threshold, compareType) => {
|
|
|
+ // 确保数值比较,转换为数字
|
|
|
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
|
+ const numThreshold =
|
|
|
+ typeof threshold === "string" ? parseFloat(threshold) : threshold;
|
|
|
+
|
|
|
switch (compareType) {
|
|
|
case 1: // >=
|
|
|
- return value >= threshold;
|
|
|
+ return numValue >= numThreshold;
|
|
|
case 2: // <=
|
|
|
- return value <= threshold;
|
|
|
+ return numValue <= numThreshold;
|
|
|
case 3: // <
|
|
|
- return value < threshold;
|
|
|
+ return numValue < numThreshold;
|
|
|
case 4: // >
|
|
|
- return value > threshold;
|
|
|
+ return numValue > numThreshold;
|
|
|
case 5: // ==
|
|
|
- return value === threshold;
|
|
|
+ return numValue === numThreshold;
|
|
|
default:
|
|
|
return false;
|
|
|
}
|