fix: 修复配置管理页面多个DOM元素ID不匹配和缺失函数问题

Coze-Commit-Type: user
Coze-User-ID: 3722323274763196
Coze-Conversation-ID: 9894087
This commit is contained in:
user9994793890
2026-07-13 17:06:51 +08:00
parent 9ca789cc18
commit 9449d25837
4 changed files with 33 additions and 5 deletions

View File

@@ -104,7 +104,7 @@ const SUMMABLE_FIELD_KEYS = [
// 渲染字段列表
function renderFields(selectedFields = [], sumFields = []) {
const fieldsList = document.getElementById('fields-list');
const fieldsList = document.getElementById('field-list');
const sumFieldsList = document.getElementById('sum-fields-list');
fieldsList.innerHTML = allFields.map(field => {
@@ -145,7 +145,7 @@ function onFieldCheckboxChange(cb) {
const item = cb.closest('.checkbox-item');
if (item) item.classList.toggle('checked', cb.checked);
const fieldsList = document.getElementById('fields-list');
const fieldsList = document.getElementById('field-list');
const checkedFields = Array.from(fieldsList.querySelectorAll('input:checked')).map(c => c.value);
// 保留当前求和字段的选择状态
@@ -161,7 +161,7 @@ let fieldCustomNames = {};
// 刷新已选字段顺序列表
function refreshSelectedFieldsOrder(selectedFields, customNames = null) {
const orderGroup = document.getElementById('selected-fields-order-group');
const orderGroup = document.getElementById('field-order-section');
const orderList = document.getElementById('selected-fields-order');
if (!orderList) return;
@@ -397,7 +397,7 @@ function updateCellDisplay(hour, periodKey) {
// 更新时段摘要
function updateTimePeriodSummary() {
const summaryEl = document.getElementById('tp-summary');
const summaryEl = document.getElementById('time-period-summary');
const parts = TIME_PERIODS.map(p => {
const hours = timePeriodConfig[p.key];
const count = hours.length;
@@ -832,3 +832,13 @@ function setDefaultTimePeriods() {
};
updateTimePeriodSummary();
}
// 拆分方式改变时加载实体列表
function onSplitTypeChange() {
const splitType = document.getElementById('split-type').value;
if (splitType) {
loadEntities(1, '');
} else {
document.getElementById('entity-list').innerHTML = '<div class="empty">请先选择拆分方式</div>';
}
}

View File

@@ -171,3 +171,11 @@ function onSplitTypeChange() {
selectedEntityIds.clear();
loadEntities(1, '');
}
// 处理搜索框回车事件
function handleSearchEnter(event) {
if (event.key === 'Enter') {
const search = document.getElementById('entity-search').value;
loadEntities(1, search);
}
}

View File

@@ -222,3 +222,12 @@ async function loadHistoryWithDate(page, startDate, endDate) {
// 初始化
loadConfigs();
loadFields();
// 全选/取消全选历史记录
function toggleSelectAllHistory() {
const selectAllCheckbox = document.getElementById('select-all-history');
const checkboxes = document.querySelectorAll('#history-list input[type="checkbox"]');
checkboxes.forEach(cb => {
cb.checked = selectAllCheckbox.checked;
});
}

View File

@@ -195,7 +195,8 @@
<button type="button" class="btn btn-sm" onclick="clearTimePeriods()">清空</button>
<button type="button" class="btn btn-sm" onclick="setDefaultTimePeriods()">默认配置</button>
</div>
<div class="time-period-grid" id="time-period-grid"></div>
<div id="tp-hours-row" style="display: grid; grid-template-columns: 60px repeat(24, 1fr); gap: 2px; margin-bottom: 10px;"></div>
<div id="tp-period-rows"></div>
<div class="time-period-summary" id="time-period-summary"></div>
</div>
</div>