diff --git a/furniture-3d-system/Dockerfile b/furniture-3d-system/Dockerfile index b0f9e17a..2b864a63 100644 --- a/furniture-3d-system/Dockerfile +++ b/furniture-3d-system/Dockerfile @@ -223,6 +223,7 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static # 复制必要的文件 COPY --from=builder --chown=nextjs:nodejs /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/private ./private COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma COPY --from=builder --chown=nextjs:nodejs /app/src/lib ./src/lib diff --git a/furniture-3d-system/private/product-stop-help/images/01-overview.png b/furniture-3d-system/private/product-stop-help/images/01-overview.png new file mode 100644 index 00000000..ad9d8ec4 Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/01-overview.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/02-filtered-result.png b/furniture-3d-system/private/product-stop-help/images/02-filtered-result.png new file mode 100644 index 00000000..6e3ed76e Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/02-filtered-result.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/03-main-row-selected.png b/furniture-3d-system/private/product-stop-help/images/03-main-row-selected.png new file mode 100644 index 00000000..fc6357fa Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/03-main-row-selected.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/04-shop-metrics.png b/furniture-3d-system/private/product-stop-help/images/04-shop-metrics.png new file mode 100644 index 00000000..3f7182c3 Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/04-shop-metrics.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/05-settings.png b/furniture-3d-system/private/product-stop-help/images/05-settings.png new file mode 100644 index 00000000..b9134ae9 Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/05-settings.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/06-demand-state-maintenance.png b/furniture-3d-system/private/product-stop-help/images/06-demand-state-maintenance.png new file mode 100644 index 00000000..5d558f0e Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/06-demand-state-maintenance.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/07-manual-push.png b/furniture-3d-system/private/product-stop-help/images/07-manual-push.png new file mode 100644 index 00000000..7f8180c3 Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/07-manual-push.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/08-export.png b/furniture-3d-system/private/product-stop-help/images/08-export.png new file mode 100644 index 00000000..771c9e92 Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/08-export.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/09-unadmitted.png b/furniture-3d-system/private/product-stop-help/images/09-unadmitted.png new file mode 100644 index 00000000..21c2e8c8 Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/09-unadmitted.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/10-logic-config.png b/furniture-3d-system/private/product-stop-help/images/10-logic-config.png new file mode 100644 index 00000000..133053d4 Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/10-logic-config.png differ diff --git a/furniture-3d-system/private/product-stop-help/images/11-warehouse-mapping.png b/furniture-3d-system/private/product-stop-help/images/11-warehouse-mapping.png new file mode 100644 index 00000000..97bfe42d Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/images/11-warehouse-mapping.png differ diff --git a/furniture-3d-system/private/product-stop-help/product-stop-detail-demo.mp4 b/furniture-3d-system/private/product-stop-help/product-stop-detail-demo.mp4 new file mode 100644 index 00000000..18022c3b Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/product-stop-detail-demo.mp4 differ diff --git a/furniture-3d-system/private/product-stop-help/product-stop-detail-demo.srt b/furniture-3d-system/private/product-stop-help/product-stop-detail-demo.srt new file mode 100644 index 00000000..6dd4dd38 --- /dev/null +++ b/furniture-3d-system/private/product-stop-help/product-stop-detail-demo.srt @@ -0,0 +1,51 @@ +1 +00:00:00,000 --> 00:00:05,727 +查询、核对、附表分析、期初维护、人工推送与导出 + +2 +00:00:05,877 --> 00:00:16,666 +查看生成日期、生成时间和数据总量;异常提示要先判断影响。 + +3 +00:00:16,816 --> 00:00:27,628 +支持分类、SPU、SKU、条码;可切换模糊、精确或批量匹配。 + +4 +00:00:27,778 --> 00:00:38,337 +查询后先看总条数、筛选条件和小计,避免带着旧条件继续操作。 + +5 +00:00:38,487 --> 00:00:48,630 +附表支持平台、店铺和负责人筛选;小计按当前筛选范围重算。 + +6 +00:00:48,780 --> 00:00:57,825 +设置列、筛选项和异常预警人员,减少无关字段。 + +7 +00:00:57,975 --> 00:01:09,355 +人工值优先;空白字段回退自动同步;历史驳回独立取最近一次。 + +8 +00:01:09,505 --> 00:01:20,095 +勾选条码,填写停产原因分类和详细说明,再核对推送结果。 + +9 +00:01:20,245 --> 00:01:30,999 +按当前筛选和排序导出,并选择仅主表、店铺明细或运营总监明细。 + +10 +00:01:31,149 --> 00:01:40,067 +单独查看是否准入为否的商品,继续查询、分析和人工处置。 + +11 +00:01:40,217 --> 00:01:50,736 +维护盘停规则、准入规则、留观天数和判定参数。 + +12 +00:01:50,886 --> 00:02:01,236 +维护采购类型与入库、代发类型及标准仓库的对应关系。 + +13 +00:02:01,386 --> 00:02:11,907 +确认快照 → 查询核对 → 主表与附表 → 处理异常 → 维护规则 → 推送或导出 diff --git a/furniture-3d-system/private/product-stop-help/product-stop-detail-sop.docx b/furniture-3d-system/private/product-stop-help/product-stop-detail-sop.docx new file mode 100644 index 00000000..b0af137c Binary files /dev/null and b/furniture-3d-system/private/product-stop-help/product-stop-detail-sop.docx differ diff --git a/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/image/[filename]/route.ts b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/image/[filename]/route.ts new file mode 100644 index 00000000..1dbb1ecb --- /dev/null +++ b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/image/[filename]/route.ts @@ -0,0 +1,26 @@ +import { NextRequest } from 'next/server' +import { handleRequest } from '@/server/core/response' +import { + assertProductStopHelpAccess, + serveProductStopHelpImage, +} from '@/server/services/product-stop-help.service' + +export async function GET( + request: NextRequest, + { params }: { params: Promise<{ filename: string }> }, +) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return serveProductStopHelpImage((await params).filename) + }, { requireAuth: true }) +} + +export async function HEAD( + request: NextRequest, + { params }: { params: Promise<{ filename: string }> }, +) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return serveProductStopHelpImage((await params).filename, true) + }, { requireAuth: true }) +} diff --git a/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/sop-file/route.ts b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/sop-file/route.ts new file mode 100644 index 00000000..02693743 --- /dev/null +++ b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/sop-file/route.ts @@ -0,0 +1,20 @@ +import { NextRequest } from 'next/server' +import { handleRequest } from '@/server/core/response' +import { + assertProductStopHelpAccess, + serveProductStopHelpFile, +} from '@/server/services/product-stop-help.service' + +export async function GET(request: NextRequest) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return serveProductStopHelpFile(request, 'sop') + }, { requireAuth: true }) +} + +export async function HEAD(request: NextRequest) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return serveProductStopHelpFile(request, 'sop', true) + }, { requireAuth: true }) +} diff --git a/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/sop/route.ts b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/sop/route.ts new file mode 100644 index 00000000..9a3e93c7 --- /dev/null +++ b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/sop/route.ts @@ -0,0 +1,20 @@ +import { NextRequest, NextResponse } from 'next/server' +import { handleRequest } from '@/server/core/response' +import { + assertProductStopHelpAccess, + renderProductStopSopHtml, +} from '@/server/services/product-stop-help.service' + +export async function GET(request: NextRequest) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return new NextResponse(renderProductStopSopHtml(), { + status: 200, + headers: { + 'Content-Type': 'text/html; charset=utf-8', + 'Cache-Control': 'no-store', + 'X-Frame-Options': 'DENY', + }, + }) + }, { requireAuth: true }) +} diff --git a/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/video-file/route.ts b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/video-file/route.ts new file mode 100644 index 00000000..c8b76cff --- /dev/null +++ b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/video-file/route.ts @@ -0,0 +1,20 @@ +import { NextRequest } from 'next/server' +import { handleRequest } from '@/server/core/response' +import { + assertProductStopHelpAccess, + serveProductStopHelpFile, +} from '@/server/services/product-stop-help.service' + +export async function GET(request: NextRequest) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return serveProductStopHelpFile(request, 'video') + }, { requireAuth: true }) +} + +export async function HEAD(request: NextRequest) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return serveProductStopHelpFile(request, 'video', true) + }, { requireAuth: true }) +} diff --git a/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/video/route.ts b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/video/route.ts new file mode 100644 index 00000000..bebad06a --- /dev/null +++ b/furniture-3d-system/src/app/api/supply-chain/management/product-inventory-stop/help/video/route.ts @@ -0,0 +1,20 @@ +import { NextRequest, NextResponse } from 'next/server' +import { handleRequest } from '@/server/core/response' +import { + assertProductStopHelpAccess, + renderProductStopVideoHtml, +} from '@/server/services/product-stop-help.service' + +export async function GET(request: NextRequest) { + return handleRequest(request, async (ctx) => { + await assertProductStopHelpAccess(ctx.user) + return new NextResponse(renderProductStopVideoHtml(), { + status: 200, + headers: { + 'Content-Type': 'text/html; charset=utf-8', + 'Cache-Control': 'no-store', + 'X-Frame-Options': 'DENY', + }, + }) + }, { requireAuth: true }) +} diff --git a/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/ProductStopDetailView.tsx b/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/ProductStopDetailView.tsx index e7f45fe2..24ef0808 100644 --- a/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/ProductStopDetailView.tsx +++ b/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/ProductStopDetailView.tsx @@ -12,6 +12,7 @@ import { import { AlertCircle, AlertTriangle, + BookOpen, ChevronDown, ChevronLeft, ChevronRight, @@ -26,6 +27,7 @@ import { Loader2, Move, Pencil, + PlayCircle, RefreshCw, Search, Send, @@ -901,6 +903,28 @@ export function ProductStopDetailView({ ) : null} + {permissions.main.view ? ( + + + + 操作SOP + + + + 操作录屏 + + + ) : null}
diff --git a/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/access.ts b/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/access.ts index 623b28c4..f1849021 100644 --- a/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/access.ts +++ b/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/access.ts @@ -1,5 +1,6 @@ import { redirect } from 'next/navigation' import { requireSession } from '@/lib/server-session' +import { canViewProductInventoryStop } from '@/lib/supply-chain-product-stop-permissions' import { supplyChainPermissionSettingsService } from '@/server/services/supply-chain-permission-settings.service' export async function requireProductInventoryStopAccess() { @@ -16,10 +17,6 @@ export async function requireProductInventoryStopPermissions() { const { authUser } = await requireSession('/login') const permissions = await supplyChainPermissionSettingsService .getProductInventoryStopPermissions(authUser) - const visible = permissions.detail.main.view - || permissions.unadmitted.main.view - || permissions.logicConfig.view - || permissions.warehouseMapping.view - if (!visible) redirect('/supply-chain') + if (!canViewProductInventoryStop(permissions)) redirect('/supply-chain') return { authUser, permissions } } diff --git a/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/product-stop-detail.module.css b/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/product-stop-detail.module.css index 9c4fc541..aed15e5c 100644 --- a/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/product-stop-detail.module.css +++ b/furniture-3d-system/src/app/supply-chain/management/product-inventory-stop/product-stop-detail.module.css @@ -244,6 +244,44 @@ padding-top: 0; } +.helpEntryGroup { + display: inline-flex; + flex: 0 0 auto; + overflow: hidden; + border: 1px solid #d4d4d8; + border-radius: 7px; + background: #fff; +} + +.helpEntry { + display: inline-flex; + min-height: 32px; + align-items: center; + gap: 6px; + padding: 0 12px; + color: #3f3f46; + font-size: 12px; + font-weight: 600; + text-decoration: none; + white-space: nowrap; +} + +.helpEntry + .helpEntry { + border-left: 1px solid #e4e4e7; +} + +.helpEntry:hover { + background: #f4f4f5; + color: #18181b; +} + +.helpEntry:focus-visible { + position: relative; + z-index: 1; + outline: 2px solid #60a5fa; + outline-offset: -2px; +} + .tableWrap { min-width: 0; min-height: 96px; diff --git a/furniture-3d-system/src/lib/supply-chain-product-stop-permissions.test.ts b/furniture-3d-system/src/lib/supply-chain-product-stop-permissions.test.ts new file mode 100644 index 00000000..50233ecd --- /dev/null +++ b/furniture-3d-system/src/lib/supply-chain-product-stop-permissions.test.ts @@ -0,0 +1,36 @@ +import { + canViewProductInventoryStop, + emptyProductInventoryStopPermissions, + type ProductInventoryStopPermissions, +} from './supply-chain-product-stop-permissions' + +function permissionWith( + apply: (permissions: ProductInventoryStopPermissions) => void, +) { + const permissions = emptyProductInventoryStopPermissions() + apply(permissions) + return permissions +} + +describe('商品盘停整体查看权限', () => { + it('没有任何模块查看权限时不能查看操作帮助', () => { + expect(canViewProductInventoryStop(emptyProductInventoryStopPermissions())).toBe(false) + }) + + it.each([ + ['盘停明细', (permissions: ProductInventoryStopPermissions) => { + permissions.detail.main.view = true + }], + ['未准入盘停明细', (permissions: ProductInventoryStopPermissions) => { + permissions.unadmitted.main.view = true + }], + ['盘停逻辑配置', (permissions: ProductInventoryStopPermissions) => { + permissions.logicConfig.view = true + }], + ['仓库映射关系', (permissions: ProductInventoryStopPermissions) => { + permissions.warehouseMapping.view = true + }], + ])('%s有查看权限时即可查看操作帮助', (_label, apply) => { + expect(canViewProductInventoryStop(permissionWith(apply))).toBe(true) + }) +}) diff --git a/furniture-3d-system/src/lib/supply-chain-product-stop-permissions.ts b/furniture-3d-system/src/lib/supply-chain-product-stop-permissions.ts index cd5139c3..c9aaac15 100644 --- a/furniture-3d-system/src/lib/supply-chain-product-stop-permissions.ts +++ b/furniture-3d-system/src/lib/supply-chain-product-stop-permissions.ts @@ -65,6 +65,15 @@ export type ProductInventoryStopPermissions = { warehouseMapping: ProductStopTablePermissions } +export function canViewProductInventoryStop( + permissions: ProductInventoryStopPermissions, +) { + return permissions.detail.main.view + || permissions.unadmitted.main.view + || permissions.logicConfig.view + || permissions.warehouseMapping.view +} + export const PRODUCT_STOP_PERMISSION_GROUPS: ProductStopPermissionGroup[] = [ { key: 'detailMain', diff --git a/furniture-3d-system/src/server/services/product-stop-help.service.test.ts b/furniture-3d-system/src/server/services/product-stop-help.service.test.ts new file mode 100644 index 00000000..cceca70a --- /dev/null +++ b/furniture-3d-system/src/server/services/product-stop-help.service.test.ts @@ -0,0 +1,62 @@ +import type { NextRequest } from 'next/server' +import { + renderProductStopSopHtml, + renderProductStopVideoHtml, + serveProductStopHelpFile, + serveProductStopHelpImage, +} from './product-stop-help.service' + +describe('商品盘停操作帮助页面', () => { + it('在线 SOP 提供录屏入口和 Word 下载', () => { + const html = renderProductStopSopHtml() + expect(html).toContain('商品盘停明细业务快速掌握') + expect(html).toContain('观看操作录屏') + expect(html).toContain('下载 Word 版') + expect(html).toContain('/help/sop-file') + expect(html).toContain('/help/image/01-overview.png') + }) + + it('录屏页面使用受权限保护的视频流和下载接口', () => { + const html = renderProductStopVideoHtml() + expect(html).toContain('