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 811c7de8..71757a75 100644 --- a/furniture-3d-system/src/app/intake/non-integrated/NonIntegratedDetailClient.tsx +++ b/furniture-3d-system/src/app/intake/non-integrated/NonIntegratedDetailClient.tsx @@ -46,6 +46,7 @@ import { type BasicFieldType, } from "./basicInfoConfig"; import { ProjectReviewWorkspace } from "./ProjectReviewWorkspace"; +import { ProductDataWorkspace } from "./ProductDataWorkspace"; import { BomBoardMaterialField, BomEdgeBandingField, @@ -20288,71 +20289,6 @@ function renderFactoryQualityWorkspace() { ); } - function renderProductDataPreviewContent() { - if (!effectiveSelectedWorkspaceFile) { - return ( - - ); - } - - if ( - effectiveSelectedWorkspacePreviewType === "image" || - effectiveSelectedWorkspacePreviewType === "pdf" - ) { - return renderDocumentWorkspacePreviewContent(); - } - - return ( -
-
-

- 资料明细 -

-

- 当前分类只对 PDF - 和图片做在线预览,其它文件保留明细展开,模型师按明细查看和下载即可。 -

-
- -
-
-

资料分类

-

- {activeProductDataGroupEntry?.label ?? "产品资料"} -

-
-
-

文件类型

-

- {getUploadFileTypeLabel(effectiveSelectedWorkspaceFile)} -

-
-
-

文件名称

-

- {effectiveSelectedWorkspaceFile.name} -

-
-
- -
-

- 当前文件不做在线预览 -

-

- DWG、Excel、PPT、压缩包等资料会保留在中间明细栏,右侧只展示关键信息。需要查看完整内容时,直接点击上方“下载”即可。 -

-
-
- ); - } - function renderOpeningReferenceWorkspace() { const topFields: { key: OpeningReferenceFieldKey; @@ -21188,140 +21124,21 @@ function renderFactoryQualityWorkspace() { } function renderProductDataWorkspace() { return ( -
-
-
-

- 资料分类 -

-

- 左侧按资料类型分栏;上传时会自动落到当前分类。 -

-
-
- {productDataGroupEntries.map((group) => { - const isActive = activeProductDataGroup === group.key; - - return ( - - ); - })} -
-
- -
-
-

- 资料明细 -

-

- 当前分类:{activeProductDataGroupEntry?.label ?? "产品资料"} · 共{" "} - {activeProductDataGroupFiles.length} 份 -

-
- - {activeProductDataGroupFiles.length === 0 ? ( -
-

- 当前还没有{activeProductDataGroupEntry?.label ?? "产品资料"} -

-

- 点击上方“批量上传”后,这里会显示当前分类下的文件明细。 -

-
- ) : ( -
- {activeProductDataGroupFiles.map((file) => { - const isActive = effectiveSelectedWorkspaceFile?.id === file.id; - const previewType = getUploadFilePreviewType(file); - const supportsInlinePreview = - previewType === "image" || previewType === "pdf"; - - return ( - - ); - })} -
- )} -
- -
-
-

- {workspacePreviewTitle} -

-

- {workspacePreviewDescription} -

-
-
- {renderProductDataPreviewContent()} -
-
-
+ ); } diff --git a/furniture-3d-system/src/app/intake/non-integrated/ProductDataWorkspace.tsx b/furniture-3d-system/src/app/intake/non-integrated/ProductDataWorkspace.tsx new file mode 100644 index 00000000..6704426d --- /dev/null +++ b/furniture-3d-system/src/app/intake/non-integrated/ProductDataWorkspace.tsx @@ -0,0 +1,269 @@ +"use client"; + +import type { ReactNode } from "react"; +import type { ProductDataGroup } from "./documentWorkspaceHelpers"; +import type { NonIntegratedUploadFile } from "./nonIntegratedStorage"; +import { + getUploadFilePreviewType, + getUploadFileTypeLabel, + type UploadFilePreviewType, +} from "./uploadFilePreview"; +import { WorkspacePreviewEmptyState } from "./components/WorkspaceShell"; + +type ProductDataGroupEntry = { + key: ProductDataGroup; + label: string; + description: string; + files: NonIntegratedUploadFile[]; +}; + +type ProductDataWorkspaceProps = { + productDataGroupEntries: ProductDataGroupEntry[]; + activeProductDataGroup: ProductDataGroup; + activeProductDataGroupLabel: string; + activeProductDataGroupFiles: NonIntegratedUploadFile[]; + selectedWorkspaceFile: NonIntegratedUploadFile | null; + selectedWorkspacePreviewType: UploadFilePreviewType; + workspacePreviewTitle: string; + workspacePreviewDescription: string; + onActiveProductDataGroupChange: (group: ProductDataGroup) => void; + onSelectWorkspaceFile: (fileId: string) => void; + renderDocumentPreviewContent: () => ReactNode; +}; + +export function ProductDataWorkspace({ + productDataGroupEntries, + activeProductDataGroup, + activeProductDataGroupLabel, + activeProductDataGroupFiles, + selectedWorkspaceFile, + selectedWorkspacePreviewType, + workspacePreviewTitle, + workspacePreviewDescription, + onActiveProductDataGroupChange, + onSelectWorkspaceFile, + renderDocumentPreviewContent, +}: ProductDataWorkspaceProps) { + return ( +
+
+
+

+ 资料分类 +

+

+ 左侧按资料类型分栏;上传时会自动落到当前分类。 +

+
+
+ {productDataGroupEntries.map((group) => { + const isActive = activeProductDataGroup === group.key; + + return ( + + ); + })} +
+
+ +
+
+

+ 资料明细 +

+

+ 当前分类:{activeProductDataGroupLabel} · 共{" "} + {activeProductDataGroupFiles.length} 份 +

+
+ + {activeProductDataGroupFiles.length === 0 ? ( +
+

+ 当前还没有{activeProductDataGroupLabel} +

+

+ 点击上方“批量上传”后,这里会显示当前分类下的文件明细。 +

+
+ ) : ( +
+ {activeProductDataGroupFiles.map((file) => { + const isActive = selectedWorkspaceFile?.id === file.id; + const previewType = getUploadFilePreviewType(file); + const supportsInlinePreview = + previewType === "image" || previewType === "pdf"; + + return ( + + ); + })} +
+ )} +
+ +
+
+

+ {workspacePreviewTitle} +

+

+ {workspacePreviewDescription} +

+
+
+ +
+
+
+ ); +} + +function ProductDataPreviewContent({ + selectedWorkspaceFile, + selectedWorkspacePreviewType, + workspacePreviewTitle, + workspacePreviewDescription, + activeProductDataGroupLabel, + renderDocumentPreviewContent, +}: { + selectedWorkspaceFile: NonIntegratedUploadFile | null; + selectedWorkspacePreviewType: UploadFilePreviewType; + workspacePreviewTitle: string; + workspacePreviewDescription: string; + activeProductDataGroupLabel: string; + renderDocumentPreviewContent: () => ReactNode; +}) { + if (!selectedWorkspaceFile) { + return ( + + ); + } + + if ( + selectedWorkspacePreviewType === "image" || + selectedWorkspacePreviewType === "pdf" + ) { + return <>{renderDocumentPreviewContent()}; + } + + return ( +
+
+

+ 资料明细 +

+

+ 当前分类只对 PDF + 和图片做在线预览,其它文件保留明细展开,模型师按明细查看和下载即可。 +

+
+ +
+
+

资料分类

+

+ {activeProductDataGroupLabel} +

+
+
+

文件类型

+

+ {getUploadFileTypeLabel(selectedWorkspaceFile)} +

+
+
+

文件名称

+

+ {selectedWorkspaceFile.name} +

+
+
+ +
+

+ 当前文件不做在线预览 +

+

+ DWG、Excel、PPT、压缩包等资料会保留在中间明细栏,右侧只展示关键信息。需要查看完整内容时,直接点击上方“下载”即可。 +

+
+
+ ); +}