diff --git a/furniture-3d-system/src/app/asset-center/packaging-materials/PackagingMaterialsClient.tsx b/furniture-3d-system/src/app/asset-center/packaging-materials/PackagingMaterialsClient.tsx index f928cc78..87a7a002 100644 --- a/furniture-3d-system/src/app/asset-center/packaging-materials/PackagingMaterialsClient.tsx +++ b/furniture-3d-system/src/app/asset-center/packaging-materials/PackagingMaterialsClient.tsx @@ -17,7 +17,6 @@ import { Copy, FolderPlus, ImageIcon, - MoreHorizontal, Package2, Pencil, Plus, @@ -1097,166 +1096,153 @@ export default function PackagingMaterialsClient({
-
- 图片 - 名称 - 编码 - 模板类型 - 规格 - 成本 - 状态 - -
+ + + + + + + + + + + + + + + {visibleVariants.length === 0 ? ( + + + + ) : ( + visibleVariants.map((variant) => { + const family = familyMap.get(variant.assetFamilyId) ?? null + const templateType = readPackagingTemplateType(variant, family) + const template = templateType ? PACKAGING_TEMPLATE_MAP.get(templateType) ?? null : null + const dimensions = (variant.dimensions ?? {}) as Record + const rowComputedCost = (() => { + const businessData = (variant.businessData ?? {}) as Record + const templateFields = + typeof businessData.templateFields === 'object' && businessData.templateFields + ? (businessData.templateFields as Record) + : {} - {visibleVariants.length === 0 ? ( -
- 当前条件下还没有包材记录,可以先新建二级分类,再建包材。 -
- ) : ( -
- {visibleVariants.map((variant) => { - const family = familyMap.get(variant.assetFamilyId) ?? null - const templateType = readPackagingTemplateType(variant, family) - const template = templateType ? PACKAGING_TEMPLATE_MAP.get(templateType) ?? null : null - const dimensions = (variant.dimensions ?? {}) as Record - const rowComputedCost = (() => { - const businessData = (variant.businessData ?? {}) as Record - const templateFields = - typeof businessData.templateFields === 'object' && businessData.templateFields - ? (businessData.templateFields as Record) - : {} + return templateType + ? computePackagingMaterialCost(templateType, templateFields) + : null + })() - return templateType - ? computePackagingMaterialCost(templateType, templateFields) - : null - })() + const specParts: string[] = [] + if (dimensions.length) specParts.push(`${dimensions.length}`) + if (dimensions.width) specParts.push(`${dimensions.width}`) + if (dimensions.height) specParts.push(`${dimensions.height}`) + const specLabel = specParts.length > 0 ? `${specParts.join('×')} mm` : '-' - const specParts: string[] = [] - if (dimensions.length) specParts.push(`${dimensions.length}`) - if (dimensions.width) specParts.push(`${dimensions.width}`) - if (dimensions.height) specParts.push(`${dimensions.height}`) - const specLabel = specParts.length > 0 ? `${specParts.join('×')} mm` : '-' - - return ( -
{ - setSelectedVariantId(variant.id) - setDetailMode('preview') - setEditDraft(null) - setDetailError(null) - }} - onKeyDown={(event) => { - if (event.key === 'Enter' || event.key === ' ') { - event.preventDefault() + return ( +
{ setSelectedVariantId(variant.id) setDetailMode('preview') setEditDraft(null) setDetailError(null) - } - }} - > -
event.stopPropagation()} + }} > -
+ + + + + + + + ) + }) + )} + +
图片名称编码模板类型规格成本状态
+ 当前条件下还没有包材记录,可以先新建二级分类,再建包材。 +
{variant.name}{variant.code}{template?.label ?? '未设置'}{specLabel} + {variant.costPrice != null ? ( + ¥ {variant.costPrice} + ) : rowComputedCost != null ? ( + ¥ {rowComputedCost.toFixed(2)} ) : ( -
- -
+ 缺成本 )} - - -
- {variant.name} -
-
- {variant.code} -
-
- {template?.label ?? '未设置'} -
-
- {specLabel} -
-
- {variant.costPrice != null ? ( - ¥ {variant.costPrice} - ) : rowComputedCost != null ? ( - ¥ {rowComputedCost.toFixed(2)} - ) : ( - 缺成本 - )} -
-
- - {getStatusLabel(variant.status)} - -
-
event.stopPropagation()} - > -
+ + {getStatusLabel(variant.status)} + + event.stopPropagation()} > - - - - - - - ) - })} - - )} +
+ + + +
+