Files
vd_test_fixture/edc-web/app/templates/test_op.html
2026-06-04 09:56:09 +08:00

100 lines
4.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}测试操作 - {{ device.serial }} - EDC 工装管理系统{% endblock %}
{% block content %}
<div class="test-page">
<div class="test-header">
<a href="/">← 返回设备列表</a>
<h2>测试操作 — {{ device.serial }} ({{ device.name or '未命名' }})</h2>
</div>
<div class="test-layout">
<!-- 左侧:测试操作区 -->
<div class="test-control">
<h3>手动指令</h3>
<div class="cmd-buttons">
<button onclick="sendCmd('B0')" class="btn-cmd">开始测试 (0xB0)</button>
<button onclick="sendCmd('B1')" class="btn-cmd">测试复原 (0xB1)</button>
<button onclick="sendCmd('BA')" class="btn-cmd">电机前进 (0xBA)</button>
<button onclick="sendCmd('BB')" class="btn-cmd">电机后退 (0xBB)</button>
<button onclick="sendCmd('BC')" class="btn-cmd">电机停止 (0xBC)</button>
</div>
<h3>自动化测试</h3>
<div class="automation">
<label>
测试次数:
<input type="number" id="test-count" value="10" min="1" max="9999">
</label>
<label style="margin-left:16px;">
间隔时间(秒)
<input type="number" id="interval-sec" value="10" min="0" max="300" style="width:60px;">
</label>
<label style="margin-left:16px;">
超时时间(秒)
<input type="number" id="timeout-sec" value="5" min="1" max="600" style="width:60px;">
</label>
<button id="btn-auto" class="btn-start" onclick="toggleAuto()">开始</button>
<div class="progress-container">
<div class="progress-bar" id="progress-bar"></div>
<div class="progress-text" id="progress-text">等待开始...</div>
</div>
<div class="stats" id="stats">
<span>完成:<strong id="stat-done">0</strong></span>
<span>失败:<strong id="stat-failed">0</strong></span>
<span>剩余:<strong id="stat-remaining">0</strong></span>
</div>
<div class="auto-status" id="auto-status" style="font-size:12px;color:#888;margin-top:4px;"></div>
<div class="auto-time" id="auto-time" style="display:none;margin-top:8px;font-size:12px;color:#888;">
开始:<span id="time-start">-</span> &nbsp; 结束:<span id="time-end">-</span>
</div>
</div>
</div>
<!-- 右侧:测试信息显示区 -->
<div class="test-info">
<h3>当前测试数据</h3>
<div id="latest-result">
<p class="placeholder">等待设备上报...</p>
</div>
<h3>波动测试数据</h3>
<div id="latest-wave">
<p class="placeholder">暂无波动数据...</p>
</div>
<h3>自动化平均值</h3>
<table id="avg-table">
<tr><td>平均峰峰值</td><td id="avg-ppvalue">-</td><td>V</td></tr>
<tr><td>平均开始工作频率</td><td id="avg-idle-freq">-</td><td>Hz</td></tr>
<tr><td>平均进入工作频率</td><td id="avg-enter-freq">-</td><td>Hz</td></tr>
<tr><td>平均进入距离</td><td id="avg-enter-dist">-</td><td>mm</td></tr>
<tr><td>平均离开距离</td><td id="avg-exit-dist">-</td><td>mm</td></tr>
<tr><td>平均进入速度</td><td id="avg-enter-speed">-</td><td>m/s</td></tr>
<tr><td>平均离开速度</td><td id="avg-exit-speed">-</td><td>m/s</td></tr>
</table>
<h3 style="margin-top:20px;">本轮测试明细</h3>
<div id="records-container" style="max-height:400px;overflow-y:auto;">
<table id="records-table" style="font-size:11px;">
<thead>
<tr>
<th>#</th><th>串口状态</th><th>模式</th><th>峰峰值(V)</th><th>开始频率</th><th>进入距离</th><th>离开距离</th><th>速度(m/s)</th><th>时间</th>
</tr>
</thead>
<tbody></tbody>
</table>
<p id="records-empty" class="placeholder">暂无记录</p>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
const DNT_ID = {{ device.id }};
</script>
<script src="{{ url_for('static', filename='js/test_op.js') }}"></script>
{% endblock %}