feat: 添加生成日报多选功能,支持批量生成多个配置
Coze-Commit-Type: user Coze-User-ID: 3722323274763196 Coze-Conversation-ID: 9894087
This commit is contained in:
@@ -852,7 +852,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="alert alert-info" style="margin-bottom: 20px;">
|
<div class="alert alert-info" style="margin-bottom: 20px;">
|
||||||
<strong>💡 使用说明:</strong><br>
|
<strong>💡 使用说明:</strong><br>
|
||||||
1. 选择已创建的配置<br>
|
1. 选择已创建的配置(可多选)<br>
|
||||||
2. 选择时间范围(可点击预设按钮快速选择)<br>
|
2. 选择时间范围(可点击预设按钮快速选择)<br>
|
||||||
3. 点击"生成日报"按钮<br>
|
3. 点击"生成日报"按钮<br>
|
||||||
4. 生成成功后,点击"立即下载Excel文件"按钮下载,或切换到"历史记录"标签页查看和下载
|
4. 生成成功后,点击"立即下载Excel文件"按钮下载,或切换到"历史记录"标签页查看和下载
|
||||||
@@ -861,10 +861,18 @@
|
|||||||
<h3 style="margin-bottom: 20px;">生成日报</h3>
|
<h3 style="margin-bottom: 20px;">生成日报</h3>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>选择配置 *</label>
|
<label>选择配置 * <span style="color: #666; font-size: 12px;">(可多选)</span></label>
|
||||||
<select id="generate-config" class="form-control">
|
<div style="border: 1px solid #ddd; border-radius: 8px; padding: 10px; max-height: 200px; overflow-y: auto;">
|
||||||
<option value="">请选择配置</option>
|
<div style="margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eee;">
|
||||||
</select>
|
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
|
||||||
|
<input type="checkbox" id="select-all-configs" onchange="toggleSelectAllConfigs()">
|
||||||
|
<strong>全选/取消全选</strong>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div id="config-checkbox-list">
|
||||||
|
<!-- 配置复选框列表将通过 JavaScript 动态生成 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -2004,15 +2012,28 @@
|
|||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const select = document.getElementById('generate-config');
|
const container = document.getElementById('config-checkbox-list');
|
||||||
select.innerHTML = '<option value="">请选择配置</option>' +
|
container.innerHTML = result.data.map(c => `
|
||||||
result.data.map(c => `<option value="${c.id}">${c.config_name}</option>`).join('');
|
<label style="display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer;">
|
||||||
|
<input type="checkbox" class="config-checkbox" value="${c.id}" data-name="${c.config_name}">
|
||||||
|
<span>${c.config_name}</span>
|
||||||
|
</label>
|
||||||
|
`).join('');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载配置失败:', error);
|
console.error('加载配置失败:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 全选/取消全选配置
|
||||||
|
function toggleSelectAllConfigs() {
|
||||||
|
const selectAll = document.getElementById('select-all-configs');
|
||||||
|
const checkboxes = document.querySelectorAll('.config-checkbox');
|
||||||
|
checkboxes.forEach(cb => {
|
||||||
|
cb.checked = selectAll.checked;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 设置预设时间
|
// 设置预设时间
|
||||||
function setPresetTime(preset) {
|
function setPresetTime(preset) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@@ -2077,14 +2098,14 @@
|
|||||||
return String(dateStr);
|
return String(dateStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成日报
|
// 生成日报(支持多选)
|
||||||
async function generateReport() {
|
async function generateReport() {
|
||||||
const configId = document.getElementById('generate-config').value;
|
const checkboxes = document.querySelectorAll('.config-checkbox:checked');
|
||||||
const startTime = document.getElementById('start-time').value;
|
const startTime = document.getElementById('start-time').value;
|
||||||
const endTime = document.getElementById('end-time').value;
|
const endTime = document.getElementById('end-time').value;
|
||||||
|
|
||||||
if (!configId) {
|
if (checkboxs.length === 0) {
|
||||||
alert('请选择配置');
|
alert('请至少选择一个配置');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user