setTitle(e.target.value)}
- className="w-full px-3 py-2 bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-lg text-sm focus:outline-none focus:border-blue-500 transition-colors"
- placeholder="如:用户表添加索引" />
+
+ {/* ====== 左侧 Schema 浏览面板 ====== */}
+ {showBrowser && instanceId && database && (
+
+
+ 库表浏览
+
-
-
-
-
-
-
- {isRedis ? (
-
- ) : databases.length > 0 ? (
-
- ) : (
- setDatabase(e.target.value)} disabled={!instanceId}
- className="w-full px-3 py-2 bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-lg text-sm focus:outline-none focus:border-blue-500 transition-colors disabled:opacity-50"
- placeholder={instanceId ? '请输入数据库名' : '请先选择实例'} />
- )}
-
-
-
- {/* 定时执行 */}
-
-
- {enableSchedule && (
- setScheduledAt(e.target.value)}
- step="1"
- className="px-3 py-2 bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-lg text-sm focus:outline-none focus:border-blue-500 transition-colors"
- min={new Date().toISOString().slice(0, 16)} />
- )}
- {enableSchedule && scheduledAt && (
-
- 将于 {new Date(scheduledAt).toLocaleString('zh-CN')} 执行
-
- )}
-
-
- {/* SQL Editor + Browser Panel */}
-
-
-
-
-
-
-
-
- {sqlContent.trim() ? sqlContent.trim().split(/;\s*/).filter(Boolean).length + ' 条语句' : ''}
-
-
-
-
-
-
-
-
- {/* Reason */}
-
-
-
-
-
- {/* === Inline Audit Result === */}
- {auditResult && (
-
-
-
- SQL 审核结果
-
-
- {errorCount > 0 && {errorCount} 错误}
- {warnCount > 0 && {warnCount} 警告}
- {infoCount > 0 && {infoCount} 提示}
- {errorCount === 0 && warnCount === 0 && infoCount === 0 && (
- 审核通过
- )}
-
-
-
- {auditResult.findings.length > 0 && (
-
- {auditResult.findings.map((f, idx) => (
-
-
-
-
- {LEVEL_LABEL[f.level] || f.level}
- ·
- {f.rule}
-
-
{f.message}
-
-
- ))}
-
- )}
-
)}
- {/* === Bottom Actions === */}
-
-
-
+ {/* ====== 主区域 ====== */}
+
+
+ {/* -- 顶栏 -- */}
+
+ {/* 返回 */}
+
+
+ {/* 工单标题 */}
+
setTitle(e.target.value)}
+ className="px-3 py-1.5 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-sm focus:border-blue-400 focus:outline-none min-w-[180px] max-w-[280px]"
+ placeholder="工单标题" />
+
+ {/* 实例 */}
+
+
+ {/* 数据库 */}
+ {isRedis ? (
+
+ ) : databases.length > 0 ? (
+
+ ) : (
+
setDatabase(e.target.value)} disabled={!instanceId}
+ className="px-3 py-1.5 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-sm focus:border-blue-400 focus:outline-none min-w-[140px] disabled:opacity-50"
+ placeholder={instanceId ? '数据库名' : '选择实例'} />
+ )}
+
+
+
+ {/* 定时执行 */}
+
+ {enableSchedule && (
+
setScheduledAt(e.target.value)}
+ step="1" min={new Date().toISOString().slice(0, 16)}
+ className="px-2 py-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-xs focus:border-blue-400 focus:outline-none" />
+ )}
+
+ {/* 浏览面板开关 */}
+ {instanceId && database && (
+
+ )}
+
+ {/* 格式化 */}
+
+
+ {/* SQL 检测 */}
+
+
+ {/* 提交审批 */}
+
+
+
+ {/* -- 定时执行提示 -- */}
+ {enableSchedule && scheduledAt && (
+
+ 定时执行:{new Date(scheduledAt).toLocaleString('zh-CN')}
+
+ )}
+
+ {/* -- 错误 -- */}
+ {error && (
+
+ )}
+
+ {/* -- SQL 编辑器 -- */}
+
+
+
+
+
+ {sqlContent.trim() ? sqlContent.trim().split(/;\s*/).filter(Boolean).length + ' 条语句 · ' : ''}
+ {sqlContent.length} 字符
+
+
+ {validated && 检测通过}
+ Ctrl+Enter 格式化
+
+
+
+
+
+ {/* -- 变更原因 + 审核结果(底部面板) -- */}
+
+ {/* 审核结果 */}
+ {auditResult && (
+
+
+
+ 审核结果
+
+ {errorCount > 0 && {errorCount} 错误}
+ {warnCount > 0 && {warnCount} 警告}
+ {infoCount > 0 && {infoCount} 提示}
+ {errorCount === 0 && warnCount === 0 && infoCount === 0 && (
+ 通过
+ )}
+
+ {auditResult.findings.length > 0 && (
+
+ {auditResult.findings.map((f, idx) => (
+
+
+ {LEVEL_LABEL[f.level] || f.level}: {f.message}
+
+ ))}
+
+ )}
+
+ )}
+
+ {/* 变更原因 */}
+
+ 变更原因 *
+ setReason(e.target.value)}
+ className="flex-1 px-3 py-1.5 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-sm focus:border-blue-400 focus:outline-none"
+ placeholder="请描述变更原因、影响范围、回滚方案等" />
+
+
);