From ad0081f6923056d1699f23b8a86caaf342438cb2 Mon Sep 17 00:00:00 2001 From: WuYongJie Date: Mon, 8 Jun 2026 17:49:31 +0800 Subject: [PATCH] refactor(intake): extract non-integrated workspace panel config --- .../NonIntegratedDetailClient.tsx | 83 ++++--------------- .../non-integrated/workspacePanelConfig.ts | 73 ++++++++++++++++ 2 files changed, 88 insertions(+), 68 deletions(-) create mode 100644 furniture-3d-system/src/app/intake/non-integrated/workspacePanelConfig.ts diff --git a/furniture-3d-system/src/app/intake/non-integrated/NonIntegratedDetailClient.tsx b/furniture-3d-system/src/app/intake/non-integrated/NonIntegratedDetailClient.tsx index a46fbb92..f25b32e9 100644 --- a/furniture-3d-system/src/app/intake/non-integrated/NonIntegratedDetailClient.tsx +++ b/furniture-3d-system/src/app/intake/non-integrated/NonIntegratedDetailClient.tsx @@ -439,6 +439,21 @@ import { PLANNING_LAYOUT_STYLE_TONE_OPTIONS, normalizeMaterialTypeOption, } from "./planningLayoutConfig"; +import { + FACTORY_QUALITY_ASSET_TYPE_LABELS, + FIRST_QUALITY_WORKSPACE_PANEL_OPTIONS, + INSTALLATION_ASSET_TYPE_LABELS, + INSTALLATION_ASSET_TYPE_OPTIONS, + INSTALLATION_SHARED_STYLE_KEY, + PACKAGING_DRAWING_ASSET_TYPE, + PACKAGING_OUTER_PACKAGING_PRESETS, + PACKAGING_WORKSPACE_PANEL_OPTIONS, + type DetectionWorkspacePanel, + type FirstQualityWorkspacePanel, + type PackagingAssetType, + type PackagingInnerItemFieldKey, + type PackagingWorkspacePanel, +} from "./workspacePanelConfig"; import { findBestMaterialFinish, getPlanningLayoutHundredPriceBand, @@ -583,8 +598,6 @@ type LinkEntryProductPatentDashboardComponent = ComponentType<{ target?: ProductPatentLedgerTarget; readOnly?: boolean; }>; -type PackagingWorkspacePanel = "packaging"; -type FirstQualityWorkspacePanel = "firstQuality" | "qualityStandard"; type UploadProgressState = { fileName: string; completedFiles: number; @@ -595,7 +608,6 @@ type UploadProgressState = { type DownloadProgressState = UploadProgressState & { phase: "fetching" | "zipping"; }; -type PackagingAssetType = "inner-drawing"; type DetectionWorkspaceAssetType = NonIntegratedDetectionAssetType; type InstallationStyleEntry = { @@ -829,11 +841,6 @@ type StyleDetailForm = { packagingModel3dUvConfig: AssetVariantUvConfig | null; }; -type PackagingInnerItemFieldKey = Exclude< - keyof NonIntegratedPackagingInnerItem, - "id" ->; - type ReviewSheetFieldKey = Exclude; type ReviewIssueFieldKey = Exclude< keyof NonIntegratedReviewIssue, @@ -846,10 +853,6 @@ type ReviewIssueFieldKey = Exclude< | "referenceImages" >; type ReviewIssueImageTarget = "issue" | "reference"; -type DetectionWorkspacePanel = - | "attachments" - | "quality-standard" - | "quality-sheet"; type BomDetailState = { rows: NonIntegratedBomRow[]; hiddenRowIds: string[]; @@ -885,31 +888,6 @@ const AUTO_COMPLETED_WORKFLOW_CATEGORIES = new Set([ ]); const FACTORY_QUALITY_WORKSPACE_CATEGORY: DocumentWorkspaceCategory = "工厂质检"; -const PACKAGING_WORKSPACE_PANEL_OPTIONS: Array<{ - key: PackagingWorkspacePanel; - label: string; -}> = [ - { key: "packaging", label: "包装资料" }, -]; -const FIRST_QUALITY_WORKSPACE_PANEL_OPTIONS: Array<{ - key: FirstQualityWorkspacePanel; - label: string; -}> = [ - { key: "firstQuality", label: "首批质检" }, - { key: "qualityStandard", label: "质检标准" }, -]; -const INSTALLATION_SHARED_STYLE_KEY = "__shared__"; -const INSTALLATION_ASSET_TYPE_LABELS: Record = { - drawing: "安装图纸", - video: "安装视频", -}; -const FACTORY_QUALITY_ASSET_TYPE_LABELS: Record< - FactoryQualityAssetType, - string -> = { - "drop-image": "质检附件", - "drop-video": "质检视频", -}; const QUALITY_INSPECTION_ROW_FIELD_KEYS = [ ...QUALITY_INSPECTION_EDITABLE_FIELD_KEYS, ...QUALITY_INSPECTION_IMAGE_FIELD_KEYS, @@ -917,37 +895,6 @@ const QUALITY_INSPECTION_ROW_FIELD_KEYS = [ const QUALITY_INSPECTION_METRICS_WITH_IMAGE_SLOT_SET = new Set( QUALITY_INSPECTION_METRIC_KEYS_WITH_IMAGE_SLOT, ); -const PACKAGING_DRAWING_ASSET_TYPE: PackagingAssetType = "inner-drawing"; -const PACKAGING_OUTER_PACKAGING_PRESETS = ["中开包", "天地盖", "其他"] as const; -const PACKAGING_INNER_ITEM_COLUMNS: { - key: PackagingInnerItemFieldKey; - label: string; - placeholder: string; -}[] = [ - { key: "materialName", label: "包材名称", placeholder: "如:泡沫、丝棉纸" }, - { key: "specification", label: "规格说明", placeholder: "可填写尺寸或型号" }, - { key: "quantity", label: "数量", placeholder: "请输入数量" }, - { key: "unit", label: "单位", placeholder: "如:张、套、块" }, - { key: "remark", label: "备注", placeholder: "可填写使用位置或补充说明" }, -]; -const INSTALLATION_ASSET_TYPE_OPTIONS: { - key: InstallationAssetType; - label: string; - emptyDescription: string; - accept?: string; -}[] = [ - { - key: "drawing", - label: "安装图纸", - emptyDescription: "可上传 PDF、图片或文档,作为当前款式的安装资料。", - }, - { - key: "video", - label: "安装视频", - emptyDescription: "可上传 MP4、MOV 等安装视频,作为当前款式的演示资料。", - accept: "video/*,.mp4,.mov,.m4v,.avi,.wmv,.webm,.mkv", - }, -]; type BomDetailMap = Record; const NON_INTEGRATED_BOM_DRAFT_STORAGE_KEY_PREFIX = "intake.nonIntegratedBomDraft"; diff --git a/furniture-3d-system/src/app/intake/non-integrated/workspacePanelConfig.ts b/furniture-3d-system/src/app/intake/non-integrated/workspacePanelConfig.ts new file mode 100644 index 00000000..3987ed87 --- /dev/null +++ b/furniture-3d-system/src/app/intake/non-integrated/workspacePanelConfig.ts @@ -0,0 +1,73 @@ +import type { NonIntegratedPackagingInnerItem } from "./nonIntegratedStorage"; +import type { + FactoryQualityAssetType, + InstallationAssetType, +} from "./styleFileHelpers"; + +export type PackagingWorkspacePanel = "packaging"; +export type FirstQualityWorkspacePanel = "firstQuality" | "qualityStandard"; +export type PackagingInnerItemFieldKey = Exclude< + keyof NonIntegratedPackagingInnerItem, + "id" +>; +export type DetectionWorkspacePanel = + | "attachments" + | "quality-standard" + | "quality-sheet"; +export const PACKAGING_WORKSPACE_PANEL_OPTIONS: Array<{ + key: PackagingWorkspacePanel; + label: string; +}> = [ + { key: "packaging", label: "包装资料" }, +]; +export const FIRST_QUALITY_WORKSPACE_PANEL_OPTIONS: Array<{ + key: FirstQualityWorkspacePanel; + label: string; +}> = [ + { key: "firstQuality", label: "首批质检" }, + { key: "qualityStandard", label: "质检标准" }, +]; +export const INSTALLATION_SHARED_STYLE_KEY = "__shared__"; +export const INSTALLATION_ASSET_TYPE_LABELS: Record = { + drawing: "安装图纸", + video: "安装视频", +}; +export const FACTORY_QUALITY_ASSET_TYPE_LABELS: Record< + FactoryQualityAssetType, + string +> = { + "drop-image": "质检附件", + "drop-video": "质检视频", +}; +export type PackagingAssetType = "inner-drawing"; +export const PACKAGING_DRAWING_ASSET_TYPE: PackagingAssetType = "inner-drawing"; +export const PACKAGING_OUTER_PACKAGING_PRESETS = ["中开包", "天地盖", "其他"] as const; +export const PACKAGING_INNER_ITEM_COLUMNS: { + key: PackagingInnerItemFieldKey; + label: string; + placeholder: string; +}[] = [ + { key: "materialName", label: "包材名称", placeholder: "如:泡沫、丝棉纸" }, + { key: "specification", label: "规格说明", placeholder: "可填写尺寸或型号" }, + { key: "quantity", label: "数量", placeholder: "请输入数量" }, + { key: "unit", label: "单位", placeholder: "如:张、套、块" }, + { key: "remark", label: "备注", placeholder: "可填写使用位置或补充说明" }, +]; +export const INSTALLATION_ASSET_TYPE_OPTIONS: { + key: InstallationAssetType; + label: string; + emptyDescription: string; + accept?: string; +}[] = [ + { + key: "drawing", + label: "安装图纸", + emptyDescription: "可上传 PDF、图片或文档,作为当前款式的安装资料。", + }, + { + key: "video", + label: "安装视频", + emptyDescription: "可上传 MP4、MOV 等安装视频,作为当前款式的演示资料。", + accept: "video/*,.mp4,.mov,.m4v,.avi,.wmv,.webm,.mkv", + }, +];