fix: hide Production ID source controls when admin selects full table validation

When admin user selects "database_full" mode, the Production ID source
selection controls should be hidden since full table validation doesn't
need Production IDs. Changed source_frame from local variable to instance
attribute to enable proper show/hide functionality.

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-26 15:52:54 +08:00
parent 2a784e66c0
commit c76ea31fcb

View File

@@ -363,13 +363,13 @@ class MaterialValidationTab(ttk.Frame):
# Production ID 数据源(仅 Admin # Production ID 数据源(仅 Admin
if self.session_manager.is_admin(): if self.session_manager.is_admin():
source_frame = ttk.Frame(parent) self.source_frame = ttk.Frame(parent)
source_frame.pack(fill=tk.X, pady=5) self.source_frame.pack(fill=tk.X, pady=5)
# Production ID 数据源选择 # Production ID 数据源选择
self.production_id_source_var = tk.StringVar(value="shared") self.production_id_source_var = tk.StringVar(value="shared")
ttk.Radiobutton( ttk.Radiobutton(
source_frame, self.source_frame,
text="使用文件:", text="使用文件:",
variable=self.production_id_source_var, variable=self.production_id_source_var,
value="file", value="file",
@@ -377,7 +377,7 @@ class MaterialValidationTab(ttk.Frame):
).pack(side=tk.LEFT) ).pack(side=tk.LEFT)
ttk.Radiobutton( ttk.Radiobutton(
source_frame, self.source_frame,
text="使用数据提取页面的 Production ID:", text="使用数据提取页面的 Production ID:",
variable=self.production_id_source_var, variable=self.production_id_source_var,
value="shared", value="shared",
@@ -542,15 +542,20 @@ class MaterialValidationTab(ttk.Frame):
mode = self.source_mode.get() mode = self.source_mode.get()
# 根据模式显示 Production ID 数据源选择(仅 Admin
if mode == "database_full": if mode == "database_full":
# 全表模式:隐藏 Production ID 选择区域 # 全表模式:隐藏所有 Production ID 相关控件
if hasattr(self, 'source_frame'): if hasattr(self, 'source_frame') and self.source_frame:
self.source_frame.pack_forget() self.source_frame.pack_forget()
if hasattr(self, 'db_filtered_production_id_selector'):
self.db_filtered_production_id_selector.pack_forget()
if hasattr(self, 'shared_ids_info_label'):
self.shared_ids_info_label.pack_forget()
elif mode == "database_filtered": elif mode == "database_filtered":
# 过滤模式:显示 Production ID 选择区域 # 过滤模式:显示数据源选择
if hasattr(self, 'source_frame'): if hasattr(self, 'source_frame') and self.source_frame:
self.source_frame.pack(fill=tk.X, pady=5) self.source_frame.pack(fill=tk.X, pady=5)
# 根据 Production ID 数据源选择显示对应控件
self._on_production_id_source_changed()
def _on_production_id_source_changed(self): def _on_production_id_source_changed(self):
"""Production ID 数据源切换回调(仅 Admin 模式)""" """Production ID 数据源切换回调(仅 Admin 模式)"""