sync: 同步 monkey-ai@weiyuan(ddc5b9443) 的 web/ 到 ui-optimization
- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等, semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi - 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复 - 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志 - 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求 - 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新 - 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
This commit is contained in:
@@ -49,11 +49,13 @@ import {
|
||||
Zap,
|
||||
Check,
|
||||
Activity,
|
||||
Route as RouteIcon,
|
||||
} from 'lucide-react';
|
||||
import { useSidebarCollapsed } from '../../hooks/common/useSidebarCollapsed';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { normalizeSidebarModulesAdmin } from '../../constants/sidebarModules';
|
||||
import { canAccessOrgSettings } from './orgFeatureFlags';
|
||||
import OrgCommissionNavigation from './OrgCommissionNavigation';
|
||||
import {
|
||||
isMiniProgramPaymentPath,
|
||||
isMiniProgramWebView,
|
||||
@@ -73,6 +75,7 @@ const pathFeatureRequirements = {
|
||||
'/org/connectors': 'connector',
|
||||
'/org/effectiveness': 'agent_effectiveness',
|
||||
'/org/quality': 'quality_monitor',
|
||||
'/org/smart-router': 'smart_router',
|
||||
'/org/departments': 'dept',
|
||||
'/org/projects': 'project',
|
||||
'/org/budgets': 'budget',
|
||||
@@ -88,6 +91,9 @@ const isFeatureEnabled = (flags, key) => {
|
||||
|
||||
const OrgSidebar = ({
|
||||
orgName,
|
||||
organizations = [],
|
||||
currentOrgId,
|
||||
onOrganizationChange,
|
||||
orgRole,
|
||||
featureFlags,
|
||||
isDeptManager = false,
|
||||
@@ -100,6 +106,9 @@ const OrgSidebar = ({
|
||||
canAuditAgentMetadata = false,
|
||||
canViewAgentEffect = false,
|
||||
canViewQuality = false,
|
||||
canViewCommission = false,
|
||||
canViewSmartRouter = false,
|
||||
smartRouterConsentOnly = false,
|
||||
isMemberActor = true,
|
||||
onNavigate,
|
||||
mobile = false,
|
||||
@@ -231,6 +240,14 @@ const OrgSidebar = ({
|
||||
adminOnly: true,
|
||||
qualityView: true,
|
||||
},
|
||||
{
|
||||
itemKey: '/org/smart-router',
|
||||
text: t('智能路由'),
|
||||
icon: RouteIcon,
|
||||
group: 'overview',
|
||||
adminOnly: true,
|
||||
smartRouterView: true,
|
||||
},
|
||||
{
|
||||
itemKey: '/org/agent-audit',
|
||||
text: t('Agent 任务审计'),
|
||||
@@ -306,6 +323,13 @@ const OrgSidebar = ({
|
||||
group: 'records',
|
||||
adminOnly: true,
|
||||
},
|
||||
{
|
||||
itemKey: '/org/commission',
|
||||
text: t('企业分佣'),
|
||||
icon: Wallet,
|
||||
group: 'records',
|
||||
commissionAccess: true,
|
||||
},
|
||||
{
|
||||
itemKey: '/org/logs',
|
||||
text: isAdmin || isDeptManager ? t('消耗明细') : t('我的消耗明细'),
|
||||
@@ -344,6 +368,7 @@ const OrgSidebar = ({
|
||||
'/org/connectors': 'connectors',
|
||||
'/org/effectiveness': 'effectiveness',
|
||||
'/org/quality': 'quality',
|
||||
'/org/smart-router': 'smartRouter',
|
||||
'/org/dashboard': 'dashboard',
|
||||
'/org/members': 'members',
|
||||
'/org/departments': 'departments',
|
||||
@@ -356,6 +381,7 @@ const OrgSidebar = ({
|
||||
'/org/logs': 'logs',
|
||||
'/org/audit': 'audit',
|
||||
'/org/recharge': 'recharge',
|
||||
'/org/commission': 'commission',
|
||||
'/org/settings': 'settings',
|
||||
};
|
||||
|
||||
@@ -390,6 +416,11 @@ const OrgSidebar = ({
|
||||
if (item.agentAudit && !canAuditAgentMetadata) return false;
|
||||
if (item.effectView && !canViewAgentEffect) return false;
|
||||
if (item.qualityView && !canViewQuality) return false;
|
||||
if (item.commissionAccess && !canViewCommission) return false;
|
||||
// 仅授权模式:功能已关闭但所有者仍有生效中的出境同意,入口保留以便撤回(与路由守卫同口径)
|
||||
if (item.itemKey === '/org/smart-router' && smartRouterConsentOnly)
|
||||
return true;
|
||||
if (item.smartRouterView && !canViewSmartRouter) return false;
|
||||
if (item.connectorManage && !canManageConnectors) return false;
|
||||
// 与路由守卫一致:管理员只有 data_security 授权后才显示设置入口。
|
||||
if (item.ownerOnly && !canManageSettings) return false;
|
||||
@@ -440,6 +471,9 @@ const OrgSidebar = ({
|
||||
canAuditAgentMetadata,
|
||||
canViewAgentEffect,
|
||||
canViewQuality,
|
||||
canViewCommission,
|
||||
canViewSmartRouter,
|
||||
smartRouterConsentOnly,
|
||||
isMemberActor,
|
||||
canManageConnectors,
|
||||
orgConfig,
|
||||
@@ -505,13 +539,13 @@ const OrgSidebar = ({
|
||||
setFoldedGroups((prev) =>
|
||||
prev.includes(activeGroup) ? prev.filter((k) => k !== activeGroup) : prev,
|
||||
);
|
||||
}, [selectedKey, groupedItems]);
|
||||
}, [selectedKey, groupedItems, location.key]);
|
||||
|
||||
// 选中项滚入可视区(分组较多时避免高亮项被折叠区/滚动区遮住)
|
||||
useEffect(() => {
|
||||
const el = navRef.current?.querySelector('[data-active="true"]');
|
||||
el?.scrollIntoView({ block: 'nearest' });
|
||||
}, [selectedKey]);
|
||||
}, [selectedKey, location.search]);
|
||||
|
||||
return (
|
||||
<aside
|
||||
@@ -528,6 +562,25 @@ const OrgSidebar = ({
|
||||
</span>
|
||||
{orgRole && <span className='ui-org-role'>{roleLabel}</span>}
|
||||
</div>
|
||||
{organizations.length > 1 && (
|
||||
<select
|
||||
aria-label={t('切换企业')}
|
||||
className='mt-3 w-full rounded-md border border-[var(--border-subtle)] bg-[var(--surface-card)] px-2 py-1 text-sm'
|
||||
value={currentOrgId}
|
||||
onChange={(event) =>
|
||||
onOrganizationChange?.(Number(event.target.value))
|
||||
}
|
||||
>
|
||||
{!organizations.some((org) => org.id === currentOrgId) && (
|
||||
<option value={currentOrgId}>{orgName}</option>
|
||||
)}
|
||||
{organizations.map((org) => (
|
||||
<option key={org.id} value={org.id}>
|
||||
{org.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<nav ref={navRef} className='ui-center-sidebar-nav'>
|
||||
@@ -552,6 +605,18 @@ const OrgSidebar = ({
|
||||
)}
|
||||
<div className='ui-org-group-items' hidden={folded && !collapsed}>
|
||||
{group.items.map((item) => {
|
||||
// 企业分佣二级导航(weiyuan eb3936cf0);企业侧栏无菜单搜索,query 恒为空
|
||||
if (item.commissionAccess)
|
||||
return (
|
||||
<OrgCommissionNavigation
|
||||
key={item.itemKey}
|
||||
collapsed={collapsed}
|
||||
expandSidebar={toggleCollapsed}
|
||||
query=''
|
||||
renderText={(text) => text}
|
||||
onNavigate={onNavigate}
|
||||
/>
|
||||
);
|
||||
const isSelected = selectedKey === item.itemKey;
|
||||
const IconComponent = item.icon;
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user