fix: 添加缺失的 renderHistory 函数,修复历史记录渲染问题
Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
BIN
assets/image_20260713142841517.png
Normal file
BIN
assets/image_20260713142841517.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -2210,6 +2210,47 @@
|
||||
}
|
||||
|
||||
// 带日期参数加载历史记录
|
||||
// 渲染历史记录列表
|
||||
function renderHistory(list) {
|
||||
const tbody = document.getElementById('history-list');
|
||||
if (!list || list.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="9" class="empty">暂无历史记录</td></tr>';
|
||||
return;
|
||||
}
|
||||
|
||||
tbody.innerHTML = list.map(item => {
|
||||
const statusText = item.status === 1 ? '成功' : '失败';
|
||||
const statusClass = item.status === 1 ? 'status-success' : 'status-failed';
|
||||
const startTime = item.start_time ? new Date(item.start_time).toLocaleString('zh-CN') : '-';
|
||||
const endTime = item.end_time ? new Date(item.end_time).toLocaleString('zh-CN') : '-';
|
||||
const timeRange = `${startTime} 至 ${endTime}`;
|
||||
const reportDate = item.report_date || '-';
|
||||
const configName = item.config_name || '-';
|
||||
const splitValue = item.split_name || '-';
|
||||
const totalOrders = item.total_orders || 0;
|
||||
const totalAmount = item.total_amount ? item.total_amount.toFixed(2) : '0.00';
|
||||
|
||||
return `
|
||||
<tr>
|
||||
<td><input type="checkbox" class="history-checkbox" value="${item.id}"></td>
|
||||
<td>${reportDate}</td>
|
||||
<td>${timeRange}</td>
|
||||
<td>${configName}</td>
|
||||
<td>${splitValue}</td>
|
||||
<td>${totalOrders}</td>
|
||||
<td>¥${totalAmount}</td>
|
||||
<td><span class="${statusClass}">${statusText}</span></td>
|
||||
<td>
|
||||
${item.status === 1 && item.file_path ?
|
||||
`<a href="/api/download?path=${encodeURIComponent(item.file_path)}" class="btn btn-sm btn-success">下载</a>` :
|
||||
'-'}
|
||||
<button class="btn btn-sm btn-danger" onclick="deleteHistory(${item.id})">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
// 加载历史记录(无日期筛选)
|
||||
async function loadHistory(page = 1) {
|
||||
loadHistoryWithDate(page);
|
||||
|
||||
Reference in New Issue
Block a user