接单平台分类管理完善:抢单大厅分类筛选与分类 CRUD
- 抢单大厅新增分类 Tab 筛选(仅显示启用分类,支持按分类查询工单) - 管理端分类面板支持编辑、启用/停用切换、删除(被工单/规则引用时禁止删除) - 后端工单列表支持 categoryId 筛选,大厅接口返回分类列表
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
Pagination,
|
||||
Space,
|
||||
Spin,
|
||||
Tabs,
|
||||
Tag,
|
||||
Typography,
|
||||
} from 'antd'
|
||||
@@ -37,14 +38,16 @@ export default function WorkerHallPage() {
|
||||
const queryClient = useQueryClient()
|
||||
const [keywordInput, setKeywordInput] = useState('')
|
||||
const [keyword, setKeyword] = useState('')
|
||||
const [categoryId, setCategoryId] = useState(0)
|
||||
const [page, setPage] = useState(1)
|
||||
const [pageSize, setPageSize] = useState(20)
|
||||
const [grabbingId, setGrabbingId] = useState(0)
|
||||
const [detailOrder, setDetailOrder] = useState<WorkOrder | null>(null)
|
||||
|
||||
const ordersQuery = useQuery({
|
||||
queryKey: ['worker-hall-orders', keyword, page, pageSize],
|
||||
queryFn: () => fetchWorkerHallOrders({ keyword, page, pageSize }),
|
||||
queryKey: ['worker-hall-orders', keyword, categoryId, page, pageSize],
|
||||
queryFn: () =>
|
||||
fetchWorkerHallOrders({ keyword, page, pageSize, categoryId: categoryId || undefined }),
|
||||
retry: false,
|
||||
})
|
||||
|
||||
@@ -94,6 +97,7 @@ export default function WorkerHallPage() {
|
||||
|
||||
const orders = ordersQuery.data?.data.items || []
|
||||
const pagination = ordersQuery.data?.data.pagination
|
||||
const categories = ordersQuery.data?.data.categories || []
|
||||
const worker = profileQuery.data?.data.worker
|
||||
const activeCount = hallSummaryQuery.data?.activeCount || 0
|
||||
const pendingAcceptanceCount = hallSummaryQuery.data?.pendingAcceptanceCount || 0
|
||||
@@ -210,6 +214,24 @@ export default function WorkerHallPage() {
|
||||
))}
|
||||
</div>
|
||||
|
||||
{categories.length > 0 ? (
|
||||
<Tabs
|
||||
size="small"
|
||||
activeKey={String(categoryId)}
|
||||
items={[
|
||||
{ key: '0', label: '全部' },
|
||||
...categories.map((category) => ({
|
||||
key: String(category.categoryId),
|
||||
label: category.name,
|
||||
})),
|
||||
]}
|
||||
onChange={(nextKey) => {
|
||||
setCategoryId(Number(nextKey) || 0)
|
||||
setPage(1)
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{shouldWarn ? (
|
||||
<Alert
|
||||
className="worker-hall-warning"
|
||||
|
||||
Reference in New Issue
Block a user