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:
@@ -9,6 +9,7 @@ import Card from '../components/ui/Card'
|
||||
import Button from '../components/ui/Button'
|
||||
import { Input, Label, Select } from '../components/ui/Input'
|
||||
import EmptyState from '../components/ui/EmptyState'
|
||||
import Pagination from '../components/ui/Pagination'
|
||||
|
||||
// 金额格式化:保留两位小数 + 千分位
|
||||
const fmt = (n: number) => (n || 0).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||
@@ -119,6 +120,8 @@ export default function Termination() {
|
||||
const [filterStatus, setFilterStatus] = useState('')
|
||||
const [filterDepartment, setFilterDepartment] = useState('')
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
const [draftPage, setDraftPage] = useState(1)
|
||||
const [draftPageSize, setDraftPageSize] = useState(20)
|
||||
|
||||
const { data: employees } = useQuery<RosterEmployee[]>({
|
||||
queryKey: ['roster-for-termination'],
|
||||
@@ -250,10 +253,10 @@ export default function Termination() {
|
||||
})
|
||||
|
||||
// 草稿列表
|
||||
const { data: drafts, refetch: refetchDrafts } = useQuery({
|
||||
queryKey: ['termination-drafts', filterStatus, filterDepartment, searchTerm],
|
||||
const { data: draftsData, refetch: refetchDrafts } = useQuery({
|
||||
queryKey: ['termination-drafts', filterStatus, filterDepartment, searchTerm, draftPage, draftPageSize],
|
||||
queryFn: async () => {
|
||||
const params: any = {}
|
||||
const params: any = { page: draftPage, pageSize: draftPageSize }
|
||||
if (filterStatus) params.status = filterStatus
|
||||
if (filterDepartment) params.department = filterDepartment
|
||||
if (searchTerm) params.search = searchTerm
|
||||
@@ -262,6 +265,8 @@ export default function Termination() {
|
||||
},
|
||||
enabled: view === 'list',
|
||||
})
|
||||
const drafts = draftsData?.items || []
|
||||
const draftsTotal = draftsData?.total || 0
|
||||
|
||||
// 草稿详情
|
||||
const { data: draftDetail } = useQuery({
|
||||
@@ -823,6 +828,13 @@ export default function Termination() {
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
<Pagination
|
||||
page={draftPage}
|
||||
pageSize={draftPageSize}
|
||||
total={draftsTotal}
|
||||
onPageChange={setDraftPage}
|
||||
onPageSizeChange={(s) => { setDraftPageSize(s); setDraftPage(1) }}
|
||||
/>
|
||||
</Card>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user