diff --git a/src/api/user/index.js b/src/api/user/index.js index 935a6be..e210379 100644 --- a/src/api/user/index.js +++ b/src/api/user/index.js @@ -66,6 +66,10 @@ export const userChangePassword = declareRequest( "userLoading", "Post > @/basicInfo/user/changePassword/{id}", ); +export const userGetDefaultPwd = declareRequest( + "userLoading", + "Post > @/basicInfo/user/getDefaultPwd", +); // 校验用户名 手机号 身份证号是否重复 export const verifyUser = declareRequest( diff --git a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js index 094cf81..563e0bc 100644 --- a/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js +++ b/src/pages/Container/Enterprise/StakeholderUnit/AccountManage/List/index.js @@ -13,7 +13,7 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import useTable from "zy-react-library/hooks/useTable"; import { UNIFIED_SOCIAL_CREDIT_CODE } from "zy-react-library/regular"; import { getLabelName } from "zy-react-library/utils"; -import { NS_ENTERPRISE, NS_GLOBAL } from "~/enumerate/namespace"; +import { NS_ENTERPRISE, NS_GLOBAL, NS_USER } from "~/enumerate/namespace"; import { getMenuIdByPath, getTenantTypeConfigList, useDebounce } from "~/utils"; function List(props) { @@ -42,27 +42,33 @@ function List(props) { }); const [addModalOpen, setAddModalOpen] = useState(false); const [currentId, setCurrentId] = useState(""); + const [resetPasswordId, setResetPasswordId] = useState(""); useEffect(() => { getMenuIdByPath().then(setMenuId); }, []); useEffect(() => { getTenantTypeConfigList({ request: props.tenantTypeConfigList }).then(setTenantTypeConfigList); }, []); - const onResetPassword = (id) => { - Modal.confirm({ - title: "提示", - content: "是否重置密码为Cc@12345678?", - onOk: () => { - props["corpInfoChangePassword"]({ - id, - }).then((res) => { - if (res.success) { + const onResetPassword = async (id) => { + setResetPasswordId(id); + try { + const res = await props["userGetDefaultPwd"]({ corpinfoId: id }); + if (!res.success) + return; + Modal.confirm({ + title: "提示", + content: `确定要重置密码为${res.data}吗?`, + onOk: () => props["corpInfoChangePassword"]({ id }).then((resetRes) => { + if (resetRes.success) { message.success("重置密码成功"); getData(); } - }); - }, - }); + }), + }); + } + finally { + setResetPasswordId(""); + } }; const onDelete = (id) => { @@ -254,6 +260,7 @@ function List(props) { && (