From 3fa0a50db8e23c59f7e9e17715446c603f776cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Fri, 7 Apr 2023 16:27:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86=E6=9C=89?= =?UTF-8?q?=E7=9B=B8=E5=85=B3api=E8=AF=B7=E6=B1=82=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/system/administrator/compenents/create.tsx | 6 ++++-- src/pages/system/administrator/compenents/update.tsx | 6 ++++-- src/pages/system/adminroles/compenents/create.tsx | 6 ++++-- src/pages/system/adminroles/compenents/update.tsx | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) 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) {