import classNames from "classnames"; import { useCallback, useEffect, useMemo, useState } from "react"; import { Button, Form, Input, Select, Table } from "antd"; import { useNavigate } from "react-router-dom"; import { PageContainer } from "@/components"; import { ASSESSMENT_TYPE_OPTIONS, PUBLISH_STATUS_MAP, PUBLISH_STATUS_OPTIONS, } from "../../../constants"; import style from "../Form/index.module.scss"; import { debounce } from "lodash"; import { getManageEvaluationListApi } from "@/api"; import { IManageFormItem, IManageFormListParams } from "@/types"; const DEFAULT_PARAMS: IManageFormListParams = { deptStatus: undefined, searchKey: "", status: undefined, type: undefined, pageNum: 1, pageSize: 20, }; const ManagementEvaluationPage = () => { const navigate = useNavigate(); const [list, setList] = useState([]); const [loading, setLoading] = useState(false); const [params, setParams] = useState({ ...DEFAULT_PARAMS, }); const [total, setTotal] = useState(0); const getList = useCallback(async () => { setLoading(true); try { const data = await getManageEvaluationListApi(params); setList(data.data); setTotal(data.total); } finally { setLoading(false); } }, [params]); const paginationChange = useCallback( () => (pageNum: number, pageSize: number) => { setParams({ ...params, pageNum, pageSize }); }, [params] ); const debounceSearch = useMemo( () => debounce((changedVal: unknown, vals: any) => { setParams({ ...params, ...vals }); }, 500), [params] ); useEffect(() => { getList(); }, []); return (
{ return ASSESSMENT_TYPE_OPTIONS.find( (i) => i.value === item.type )?.label; }, }, { title: "说明", dataIndex: "remark", align: "center", minWidth: 100, }, { title: "考核周期", align: "center", minWidth: 100, render: (item: IManageFormItem) => `${item.dateStart}-${item.dateEnd}`, }, { title: "发布状态", key: "c", align: "center", minWidth: 100, render: (item: IManageFormItem) => (

{PUBLISH_STATUS_MAP[item.publishStatus].label}

), }, { title: "操作", key: "h", align: "center", fixed: "right", render: (item: IManageFormItem) => { return ( ); }, }, ]} pagination={{ showQuickJumper: true, position: ["bottomCenter"], showSizeChanger: true, current: params.pageNum, pageSize: params.pageSize, total, onChange: paginationChange(), }} /> ); }; export default ManagementEvaluationPage;