refactor: 测试信息页拆为三视图(全部/B2/B4),按data_source自动切换列

- 移除混杂的24列大表,改为三个标签页切换
- 全部视图: 精简核心字段
- B2视图: 峰峰值、频率、距离、速度、故障、完成状态
- B4视图: 剩余次数、当前距离、速度、波动范围、进入/离开高度
- 后端增加data_source查询/导出参数支持
This commit is contained in:
wangfq
2026-06-03 17:02:27 +08:00
parent a69d7ab1d0
commit d00d199558
4 changed files with 168 additions and 77 deletions
+12 -2
View File
@@ -151,10 +151,12 @@ def get_latest_test_state(dnt_id: int) -> dict | None:
def get_test_data(page: int = 1, per_page: int = 20,
serial: str = "", date_from: str = "",
date_to: str = "", test_mode: str = "") -> tuple[list[dict], int]:
date_to: str = "", test_mode: str = "",
data_source: str = "") -> tuple[list[dict], int]:
"""分页查询测试数据(JOIN dnt_info),返回 (records, total)
test_mode: ''=全部, '0'=灵敏度, '1'=波动
data_source: ''=全部, 'B2', 'B4'
"""
conn = get_conn()
try:
@@ -173,6 +175,9 @@ def get_test_data(page: int = 1, per_page: int = 20,
if test_mode:
where.append("t.test_mode = %s")
params.append(int(test_mode))
if data_source:
where.append("t.data_source = %s")
params.append(data_source)
where_clause = " AND ".join(where) if where else "1=1"
@@ -201,10 +206,12 @@ def get_test_data(page: int = 1, per_page: int = 20,
def get_all_test_data_for_export(serial: str = "", date_from: str = "",
date_to: str = "", test_mode: str = "") -> list[dict]:
date_to: str = "", test_mode: str = "",
data_source: str = "") -> list[dict]:
"""导出全部数据
test_mode: ''=全部, '0'=灵敏度, '1'=波动
data_source: ''=全部, 'B2', 'B4'
"""
conn = get_conn()
try:
@@ -223,6 +230,9 @@ def get_all_test_data_for_export(serial: str = "", date_from: str = "",
if test_mode:
where.append("t.test_mode = %s")
params.append(int(test_mode))
if data_source:
where.append("t.data_source = %s")
params.append(data_source)
where_clause = " AND ".join(where) if where else "1=1"
cur.execute(