feat(client): 库存表列按原型重排 + 商品列 name/code 合并两行
列序照原型:商品(name+code 两行) · 规格 · 系列 · 批次 · 单价 · 生产日期 · 入库时间 · 供应商 · 仓库 · 备注 · 状态 · 操作。遵项目铁律跳过「库存数量/成本价」 (装箱数脏数据 + 进价敏感),仓库/备注保留为可隐藏列。新增 _productCell (name 加粗可点进详情 + code 等宽 muted,fsXs 走 AppDims)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
@@ -46,18 +46,18 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
|||||||
|
|
||||||
static const _screenId = 'inventory_list';
|
static const _screenId = 'inventory_list';
|
||||||
|
|
||||||
|
// 列序照原型重排;商品 = name+code 合并两行。
|
||||||
|
// 库存量/成本价列按项目铁律不展示(装箱数脏数据 + 进价敏感);仓库/备注作可隐藏列。
|
||||||
static const _colDefs = [
|
static const _colDefs = [
|
||||||
ColDef('code', '商品编码', required: true),
|
ColDef('product', '商品', required: true),
|
||||||
ColDef('name', '商品名称', required: true),
|
|
||||||
ColDef('spec', '规格'),
|
ColDef('spec', '规格'),
|
||||||
ColDef('series', '系列'),
|
ColDef('series', '系列'),
|
||||||
ColDef('batch', '批次号'),
|
ColDef('batch', '批次号'),
|
||||||
ColDef('warehouse', '仓库'),
|
|
||||||
// 库存量列已移除:序列号模型下每件独立,原数量列含历史装箱数脏数据易误导
|
|
||||||
ColDef('price', '单价'),
|
ColDef('price', '单价'),
|
||||||
ColDef('prodDate', '生产日期'),
|
ColDef('prodDate', '生产日期'),
|
||||||
ColDef('inTime', '入库时间'),
|
ColDef('inTime', '入库时间'),
|
||||||
ColDef('supplier', '供应商'),
|
ColDef('supplier', '供应商'),
|
||||||
|
ColDef('warehouse', '仓库'),
|
||||||
ColDef('remark', '备注'),
|
ColDef('remark', '备注'),
|
||||||
ColDef('status', '状态'),
|
ColDef('status', '状态'),
|
||||||
ColDef('actions', '操作', required: true),
|
ColDef('actions', '操作', required: true),
|
||||||
@@ -283,31 +283,44 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 商品列: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)
|
/// 库存查询:宽屏表格单元格(按列 key 返回对应 DataCell)
|
||||||
DataCell _buildInventoryCell(String key, Inventory item, BuildContext context) {
|
DataCell _buildInventoryCell(String key, Inventory item, BuildContext context) {
|
||||||
return switch (key) {
|
return switch (key) {
|
||||||
'code' => DataCell(Text(
|
'product' => DataCell(_productCell(item, context)),
|
||||||
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)),
|
|
||||||
'spec' => DataCell(Text(item.spec.isEmpty ? '-' : item.spec)),
|
'spec' => DataCell(Text(item.spec.isEmpty ? '-' : item.spec)),
|
||||||
'series' => DataCell(Text(item.series.isEmpty ? '-' : item.series)),
|
'series' => DataCell(Text(item.series.isEmpty ? '-' : item.series)),
|
||||||
'batch' => DataCell(Text(item.batchNo.isEmpty ? '-' : item.batchNo,
|
'batch' => DataCell(Text(item.batchNo.isEmpty ? '-' : item.batchNo,
|
||||||
|
|||||||
Reference in New Issue
Block a user