feat: 工装配置页面 + 车检器基准参数管理

- 设备页增加「配置」按钮(devices.js)
- 新增工装配置页面(fixture.html+js): 参数表单、5个操作按钮、通信日志区、基准参数表
- 新增车检器基准参数管理页面(vehicle_base_test.html+js): CRUD + 搜索
- 新增 fixture 蓝图(routes/fixture.py): 0x4A~0x4E 指令发送、参数CRUD、serialnet状态查询
- models.py: 新增 get_serialnet_by_id, tb_fixture_param/tb_vechicle_base_test CRUD
- edc_server 子模块更新
This commit is contained in:
wangfq
2026-05-29 17:26:07 +08:00
parent ae816eaffd
commit dbe5d1cefb
10 changed files with 1197 additions and 1 deletions

View File

@@ -0,0 +1,128 @@
{% 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>复位距离 (cm)</label>
<input type="number" id="param-reset-dis" value="0" min="0">
</div>
<div class="form-group">
<label>皮距/开始距离 (cm)</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>
<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>
</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 %}

View File

@@ -0,0 +1,90 @@
{% extends "base.html" %}
{% block title %}车检器测试基准参数管理 - EDC 工装管理系统{% endblock %}
{% block content %}
<div class="test-header">
<a href="/">← 返回设备列表</a>
<h2>车检器测试基准参数管理</h2>
</div>
<div class="fixture-card">
<div class="vbt-header">
<div style="display:flex; gap:8px; align-items:center;">
<input type="text" id="search-input" placeholder="搜索型号/编码..."
style="padding:6px 10px; border:1px solid #ddd; border-radius:4px; font-size:13px; width:200px;"
oninput="loadList()">
</div>
<button class="btn-add" onclick="openModal()">+ 新增</button>
</div>
<table id="vbt-table">
<thead>
<tr>
<th>类型编码</th>
<th>型号/名称</th>
<th>灵敏度范围</th>
<th>频率范围 (Hz)</th>
<th>峰峰值范围</th>
<th>备注</th>
<th>操作</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<!-- 编辑弹窗 -->
<div id="edit-modal" class="modal-overlay" style="display:none;" onclick="if(event.target===this)closeModal()">
<div class="modal-box">
<h3 id="modal-title">新增车检器测试基准</h3>
<div class="modal-form">
<div class="form-group">
<label>类型编码 *</label>
<input type="number" id="edit-type-num" min="0" max="255">
</div>
<div class="form-group">
<label>型号/名称 *</label>
<input type="text" id="edit-dev-name">
</div>
<div class="form-group">
<label>灵敏度最小值</label>
<input type="number" id="edit-sens-min" value="0">
</div>
<div class="form-group">
<label>灵敏度最大值</label>
<input type="number" id="edit-sens-max" value="0">
</div>
<div class="form-group">
<label>频率最小值 (Hz)</label>
<input type="number" id="edit-fre-min" value="0">
</div>
<div class="form-group">
<label>频率最大值 (Hz)</label>
<input type="number" id="edit-fre-max" value="0">
</div>
<div class="form-group">
<label>峰峰值最小值</label>
<input type="number" id="edit-peak-min" value="0">
</div>
<div class="form-group">
<label>峰峰值最大值</label>
<input type="number" id="edit-peak-max" value="0">
</div>
<div class="form-group full">
<label>备注</label>
<textarea id="edit-remark" rows="2" style="resize:vertical;"></textarea>
</div>
</div>
<div class="modal-actions">
<button class="btn-cancel" onclick="closeModal()">取消</button>
<button class="btn-save" onclick="saveRecord()">保存</button>
</div>
</div>
</div>
<div id="toast" class="msg-toast"></div>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/vehicle_base_test.js') }}"></script>
{% endblock %}