feat: default workflow batch filters to latest batch

This commit is contained in:
chengma
2026-07-08 10:30:30 +08:00
parent c64f947f2f
commit 530ef2009f
6 changed files with 108 additions and 12 deletions
+9 -4
View File
@@ -375,15 +375,20 @@ class CollectTab(QWidget):
self._update_delete_batch_button()
def _populate_batch_filter(self, batches, selected_batch):
batch_ids = {batch.id for batch in batches}
previous = selected_batch if selected_batch in batch_ids else None
had_previous_items = self.batch_filter.count() > 0
self.batch_filter.blockSignals(True)
self.batch_filter.clear()
self.batch_filter.addItem("全部批次", None)
for batch in batches:
self.batch_filter.addItem(self._batch_label(batch), batch.id)
index = self.batch_filter.findData(previous)
self.batch_filter.setCurrentIndex(index if index >= 0 else 0)
self.batch_filter.setCurrentIndex(
_batch_filter_current_index(
self.batch_filter,
batches,
selected_batch,
had_previous_items,
)
)
self.batch_filter.blockSignals(False)
def _batch_label(self, batch):