哈哈哈哈哈
This commit is contained in:
44
gui_app.py
44
gui_app.py
@@ -957,10 +957,17 @@ class MainWindow(QMainWindow):
|
|||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# 检查是否符合状态筛选
|
# 检查是否符合状态筛选(使用与 _filter_by_status 相同的匹配逻辑)
|
||||||
if has_status_filter:
|
if has_status_filter:
|
||||||
config_status = config.get('情况', '待执行')
|
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
|
continue
|
||||||
|
|
||||||
# 符合筛选条件,更新勾选状态
|
# 符合筛选条件,更新勾选状态
|
||||||
@@ -983,13 +990,20 @@ class MainWindow(QMainWindow):
|
|||||||
self._suppress_filter_clear_once = True
|
self._suppress_filter_clear_once = True
|
||||||
self.filter_table(self.table_search_input.text())
|
self.filter_table(self.table_search_input.text())
|
||||||
elif has_status_filter:
|
elif has_status_filter:
|
||||||
# 重新应用状态筛选(隐藏不匹配的行)
|
# 重新应用状态筛选(隐藏不匹配的行,使用与 _filter_by_status 相同的匹配逻辑)
|
||||||
for row in range(self.config_table.rowCount()):
|
for row in range(self.config_table.rowCount()):
|
||||||
if row < len(self.page_row_indices):
|
if row < len(self.page_row_indices):
|
||||||
config_index = self.page_row_indices[row]
|
config_index = self.page_row_indices[row]
|
||||||
if config_index < len(self.configs):
|
if config_index < len(self.configs):
|
||||||
config_status = self.configs[config_index].get('情况', '待执行')
|
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:
|
if is_checked:
|
||||||
self._show_infobar("success", "提示", f"已勾选 {visible_count} 行(跨页操作)")
|
self._show_infobar("success", "提示", f"已勾选 {visible_count} 行(跨页操作)")
|
||||||
@@ -1600,6 +1614,13 @@ class MainWindow(QMainWindow):
|
|||||||
suppress_clear = getattr(self, "_suppress_filter_clear_once", False)
|
suppress_clear = getattr(self, "_suppress_filter_clear_once", False)
|
||||||
if suppress_clear:
|
if suppress_clear:
|
||||||
self._suppress_filter_clear_once = False
|
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")
|
if (not suppress_clear and keyword_raw and hasattr(self, "table_select_all_checkbox")
|
||||||
and self.table_select_all_checkbox.isChecked()):
|
and self.table_select_all_checkbox.isChecked()):
|
||||||
@@ -2002,6 +2023,21 @@ class MainWindow(QMainWindow):
|
|||||||
self._show_infobar("warning", "提示", "暂无数据")
|
self._show_infobar("warning", "提示", "暂无数据")
|
||||||
return
|
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)
|
current_filter = getattr(self, '_current_status_filter', None)
|
||||||
if current_filter == status:
|
if current_filter == status:
|
||||||
|
|||||||
Reference in New Issue
Block a user