feat(user): 优化重置密码流程,支持动态默认密码获取
- 在用户相关接口中新增获取默认密码的请求方法 - 多个用户管理页面引入重置密码状态,支持按钮加载态显示 - 重构重置密码函数,先异步调用获取默认密码接口 - 弹窗提示显示动态获取的默认密码,增强用户确认体验 - 成功重置密码后刷新数据,保持界面最新状态 - 更新命名空间依赖,新增NS_USER支持对应请求与数据绑定配合重庆项目需求变更
parent
bc2e64cf1a
commit
11c42c48f8
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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) {
|
|||
&& (
|
||||
<Button
|
||||
type="link"
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
@ -508,4 +515,4 @@ function AddModalComponent(props) {
|
|||
);
|
||||
}
|
||||
const AddModal = AddModalComponent;
|
||||
export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List));
|
||||
export default Connect([NS_ENTERPRISE, NS_GLOBAL, NS_USER], true)(Permission(List));
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ function List(props) {
|
|||
const [selectedNodeId, setSelectedNodeId] = useState();
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [resetPasswordId, setResetPasswordId] = useState("");
|
||||
const queryParams = useGetUrlQuery();
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(props["userList"], {
|
||||
|
|
@ -41,21 +42,26 @@ function List(props) {
|
|||
};
|
||||
},
|
||||
});
|
||||
const onResetPassword = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要重置密码为Cc@12345678吗?",
|
||||
onOk: () => {
|
||||
props["userChangePassword"]({
|
||||
id,
|
||||
}).then((res) => {
|
||||
if (res.success) {
|
||||
const onResetPassword = async (id) => {
|
||||
setResetPasswordId(id);
|
||||
try {
|
||||
const res = await props["userGetDefaultPwd"]({ userId: id });
|
||||
if (!res.success)
|
||||
return;
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: `确定要重置密码为${res.data}吗?`,
|
||||
onOk: () => props["userChangePassword"]({ id }).then((resetRes) => {
|
||||
if (resetRes.success) {
|
||||
message.success("重置密码成功");
|
||||
getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}),
|
||||
});
|
||||
}
|
||||
finally {
|
||||
setResetPasswordId("");
|
||||
}
|
||||
};
|
||||
|
||||
// 清除伪类
|
||||
|
|
@ -159,6 +165,7 @@ function List(props) {
|
|||
&& (
|
||||
<Button
|
||||
type="link"
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ function List(props) {
|
|||
const [selectedNodeId, setSelectedNodeId] = useState();
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [resetPasswordId, setResetPasswordId] = useState("");
|
||||
const [form] = Form.useForm();
|
||||
const { downloadBlob } = useDownloadBlob();
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||
|
|
@ -82,21 +83,26 @@ function List(props) {
|
|||
},
|
||||
});
|
||||
};
|
||||
const onResetPassword = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要重置密码为Bb@12345678吗?",
|
||||
onOk: () => {
|
||||
props["userChangePassword"]({
|
||||
id,
|
||||
}).then((res) => {
|
||||
if (res.success) {
|
||||
const onResetPassword = async (id) => {
|
||||
setResetPasswordId(id);
|
||||
try {
|
||||
const res = await props["userGetDefaultPwd"]({ userId: id });
|
||||
if (!res.success)
|
||||
return;
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: `确定要重置密码为${res.data}吗?`,
|
||||
onOk: () => props["userChangePassword"]({ id }).then((resetRes) => {
|
||||
if (resetRes.success) {
|
||||
message.success("重置密码成功");
|
||||
getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}),
|
||||
});
|
||||
}
|
||||
finally {
|
||||
setResetPasswordId("");
|
||||
}
|
||||
};
|
||||
const onImportFileConfirm = (values) => {
|
||||
importFile("/basicInfo/user/importUserTableByCorp2", {
|
||||
|
|
@ -258,6 +264,7 @@ function List(props) {
|
|||
&& (
|
||||
<Button
|
||||
type="link"
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ function List(props) {
|
|||
const [selectedNodeId, setSelectedNodeId] = useState();
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [resetPasswordId, setResetPasswordId] = useState("");
|
||||
const [modalType, setModalType] = useState("");
|
||||
const [form] = Form.useForm();
|
||||
|
||||
|
|
@ -44,21 +45,26 @@ function List(props) {
|
|||
};
|
||||
},
|
||||
});
|
||||
const onResetPassword = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要重置密码为Cc@12345678吗?",
|
||||
onOk: () => {
|
||||
props["userChangePassword"]({
|
||||
id,
|
||||
}).then((res) => {
|
||||
if (res.success) {
|
||||
const onResetPassword = async (id) => {
|
||||
setResetPasswordId(id);
|
||||
try {
|
||||
const res = await props["userGetDefaultPwd"]({ userId: id });
|
||||
if (!res.success)
|
||||
return;
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: `确定要重置密码为${res.data}吗?`,
|
||||
onOk: () => props["userChangePassword"]({ id }).then((resetRes) => {
|
||||
if (resetRes.success) {
|
||||
message.success("重置密码成功");
|
||||
getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}),
|
||||
});
|
||||
}
|
||||
finally {
|
||||
setResetPasswordId("");
|
||||
}
|
||||
};
|
||||
const onDelete = (row) => {
|
||||
Modal.confirm({
|
||||
|
|
@ -184,6 +190,7 @@ function List(props) {
|
|||
<Button
|
||||
type="link"
|
||||
hidden={record.employmentFlag === 0}
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
|
|||
|
|
@ -12,7 +12,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";
|
||||
|
||||
const USER_FLAG = [
|
||||
|
|
@ -58,25 +58,31 @@ function List(props) {
|
|||
});
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [resetPasswordId, setResetPasswordId] = useState("");
|
||||
const [openType, setOpenType] = useState("");
|
||||
useEffect(() => {
|
||||
getMenuIdByPath().then(setMenuId);
|
||||
}, []);
|
||||
const onResetPassword = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "是否重置密码为Bb@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 = () => {
|
||||
Modal.confirm({
|
||||
|
|
@ -277,6 +283,7 @@ function List(props) {
|
|||
&& (
|
||||
<Button
|
||||
type="link"
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
@ -560,4 +567,4 @@ function AddModalComponent(props) {
|
|||
);
|
||||
}
|
||||
const AddModal = AddModalComponent;
|
||||
export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List));
|
||||
export default Connect([NS_ENTERPRISE, NS_GLOBAL, NS_USER], true)(Permission(List));
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ 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) {
|
||||
|
|
@ -40,27 +40,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 = () => {
|
||||
|
|
@ -265,6 +271,7 @@ function List(props) {
|
|||
&& (
|
||||
<Button
|
||||
type="link"
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
@ -514,4 +521,4 @@ function AddModalComponent(props) {
|
|||
);
|
||||
}
|
||||
const AddModal = AddModalComponent;
|
||||
export default Connect([NS_ENTERPRISE, NS_GLOBAL], true)(Permission(List));
|
||||
export default Connect([NS_ENTERPRISE, NS_GLOBAL, NS_USER], true)(Permission(List));
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ function List(props) {
|
|||
const [selectedNodeId, setSelectedNodeId] = useState();
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [resetPasswordId, setResetPasswordId] = useState("");
|
||||
const queryParams = useGetUrlQuery();
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(props["userList"], {
|
||||
|
|
@ -43,21 +44,26 @@ function List(props) {
|
|||
},
|
||||
];
|
||||
|
||||
const onResetPassword = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要重置密码为Cc@12345678吗?",
|
||||
onOk: () => {
|
||||
props["userChangePassword"]({
|
||||
id,
|
||||
}).then((res) => {
|
||||
if (res.success) {
|
||||
const onResetPassword = async (id) => {
|
||||
setResetPasswordId(id);
|
||||
try {
|
||||
const res = await props["userGetDefaultPwd"]({ userId: id });
|
||||
if (!res.success)
|
||||
return;
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: `确定要重置密码为${res.data}吗?`,
|
||||
onOk: () => props["userChangePassword"]({ id }).then((resetRes) => {
|
||||
if (resetRes.success) {
|
||||
message.success("重置密码成功");
|
||||
getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}),
|
||||
});
|
||||
}
|
||||
finally {
|
||||
setResetPasswordId("");
|
||||
}
|
||||
};
|
||||
// 清除伪类
|
||||
useEffect(() => {
|
||||
|
|
@ -146,6 +152,7 @@ function List(props) {
|
|||
&& (
|
||||
<Button
|
||||
type="link"
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ function List(props) {
|
|||
const [selectedNodeId, setSelectedNodeId] = useState();
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [resetPasswordId, setResetPasswordId] = useState("");
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||
const [employmentFlagData, setEmploymentFlagData] = useState([]);
|
||||
|
||||
|
|
@ -82,21 +83,26 @@ function List(props) {
|
|||
},
|
||||
});
|
||||
};
|
||||
const onResetPassword = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要重置密码为Aa@12345678吗?",
|
||||
onOk: () => {
|
||||
props["userChangePassword"]({
|
||||
id,
|
||||
}).then((res) => {
|
||||
if (res.success) {
|
||||
const onResetPassword = async (id) => {
|
||||
setResetPasswordId(id);
|
||||
try {
|
||||
const res = await props["userGetDefaultPwd"]({ userId: id });
|
||||
if (!res.success)
|
||||
return;
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: `确定要重置密码为${res.data}吗?`,
|
||||
onOk: () => props["userChangePassword"]({ id }).then((resetRes) => {
|
||||
if (resetRes.success) {
|
||||
message.success("重置密码成功");
|
||||
getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}),
|
||||
});
|
||||
}
|
||||
finally {
|
||||
setResetPasswordId("");
|
||||
}
|
||||
};
|
||||
const onImportFileConfirm = (values) => {
|
||||
importFile("/basicInfo/user/importUserTable", {
|
||||
|
|
@ -339,6 +345,7 @@ function List(props) {
|
|||
&& (
|
||||
<Button
|
||||
type="link"
|
||||
loading={resetPasswordId === record.id}
|
||||
onClick={() => onResetPassword(record.id)}
|
||||
>
|
||||
重置密码
|
||||
|
|
|
|||
Loading…
Reference in New Issue