refactor(intake): extract non-integrated workspace panel config

This commit is contained in:
WuYongJie 2026-06-08 17:49:31 +08:00
parent 3a8de95bf1
commit ad0081f692
2 changed files with 88 additions and 68 deletions

View File

@ -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<keyof NonIntegratedReviewSheet, "issues">;
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<WorkflowNodeCategory>([
]);
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<InstallationAssetType, string> = {
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<string>(
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<string, BomDetailState>;
const NON_INTEGRATED_BOM_DRAFT_STORAGE_KEY_PREFIX =
"intake.nonIntegratedBomDraft";

View File

@ -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<InstallationAssetType, string> = {
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",
},
];