节能减排
This commit is contained in:
parent
b41e31473b
commit
26dbe0122f
|
|
@ -84,6 +84,9 @@
|
||||||
.layui-layer-title {
|
.layui-layer-title {
|
||||||
border-bottom: 1px solid #008781;
|
border-bottom: 1px solid #008781;
|
||||||
}
|
}
|
||||||
|
.layui-laydate-preview{
|
||||||
|
color: #FFFFFF !important;
|
||||||
|
}
|
||||||
|
|
||||||
#alarm-container {
|
#alarm-container {
|
||||||
overflow-x: auto; /* 或 overflow-y: auto,根据需要 */
|
overflow-x: auto; /* 或 overflow-y: auto,根据需要 */
|
||||||
|
|
@ -181,7 +184,7 @@
|
||||||
table = layui.table;
|
table = layui.table;
|
||||||
form = layui.form;
|
form = layui.form;
|
||||||
laydate = layui.laydate;
|
laydate = layui.laydate;
|
||||||
let range = getDateRangeOneMonth();
|
let range = getDateRangeOneWeek();
|
||||||
|
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#ID-laydate-range',
|
elem: '#ID-laydate-range',
|
||||||
|
|
@ -190,11 +193,23 @@
|
||||||
value: range.startDate + ' - ' + range.endDate,
|
value: range.startDate + ' - ' + range.endDate,
|
||||||
done: function (value) {
|
done: function (value) {
|
||||||
// value 是选择的字符串,比如 '2025-06-23 - 2025-07-23'
|
// value 是选择的字符串,比如 '2025-06-23 - 2025-07-23'
|
||||||
console.log('选择的日期范围:', value);
|
const [startDateStr, endDateStr] = value.split(" - ");
|
||||||
const [startDate, endDate] = value.split(" - ");
|
const startDate = new Date(startDateStr);
|
||||||
|
const endDate = new Date(endDateStr);
|
||||||
|
|
||||||
|
// 计算两个日期相差的天数
|
||||||
|
const diffDays = (endDate - startDate) / (1000 * 60 * 60 * 24);
|
||||||
|
|
||||||
|
if (diffDays > 7) {
|
||||||
|
layer.msg('起止时间不能超过7天', {icon: 0});
|
||||||
|
// 重置日期为上一次合法范围(或你预设的默认值)
|
||||||
|
this.elem.val(range.startDate + ' - ' + range.endDate);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
"startDate": startDate,
|
"startDate": startDateStr,
|
||||||
"endDate": endDate,
|
"endDate": endDateStr,
|
||||||
"proId": parent.parent.$('#bidPro').val()
|
"proId": parent.parent.$('#bidPro').val()
|
||||||
}
|
}
|
||||||
selectEnergyStatsByDateRange(data)
|
selectEnergyStatsByDateRange(data)
|
||||||
|
|
@ -217,13 +232,12 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取今天和一个月前日期,格式 yyyy-MM-dd
|
// 获取今天和一个月前日期,格式 yyyy-MM-dd
|
||||||
function getDateRangeOneMonth() {
|
function getDateRangeOneWeek() {
|
||||||
let today = new Date();
|
let today = new Date();
|
||||||
let year = today.getFullYear();
|
|
||||||
let month = today.getMonth();
|
|
||||||
let day = today.getDate();
|
|
||||||
|
|
||||||
let oneMonthAgo = new Date(year, month - 1, day);
|
// 复制一个日期,减去7天
|
||||||
|
let oneWeekAgo = new Date(today);
|
||||||
|
oneWeekAgo.setDate(today.getDate() - 7);
|
||||||
|
|
||||||
function formatDate(d) {
|
function formatDate(d) {
|
||||||
let m = d.getMonth() + 1;
|
let m = d.getMonth() + 1;
|
||||||
|
|
@ -232,11 +246,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
startDate: formatDate(oneMonthAgo),
|
startDate: formatDate(oneWeekAgo),
|
||||||
endDate: formatDate(today)
|
endDate: formatDate(today)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 加载数据分析应用 */
|
/* 加载数据分析应用 */
|
||||||
function selectEnergyStatsByDateRange(data) {
|
function selectEnergyStatsByDateRange(data) {
|
||||||
const url = commonUrl + 'screen/largeScreen/deviceEnergyAnalysis/selectEnergyStatsByDateRange';
|
const url = commonUrl + 'screen/largeScreen/deviceEnergyAnalysis/selectEnergyStatsByDateRange';
|
||||||
|
|
@ -421,10 +436,12 @@
|
||||||
},
|
},
|
||||||
yAxis: [{
|
yAxis: [{
|
||||||
type: 'value',
|
type: 'value',
|
||||||
name: '能源消耗量(kWh)'
|
name: '能源消耗量(kWh)',
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
name: '节能减排量(kgCO₂)',
|
name: '节能减排量(kgCO₂)',
|
||||||
|
|
||||||
splitLine: {
|
splitLine: {
|
||||||
show: false
|
show: false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue