diff --git a/client/lib/screens/inventory/inventory_list_screen.dart b/client/lib/screens/inventory/inventory_list_screen.dart index f960841..7332a07 100644 --- a/client/lib/screens/inventory/inventory_list_screen.dart +++ b/client/lib/screens/inventory/inventory_list_screen.dart @@ -46,18 +46,18 @@ class _InventoryListScreenState extends ConsumerState { static const _screenId = 'inventory_list'; + // 列序照原型重排;商品 = name+code 合并两行。 + // 库存量/成本价列按项目铁律不展示(装箱数脏数据 + 进价敏感);仓库/备注作可隐藏列。 static const _colDefs = [ - ColDef('code', '商品编码', required: true), - ColDef('name', '商品名称', required: true), + ColDef('product', '商品', required: true), ColDef('spec', '规格'), ColDef('series', '系列'), ColDef('batch', '批次号'), - ColDef('warehouse', '仓库'), - // 库存量列已移除:序列号模型下每件独立,原数量列含历史装箱数脏数据易误导 ColDef('price', '单价'), ColDef('prodDate', '生产日期'), ColDef('inTime', '入库时间'), ColDef('supplier', '供应商'), + ColDef('warehouse', '仓库'), ColDef('remark', '备注'), ColDef('status', '状态'), ColDef('actions', '操作', required: true), @@ -283,31 +283,44 @@ class _InventoryListScreenState extends ConsumerState { ); } + /// 商品列:name(可点进详情)+ code 两行(还原原型 .pname/.pcode)。 + Widget _productCell(Inventory item, BuildContext context) { + final linked = item.productId != null; + final body = Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + item.productName.isEmpty ? '-' : item.productName, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: FontWeight.w600, + color: linked ? context.tokens.primary : context.tokens.text, + ), + ), + if (item.productCode.isNotEmpty) + Text( + item.productCode, + style: TextStyle( + fontFamily: 'monospace', + fontSize: AppDims.fsXs, + color: context.tokens.muted, + ), + ), + ], + ); + final cell = SizedBox(width: 200, child: body); + if (!linked) return cell; + return GestureDetector( + onTap: () => context.push('/products/${item.productId}'), + child: cell, + ); + } + /// 库存查询:宽屏表格单元格(按列 key 返回对应 DataCell) DataCell _buildInventoryCell(String key, Inventory item, BuildContext context) { return switch (key) { - 'code' => DataCell(Text( - item.productCode.isEmpty ? '-' : item.productCode, - style: TextStyle( - fontFamily: 'monospace', fontSize: 12, color: context.tokens.muted))), - 'name' => DataCell(item.productId != null - ? GestureDetector( - onTap: () => context.push('/products/${item.productId}'), - child: SizedBox( - width: 180, - child: Text( - item.productName.isEmpty ? '-' : item.productName, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: context.tokens.primary, - decoration: TextDecoration.underline, - decorationColor: context.tokens.primary, - ), - ), - ), - ) - : Text(item.productName.isEmpty ? '-' : item.productName, - overflow: TextOverflow.ellipsis)), + 'product' => DataCell(_productCell(item, context)), 'spec' => DataCell(Text(item.spec.isEmpty ? '-' : item.spec)), 'series' => DataCell(Text(item.series.isEmpty ? '-' : item.series)), 'batch' => DataCell(Text(item.batchNo.isEmpty ? '-' : item.batchNo,