瀏覽代碼

feat: 添加课程状态指示器并更新设备配置

更新VSCode设置中的JSON格式化工具
在课程运行页面添加状态指示器,显示课程状态(未开始/运行中/已暂停)
修改设备配置文件,将https字段重命名为https_1并添加websocket配置
为Meta2dView组件添加数据存在性检查
zhanghaijun 9 月之前
父節點
當前提交
f62f2c8927

+ 1 - 1
.vscode/settings.json

@@ -17,7 +17,7 @@
   // 默认格式化工具选择prettier
   "editor.defaultFormatter": "esbenp.prettier-vscode",
   "[json]": {
-    "editor.defaultFormatter": "esbenp.prettier-vscode"
+    "editor.defaultFormatter": "vscode.json-language-features"
   },
   "[vue]": {
     "editor.defaultFormatter": "esbenp.prettier-vscode"

+ 11 - 9
public/device.001.json

@@ -34071,15 +34071,17 @@
     ],
     "gridColor": "#e2e2e2",
     "gridSize": 20,
-    "https": [
-    {
-      "http": "/course/api/serverctrl/alleqpmtList",
-      "httpHeaders": {},
-      "httpTimeInterval": 5000,
-      "method": "POST",
-      "times": 0
-    }
-  ],
+    "https_1": [
+        {
+            "http": "/course/api/serverctrl/alleqpmtList",
+            "httpHeaders": {},
+            "httpTimeInterval": 5000,
+            "method": "POST",
+            "times": 0
+        }
+    ],
+    "websocket": "ws://124.222.28.5:7313/ws/equipment",
+    "websocketProtocols": "",
     "iot": {},
     "localSaveAt": "2025-11-17T22:35:54+08:00",
     "ruleColor": "#888888",

+ 11 - 9
public/device.002.json

@@ -38905,15 +38905,17 @@
     ],
     "gridColor": "#e2e2e2",
     "gridSize": 20,
-    "https": [
-    {
-      "http": "/course/api/serverctrl/alleqpmtList",
-      "httpHeaders": {},
-      "httpTimeInterval": 5000,
-      "method": "POST",
-      "times": 0
-    }
-  ],
+    "https_1": [
+        {
+            "http": "/course/api/serverctrl/alleqpmtList",
+            "httpHeaders": {},
+            "httpTimeInterval": 5000,
+            "method": "POST",
+            "times": 0
+        }
+    ],
+    "websocket": "ws://124.222.28.5:7313/ws/equipment",
+    "websocketProtocols": "",
     "iot": {},
     "localSaveAt": "2025-11-17T14:09:24+08:00",
     "ruleColor": "#888888",

+ 3 - 1
public/device.json

@@ -63449,7 +63449,7 @@
   "gridColor": "#e2e2e2",
   "gridSize": 20,
   "groups": [],
-  "https": [
+  "https_1": [
     {
       "http": "/course/api/serverctrl/alleqpmtList",
       "httpHeaders": {},
@@ -63458,6 +63458,8 @@
       "times": 0
     }
   ],
+  "websocket": "ws://124.222.28.5:7313/ws/equipment",
+  "websocketProtocols": "",
   "iot": {},
   "ruleColor": "#888888",
   "version": "1.0.84"

+ 6 - 5
src/views/train/course/trainer_run/index.vue

@@ -29,6 +29,11 @@
       </div>
       <div class="flex w-[320px] flex-col gap-4">
         <div class="run-action relative">
+          <div class="status-header mt-8 ml-6">
+            <div class="status-indicator" :style="timerStatus === 'noStart' ? 'background-color: #FF4D4F' : timerStatus === 'running' ? 'background-color: #409EFF' : 'background-color: #E6A23C'">
+            </div>
+            <h3 class="status-title">{{ timerStatus === 'noStart' ? '课程未开始' : timerStatus === 'running' ? '课程运行中' : '课程已暂停' }}</h3>
+          </div>
           <div v-if="!runStatus || runStatus?.runCourseID === Number(courseId)" class="absolute right-[10px] bottom-[20px] left-[10px] flex items-center justify-center">
             <el-button v-if="timerStatus === 'noStart'" type="primary" @click="courseStart">开始课程</el-button>
             <el-button v-else-if="timerStatus === 'running'" type="primary" @click="coursePause">暂停课程</el-button>
@@ -36,10 +41,6 @@
             <el-button type="primary" :disabled="timerStatus === 'noStart'" @click="courseReset">结束课程</el-button>
           </div>
           <div v-else class="course-running-status">
-            <div class="status-header">
-              <div class="status-indicator"></div>
-              <h3 class="status-title">课程运行中</h3>
-            </div>
             <div class="status-content">
               <div class="info-item">
                 <span class="info-label">课程ID</span>
@@ -236,7 +237,7 @@
   .status-indicator {
     width: 8px;
     height: 8px;
-    background: #4caf50;
+    // background: #4caf50;
     border-radius: 50%;
     animation: pulse 2s infinite;
   }

+ 1 - 1
src/views/train/fault/index.vue

@@ -9,7 +9,7 @@
       </div>
     </div>
     <div class="flex-1">
-      <Meta2dView :data="dataJson" :preview="true" />
+      <Meta2dView v-if="dataJson" :data="dataJson" :preview="true" />
     </div>
     <FaultList ref="faultListRef" />
     <DeviceList ref="deviceListRef" />