fix
parent
f6fa4864a6
commit
35f8b990d8
|
|
@ -31,7 +31,9 @@ export const staffInfoRemove = declareRequest(
|
||||||
|
|
||||||
export const staffInfoResetPassword = declareRequest(
|
export const staffInfoResetPassword = declareRequest(
|
||||||
"staffInfoLoading",
|
"staffInfoLoading",
|
||||||
safeAction(async ({ id }) => apiPost("/safetyEval/org-personnel/reset-password", { data: asId(id) })),
|
safeAction(async ({ id, resetPassword }) =>
|
||||||
|
apiPost("/safetyEval/org-personnel/reset-password", { data: {id, resetPassword} }),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const queryBasicDisciplineMajor = declareRequest(
|
export const queryBasicDisciplineMajor = declareRequest(
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ function PersonnelInfoPage(props) {
|
||||||
const [formModalOpen, setFormModalOpen] = useState(false);
|
const [formModalOpen, setFormModalOpen] = useState(false);
|
||||||
const [viewModalOpen, setViewModalOpen] = useState(false);
|
const [viewModalOpen, setViewModalOpen] = useState(false);
|
||||||
const [importModalOpen, setImportModalOpen] = useState(false);
|
const [importModalOpen, setImportModalOpen] = useState(false);
|
||||||
|
const [resetPasswordModalOpen, setResetPasswordModalOpen] = useState(false);
|
||||||
const [currentId, setCurrentId] = useState("");
|
const [currentId, setCurrentId] = useState("");
|
||||||
const [searchForm] = Form.useForm();
|
const [searchForm] = Form.useForm();
|
||||||
const [deptOptions, setDeptOptions] = useState([]);
|
const [deptOptions, setDeptOptions] = useState([]);
|
||||||
|
|
@ -115,18 +116,8 @@ function PersonnelInfoPage(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResetPassword = (id) => {
|
const onResetPassword = (id) => {
|
||||||
Modal.confirm({
|
setCurrentId(id);
|
||||||
title: "提示",
|
setResetPasswordModalOpen(true);
|
||||||
content: "密码将会重置,您是否确认重置密码?",
|
|
||||||
okText: "是",
|
|
||||||
cancelText: "否",
|
|
||||||
onOk: async () => {
|
|
||||||
const res = await props.staffInfoResetPassword({ id });
|
|
||||||
if (res?.success !== false) {
|
|
||||||
message.success("重置成功");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -336,6 +327,17 @@ function PersonnelInfoPage(props) {
|
||||||
onSuccess={handleSearch}
|
onSuccess={handleSearch}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{resetPasswordModalOpen && (
|
||||||
|
<ResetPasswordModal
|
||||||
|
open={resetPasswordModalOpen}
|
||||||
|
currentId={currentId}
|
||||||
|
staffInfoResetPassword={props.staffInfoResetPassword}
|
||||||
|
onCancel={() => {
|
||||||
|
setResetPasswordModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1061,6 +1063,57 @@ function StaffImportModal({ open, onCancel, onSuccess }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ResetPasswordModal({ open, currentId, staffInfoResetPassword, onCancel }) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const [submitting, setSubmitting] = useState(false);
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
form.resetFields();
|
||||||
|
onCancel();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async (values) => {
|
||||||
|
try {
|
||||||
|
setSubmitting(true);
|
||||||
|
const res = await staffInfoResetPassword({
|
||||||
|
id: currentId,
|
||||||
|
resetPassword: values.resetPassword,
|
||||||
|
});
|
||||||
|
if (res?.success !== false) {
|
||||||
|
message.success("重置成功");
|
||||||
|
handleCancel();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setSubmitting(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
open={open}
|
||||||
|
destroyOnHidden
|
||||||
|
title="重置密码"
|
||||||
|
confirmLoading={submitting}
|
||||||
|
onCancel={handleCancel}
|
||||||
|
onOk={form.submit}
|
||||||
|
>
|
||||||
|
<Form form={form} layout="vertical" onFinish={handleSubmit}>
|
||||||
|
<Form.Item
|
||||||
|
name="resetPassword"
|
||||||
|
label="新密码"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: "请输入新密码" },
|
||||||
|
{ min: 6, message: "密码至少6位" },
|
||||||
|
{ max: 20, message: "密码不能超过20位" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input.Password placeholder="请输入新密码" maxLength={20} />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default Connect(
|
export default Connect(
|
||||||
[NS_STAFF_INFO, NS_ORG_DEPARTMENT],
|
[NS_STAFF_INFO, NS_ORG_DEPARTMENT],
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue