From 60c11fe71970635ca8e315499a85cd55c982ad01 Mon Sep 17 00:00:00 2001 From: wangfq Date: Tue, 9 Jun 2026 17:41:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=8B=E8=AF=95=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E9=A1=B5=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=EF=BC=8C=E7=81=B5=E6=95=8F=E5=BA=A6=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E9=9A=90=E8=97=8F=E6=B3=A2=E5=8A=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 页面头部新增测试模式指示器(灵敏度测试/波动测试) - 灵敏度模式时隐藏「波动测试数据」区块 - loadTestMode() 从工装参数获取 TestMode,无参数时回退到最新测试数据 - renderLatest 收到新数据时同步更新模式指示 --- edc-web/app/static/js/test_op.js | 36 ++++++++++++++++++++++++++++++ edc-web/app/templates/test_op.html | 3 +++ 2 files changed, 39 insertions(+) diff --git a/edc-web/app/static/js/test_op.js b/edc-web/app/static/js/test_op.js index bd52a56..5a90659 100644 --- a/edc-web/app/static/js/test_op.js +++ b/edc-web/app/static/js/test_op.js @@ -7,6 +7,7 @@ let autoFailed = 0; let autoRemaining = 0; let autoStartTime = ""; let localSinceStr = ""; +let currentTestMode = null; // 0=灵敏度, 1=波动, null=未加载 let pollInterval = null; let nextCmdTimer = null; // 间隔等待定时器 @@ -256,7 +257,39 @@ async function pollProgress() { } // ─── 页面加载时获取初始数据 ────────────────────── + +async function loadTestMode() { + try { + const resp = await fetch(`/api/fixture/param/${DNT_ID}`); + const param = await resp.json(); + if (param && param.dnt_id) { + updateTestModeUI(param.TestMode); + } else { + // 没有工装参数时,尝试从最新测试数据获取 + const r2 = await fetch(`/api/automation/${DNT_ID}/progress`); + const d2 = await r2.json(); + if (d2.latest && d2.latest.test_mode !== undefined) { + updateTestModeUI(d2.latest.test_mode); + } + } + } catch (e) { /* 静默 */ } +} + +function updateTestModeUI(mode) { + currentTestMode = mode; + const indicator = document.getElementById("test-mode-indicator"); + const waveSection = document.getElementById("wave-section"); + if (mode === 1) { + indicator.innerHTML = '当前测试模式:波动测试'; + waveSection.style.display = ''; + } else { + indicator.innerHTML = '当前测试模式:灵敏度测试'; + waveSection.style.display = 'none'; + } +} + async function loadInitialData() { + await loadTestMode(); try { const resp = await fetch(`/api/automation/${DNT_ID}/progress`); const data = await resp.json(); @@ -321,6 +354,9 @@ function decodeRelay(v) { // ─── 显示最新结果 ────────────────────────────── function renderLatest(data) { + if (data.test_mode !== undefined && data.test_mode !== currentTestMode) { + updateTestModeUI(data.test_mode); + } const div = document.getElementById("latest-result"); div.innerHTML = `

设备型号:${data.str_type || '-'}

diff --git a/edc-web/app/templates/test_op.html b/edc-web/app/templates/test_op.html index 4253e02..e70433b 100644 --- a/edc-web/app/templates/test_op.html +++ b/edc-web/app/templates/test_op.html @@ -6,6 +6,7 @@
← 返回设备列表

测试操作 — {{ device.serial }} ({{ device.name or '未命名' }})

+
加载中…
@@ -58,10 +59,12 @@

等待设备上报...

+

波动测试数据

暂无波动数据...

+

自动化平均值