修改峰平谷不对齐
This commit is contained in:
@@ -33,9 +33,8 @@ function renderSumDataList(rawList) {
|
||||
}
|
||||
});
|
||||
|
||||
// 排序:峰平谷按顺序
|
||||
const fieldOrder = ['sharp_electricity', 'peak_electricity', 'flat_electricity', 'valley_electricity',
|
||||
'peak_degree', 'peak_time_degree', 'normal_time_degree', 'valley_time_degree'];
|
||||
// 排序:尖峰平谷按顺序
|
||||
const fieldOrder = ['sharp_electricity', 'peak_electricity', 'flat_electricity', 'valley_electricity'];
|
||||
sumDataDynamicFields = Object.keys(fieldMap).sort((a, b) => {
|
||||
const idxA = fieldOrder.indexOf(a);
|
||||
const idxB = fieldOrder.indexOf(b);
|
||||
@@ -231,7 +230,15 @@ function toggleSelectAllSumData() {
|
||||
|
||||
// 从历史记录采集
|
||||
async function collectSumDataFromHistory() {
|
||||
if (!confirm('确定要从所有成功的历史记录中重新采集求和数据吗?\n(会先清除旧的自动采集数据)')) return;
|
||||
const startDate = document.getElementById('sum-data-start-date').value;
|
||||
const endDate = document.getElementById('sum-data-end-date').value;
|
||||
|
||||
if (!startDate || !endDate) {
|
||||
alert('请先选择日期范围');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm(`确定要从 ${startDate} 到 ${endDate} 的历史记录中采集求和数据吗?\n(会先清除该日期范围内旧的自动采集数据)`)) return;
|
||||
|
||||
const resultDiv = document.getElementById('sum-data-list');
|
||||
resultDiv.innerHTML = '<tr><td colspan="12" class="empty">正在采集中,请稍候...</td></tr>';
|
||||
@@ -240,7 +247,10 @@ async function collectSumDataFromHistory() {
|
||||
const response = await fetch('/api/sum-data/collect', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({})
|
||||
body: JSON.stringify({
|
||||
start_date: startDate,
|
||||
end_date: endDate
|
||||
})
|
||||
});
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
@@ -411,7 +421,8 @@ async function saveSumData() {
|
||||
body: JSON.stringify({
|
||||
sum_value: fieldValue,
|
||||
total_orders: totalOrders,
|
||||
remark: remark
|
||||
remark: remark,
|
||||
data_source: 'manual'
|
||||
})
|
||||
});
|
||||
const result = await response.json();
|
||||
@@ -452,28 +463,28 @@ async function saveSumData() {
|
||||
}
|
||||
if (peakDegree) {
|
||||
fieldsData.push({
|
||||
sum_field_key: 'peak_degree',
|
||||
sum_field_key: 'sharp_electricity',
|
||||
sum_field_name: '尖时电量(kWh)',
|
||||
sum_value: peakDegree
|
||||
});
|
||||
}
|
||||
if (peakTime) {
|
||||
fieldsData.push({
|
||||
sum_field_key: 'peak_time_degree',
|
||||
sum_field_key: 'peak_electricity',
|
||||
sum_field_name: '峰时电量(kWh)',
|
||||
sum_value: peakTime
|
||||
});
|
||||
}
|
||||
if (normalTime) {
|
||||
fieldsData.push({
|
||||
sum_field_key: 'normal_time_degree',
|
||||
sum_field_key: 'flat_electricity',
|
||||
sum_field_name: '平时电量(kWh)',
|
||||
sum_value: normalTime
|
||||
});
|
||||
}
|
||||
if (valleyTime) {
|
||||
fieldsData.push({
|
||||
sum_field_key: 'valley_time_degree',
|
||||
sum_field_key: 'valley_electricity',
|
||||
sum_field_name: '谷时电量(kWh)',
|
||||
sum_value: valleyTime
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user