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:
freedakgmail
2026-07-30 10:39:21 +08:00
parent cea7eb07c4
commit 5a5ce7186b
13 changed files with 221 additions and 63 deletions
+17 -4
View File
@@ -9,6 +9,7 @@ import Button from '../components/ui/Button'
import { Input, Label, Select } from '../components/ui/Input'
import Modal from '../components/ui/Modal'
import EmptyState from '../components/ui/EmptyState'
import Pagination from '../components/ui/Pagination'
const CATEGORY_LABELS: Record<string, string> = {
CONTRACT: '合同',
@@ -303,6 +304,8 @@ function SystemTemplates() {
function EnterpriseTemplates() {
const queryClient = useQueryClient()
const [category, setCategory] = useState<string>('')
const [page, setPage] = useState(1)
const [pageSize, setPageSize] = useState(20)
const [showEdit, setShowEdit] = useState(false)
const [editItem, setEditItem] = useState<any>(null)
const [form, setForm] = useState({ name: '', category: 'CONTRACT', description: '', content: '' })
@@ -310,14 +313,17 @@ function EnterpriseTemplates() {
const [rendered, setRendered] = useState('')
const [variables, setVariables] = useState<Record<string, string>>({})
const { data: list, isLoading } = useQuery<any>({
queryKey: ['enterprise-templates', category],
const { data: listData, isLoading } = useQuery<any>({
queryKey: ['enterprise-templates', category, page, pageSize],
queryFn: async () => {
const params = category ? `?category=${category}` : ''
const res = await api.get(`/enterprise-templates${params}`) as any
const params: any = { page, pageSize }
if (category) params.category = category
const res = await api.get('/enterprise-templates', { params }) as any
return res.data
},
})
const list = listData?.items || []
const total = listData?.total || 0
const { data: detail } = useQuery<any>({
queryKey: ['enterprise-template-detail', selected?.id],
@@ -459,6 +465,13 @@ function EnterpriseTemplates() {
))}
</div>
)}
<Pagination
page={page}
pageSize={pageSize}
total={total}
onPageChange={setPage}
onPageSizeChange={(s) => { setPageSize(s); setPage(1) }}
/>
{/* 编辑弹窗 */}
<Modal open={showEdit} onClose={() => setShowEdit(false)} title={editItem ? '编辑模板' : '新建模板'} size="lg">