feat: 全部列表页统一分页 + WorkProcess集成现有服务
- WorkProcess/Termination/Evidence/Contracts/Policies/Templates 添加 Pagination 组件 - 后端 getDrafts/getPolicies/enterprise-template 路由添加分页支持(可选参数,向后兼容) - work-process.service CONFIRM case 修正:移除不存在的 probationEndDate 字段 - 新增 migration_add_three_tables.sql 增量迁移文件
This commit is contained in:
@@ -6,6 +6,7 @@ import api from '../lib/api'
|
||||
import Card from '../components/ui/Card'
|
||||
import Button from '../components/ui/Button'
|
||||
import EmptyState from '../components/ui/EmptyState'
|
||||
import Pagination from '../components/ui/Pagination'
|
||||
|
||||
const STEP_LABELS: Record<string, string> = {
|
||||
DRAFTING: '起草',
|
||||
@@ -23,14 +24,18 @@ export default function Policies() {
|
||||
const queryClient = useQueryClient()
|
||||
const [showCreate, setShowCreate] = useState(false)
|
||||
const [selectedPolicy, setSelectedPolicy] = useState<any>(null)
|
||||
const [page, setPage] = useState(1)
|
||||
const [pageSize, setPageSize] = useState(20)
|
||||
|
||||
const { data: list, isLoading } = useQuery<any>({
|
||||
queryKey: ['policies'],
|
||||
const { data: listData, isLoading } = useQuery<any>({
|
||||
queryKey: ['policies', page, pageSize],
|
||||
queryFn: async () => {
|
||||
const res = await api.get('/policies') as any
|
||||
const res = await api.get('/policies', { params: { page, pageSize } }) as any
|
||||
return res.data
|
||||
},
|
||||
})
|
||||
const list = listData?.items || []
|
||||
const total = listData?.total || 0
|
||||
|
||||
const advanceMutation = useMutation({
|
||||
mutationFn: ({ id, step, note }: { id: string; step: number; note?: string }) => api.post(`/policies/${id}/advance-step`, { step, note }),
|
||||
@@ -114,6 +119,13 @@ export default function Policies() {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<Pagination
|
||||
page={page}
|
||||
pageSize={pageSize}
|
||||
total={total}
|
||||
onPageChange={setPage}
|
||||
onPageSizeChange={(s) => { setPageSize(s); setPage(1) }}
|
||||
/>
|
||||
|
||||
{/* 详情弹窗 */}
|
||||
{selectedPolicy && (
|
||||
|
||||
Reference in New Issue
Block a user