diff --git a/src/pages/system/administrator/compenents/create.tsx b/src/pages/system/administrator/compenents/create.tsx index d92845c..e447677 100644 --- a/src/pages/system/administrator/compenents/create.tsx +++ b/src/pages/system/administrator/compenents/create.tsx @@ -21,8 +21,10 @@ export const SystemAdministratorCreate: React.FC = ({ const [roles, setRoles] = useState([]); useEffect(() => { - getParams(); - }, [refresh]); + if (open) { + getParams(); + } + }, [refresh, open]); useEffect(() => { let roleIds = []; diff --git a/src/pages/system/administrator/compenents/update.tsx b/src/pages/system/administrator/compenents/update.tsx index ac92d16..ff5b8e6 100644 --- a/src/pages/system/administrator/compenents/update.tsx +++ b/src/pages/system/administrator/compenents/update.tsx @@ -21,8 +21,10 @@ export const SystemAdministratorUpdate: React.FC = ({ const [roles, setRoles] = useState([]); useEffect(() => { - getParams(); - }, [refresh]); + if (open) { + getParams(); + } + }, [refresh, open]); useEffect(() => { if (id === 0) { diff --git a/src/pages/system/adminroles/compenents/create.tsx b/src/pages/system/adminroles/compenents/create.tsx index 3ac0d62..5109c5a 100644 --- a/src/pages/system/adminroles/compenents/create.tsx +++ b/src/pages/system/adminroles/compenents/create.tsx @@ -24,8 +24,10 @@ export const SystemAdminrolesCreate: React.FC = ({ const [actions, setActions] = useState([]); useEffect(() => { - getParams(); - }, []); + if (open) { + getParams(); + } + }, [open]); useEffect(() => { form.setFieldsValue({ diff --git a/src/pages/system/adminroles/compenents/update.tsx b/src/pages/system/adminroles/compenents/update.tsx index 8708800..3f6697a 100644 --- a/src/pages/system/adminroles/compenents/update.tsx +++ b/src/pages/system/adminroles/compenents/update.tsx @@ -26,8 +26,10 @@ export const SystemAdminrolesUpdate: React.FC = ({ const [actions, setActions] = useState([]); useEffect(() => { - getParams(); - }, []); + if (open) { + getParams(); + } + }, [open]); useEffect(() => { if (id === undefined) {