From 1ba2f3d3223644d2eb6081d825db76270c44ff12 Mon Sep 17 00:00:00 2001
From: tony.cheng <chengmingwei_1984122@126.com>
Date: Tue, 17 Mar 2026 13:37:39 +0800
Subject: [PATCH] fix: 修复caseState类型比较问题,使用Number()转换确保字符串和数字类型都能正确匹配

---
 web-app/src/components/dashboard/TabContainer.jsx |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/web-app/src/components/dashboard/TabContainer.jsx b/web-app/src/components/dashboard/TabContainer.jsx
index c87efc5..490f498 100644
--- a/web-app/src/components/dashboard/TabContainer.jsx
+++ b/web-app/src/components/dashboard/TabContainer.jsx
@@ -364,29 +364,35 @@
 
   // 状态控制按钮显示逻辑
   const shouldShowControlButton = () => {
-    const show = caseState === 0 || caseState === 1 || caseState === 5;
+    // 转换为数字类型进行比较,兼容字符串和数字
+    const stateNum = Number(caseState);
+    const show = stateNum === 0 || stateNum === 1 || stateNum === 5;
     console.log('状态控制按钮显示检查:', {
       caseState,
+      caseStateType: typeof caseState,
+      stateNum,
       show,
       conditions: {
-        'caseState === 0': caseState === 0,
-        'caseState === 1': caseState === 1,
-        'caseState === 5': caseState === 5
+        'stateNum === 0': stateNum === 0,
+        'stateNum === 1': stateNum === 1,
+        'stateNum === 5': stateNum === 5
       }
     });
     return show;
   };
 
   const getControlButtonProps = () => {
-    console.log('获取按钮属性:', { caseState });
+    // 转换为数字类型进行比较
+    const stateNum = Number(caseState);
+    console.log('获取按钮属性:', { caseState, caseStateType: typeof caseState, stateNum });
     
-    if (caseState === 0 || caseState === 1) {
+    if (stateNum === 0 || stateNum === 1) {
       return {
         text: '终止',
         style: 'terminate',
         action: 'terminate'
       };
-    } else if (caseState === 5) {
+    } else if (stateNum === 5) {
       return {
         text: '恢复',
         style: 'resume',

--
Gitblit v1.8.0