feat(client): 名称/系列/规格可搜索下拉 + 修复打印状态提示
- 新增 SearchableOptionField 组件:点击弹出带搜索框的对话框,支持实时过滤 - 入库/出库表单名称、系列、规格列全部替换为可搜索选择器 - 打印按钮加步骤状态提示(正在准备字体→生成PDF→打开打印)+ catch 错误展示 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import '../../providers/product_provider.dart';
|
||||
import '../../providers/inventory_provider.dart';
|
||||
import '../../providers/stock_in_provider.dart';
|
||||
import '../../providers/warehouse_provider.dart';
|
||||
import '../../widgets/searchable_option_field.dart';
|
||||
|
||||
class StockInFormScreen extends ConsumerStatefulWidget {
|
||||
final int? editOrderId;
|
||||
@@ -515,24 +516,18 @@ class _StockInFormScreenState extends ConsumerState<StockInFormScreen> {
|
||||
child: asyncNames.when(
|
||||
loading: () => const LinearProgressIndicator(),
|
||||
error: (_, __) => const Text('加载失败'),
|
||||
data: (names) => DropdownButtonFormField<int>(
|
||||
value: item.selectedNameId,
|
||||
hint: const Text('选择名称', style: TextStyle(fontSize: 12)),
|
||||
isExpanded: true,
|
||||
items: names
|
||||
.map((o) => DropdownMenuItem(
|
||||
value: o.id,
|
||||
child: Text(o.name,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis)))
|
||||
data: (names) => SearchableOptionField(
|
||||
options: names
|
||||
.map((o) => OptionItem(id: o.id, name: o.name, code: o.code))
|
||||
.toList(),
|
||||
selectedId: item.selectedNameId,
|
||||
hint: '选择名称',
|
||||
dialogTitle: '选择商品名称',
|
||||
isRequired: true,
|
||||
onChanged: (v) => setState(() {
|
||||
item.selectedNameId = v;
|
||||
item.productId = null;
|
||||
}),
|
||||
validator: (v) => v == null ? '请选择' : null,
|
||||
decoration: const InputDecoration(isDense: true),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.black87),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -542,23 +537,17 @@ class _StockInFormScreenState extends ConsumerState<StockInFormScreen> {
|
||||
child: asyncSeries.when(
|
||||
loading: () => const LinearProgressIndicator(),
|
||||
error: (_, __) => const Text('加载失败'),
|
||||
data: (series) => DropdownButtonFormField<int>(
|
||||
value: item.selectedSeriesId,
|
||||
hint: const Text('选择系列', style: TextStyle(fontSize: 12)),
|
||||
isExpanded: true,
|
||||
items: series
|
||||
.map((o) => DropdownMenuItem(
|
||||
value: o.id,
|
||||
child: Text(o.name,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis)))
|
||||
data: (series) => SearchableOptionField(
|
||||
options: series
|
||||
.map((o) => OptionItem(id: o.id, name: o.name, code: o.code))
|
||||
.toList(),
|
||||
selectedId: item.selectedSeriesId,
|
||||
hint: '选择系列',
|
||||
dialogTitle: '选择系列',
|
||||
onChanged: (v) => setState(() {
|
||||
item.selectedSeriesId = v;
|
||||
item.productId = null;
|
||||
}),
|
||||
decoration: const InputDecoration(isDense: true),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.black87),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -568,24 +557,18 @@ class _StockInFormScreenState extends ConsumerState<StockInFormScreen> {
|
||||
child: asyncSpecs.when(
|
||||
loading: () => const LinearProgressIndicator(),
|
||||
error: (_, __) => const Text('加载失败'),
|
||||
data: (specs) => DropdownButtonFormField<int>(
|
||||
value: item.selectedSpecId,
|
||||
hint: const Text('选择规格', style: TextStyle(fontSize: 12)),
|
||||
isExpanded: true,
|
||||
items: specs
|
||||
.map((o) => DropdownMenuItem(
|
||||
value: o.id,
|
||||
child: Text(o.name,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
overflow: TextOverflow.ellipsis)))
|
||||
data: (specs) => SearchableOptionField(
|
||||
options: specs
|
||||
.map((o) => OptionItem(id: o.id, name: o.name, code: o.code))
|
||||
.toList(),
|
||||
selectedId: item.selectedSpecId,
|
||||
hint: '选择规格',
|
||||
dialogTitle: '选择规格',
|
||||
isRequired: true,
|
||||
onChanged: (v) => setState(() {
|
||||
item.selectedSpecId = v;
|
||||
item.productId = null;
|
||||
}),
|
||||
validator: (v) => v == null ? '请选择' : null,
|
||||
decoration: const InputDecoration(isDense: true),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.black87),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user