refactor(intake): move detection workspace helpers

This commit is contained in:
WuYongJie 2026-06-08 20:29:24 +08:00
parent 96e7a4db8d
commit 4f66a42cec
2 changed files with 17 additions and 14 deletions

View File

@ -421,21 +421,24 @@ import {
PRODUCT_PHOTO_NINE_VIEW_SLOT_LABELS,
PRODUCT_PHOTO_NINE_VIEW_SLOTS,
PRODUCT_PHOTO_PANEL_ORDER,
QUALITY_STANDARD_FILE_ACCEPT,
areProductPhotoSelectionsEqual,
buildDocumentWorkspaceRevisionFileEntries,
buildProductPhotoMetadata,
getDocumentWorkspaceCategoryLabel,
getDocumentWorkspaceShortcutCountClass,
getDocumentWorkspaceSidebarButtonClass,
buildDocumentWorkspaceRevisionFileEntries,
getProductPhotoPanelCompactTitle,
getProductPhotoPanelTitle,
getSupplementWorkspaceShortcutButtonClass,
getUploadCategoryOptionLabel,
inferProductDataGroup,
inferProductPhotoNineViewSlot,
resolveDetectionWorkspaceAssetType,
resolveProductDataGroup,
resolveProductPhotoAssignment,
resolveProductPhotoFileStyleKey,
type DetectionWorkspaceAssetType,
type DocumentWorkspaceCategory,
type ProductDataGroup,
type ProductPhotoFileGroup,
@ -759,8 +762,6 @@ type UploadProgressState = {
type DownloadProgressState = UploadProgressState & {
phase: "fetching" | "zipping";
};
type DetectionWorkspaceAssetType = NonIntegratedDetectionAssetType;
type InstallationStyleEntry = {
key: string;
label: string;
@ -4595,17 +4596,6 @@ async function uploadFileToServer(
};
}
const QUALITY_STANDARD_FILE_ACCEPT =
".xls,.xlsx,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
function resolveDetectionWorkspaceAssetType(
file: NonIntegratedUploadFile,
): DetectionWorkspaceAssetType {
return file.detectionAssetType === "quality-standard"
? "quality-standard"
: "attachment";
}
function applyUploadFileCategoryMetadata(
file: NonIntegratedUploadFile,
category: UploadCategoryKey,

View File

@ -1,5 +1,6 @@
import {
getNonIntegratedDocumentWorkspaceCategoryLabel,
type NonIntegratedDetectionAssetType,
type NonIntegratedDocumentWorkspaceCategory,
type NonIntegratedUploadFile,
type NonIntegratedWorkflowNodeCategory,
@ -32,6 +33,7 @@ export type UploadCategoryKey =
export type DocumentWorkspaceCategory = NonIntegratedDocumentWorkspaceCategory;
export type WorkflowNodeCategory = NonIntegratedWorkflowNodeCategory;
export type DetectionWorkspaceAssetType = NonIntegratedDetectionAssetType;
export type ProductDataGroup =
| "sampling"
| "exploded"
@ -106,6 +108,17 @@ export function buildDocumentWorkspaceRevisionFileEntries(
factoryQualityAssetType: file.factoryQualityAssetType,
}));
}
export const QUALITY_STANDARD_FILE_ACCEPT =
".xls,.xlsx,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
export function resolveDetectionWorkspaceAssetType(
file: NonIntegratedUploadFile,
): DetectionWorkspaceAssetType {
return file.detectionAssetType === "quality-standard"
? "quality-standard"
: "attachment";
}
export const PRODUCT_PHOTO_NINE_VIEW_SLOTS: {
key: ProductPhotoNineViewSlot;
label: string;