fix: 设备日志页增加 TCP 连接/断开事件类型支持

This commit is contained in:
wangfq
2026-06-10 10:01:12 +08:00
parent 0bddb46605
commit 5df08a26a9
2 changed files with 7 additions and 2 deletions

View File

@@ -13,6 +13,8 @@
<option value="online">在线</option> <option value="online">在线</option>
<option value="offline">离线</option> <option value="offline">离线</option>
<option value="poor">通信不良</option> <option value="poor">通信不良</option>
<option value="tcp_connect">TCP连接</option>
<option value="tcp_disconnect">TCP断开</option>
</select> </select>
</label> </label>
<button onclick="searchLogs(1)" class="btn-search">查询</button> <button onclick="searchLogs(1)" class="btn-search">查询</button>
@@ -68,6 +70,8 @@ function renderTable(records) {
if (r.event_type === 'online' || r.event_type === 'login') typeStyle = 'color:#27ae60;font-weight:bold;'; if (r.event_type === 'online' || r.event_type === 'login') typeStyle = 'color:#27ae60;font-weight:bold;';
else if (r.event_type === 'offline') typeStyle = 'color:#e74c3c;font-weight:bold;'; else if (r.event_type === 'offline') typeStyle = 'color:#e74c3c;font-weight:bold;';
else if (r.event_type === 'poor') typeStyle = 'color:#f39c12;font-weight:bold;'; else if (r.event_type === 'poor') typeStyle = 'color:#f39c12;font-weight:bold;';
else if (r.event_type === 'tcp_disconnect') typeStyle = 'color:#e74c3c;';
else if (r.event_type === 'tcp_connect') typeStyle = 'color:#3498db;';
return ` return `
<tr> <tr>
<td>${r.id}</td> <td>${r.id}</td>
@@ -81,7 +85,8 @@ function renderTable(records) {
} }
function eventLabel(t) { function eventLabel(t) {
const m = {login: '登录', online: '在线', offline: '离线', poor: '通信不良'}; const m = {login: '登录', online: '在线', offline: '离线', poor: '通信不良',
tcp_connect: 'TCP连接', tcp_disconnect: 'TCP断开'};
return m[t] || t; return m[t] || t;
} }