From b5739ba955e7702ae6f2e5c7dff366620756fcee Mon Sep 17 00:00:00 2001 From: logan Date: Wed, 27 May 2026 21:42:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9D=83=E9=99=90=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E8=BE=93=E5=85=A5=E6=A1=86=E5=A4=B1=E7=84=A6?= =?UTF-8?q?=20=E2=80=94=20FormModal=E4=BB=8E=E5=86=85=E8=81=94=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E4=BB=B6=E6=94=B9=E4=B8=BA=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?JSX=E5=86=85=E8=81=94=EF=BC=8C=E9=81=BF=E5=85=8Dstate=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AF=BC=E8=87=B4DOM=E9=87=8D=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/InstanceGroupPage.tsx | 108 +++++++++++------------ 1 file changed, 51 insertions(+), 57 deletions(-) diff --git a/frontend/src/pages/InstanceGroupPage.tsx b/frontend/src/pages/InstanceGroupPage.tsx index cf3fe70..373155d 100644 --- a/frontend/src/pages/InstanceGroupPage.tsx +++ b/frontend/src/pages/InstanceGroupPage.tsx @@ -254,61 +254,10 @@ export default function InstanceGroupPage() { ); }; - /* ── Form Modal (shared by create & edit) ── */ - const FormModal = ({ mode }: { mode: 'create' | 'edit' }) => { - const show = mode === 'create' ? showCreateModal : showEditModal; - const close = () => { setShowCreateModal(false); setShowEditModal(false); resetForm(); }; - const submit = mode === 'create' ? handleCreate : handleEdit; - return show ? ( -
-
e.stopPropagation()}> -
-

{mode === 'create' ? '新建权限策略' : '编辑权限策略'}

- -
-
-
-
- - setFormName(e.target.value)} placeholder="如:生产数据库权限" /> -
-
- - setFormDesc(e.target.value)} placeholder="可选" /> -
-
- - {/* Readonly Transfer */} -
-
- - 查询授权 - — 查询数据的实例 -
- -
- - {/* Write Transfer */} -
-
- - 变更授权 - — 数据变更工单的实例 -
- -
- -
- - -
-
-
-
- ) : null; - }; + /* ── Form Modal shared close/submit ── */ + const formClose = () => { setShowCreateModal(false); setShowEditModal(false); resetForm(); }; + const formMode = showCreateModal ? 'create' as const : showEditModal ? 'edit' as const : null; + const formSubmit = formMode === 'create' ? handleCreate : handleEdit; return (
@@ -439,8 +388,53 @@ export default function InstanceGroupPage() {
{/* Form Modal (create & edit) */} - - + {formMode && ( +
+
e.stopPropagation()}> +
+

{formMode === 'create' ? '新建权限策略' : '编辑权限策略'}

+ +
+
+
+
+ + setFormName(e.target.value)} placeholder="如:生产数据库权限" /> +
+
+ + setFormDesc(e.target.value)} placeholder="可选" /> +
+
+ +
+
+ + 查询授权 + — 查询数据的实例 +
+ +
+ +
+
+ + 变更授权 + — 数据变更工单的实例 +
+ +
+ +
+ + +
+
+
+
+ )}