fix(client): 修复标签打印预览三个问题
- 打印完成后自动关闭预览弹窗 - 打印机列表改为仅显示热敏打印机,无热敏打印机时显示"无打印机可用"并禁用打印按钮 - 库存列表表格行"打标签"按钮改为调用预览弹窗(之前仍走旧直接打印逻辑) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@ class _LabelPreviewDialogState extends State<LabelPreviewDialog> {
|
||||
List<String> _printers = [];
|
||||
String? _printer;
|
||||
bool _printing = false;
|
||||
bool _printersChecked = false;
|
||||
String _status = '';
|
||||
|
||||
@override
|
||||
@@ -63,6 +64,7 @@ class _LabelPreviewDialogState extends State<LabelPreviewDialog> {
|
||||
setState(() {
|
||||
_printers = printers;
|
||||
_printer = selected;
|
||||
_printersChecked = true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -147,6 +149,7 @@ class _LabelPreviewDialogState extends State<LabelPreviewDialog> {
|
||||
_printing = false;
|
||||
_status = '完成,共打印 $done 张';
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,8 +332,9 @@ class _LabelPreviewDialogState extends State<LabelPreviewDialog> {
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: _printers.isEmpty
|
||||
? const Text('检测中或未检测到打印机...',
|
||||
style: TextStyle(
|
||||
? Text(
|
||||
_printersChecked ? '无打印机可用' : '正在检测打印机...',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppTheme.textSecondary))
|
||||
: DropdownButtonHideUnderline(
|
||||
@@ -419,7 +423,9 @@ class _LabelPreviewDialogState extends State<LabelPreviewDialog> {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
FilledButton(
|
||||
onPressed: (_printing || totalCount == 0) ? null : _doPrint,
|
||||
onPressed: (_printing || totalCount == 0 || _printer == null)
|
||||
? null
|
||||
: _doPrint,
|
||||
child: Text(
|
||||
_printing ? '打印中...' : '打印 $totalCount 张'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user