增加日志
This commit is contained in:
@@ -16,8 +16,8 @@ async function batchDownloadHistory() {
|
||||
|
||||
// 按日期查询
|
||||
function queryHistoryByDate() {
|
||||
const startDate = document.getElementById('query-start-date').value;
|
||||
const endDate = document.getElementById('query-end-date').value;
|
||||
const startDate = document.getElementById('history-start-date').value;
|
||||
const endDate = document.getElementById('history-end-date').value;
|
||||
if (!startDate && !endDate) {
|
||||
alert('请至少选择一个日期');
|
||||
return;
|
||||
@@ -28,8 +28,8 @@ function queryHistoryByDate() {
|
||||
|
||||
// 清除日期查询
|
||||
function clearDateQuery() {
|
||||
document.getElementById('query-start-date').value = '';
|
||||
document.getElementById('query-end-date').value = '';
|
||||
document.getElementById('history-start-date').value = '';
|
||||
document.getElementById('history-end-date').value = '';
|
||||
loadHistory(1);
|
||||
}
|
||||
|
||||
@@ -227,3 +227,59 @@ function toggleSelectAllHistory() {
|
||||
cb.checked = selectAllCheckbox.checked;
|
||||
});
|
||||
}
|
||||
|
||||
// 删除单条历史记录
|
||||
async function deleteHistory(id) {
|
||||
if (!confirm('确定要删除这条历史记录吗?对应的报表文件也会被删除。')) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/report/history/batch-delete', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ ids: [id] })
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
alert('删除成功');
|
||||
loadHistory();
|
||||
} else {
|
||||
alert('删除失败: ' + result.message);
|
||||
}
|
||||
} catch (error) {
|
||||
alert('删除失败: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 批量删除历史记录
|
||||
async function batchDeleteHistory() {
|
||||
const checkboxes = document.querySelectorAll('.history-checkbox:checked');
|
||||
if (checkboxes.length === 0) {
|
||||
alert('请至少选择一条记录');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm(`确定要删除选中的 ${checkboxes.length} 条历史记录吗?对应的报表文件也会被删除。`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ids = Array.from(checkboxes).map(cb => parseInt(cb.value));
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/report/history/batch-delete', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ ids: ids })
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
alert(result.message);
|
||||
loadHistory();
|
||||
} else {
|
||||
alert('删除失败: ' + result.message);
|
||||
}
|
||||
} catch (error) {
|
||||
alert('删除失败: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user