Files
vd_test_fixture/edc-web/app/templates/test_data.html
wangfq 000e4f8d3a feat: 增加 manager 角色,admin+manager 共享管理权限(用户管理除外),所有用户可自行修改密码
- auth.py: 新增 privileged_required 装饰器 (admin+manager),admin_required 仅限用户管理
- 路由权限: fixture/logs/device_logs/test_data 的 admin 检查改为 admin+manager
- 前端: 导航栏/删除按钮/配置按钮扩展为 admin+manager 可见
- 用户管理: 角色下拉增加 manager 选项,仍仅 admin 可访问
- 新增 /change-password 路由+模板,所有登录用户可自行修改密码
- edc_server models.py: role COMMENT 更新 + ALTER TABLE 迁移
2026-06-11 09:11:54 +08:00

100 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% block title %}测试信息 - EDC 工装管理系统{% endblock %}
{% block content %}
<h2>测试信息</h2>
<div class="view-tabs">
<button id="tab-all" class="tab-btn active" onclick="switchView('all')">全部数据</button>
<button id="tab-b2" class="tab-btn" onclick="switchView('b2')">灵敏度测试 (0xB2)</button>
<button id="tab-b4" class="tab-btn" onclick="switchView('b4')">波动测试 (0xB4)</button>
</div>
<div class="search-bar">
<label>
设备编码:
<input type="text" id="search-serial" placeholder="输入设备编码搜索...">
</label>
<label>
时间范围:
<input type="date" id="search-date-from">
<input type="time" id="search-time-from" step="1" style="width:110px;" title="起始时间(时:分:秒)">
<input type="date" id="search-date-to">
<input type="time" id="search-time-to" step="1" style="width:110px;" title="截止时间(时:分:秒)">
</label>
<button onclick="searchData(1)" class="btn-search">搜索</button>
<button onclick="exportCSV()" class="btn-export">导出 CSV</button>
<label style="margin-left:16px;">
每页:
<select id="per-page" onchange="searchData(1)" style="width:70px;">
<option value="20">20</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</label>
<button id="btn-chart" class="btn-chart" onclick="toggleChart()">📈 图表</button>
{% if current_user.role in ('admin', 'manager') %}
<button id="btn-delete" class="btn-delete" onclick="confirmDelete()">🗑 删除</button>
{% endif %}
</div>
<div id="chart-container" style="display:none; width:100%; height:500px; margin-bottom:16px;"></div>
<div style="overflow-x:auto; max-width:100%; -webkit-overflow-scrolling:touch;">
<table id="test-data-table">
<thead></thead>
<tbody></tbody>
</table>
</div>
<div class="pagination" id="pagination"></div>
{% endblock %}
{% block scripts %}
<style>
.view-tabs { margin-bottom: 16px; display: flex; gap: 8px; }
.tab-btn {
padding: 8px 20px;
border: 1px solid #ccc;
background: #f5f5f5;
cursor: pointer;
border-radius: 4px 4px 0 0;
font-size: 14px;
transition: all .2s;
}
.tab-btn.active {
background: #2c3e50;
color: #fff;
border-color: #2c3e50;
}
.tab-btn:hover:not(.active) { background: #e0e0e0; }
.btn-chart {
margin-left: 16px;
padding: 6px 14px;
border: 1px solid #27ae60;
background: #fff;
color: #27ae60;
cursor: pointer;
border-radius: 4px;
font-size: 13px;
}
.btn-chart.active { background: #27ae60; color: #fff; }
.btn-delete {
margin-left: 8px;
padding: 6px 14px;
border: 1px solid #e74c3c;
background: #fff;
color: #e74c3c;
cursor: pointer;
border-radius: 4px;
font-size: 13px;
}
.btn-delete:hover { background: #e74c3c; color: #fff; }
#test-data-table th,
#test-data-table td { white-space: nowrap; }
</style>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.0/dist/echarts.min.js"></script>
<script src="{{ url_for('static', filename='js/test_data.js') }}"></script>
{% endblock %}