diff --git a/edc-web/app/__pycache__/models.cpython-311.pyc b/edc-web/app/__pycache__/models.cpython-311.pyc index c4353ac..8fc835c 100644 Binary files a/edc-web/app/__pycache__/models.cpython-311.pyc and b/edc-web/app/__pycache__/models.cpython-311.pyc differ diff --git a/edc-web/app/routes/__pycache__/test_data.cpython-311.pyc b/edc-web/app/routes/__pycache__/test_data.cpython-311.pyc index 1d35a00..3f748d1 100644 Binary files a/edc-web/app/routes/__pycache__/test_data.cpython-311.pyc and b/edc-web/app/routes/__pycache__/test_data.cpython-311.pyc differ diff --git a/edc-web/app/static/js/test_data.js b/edc-web/app/static/js/test_data.js index 39ef66b..2916e2a 100644 --- a/edc-web/app/static/js/test_data.js +++ b/edc-web/app/static/js/test_data.js @@ -35,7 +35,7 @@ const VIEWS = { { key: 'test_mode', title: '测试模式', render: r => r.test_mode === 1 ? '波动' : '灵敏度' }, { key: 'iffinish', title: '完成', render: r => r.iffinish === '1' ? '是' : '否' }, { key: 'fault_info', title: '故障信息' }, - { key: 'relay_out', title: '继电器' }, + { key: 'relay_out', title: '继电器', render: r => decodeRelay(r.relay_code) }, { key: 'ppvalue', title: '峰峰值(V)', render: r => r.ppvalue?.toFixed(2) || '-' }, { key: 'idle_freq', title: '开始频率' }, { key: 'enter_freq', title: '进入频率' }, @@ -62,7 +62,7 @@ const VIEWS = { { key: 'far_dist', title: '最远距离(mm)' }, { key: 'b4_enter_dist', title: '进入高度(mm)' }, { key: 'b4_leave_dist', title: '离开高度(mm)' }, - { key: 'relay_out', title: '继电器' }, + { key: 'relay_out', title: '继电器', render: r => decodeRelay(r.relay_code) }, { key: 'create_time', title: '时间', render: r => fmtTime(r.create_time) }, ], }, @@ -92,6 +92,17 @@ function fmtTime(v) { return `${y}-${m}-${d2} ${h}:${min}:${s}`; } +const RELAY_MAP = { + 0: '无输出', + 1: '存在信号', + 2: '脉冲信号', + 3: '存在信号; 脉冲信号', +}; +function decodeRelay(v) { + if (v === null || v === undefined || v === '') return '-'; + return RELAY_MAP[parseInt(v)] || `0x${parseInt(v).toString(16).toUpperCase().padStart(2, '0')}`; +} + // ─── 视图切换 ──────────────────────────────────── function switchView(view) { diff --git a/edc-web/app/static/js/test_op.js b/edc-web/app/static/js/test_op.js index 7f4bd9f..dc6cf3b 100644 --- a/edc-web/app/static/js/test_op.js +++ b/edc-web/app/static/js/test_op.js @@ -291,6 +291,17 @@ function fmtTime(v) { return `${y}-${m}-${d2} ${h}:${min}:${s}`; } +const RELAY_MAP = { + 0: '无输出', + 1: '存在信号', + 2: '脉冲信号', + 3: '存在信号; 脉冲信号', +}; +function decodeRelay(v) { + if (v === null || v === undefined || v === '') return '-'; + return RELAY_MAP[parseInt(v)] || `0x${parseInt(v).toString(16).toUpperCase().padStart(2, '0')}`; +} + // ─── 显示最新结果 ────────────────────────────── function renderLatest(data) { @@ -308,6 +319,7 @@ function renderLatest(data) {
离开速度:${toSpeed(data.exit_speed)} m/s
是否完成:${data.iffinish === '1' ? '是' : '否'}
故障信息:${data.fault_info || '无'}
+继电器:${decodeRelay(data.relay_code)}
时间:${fmtTime(data.create_time)}
`; } @@ -348,7 +360,7 @@ function renderLatestWave(data) {最远距离:${data.far_dist || '-'} mm
进入高度 (B4):${data.b4_enter_dist || '-'} mm
离开高度 (B4):${data.b4_leave_dist || '-'} mm
-继电器:${data.relay_out || '无'}
+继电器:${decodeRelay(data.relay_code)}
时间:${fmtTime(data.create_time)}
`; }