Files
vd_test_fixture/edc-web/app/templates/fixture.html
wangfq c0e77398d4 fix(fixture): 配置页面距离/容差值跟随单位 cm→mm 转换
- fillFormFromParam: DB值(cm) ×10 显示(mm)
- getFormParams: 表单值(mm) ÷10 存回(cm)
- HTML max: 255→2550 (适配mm)
- 0x4B下发/0x4C回读均正确:前端处理转换,协议仍用cm
2026-06-08 16:54:54 +08:00

191 lines
9.4 KiB
HTML

{% extends "base.html" %}
{% block title %}工装配置 - {{ device.serial }} - EDC 工装管理系统{% endblock %}
{% block content %}
<div class="test-header">
<a href="/">← 返回设备列表</a>
<h2>工装配置 —— {{ device.serial }} ({{ device.name or '未命名' }})</h2>
</div>
<div class="fixture-layout">
<!-- 左侧:工装测试参数配置区 -->
<div class="fixture-left">
<div class="fixture-card">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:12px;">
<h3 style="margin:0;">工装测试参数</h3>
<div>
<button class="btn-fixture" onclick="refreshParams()" title="从数据库重新加载">🔄 刷新</button>
<button class="btn-fixture primary" onclick="saveToDb()" title="仅保存到数据库,不下发设备">💾 保存</button>
</div>
</div>
<div class="fixture-form">
<div class="form-group">
<label>工装设备地址</label>
<input type="number" id="param-addr" value="1" min="0" max="255">
</div>
<div class="form-group">
<label>测试模式</label>
<select id="param-test-mode">
<option value="0">0 - 灵敏度测试模式</option>
<option value="1">1 - 波动测试模式</option>
</select>
</div>
<div class="form-group">
<label>复位距离 (mm)</label>
<input type="number" id="param-reset-dis" value="0" min="0">
</div>
<div class="form-group">
<label>皮距/开始距离 (mm)</label>
<input type="number" id="param-minus-dis" value="0" min="0">
</div>
<div class="form-group">
<label>被检设备型号</label>
<select id="param-dev-type" onchange="onDevTypeChange()">
<option value="0">-- 请选择车检器基准 --</option>
</select>
</div>
<div class="form-group">
<label>灵敏度最小值</label>
<input type="number" id="param-sens-min" value="0">
</div>
<div class="form-group">
<label>灵敏度最大值</label>
<input type="number" id="param-sens-max" value="0">
</div>
<div class="form-group">
<label>频率最小值 (Hz)</label>
<input type="number" id="param-fre-min" value="0">
</div>
<div class="form-group">
<label>频率最大值 (Hz)</label>
<input type="number" id="param-fre-max" value="0">
</div>
<div class="form-group">
<label>峰峰值最小值</label>
<input type="number" id="param-peak-min" value="0">
</div>
<div class="form-group">
<label>峰峰值最大值</label>
<input type="number" id="param-peak-max" value="0">
</div>
<div class="form-group"><hr style="border-color:#eee; margin:2px 0;"></div>
<h4 style="margin:8px 0 4px 0; color:#e67e22; font-size:13px;">⚡ 波动测试参数 (TestMode=1 时生效)</h4>
<div class="form-group">
<label>最远容差 (mm)</label>
<input type="number" id="param-far-tol" value="0" min="0" max="2550">
</div>
<div class="form-group">
<label>最近容差 (mm)</label>
<input type="number" id="param-near-tol" value="0" min="0" max="2550">
</div>
<div class="form-group">
<label>步进容差 (mm)</label>
<input type="number" id="param-step-tol" value="0" min="0" max="2550">
</div>
<div class="form-group">
<label>来回次数</label>
<input type="number" id="param-back-forth" value="0" min="0" max="255">
</div>
<div class="form-group">
<label>最近停留时间 (ms)</label>
<input type="number" id="param-near-stay" value="0" min="0" max="65535">
</div>
<div class="form-group">
<label>最远停留时间 (ms)</label>
<input type="number" id="param-far-stay" value="0" min="0" max="65535">
</div>
</div>
<div class="fixture-actions">
<button class="btn-fixture" onclick="sendFixtureCmd('4A')">📋 获取版本号 (0x4A)</button>
<button class="btn-fixture" onclick="sendFixtureCmd('4C')">🔍 查询参数 (0x4C)</button>
<button class="btn-fixture primary" onclick="sendConfig()">📤 配置参数 (0x4B)</button>
<button class="btn-fixture danger" onclick="sendFixtureCmd('4D')">🏭 出厂初始化 (0x4D)</button>
<button class="btn-fixture danger" onclick="sendFixtureCmd('4E')">🔄 设备复位 (0x4E)</button>
</div>
<div id="version-info" class="version-info" style="display:none"></div>
</div>
<!-- 通信日志区 -->
<div class="fixture-card">
<h3>通信日志</h3>
<div id="comm-log" style="background:#1e1e1e; color:#d4d4d4; font-family:monospace; font-size:12px;
padding:10px; border-radius:6px; max-height:250px; overflow-y:auto; line-height:1.5;">
<div style="color:#888;">等待操作…</div>
</div>
</div>
</div>
<!-- 右侧:车检器测试基准参数表 -->
<div class="fixture-right">
<div class="fixture-card">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
<h3 style="margin:0;">车检器测试基准参数</h3>
<div>
<input type="text" id="ref-search" placeholder="搜索型号/编码..."
style="padding:4px 8px; border:1px solid #ddd; border-radius:4px; font-size:12px; width:140px;"
oninput="loadBaseTests()">
<button class="btn-config" style="padding:4px 12px; font-size:12px;"
onclick="location.href='/vehicle-base-test'">管理</button>
</div>
</div>
<div class="ref-table-wrapper">
<table>
<thead>
<tr>
<th>编码</th><th>名称</th><th>灵敏度</th><th>频率(Hz)</th><th>峰峰值</th>
</tr>
</thead>
<tbody id="ref-table-body"></tbody>
</table>
</div>
</div>
<!-- 线圈参数选择区 -->
<div class="fixture-card">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
<h3 style="margin:0;">关联线圈参数</h3>
<button class="btn-config" style="padding:4px 12px; font-size:12px;"
onclick="location.href='/coil-info'">管理</button>
</div>
<div style="margin-bottom:8px;">
<label style="font-size:12px; color:#666;">当前线圈:</label>
<span id="current-coil-label" style="font-weight:600; font-size:13px;">未设置</span>
</div>
<select id="coil-select" style="width:100%; padding:4px; border:1px solid #ddd; border-radius:4px; font-size:12px;"
onchange="onCoilChange()">
<option value="">-- 选择线圈 --</option>
</select>
<div id="coil-detail" style="font-size:12px; color:#888; margin-top:4px;"></div>
</div>
<!-- 模拟车辆参数选择区 -->
<div class="fixture-card">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
<h3 style="margin:0;">关联模拟车辆参数</h3>
<button class="btn-config" style="padding:4px 12px; font-size:12px;"
onclick="location.href='/simulate-car'">管理</button>
</div>
<div style="margin-bottom:8px;">
<label style="font-size:12px; color:#666;">当前车辆:</label>
<span id="current-car-label" style="font-weight:600; font-size:13px;">未设置</span>
</div>
<select id="car-select" style="width:100%; padding:4px; border:1px solid #ddd; border-radius:4px; font-size:12px;"
onchange="onCarChange()">
<option value="">-- 选择模拟车辆 --</option>
</select>
<div id="car-detail" style="font-size:12px; color:#888; margin-top:4px;"></div>
</div>
</div>
</div>
<div id="toast" class="msg-toast"></div>
{% endblock %}
{% block scripts %}
<script>
const DNT_ID = {{ device.id }};
</script>
<script src="{{ url_for('static', filename='js/fixture.js') }}"></script>
{% endblock %}