feat(emex): use SchemaViewer for group parts page with image pagination
Some checks failed
CI / Lint, Typecheck, Test & Build (push) Has been cancelled
Some checks failed
CI / Lint, Typecheck, Test & Build (push) Has been cancelled
Replace stacked images + plain table with interactive SchemaViewer (same as PL24). Backend transforms response to SchemaViewer-compatible format (Part/SchemaPic types). Add prev/next pagination for groups with multiple schema images. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -49,24 +49,19 @@ export interface EmexGroupDto {
|
||||
|
||||
interface EmexPartDto {
|
||||
id: string;
|
||||
partNumber: string | null;
|
||||
name: string;
|
||||
nameOriginal: string | null;
|
||||
description: string | null;
|
||||
oemNumber: string | null;
|
||||
hotspotIndex: number | null;
|
||||
quantity: number | null;
|
||||
oemCode: string;
|
||||
quantity: number;
|
||||
position: string | null;
|
||||
hotspotIndex: number | null;
|
||||
}
|
||||
|
||||
interface EmexSchemaPicDto {
|
||||
id: string;
|
||||
imageUrl: string | null;
|
||||
localPath: string | null;
|
||||
hotspots: unknown;
|
||||
width: number | null;
|
||||
height: number | null;
|
||||
sortOrder: number | null;
|
||||
url: string;
|
||||
width: number;
|
||||
height: number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface EmexGroupPartsDto {
|
||||
@@ -254,7 +249,25 @@ export class EmexCatalogService {
|
||||
.where(eq(emexSchemaPics.groupId, groupId))
|
||||
.orderBy(emexSchemaPics.sortOrder);
|
||||
|
||||
const result: EmexGroupPartsDto = { group, parts, schemaPics };
|
||||
// Transform to SchemaViewer-compatible format
|
||||
const formattedParts: EmexPartDto[] = parts.map((p) => ({
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
oemCode: p.partNumber || p.oemNumber || "",
|
||||
quantity: p.quantity ?? 1,
|
||||
position: p.position,
|
||||
hotspotIndex: p.position ? parseInt(p.position, 10) || null : null,
|
||||
}));
|
||||
|
||||
const formattedPics: EmexSchemaPicDto[] = schemaPics.map((sp) => ({
|
||||
id: sp.id,
|
||||
url: sp.imageUrl || "",
|
||||
width: sp.width ?? 0,
|
||||
height: sp.height ?? 0,
|
||||
label: group.name || "",
|
||||
}));
|
||||
|
||||
const result: EmexGroupPartsDto = { group, parts: formattedParts, schemaPics: formattedPics };
|
||||
await this.redis.setJson(cacheKey, result, CACHE_TTL.parts);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user