IAQ页面优化和环境监测时间范围变更

parent a29676d4
......@@ -368,27 +368,31 @@
flex: 1;
margin-top: 6px;
min-height: 0;
overflow-y: auto;
overflow: auto;
}
.table-scroll {
overflow-x: auto;
min-height: 100%;
}
table {
width: 100%;
min-width: 900px;
border-collapse: collapse;
border-collapse: separate;
border-spacing: 0;
font-size: 12px;
}
thead {
background: rgba(var(--color-primary-rgb), 0.06);
}
th {
position: sticky;
top: 0;
z-index: 2;
padding: 10px 8px;
text-align: center;
font-weight: 500;
color: var(--color-primary-light);
color: var(--color-text-bright);
font-size: 12px;
background: #101d12;
border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.15);
white-space: nowrap;
}
......
......@@ -292,13 +292,22 @@ function getTodayStart(): string {
}
/**
* 获取最近一小时起始的时间字符串
*/
function getLastHourStart(): string {
const now = new Date();
now.setHours(now.getHours() - 1);
return formatTime(now);
}
/**
* 获取当天最近的 device_data 记录(按设备测量时间倒序,限量返回)
*/
async function getTodayDeviceData(deviceId: string, limit: number = RECORD_LIMIT): Promise<any[]> {
const todayStart = getTodayStart();
const hourAgo = getLastHourStart();
const params: any = {
device_id: deviceId,
device_time: { "%gte%": todayStart },
device_time: { "%gte%": hourAgo },
"%orderDesc%": "device_time",
};
if (limit) params["%limit%"] = limit;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment