From 9bcf650958357f42590f0f65e5345692db251ec4 Mon Sep 17 00:00:00 2001 From: ddrwode <34234@3来 34> Date: Thu, 5 Feb 2026 15:00:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=88=E5=93=88=E5=93=88=E5=93=88=E5=93=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui_app.py | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/gui_app.py b/gui_app.py index 714e895..ac06425 100644 --- a/gui_app.py +++ b/gui_app.py @@ -957,10 +957,17 @@ class MainWindow(QMainWindow): if not match: continue - # 检查是否符合状态筛选 + # 检查是否符合状态筛选(使用与 _filter_by_status 相同的匹配逻辑) if has_status_filter: config_status = config.get('情况', '待执行') - if config_status != self._current_status_filter: + status_match = False + if self._current_status_filter == "成功": + status_match = "完成" in config_status or "成功" in config_status + elif self._current_status_filter == "失败": + status_match = "失败" in config_status or "错误" in config_status + else: + status_match = self._current_status_filter in config_status + if not status_match: continue # 符合筛选条件,更新勾选状态 @@ -983,13 +990,20 @@ class MainWindow(QMainWindow): self._suppress_filter_clear_once = True self.filter_table(self.table_search_input.text()) elif has_status_filter: - # 重新应用状态筛选(隐藏不匹配的行) + # 重新应用状态筛选(隐藏不匹配的行,使用与 _filter_by_status 相同的匹配逻辑) for row in range(self.config_table.rowCount()): if row < len(self.page_row_indices): config_index = self.page_row_indices[row] if config_index < len(self.configs): config_status = self.configs[config_index].get('情况', '待执行') - self.config_table.setRowHidden(row, config_status != self._current_status_filter) + # 使用相同的状态匹配逻辑 + if self._current_status_filter == "成功": + status_match = "完成" in config_status or "成功" in config_status + elif self._current_status_filter == "失败": + status_match = "失败" in config_status or "错误" in config_status + else: + status_match = self._current_status_filter in config_status + self.config_table.setRowHidden(row, not status_match) if is_checked: self._show_infobar("success", "提示", f"已勾选 {visible_count} 行(跨页操作)") @@ -1600,6 +1614,13 @@ class MainWindow(QMainWindow): suppress_clear = getattr(self, "_suppress_filter_clear_once", False) if suppress_clear: self._suppress_filter_clear_once = False + # 清除状态筛选,确保每次筛选都基于全量数据 + if hasattr(self, '_current_status_filter') and self._current_status_filter: + self._current_status_filter = None + # 先显示所有行,再根据文本筛选 + if not self.use_model_view and hasattr(self, 'config_table'): + for row in range(self.config_table.rowCount()): + self.config_table.setRowHidden(row, False) # 如果先全选再进行筛选,先清空勾选,避免隐藏行仍保持勾选 if (not suppress_clear and keyword_raw and hasattr(self, "table_select_all_checkbox") and self.table_select_all_checkbox.isChecked()): @@ -2002,6 +2023,21 @@ class MainWindow(QMainWindow): self._show_infobar("warning", "提示", "暂无数据") return + # 清除文本筛选,确保每次筛选都基于全量数据 + if hasattr(self, 'table_search_input') and self.table_search_input.text().strip(): + self.table_search_input.blockSignals(True) + self.table_search_input.clear() + self.table_search_input.blockSignals(False) + # 清除高亮和显示所有行 + for row in range(self.config_table.rowCount()): + for col in range(self.config_table.columnCount()): + item = self.config_table.item(row, col) + if item: + item.setBackground(self._default_color()) + self.config_table.setRowHidden(row, False) + self.table_match_rows = [] + self.table_match_index = -1 + # 切换筛选状态 current_filter = getattr(self, '_current_status_filter', None) if current_filter == status: