merge: adopt xuxiake material library workflow

This commit is contained in:
WuYongJie 2026-04-13 17:26:23 +08:00
commit d12470419e
5 changed files with 19 additions and 7 deletions

View File

@ -0,0 +1,4 @@
ALTER TABLE "Substrate"
ALTER COLUMN "systemNameOptionId" DROP NOT NULL;
DROP INDEX IF EXISTS "Substrate_categoryId_environmentGradeId_thicknessSpecId_sur_key";

View File

@ -794,7 +794,7 @@ export default function MaterialLibraryClient({
</div>
<div className="space-y-3">
<div>
<p className="text-xs text-apple-label-tertiary">基材名称</p>
<p className="text-xs text-apple-label-tertiary">系统名称</p>
<p className="text-sm font-apple-medium text-apple-label-primary">{s.name}</p>
</div>
<div className="grid grid-cols-2 gap-3">

View File

@ -21,13 +21,17 @@ export function buildSubstrateDisplayName(params: {
finishLabels?: string[]
surfaceLabel?: string
}): string {
const envLabel = params.environmentGradeLabel.trim()
const envWithSuffix = envLabel ? (envLabel.endsWith('级') ? envLabel : `${envLabel}级`) : ''
const thicknessLabel = `${params.thicknessMm}MM`
const environmentLabel = params.environmentGradeLabel.trim()
const normalizedEnvironment = environmentLabel.endsWith('级')
? environmentLabel
: `${environmentLabel}级`
return [
`${params.thicknessMm}`,
envWithSuffix,
thicknessLabel,
normalizedEnvironment,
params.categoryLabel.trim(),
...(params.finishLabels ?? []),
...(params.finishLabels ?? []).map((item) => item.trim()).filter(Boolean),
params.surfaceLabel?.trim() ?? '',
]
.filter(Boolean)

View File

@ -40,6 +40,7 @@ export interface SubstrateWithRelations extends Substrate {
environmentGrade: { id: string; name: string }
thicknessSpec: { id: string; name: string; thicknessMm: number; sheetLengthMm: number; sheetWidthMm: number }
surfaceOption: { id: string; name: string } | null
systemNameOption: { id: string; name: string } | null
finishes: {
finish: {
id: string
@ -88,6 +89,7 @@ const substrateRelationInclude = {
},
},
surfaceOption: { select: { id: true, name: true } },
systemNameOption: { select: { id: true, name: true } },
finishes: {
select: {
finish: {

View File

@ -536,7 +536,7 @@ class AssetCenterService {
assetType: variant.assetType as AssetThumbnailRenderAssetType,
modelUrl,
renderBaseUrl,
materialConfig,
...(materialConfig ? { materialConfig } : {}),
})
return this.persistVariantThumbnail(variant, thumbnailUrl, updatedBy)
} catch (error) {
@ -774,6 +774,7 @@ class AssetCenterService {
select: { id: true, name: true, thicknessMm: true, sheetLengthMm: true, sheetWidthMm: true },
},
surfaceOption: { select: { id: true, name: true } },
systemNameOption: { select: { id: true, name: true } },
finishes: {
include: {
finish: {
@ -886,6 +887,7 @@ class AssetCenterService {
select: { id: true, name: true, thicknessMm: true, sheetLengthMm: true, sheetWidthMm: true },
},
surfaceOption: { select: { id: true, name: true } },
systemNameOption: { select: { id: true, name: true } },
finishes: {
include: {
finish: {