update code
This commit is contained in:
@@ -80,6 +80,24 @@ function displayStatistics(stats) {
|
||||
});
|
||||
}
|
||||
|
||||
function exportReport() {
|
||||
const reportContent = document.getElementById('report-content').textContent;
|
||||
if (!reportContent) {
|
||||
showError('请先生成日报');
|
||||
return;
|
||||
}
|
||||
|
||||
const blob = new Blob([reportContent], { type: 'text/markdown' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `运营日报_${document.getElementById('date').value}.md`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
// 页面加载时自动生成今日日报
|
||||
window.addEventListener('load', function () {
|
||||
generateTodayReport();
|
||||
|
||||
@@ -40,7 +40,7 @@ function generateReport() {
|
||||
}
|
||||
|
||||
// 转换格式:YYYY-WWW 到 YYYY-WW
|
||||
const weekFormatted = week.replace('W', '-W');
|
||||
const weekFormatted = week.replace('W', '');
|
||||
|
||||
showLoading();
|
||||
|
||||
@@ -50,7 +50,10 @@ function generateReport() {
|
||||
hideLoading();
|
||||
|
||||
if (data.success) {
|
||||
document.getElementById('report-content').textContent = data.report;
|
||||
// 保存原始Markdown内容到data属性
|
||||
document.getElementById('report-content').setAttribute('data-markdown', data.report);
|
||||
// 使用innerHTML显示格式化内容
|
||||
document.getElementById('report-content').innerHTML = data.report.replace(/\n/g, '<br>');
|
||||
document.getElementById('report-container').style.display = 'block';
|
||||
|
||||
// 显示统计数据
|
||||
@@ -116,7 +119,7 @@ function displayCategoryChart(categories) {
|
||||
}
|
||||
|
||||
function exportReport() {
|
||||
const reportContent = document.getElementById('report-content').textContent;
|
||||
const reportContent = document.getElementById('report-content').getAttribute('data-markdown');
|
||||
if (!reportContent) {
|
||||
showError('请先生成周报');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user