优化: 大文件拆分+代码分割+按需加载+console清理+any类型替换
- Money.tsx (2260行→54行): 拆分为 money/ 子目录4个组件, React.lazy二级分割 - AIAssistant.tsx (2038行→63行): 拆分为 ai-assistant/ 子目录6个组件, React.lazy二级分割 - xlsx改为动态导入, OvertimeTab从345KB降至12.7KB - api-services.ts: 请求参数 any→Record<string,unknown> - 移除前端3处console.log残留 - 后端console替换为pino logger - 前后端未使用import/变量清理 - Zod schema验证: termination/platform/special-status/work-process - 新增 leave.routes.ts, acceptance-test.routes.ts - UI组件: PageGuide, QueryError, Stepper
This commit is contained in:
@@ -7,6 +7,8 @@ import Card from '../components/ui/Card'
|
||||
import Button from '../components/ui/Button'
|
||||
import EmptyState from '../components/ui/EmptyState'
|
||||
import Pagination from '../components/ui/Pagination'
|
||||
import PageGuide from '../components/ui/PageGuide'
|
||||
import QueryError from '../components/ui/QueryError'
|
||||
|
||||
const STEP_LABELS: Record<string, string> = {
|
||||
DRAFTING: '起草',
|
||||
@@ -27,7 +29,7 @@ export default function Policies() {
|
||||
const [page, setPage] = useState(1)
|
||||
const [pageSize, setPageSize] = useState(20)
|
||||
|
||||
const { data: listData, isLoading } = useQuery<any>({
|
||||
const { data: listData, isLoading, isError, error, refetch } = useQuery<any>({
|
||||
queryKey: ['policies', page, pageSize],
|
||||
queryFn: async () => {
|
||||
return await policiesApi.list({ page, pageSize })
|
||||
@@ -51,6 +53,9 @@ export default function Policies() {
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<PageGuide>
|
||||
规章制度管理遵循民主程序四步法:起草 → 讨论 → 协商 → 公示。每一步均需记录参与人员、会议纪要及员工签字,确保制度合法有效。新建制度后按步骤推进,系统自动生成民主程序履行记录。
|
||||
</PageGuide>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -66,6 +71,8 @@ export default function Policies() {
|
||||
|
||||
{isLoading ? (
|
||||
<div className="text-center py-8 text-gray-500">加载中...</div>
|
||||
) : isError ? (
|
||||
<QueryError error={error} onRetry={refetch} />
|
||||
) : !list || list.length === 0 ? (
|
||||
<EmptyState title="暂无规章制度" description="点击右上角新建制度" />
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user