第一步优化勾选功能

This commit is contained in:
27942
2026-02-05 00:24:34 +08:00
parent 24692ab0f5
commit 4219c2fb58

View File

@@ -459,11 +459,12 @@ class MainWindow(QMainWindow):
self.table_clear_btn = PushButton("清空筛选")
self.table_clear_btn.clicked.connect(self._clear_filter_and_selection)
search_row.addWidget(self.table_clear_btn)
update_row.addSpacing(20)
self.table_export_all_btn = PushButton("导出全部")
self.table_export_all_btn.clicked.connect(self.export_all_rows)
search_row.addWidget(self.table_export_all_btn)
self.table_select_count = QLabel("已选: 0")
self.table_select_count.setStyleSheet("color: #666; font-size: 10px;")
self.table_select_count.setStyleSheet("color: #666; font-weight: bold;")
search_row.addWidget(self.table_select_count)
table_layout.addLayout(search_row)
@@ -2026,10 +2027,10 @@ class MainWindow(QMainWindow):
def _update_status_statistics(self):
"""更新状态统计(成功/失败/待执行数量)- 统计所有配置的真实状态
待执行:所有状态不是"已完成"的数据(包括"待执行""失败"的),表示还需要处理的任务数
待执行:勾选的且状态不是"已完成"的数据,表示用户选择要处理的任务数
执行中只有在任务运行时才有值任务完成后为0
成功:状态为"已完成"的数据数量
失败:状态为"失败"的数据数量
失败:状态为"失败/跳过/过期"的数据数量
"""
if not hasattr(self, 'configs') or not self.configs:
self.set_status_cards(pending=0, running=0, success=0, failed=0)
@@ -2042,13 +2043,19 @@ class MainWindow(QMainWindow):
# 统计所有配置的状态(根据数据总量来统计)
for config in self.configs:
status = config.get('情况', '待执行')
is_checked = config.get('勾选', False)
if "完成" in status or "成功" in status:
success_count += 1
elif "失败" in status or "错误" in status:
elif "失败" in status or "错误" in status or "过期" in status or "跳过" in status:
failed_count += 1
pending_count += 1 # 失败的也算待执行(需要重试)
# 只有勾选的失败项才算待执行
if is_checked:
pending_count += 1
elif "" in status or not status:
pending_count += 1
# 只有勾选的待执行项才算待执行
if is_checked:
pending_count += 1
# 执行中始终为0只有任务运行时才会被单独更新
self.set_status_cards(pending=pending_count, running=0, success=success_count, failed=failed_count)
@@ -2063,7 +2070,7 @@ class MainWindow(QMainWindow):
failed_indices = []
for idx, config in enumerate(self.configs):
status = config.get('情况', '')
if "失败" in status or "错误" in status:
if "失败" in status or "错误" in status or "过期" in status or "跳过" in status:
failed_indices.append(idx)
if not failed_indices:
@@ -2104,7 +2111,7 @@ class MainWindow(QMainWindow):
failed_configs = []
for config in self.configs:
status = config.get('情况', '')
if "失败" in status or "错误" in status:
if "失败" in status or "错误" in status or "过期" in status or "跳过" in status:
failed_configs.append(config)
return failed_configs
@@ -3223,7 +3230,7 @@ class MainWindow(QMainWindow):
failed_indices = []
for idx, cfg in enumerate(self.configs):
status = cfg.get('情况', '')
if "失败" in status or "错误" in status:
if "失败" in status or "错误" in status or "过期" in status or "跳过" in status:
failed_indices.append(idx)
if failed_indices:
for idx, cfg in enumerate(self.configs):
@@ -3264,7 +3271,7 @@ class MainWindow(QMainWindow):
status = config.get('情况', '待执行')
if "完成" in status or "成功" in status:
existing_success += 1
elif "失败" in status or "错误" in status:
elif "失败" in status or "错误" in status or "过期" in status or "跳过" in status:
existing_failed += 1
existing_pending += 1 # 失败的也算待执行
elif "" in status or not status:
@@ -3324,7 +3331,7 @@ class MainWindow(QMainWindow):
status = config.get('情况', '待执行')
if "完成" in status or "成功" in status:
existing_success += 1
elif "失败" in status or "错误" in status:
elif "失败" in status or "错误" in status or "过期" in status or "跳过" in status:
existing_failed += 1
existing_pending += 1 # 失败的也算待执行
elif "" in status or not status:
@@ -3468,6 +3475,9 @@ class MainWindow(QMainWindow):
if matching_idx is not None:
self._update_table_status(matching_idx, "已跳过(定时过期)", is_config_index=True)
self.configs[matching_idx]['情况'] = '已跳过(定时过期)'
# 跳过视为失败,更新失败统计
self.batch_failed_count = getattr(self, "batch_failed_count", 0) + 1
self.set_status_cards(failed=self.batch_failed_count)
j += 1
continue
video_batch.append(f)
@@ -3521,6 +3531,9 @@ class MainWindow(QMainWindow):
if matching_idx is not None:
self._update_table_status(matching_idx, "已跳过(定时过期)", is_config_index=True)
self.configs[matching_idx]['情况'] = '已跳过(定时过期)'
# 跳过视为失败,更新失败统计
self.batch_failed_count = getattr(self, "batch_failed_count", 0) + 1
self.set_status_cards(failed=self.batch_failed_count)
i += 1
continue
@@ -3552,6 +3565,9 @@ class MainWindow(QMainWindow):
if matching_idx is not None:
self._update_table_status(matching_idx, "已跳过(定时过期)", is_config_index=True)
self.configs[matching_idx]['情况'] = '已跳过(定时过期)'
# 跳过视为失败,更新失败统计
self.batch_failed_count = getattr(self, "batch_failed_count", 0) + 1
self.set_status_cards(failed=self.batch_failed_count)
i += 1
continue