import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, DatePicker, Descriptions, Form, Input, message, Modal, Select, Table, Tag, } from "antd"; import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction"; import AttachmentUpload from "~/components/AttachmentUpload"; import { useEffect, useState } from "react"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import SearchForm from "@cqsjjb/jjb-react-admin-component/SearchForm"; import ControlWrapper from "@cqsjjb/jjb-react-admin-component/ControlWrapper"; import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd"; import { tools } from "@cqsjjb/jjb-common-lib"; import { NS_STAFF_INFO, NS_STAFF_RESIGNATION_APPLY, } from "~/enumerate/namespace"; import { RESIGN_AUDIT_STATUS_LABEL, AUDIT_STATUS_COLOR, } from "~/utils/enterpriseForm"; const { router } = tools; function ResignationApplyPage(props) { const [addModalOpen, setAddModalOpen] = useState(false); const [viewModalOpen, setViewModalOpen] = useState(false); const [currentId, setCurrentId] = useState(""); const [staffOptions, setStaffOptions] = useState([]); const [searchForm] = Form.useForm(); const { staffResignationApply } = props; const { staffResignationApplyList: dataSource, staffResignationApplyTotal: total, staffResignationApplyLoading: loading, } = staffResignationApply || {}; const handleSearch = () => { props.staffResignationApplyList({ ...router.query }); }; useEffect(() => { searchForm.setFieldsValue(router.query); handleSearch(); }, []); useEffect(() => { let cancelled = false; props .staffInfoList?.({ current: 1, size: 500 }) .then((res) => { if (!cancelled) { setStaffOptions( (res?.data || []).map((s) => ({ label: `${s.userName ?? s.staffName}(${s.account})`, value: s.id, staffName: s.userName ?? s.staffName, account: s.account, })), ); } }) .catch(() => {}); return () => { cancelled = true; }; }, []); return ( 离职申请管理
机构管理员在人员信息管理页面进行相应的修改操作
} extra={ } > , {Object.entries(RESIGN_AUDIT_STATUS_LABEL).map( ([value, label]) => ( {label} ), )} , ]} onReset={(value) => { router.query = { ...value, current: 1, size: 10 }; handleSearch(); }} onFinish={(value) => { router.query = { ...value, current: 1, size: 10 }; handleSearch(); }} /> { const code = record.auditStatusCode ?? record.auditStatus; const label = RESIGN_AUDIT_STATUS_LABEL[code] ?? "-"; return {label}; }, }, { title: "操作", width: 80, render: (_, record) => ( ), }, ]} dataSource={dataSource} scroll={{ y: props.scrollY }} loading={loading} pagination={{ total, showSizeChanger: true, showQuickJumper: true, showTotal: (t) => `共 ${t} 条`, current: router.query.current || 1, pageSize: router.query.size || 10, onChange: (page, pageSize) => { router.query = { ...router.query, current: page, size: pageSize }; handleSearch(); }, }} /> setAddModalOpen(false)} onSuccess={handleSearch} /> { setViewModalOpen(false); setCurrentId(""); }} /> ); } function AddModal({ open, staffOptions, requestAdd, onCancel, onSuccess }) { const [form] = Form.useForm(); const [submitting, setSubmitting] = useState(false); const handleCancel = () => { form.resetFields(); onCancel(); }; const handleSubmit = async () => { try { const values = await form.validateFields(); setSubmitting(true); values.applyTime = values.applyTime?.format?.("YYYY-MM-DD HH:mm:ss") || values.applyTime; values.expectedResignDate = values.expectedResignDate?.format?.("YYYY-MM-DD") || values.expectedResignDate; values.reportFileUrl = values.reportFileUrl?.map?.((f) => f.url).filter(Boolean).join(",") || undefined; const res = await requestAdd(values); if (res?.success !== false) { message.success("提交成功"); handleCancel(); onSuccess(); } else { message.error(res?.message || "提交失败"); } } catch { // validation error } finally { setSubmitting(false); } }; return (