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

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() {
const [searchParams] = useSearchParams()
const [activeTab, setActiveTab] = useState(() => loadActiveTab(searchParams.get('tab')))
const isAdmin = getAdminRole() === 'admin'
const visibleActiveTab = !isAdmin && activeTab === 'notifications' ? 'orders' : activeTab
const role = getAdminRole()
const isAdmin = role === 'admin'
const isSupport = role === 'support'
const visibleActiveTab =
isSupport || (!isAdmin && activeTab === 'notifications') ? 'orders' : activeTab
useEffect(() => {
const tab = searchParams.get('tab')
@@ -40,17 +43,21 @@ export default function AdminWorkerPlatformPage() {
destroyOnHidden={false}
activeKey={visibleActiveTab}
onChange={changeTab}
items={[
{ key: 'orders', label: '接单工单', children: <WorkOrdersPanel /> },
{ key: 'rules', label: '物品规则', children: <ProductRulesPanel /> },
{ key: 'categories', label: '分类', children: <CategoriesPanel /> },
{ key: 'workers', label: '打手', children: <WorkersPanel /> },
{ key: 'finance', label: '资金', children: <FinancePanel /> },
{ key: 'levels', label: '等级权限', children: <LevelsPanel /> },
...(isAdmin
? [{ key: 'notifications', label: '通知配置', children: <NotificationsPanel /> }]
: []),
]}
items={
isSupport
? [{ key: 'orders', label: '接单工单', children: <WorkOrdersPanel /> }]
: [
{ key: 'orders', label: '接单工单', children: <WorkOrdersPanel /> },
{ key: 'rules', label: '物品规则', children: <ProductRulesPanel /> },
{ key: 'categories', label: '分类', children: <CategoriesPanel /> },
{ key: 'workers', label: '打手', children: <WorkersPanel /> },
{ key: 'finance', label: '资金', children: <FinancePanel /> },
{ key: 'levels', label: '等级权限', children: <LevelsPanel /> },
...(isAdmin
? [{ key: 'notifications', label: '通知配置', children: <NotificationsPanel /> }]
: []),
]
}
/>
</section>
)
@@ -125,6 +125,7 @@ export default function WorkOrdersPanel() {
const [searchParams, setSearchParams] = useSearchParams()
const queryClient = useQueryClient()
const canEditRequirementFields = hasAdminRole('operator')
const canViewStatistics = hasAdminRole('operator')
const [statuses, setStatuses] = useState<string[]>([])
const [targetWorkOrderId, setTargetWorkOrderId] = useState<number | undefined>()
const [keyword, setKeyword] = useState('')
@@ -965,7 +966,9 @@ export default function WorkOrdersPanel() {
</div>
</div>
</Card>
<WorkOrderStatisticsBar statistics={ordersQuery.data?.data.statistics} />
{canViewStatistics ? (
<WorkOrderStatisticsBar statistics={ordersQuery.data?.data.statistics} />
) : null}
<Card
title="接单工单"
extra={