refactor(intake): extract upload category helper
This commit is contained in:
parent
c282dd5ff1
commit
8e8c713675
@ -532,6 +532,7 @@ import {
|
||||
buildPreviewHoleOverlayState,
|
||||
findPreviewHoleSnapTarget,
|
||||
} from "./previewHoleHelpers";
|
||||
import { inferUploadCategory } from "./uploadCategoryHelpers";
|
||||
import {
|
||||
MATERIAL_TYPE_OPTIONS,
|
||||
PLANNING_LAYOUT_AUDIENCE_OPTIONS,
|
||||
@ -5301,95 +5302,6 @@ function syncSkuItemsBrandPrefix(items: NonIntegratedSkuItem[], brand: string) {
|
||||
}));
|
||||
}
|
||||
|
||||
function inferUploadCategory(fileName: string): UploadCategoryKey {
|
||||
const normalizedName = fileName.trim().toLowerCase();
|
||||
if (!normalizedName) return "未分类";
|
||||
|
||||
if (
|
||||
normalizedName.includes("检测") ||
|
||||
normalizedName.includes("报告") ||
|
||||
normalizedName.includes("质检") ||
|
||||
normalizedName.includes("抽检")
|
||||
) {
|
||||
return "检测报告";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("安装") ||
|
||||
normalizedName.includes("组装") ||
|
||||
normalizedName.includes("视频")
|
||||
) {
|
||||
return "安装方式";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("实拍") ||
|
||||
normalizedName.includes("细节图") ||
|
||||
normalizedName.includes("六视图") ||
|
||||
normalizedName.includes("九视图") ||
|
||||
normalizedName.includes("立体图") ||
|
||||
normalizedName.includes("主视图") ||
|
||||
normalizedName.includes("正视图") ||
|
||||
normalizedName.includes("左视图") ||
|
||||
normalizedName.includes("右视图")
|
||||
) {
|
||||
return "产品实拍图";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("卖点") ||
|
||||
normalizedName.includes("ppt") ||
|
||||
normalizedName.includes("设计")
|
||||
) {
|
||||
return "设计卖点";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("打样资料") ||
|
||||
normalizedName.includes("爆炸") ||
|
||||
normalizedName.includes("线稿") ||
|
||||
normalizedName.includes("孔位")
|
||||
) {
|
||||
return "产品模型";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("包装") ||
|
||||
normalizedName.includes("开箱") ||
|
||||
normalizedName.includes("包材") ||
|
||||
normalizedName.includes("外箱") ||
|
||||
normalizedName.includes("内盒") ||
|
||||
normalizedName.includes("泡沫")
|
||||
) {
|
||||
return "包装细节";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("模型") ||
|
||||
normalizedName.includes("step") ||
|
||||
normalizedName.includes("igs") ||
|
||||
normalizedName.includes("dwg") ||
|
||||
normalizedName.includes("cad") ||
|
||||
normalizedName.includes(".glb") ||
|
||||
normalizedName.includes(".gltf") ||
|
||||
normalizedName.includes(".obj")
|
||||
) {
|
||||
return "产品模型";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("下单表") ||
|
||||
normalizedName.includes("基础资料") ||
|
||||
normalizedName.includes("资料") ||
|
||||
normalizedName.includes("说明书") ||
|
||||
normalizedName.includes("评审")
|
||||
) {
|
||||
return "评审资料";
|
||||
}
|
||||
|
||||
return "未分类";
|
||||
}
|
||||
|
||||
function buildProductPayload(
|
||||
id: string,
|
||||
formValues: FormValues,
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
import type { UploadCategoryKey } from "./documentWorkspaceHelpers";
|
||||
|
||||
export function inferUploadCategory(fileName: string): UploadCategoryKey {
|
||||
const normalizedName = fileName.trim().toLowerCase();
|
||||
if (!normalizedName) return "未分类";
|
||||
|
||||
if (
|
||||
normalizedName.includes("检测") ||
|
||||
normalizedName.includes("报告") ||
|
||||
normalizedName.includes("质检") ||
|
||||
normalizedName.includes("抽检")
|
||||
) {
|
||||
return "检测报告";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("安装") ||
|
||||
normalizedName.includes("组装") ||
|
||||
normalizedName.includes("视频")
|
||||
) {
|
||||
return "安装方式";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("实拍") ||
|
||||
normalizedName.includes("细节图") ||
|
||||
normalizedName.includes("六视图") ||
|
||||
normalizedName.includes("九视图") ||
|
||||
normalizedName.includes("立体图") ||
|
||||
normalizedName.includes("主视图") ||
|
||||
normalizedName.includes("正视图") ||
|
||||
normalizedName.includes("左视图") ||
|
||||
normalizedName.includes("右视图")
|
||||
) {
|
||||
return "产品实拍图";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("卖点") ||
|
||||
normalizedName.includes("ppt") ||
|
||||
normalizedName.includes("设计")
|
||||
) {
|
||||
return "设计卖点";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("打样资料") ||
|
||||
normalizedName.includes("爆炸") ||
|
||||
normalizedName.includes("线稿") ||
|
||||
normalizedName.includes("孔位")
|
||||
) {
|
||||
return "产品模型";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("包装") ||
|
||||
normalizedName.includes("开箱") ||
|
||||
normalizedName.includes("包材") ||
|
||||
normalizedName.includes("外箱") ||
|
||||
normalizedName.includes("内盒") ||
|
||||
normalizedName.includes("泡沫")
|
||||
) {
|
||||
return "包装细节";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("模型") ||
|
||||
normalizedName.includes("step") ||
|
||||
normalizedName.includes("igs") ||
|
||||
normalizedName.includes("dwg") ||
|
||||
normalizedName.includes("cad") ||
|
||||
normalizedName.includes(".glb") ||
|
||||
normalizedName.includes(".gltf") ||
|
||||
normalizedName.includes(".obj")
|
||||
) {
|
||||
return "产品模型";
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedName.includes("下单表") ||
|
||||
normalizedName.includes("基础资料") ||
|
||||
normalizedName.includes("资料") ||
|
||||
normalizedName.includes("说明书") ||
|
||||
normalizedName.includes("评审")
|
||||
) {
|
||||
return "评审资料";
|
||||
}
|
||||
|
||||
return "未分类";
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user