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="可选" /> +
+
+ +
+
+ + 查询授权 + — 查询数据的实例 +
+ +
+ +
+
+ + 变更授权 + — 数据变更工单的实例 +
+ +
+ +
+ + +
+
+
+
+ )}