限制客服接单平台可见内容

This commit is contained in:
yml2213
2026-08-18 09:09:50 +08:00
parent 22f73fefb7
commit fe569fe75a
2 changed files with 24 additions and 14 deletions
@@ -17,8 +17,11 @@ import WorkOrdersPanel from './panels/WorkOrdersPanel'
export default function AdminWorkerPlatformPage() { export default function AdminWorkerPlatformPage() {
const [searchParams] = useSearchParams() const [searchParams] = useSearchParams()
const [activeTab, setActiveTab] = useState(() => loadActiveTab(searchParams.get('tab'))) const [activeTab, setActiveTab] = useState(() => loadActiveTab(searchParams.get('tab')))
const isAdmin = getAdminRole() === 'admin' const role = getAdminRole()
const visibleActiveTab = !isAdmin && activeTab === 'notifications' ? 'orders' : activeTab const isAdmin = role === 'admin'
const isSupport = role === 'support'
const visibleActiveTab =
isSupport || (!isAdmin && activeTab === 'notifications') ? 'orders' : activeTab
useEffect(() => { useEffect(() => {
const tab = searchParams.get('tab') const tab = searchParams.get('tab')
@@ -40,17 +43,21 @@ export default function AdminWorkerPlatformPage() {
destroyOnHidden={false} destroyOnHidden={false}
activeKey={visibleActiveTab} activeKey={visibleActiveTab}
onChange={changeTab} onChange={changeTab}
items={[ items={
{ key: 'orders', label: '接单工单', children: <WorkOrdersPanel /> }, isSupport
{ key: 'rules', label: '物品规则', children: <ProductRulesPanel /> }, ? [{ key: 'orders', label: '接单工单', children: <WorkOrdersPanel /> }]
{ key: 'categories', label: '分类', children: <CategoriesPanel /> }, : [
{ key: 'workers', label: '打手', children: <WorkersPanel /> }, { key: 'orders', label: '接单工单', children: <WorkOrdersPanel /> },
{ key: 'finance', label: '资金', children: <FinancePanel /> }, { key: 'rules', label: '物品规则', children: <ProductRulesPanel /> },
{ key: 'levels', label: '等级权限', children: <LevelsPanel /> }, { key: 'categories', label: '分类', children: <CategoriesPanel /> },
...(isAdmin { key: 'workers', label: '打手', children: <WorkersPanel /> },
? [{ key: 'notifications', label: '通知配置', children: <NotificationsPanel /> }] { key: 'finance', label: '资金', children: <FinancePanel /> },
: []), { key: 'levels', label: '等级权限', children: <LevelsPanel /> },
]} ...(isAdmin
? [{ key: 'notifications', label: '通知配置', children: <NotificationsPanel /> }]
: []),
]
}
/> />
</section> </section>
) )
@@ -125,6 +125,7 @@ export default function WorkOrdersPanel() {
const [searchParams, setSearchParams] = useSearchParams() const [searchParams, setSearchParams] = useSearchParams()
const queryClient = useQueryClient() const queryClient = useQueryClient()
const canEditRequirementFields = hasAdminRole('operator') const canEditRequirementFields = hasAdminRole('operator')
const canViewStatistics = hasAdminRole('operator')
const [statuses, setStatuses] = useState<string[]>([]) const [statuses, setStatuses] = useState<string[]>([])
const [targetWorkOrderId, setTargetWorkOrderId] = useState<number | undefined>() const [targetWorkOrderId, setTargetWorkOrderId] = useState<number | undefined>()
const [keyword, setKeyword] = useState('') const [keyword, setKeyword] = useState('')
@@ -965,7 +966,9 @@ export default function WorkOrdersPanel() {
</div> </div>
</div> </div>
</Card> </Card>
<WorkOrderStatisticsBar statistics={ordersQuery.data?.data.statistics} /> {canViewStatistics ? (
<WorkOrderStatisticsBar statistics={ordersQuery.data?.data.statistics} />
) : null}
<Card <Card
title="接单工单" title="接单工单"
extra={ extra={