fix: 修复历史记录页面显示问题 - 报表日期中文化、时间范围格式修正、配置名称显示

Coze-Commit-Type: user
Coze-User-ID: 3722323274763196
Coze-Conversation-ID: 9894087
This commit is contained in:
user9994793890
2026-07-13 14:51:40 +08:00
parent bce03557dd
commit aaa5ba887a
4 changed files with 51 additions and 7 deletions

View File

@@ -2221,10 +2221,40 @@
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 || '-';
// 格式化报表日期为中文(直接解析字符串格式 '2026-07-12'
let reportDate = '-';
if (item.report_date) {
const match = item.report_date.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
if (match) {
const year = parseInt(match[1]);
const month = parseInt(match[2]);
const day = parseInt(match[3]);
reportDate = `${year}${month}${day}`;
} else {
reportDate = item.report_date;
}
}
// 格式化时间范围(直接解析字符串格式 '2026-07-12 08:00:00'
let timeRange = '-';
if (item.start_time && item.end_time) {
const formatTimeStr = (timeStr) => {
const match = timeStr.match(/(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2}):(\d{1,2})/);
if (match) {
const year = match[1];
const month = match[2].padStart(2, '0');
const day = match[3].padStart(2, '0');
const hour = match[4].padStart(2, '0');
const minute = match[5].padStart(2, '0');
const second = match[6].padStart(2, '0');
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
}
return timeStr;
};
timeRange = `${formatTimeStr(item.start_time)}${formatTimeStr(item.end_time)}`;
}
const configName = item.config_name || '-';
const splitValue = item.split_name || '-';
const totalOrders = item.total_orders || 0;