From 8e5cc5054d76157c3aaa05b4267bf6e01f721a08 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Thu, 25 Jun 2026 10:05:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(client):=20=E5=BA=93=E5=AD=98=E8=A1=A8?= =?UTF-8?q?=E5=88=97=E6=8C=89=E5=8E=9F=E5=9E=8B=E9=87=8D=E6=8E=92=20+=20?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=20name/code=20=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E4=B8=A4=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 列序照原型:商品(name+code 两行) · 规格 · 系列 · 批次 · 单价 · 生产日期 · 入库时间 · 供应商 · 仓库 · 备注 · 状态 · 操作。遵项目铁律跳过「库存数量/成本价」 (装箱数脏数据 + 进价敏感),仓库/备注保留为可隐藏列。新增 _productCell (name 加粗可点进详情 + code 等宽 muted,fsXs 走 AppDims)。 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX --- .../inventory/inventory_list_screen.dart | 65 +++++++++++-------- 1 file changed, 39 insertions(+), 26 deletions(-) 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,