完善查询历史记录
This commit is contained in:
@@ -2446,6 +2446,9 @@ async function showQueryHistoryDialog() {
|
||||
<button class="btn btn-sm btn-info me-1" onclick="viewHistoryDetail(${history.id})" title="查看详情">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-success me-1" onclick="loadHistoryResults(${history.id})" title="查看结果">
|
||||
<i class="fas fa-chart-bar"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-danger" onclick="deleteHistoryRecord(${history.id}, '${history.name}')" title="删除">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
@@ -2723,6 +2726,44 @@ async function viewHistoryDetail(historyId) {
|
||||
}
|
||||
}
|
||||
|
||||
// 加载历史记录结果
|
||||
async function loadHistoryResults(historyId) {
|
||||
try {
|
||||
const response = await fetch(`/api/query-history/${historyId}/results`);
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
// 设置当前结果数据
|
||||
currentResults = result.data;
|
||||
|
||||
// 根据查询类型设置分表模式
|
||||
if (result.data.history_info.query_type === 'sharding') {
|
||||
isShardingMode = true;
|
||||
document.getElementById('enableSharding').checked = true;
|
||||
toggleShardingMode();
|
||||
} else {
|
||||
isShardingMode = false;
|
||||
document.getElementById('enableSharding').checked = false;
|
||||
toggleShardingMode();
|
||||
}
|
||||
|
||||
// 显示结果
|
||||
displayResults(result.data);
|
||||
|
||||
// 关闭历史记录modal
|
||||
const modal = bootstrap.Modal.getInstance(document.getElementById('queryHistoryModal'));
|
||||
modal.hide();
|
||||
|
||||
const queryTypeDesc = result.data.history_info.query_type === 'sharding' ? '分表查询' : '单表查询';
|
||||
showAlert('success', `${queryTypeDesc}历史记录结果 "${result.data.history_info.name}" 加载成功`);
|
||||
} else {
|
||||
showAlert('danger', result.error || '加载历史记录结果失败');
|
||||
}
|
||||
} catch (error) {
|
||||
showAlert('danger', '加载历史记录结果失败: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除历史记录
|
||||
async function deleteHistoryRecord(historyId, historyName) {
|
||||
if (!confirm(`确定要删除历史记录 "${historyName}" 吗?此操作不可撤销。`)) {
|
||||
|
Reference in New Issue
Block a user