diff --git a/src/pages/Container/EnterpriseInfo/ResignationApply/index.js b/src/pages/Container/EnterpriseInfo/ResignationApply/index.js index 7930e3b..75e4fa3 100644 --- a/src/pages/Container/EnterpriseInfo/ResignationApply/index.js +++ b/src/pages/Container/EnterpriseInfo/ResignationApply/index.js @@ -13,7 +13,6 @@ import { } from "antd"; import TableAction from "@cqsjjb/jjb-react-admin-component/TableAction"; import AttachmentUpload from "~/components/AttachmentUpload"; -import { UploadOutlined } from "@ant-design/icons"; import PreviewUrlButton from "~/components/PreviewUrlButton"; import { useEffect, useState } from "react"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; @@ -222,6 +221,12 @@ function AddModal({ open, staffOptions, requestAdd, onCancel, onSuccess }) { const handleSubmit = async () => { try { const values = await form.validateFields(); + if (!values.reportFileUrl?.length) { + form.setFields([ + { name: "reportFileUrl", errors: ["请上传离职通知报告"] }, + ]); + return; + } setSubmitting(true); values.applyTime = values.applyTime?.format?.("YYYY-MM-DD HH:mm:ss") || values.applyTime; @@ -292,52 +297,12 @@ function AddModal({ open, staffOptions, requestAdd, onCancel, onSuccess }) { - - - { - const url = form.getFieldValue("reportFileUrl"); - if (url) window.open(url); - }} - onChange={(info) => { - if (info.file.status === "uploading") { - setUploading(true); - } else { - setUploading(false); - if (info.file.status === "done") { - const data = info.file.response?.data; - if (data) { - const url = data.url || data; - form.setFieldsValue({ reportFileUrl: url }); - } else { - message.error("上传失败,未获取到文件地址"); - } - } else if (info.file.status === "error") { - message.error(`${info.file.name} 上传失败`); - } - } - }} - onRemove={() => { - form.setFieldsValue({ reportFileUrl: "" }); - }} - > - - - + maxCount={1} + accept=".pdf" + /> );