按《仓库库存动销分析.xlsx》: - 一级菜单「大货库存监控」下新增二级「库存动销分析」(路由 /planning/operation/stock-sales-analysis) - 表头与表格结构按需求表:仓库 | 动销等级 | SKU数量 | SKU占比 | 库存数量 | 库存占比 | 销量, 每仓 6 个动销等级(爆款/热卖款/平销款/滞销款-1/滞销款-2/销售=0)+ 1 行汇总,仓库列跨行合并 - 分档口径:日销 = 统计窗口内已发货件数 ÷ 窗口天数(7/14/30 天可选,默认 30), 库存取 rpt.jst_inventoryInfo 实时库存,销量取 jst_Orders×jst_OrderItem 按 send_date (排除 Delete/Cancelled,与每日进销存发货口径一致),只统计有库存或有销量的 SKU - 后端 /api/stock-sales-analysis:单条 SQL 一次覆盖全部仓库×等级,5 分钟缓存 + refresh=1 强制重算; 返回逐仓 + 全仓合计、占比、无数据仓数量 - 前端页面:统计天数/仓库筛选、口径说明弹窗、合计行高亮、无数据仓计数提示 - 页面权限:前后端 sidebarPages 注册 pageKey=stock_sales_analysis,默认 planning 角色可见 验证:后端 syntax + 单测 5/5;前端 eslint、build、npm test 21/21; 本地接口 30 天窗口实测 27 仓(崔桥汇总 2080 SKU / 90822 件 / 54076 件销量), 占比逐仓闭合为 100%;浏览器实测侧边栏入口、表头、197 行渲染与截图均正常
209 lines
7.9 KiB
JavaScript
209 lines
7.9 KiB
JavaScript
import React, { lazy, Suspense } from 'react';
|
||
import { createBrowserRouter, Navigate } from 'react-router-dom';
|
||
import BasicLayout from '../layouts/BasicLayout';
|
||
import { AuthPageLoadingFallback, PageLoadingFallback } from '../components/AppLoadingSkeleton';
|
||
|
||
const Login = lazy(() => import('../pages/Login'));
|
||
const Install = lazy(() => import('../pages/Install'));
|
||
const Setup = lazy(() => import('../pages/Setup'));
|
||
const Settings = lazy(() => import('../pages/Settings'));
|
||
const OnlineDesktopUsers = lazy(() => import('../pages/OnlineDesktopUsers'));
|
||
const DesktopExecutionTasks = lazy(() => import('../pages/DesktopExecutionTasks'));
|
||
const MarketingEvents = lazy(() => import('../pages/MarketingEvents'));
|
||
const ProductInformation = lazy(() => import('../pages/ProductInformation'));
|
||
const PromotionModule = lazy(() => import('../pages/PromotionModule'));
|
||
const OperationPlaceholder = lazy(() => import('../pages/OperationPlaceholder'));
|
||
const DevelopmentStylePreview = lazy(() => import('../pages/DevelopmentStylePreview'));
|
||
const ProductAnalysis = lazy(() => import('../pages/ProductAnalysis'));
|
||
const OpsBIncentiveBoard = lazy(() => import('../pages/PlanningUpload/OpsBIncentiveBoard'));
|
||
const ProductMonitoring = lazy(() => import('../pages/ProductMonitoring'));
|
||
const ModularStockMonitor = lazy(() => import('../pages/ModularStockMonitor'));
|
||
const MkhBomData = lazy(() => import('../pages/MkhBomData'));
|
||
const DailyInventory = lazy(() => import('../pages/DailyInventory'));
|
||
const StockSalesAnalysis = lazy(() => import('../pages/StockSalesAnalysis'));
|
||
const ReturnsInventoryMonitor = lazy(() => import('../pages/ReturnsInventoryWarning/Monitor'));
|
||
|
||
const lazyLoadingElement = <PageLoadingFallback />;
|
||
|
||
const renderLazyComponent = (lazyView, props = {}, fallback = lazyLoadingElement) => {
|
||
const LazyView = lazyView;
|
||
|
||
return (
|
||
<Suspense fallback={fallback}>
|
||
<LazyView {...props} />
|
||
</Suspense>
|
||
);
|
||
};
|
||
|
||
const HOME_URL = '/planning/dev-style-preview';
|
||
|
||
const router = createBrowserRouter([
|
||
{
|
||
path: '/login',
|
||
element: renderLazyComponent(Login, {}, <AuthPageLoadingFallback />),
|
||
},
|
||
{
|
||
path: '/callback',
|
||
element: renderLazyComponent(Login, {}, <AuthPageLoadingFallback />),
|
||
},
|
||
{
|
||
path: '/setup',
|
||
element: renderLazyComponent(Setup),
|
||
},
|
||
{
|
||
path: '/install',
|
||
element: renderLazyComponent(Install),
|
||
},
|
||
{
|
||
path: '/',
|
||
element: <BasicLayout />,
|
||
children: [
|
||
{
|
||
index: true,
|
||
element: <Navigate to={HOME_URL} replace />,
|
||
},
|
||
{
|
||
path: 'dashboard',
|
||
element: <Navigate to={HOME_URL} replace />,
|
||
},
|
||
{
|
||
path: 'channel',
|
||
element: <Navigate to={HOME_URL} replace />,
|
||
},
|
||
{
|
||
path: 'planning',
|
||
element: <Navigate to={HOME_URL} replace />,
|
||
},
|
||
{
|
||
path: 'planning/operation/marketing-events',
|
||
element: <Navigate to="/planning/operation/marketing-events/activity-products" replace />,
|
||
},
|
||
{
|
||
path: 'planning/operation/marketing-events/activity-products',
|
||
element: renderLazyComponent(MarketingEvents),
|
||
},
|
||
{
|
||
path: 'planning/operation/marketing-tools',
|
||
element: <Navigate to="/planning/operation/marketing-events" replace />,
|
||
},
|
||
{
|
||
path: 'planning/operation/product-information',
|
||
element: renderLazyComponent(ProductInformation),
|
||
},
|
||
{
|
||
path: 'planning/operation/product-analysis',
|
||
element: renderLazyComponent(ProductAnalysis),
|
||
},
|
||
{
|
||
path: 'planning/operation/promotion-module',
|
||
element: renderLazyComponent(PromotionModule),
|
||
},
|
||
{
|
||
path: 'planning/operation/ops-b-incentive',
|
||
element: renderLazyComponent(OpsBIncentiveBoard),
|
||
},
|
||
{
|
||
path: 'planning/operation/product-monitoring',
|
||
element: renderLazyComponent(ProductMonitoring),
|
||
},
|
||
{
|
||
path: 'planning/operation/modular-stock-monitor',
|
||
element: renderLazyComponent(ModularStockMonitor),
|
||
},
|
||
{
|
||
path: 'planning/operation/mkh-bom-data',
|
||
element: renderLazyComponent(MkhBomData),
|
||
},
|
||
{
|
||
path: 'planning/operation/daily-inventory',
|
||
element: renderLazyComponent(DailyInventory),
|
||
},
|
||
{
|
||
path: 'planning/operation/stock-sales-analysis',
|
||
element: renderLazyComponent(StockSalesAnalysis),
|
||
},
|
||
// 客退数据监控(5 张看板共用同一个页面,靠 warehouseKey 区分取哪个仓;
|
||
// 单一「退货库存预警」视图,原 明细/超期/汇总/差异 四个页签已下线)
|
||
{
|
||
path: 'planning/operation/returns-inventory/cuiqiao',
|
||
element: renderLazyComponent(ReturnsInventoryMonitor, { warehouseKey: 'cuiqiao' }),
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/subei',
|
||
element: renderLazyComponent(ReturnsInventoryMonitor, { warehouseKey: 'subei' }),
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/suining',
|
||
element: renderLazyComponent(ReturnsInventoryMonitor, { warehouseKey: 'suining' }),
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/shandong',
|
||
element: renderLazyComponent(ReturnsInventoryMonitor, { warehouseKey: 'shandong' }),
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/henan',
|
||
element: renderLazyComponent(ReturnsInventoryMonitor, { warehouseKey: 'henan' }),
|
||
},
|
||
// 历史路径(子看板 / 页签形态)→ 统一回到主看板
|
||
{
|
||
path: 'planning/operation/returns-inventory/henlin2',
|
||
element: <Navigate to="/planning/operation/returns-inventory/cuiqiao" replace />,
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/henlin2/monitor',
|
||
element: <Navigate to="/planning/operation/returns-inventory/cuiqiao" replace />,
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/henlin2/inbound',
|
||
element: <Navigate to="/planning/operation/returns-inventory/cuiqiao" replace />,
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/henlin2/stock',
|
||
element: <Navigate to="/planning/operation/returns-inventory/cuiqiao" replace />,
|
||
},
|
||
{
|
||
path: 'planning/operation/returns-inventory/cuiqiao/monitor',
|
||
element: <Navigate to="/planning/operation/returns-inventory/cuiqiao" replace />,
|
||
},
|
||
{ path: 'planning/operation/store-checkup', element: <Navigate to={HOME_URL} replace /> },
|
||
{ path: 'planning/operation/review-analysis', element: <Navigate to={HOME_URL} replace /> },
|
||
{ path: 'planning/operation/customer-service-checkup', element: <Navigate to={HOME_URL} replace /> },
|
||
{ path: 'planning/operation/pricing-calculator', element: <Navigate to={HOME_URL} replace /> },
|
||
{ path: 'planning/operation/desktop-client-download', element: <Navigate to={HOME_URL} replace /> },
|
||
{ path: 'planning/operation/ai-buyer-show', element: <Navigate to={HOME_URL} replace /> },
|
||
{ path: 'planning/operation/ai-seeding-video', element: <Navigate to={HOME_URL} replace /> },
|
||
{ path: 'settings/desktop-client-releases', element: <Navigate to={HOME_URL} replace /> },
|
||
{
|
||
path: 'planning/operation/:featureKey',
|
||
element: renderLazyComponent(OperationPlaceholder),
|
||
},
|
||
{
|
||
path: 'planning/upload',
|
||
element: <Navigate to={HOME_URL} replace />,
|
||
},
|
||
{
|
||
path: 'planning/dev-style-preview',
|
||
element: renderLazyComponent(DevelopmentStylePreview),
|
||
},
|
||
{
|
||
path: 'settings',
|
||
element: renderLazyComponent(Settings),
|
||
},
|
||
{
|
||
path: 'settings/online-desktop-users',
|
||
element: renderLazyComponent(OnlineDesktopUsers),
|
||
},
|
||
{
|
||
path: 'settings/desktop-execution-tasks',
|
||
element: renderLazyComponent(DesktopExecutionTasks),
|
||
},
|
||
{
|
||
path: '*',
|
||
element: <Navigate to={HOME_URL} replace />,
|
||
},
|
||
],
|
||
},
|
||
]);
|
||
|
||
export default router;
|