merge bugfix
This commit is contained in:
@@ -6,17 +6,37 @@ import { useState } from "react";
|
||||
import * as echarts from "echarts";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
function getTimeStr(period) {
|
||||
return {
|
||||
日:
|
||||
dayjs().format("YYYY.MM.DD") +
|
||||
" 7点 - " +
|
||||
dayjs().add(1, "d").format("YYYY.MM.DD") +
|
||||
" 7点",
|
||||
年:
|
||||
dayjs().subtract(1, "year").endOf("year").format("YYYY.MM.") +
|
||||
"29 - " +
|
||||
dayjs().endOf("year").format("YYYY.MM.") +
|
||||
"28",
|
||||
周:
|
||||
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||
" - " +
|
||||
dayjs().subtract(1, "day").format("YYYY.MM.DD"),
|
||||
月:
|
||||
dayjs().subtract(1, "month").format("YYYY.MM.") +
|
||||
"29 - " +
|
||||
dayjs().format("YYYY.MM.") +
|
||||
"28",
|
||||
}[period];
|
||||
}
|
||||
|
||||
function Oxygen(props) {
|
||||
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
||||
const weekTrend = useSelector((state) => state.smoke?.weekTrend);
|
||||
const monthTrend = useSelector((state) => state.smoke?.monthTrend);
|
||||
const yearTrend = useSelector((state) => state.smoke?.yearTrend);
|
||||
const [period, setPeriod] = useState("日");
|
||||
const [timestr, setTimestr] = useState(
|
||||
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||
" - " +
|
||||
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||
);
|
||||
let timestr = getTimeStr(period);
|
||||
|
||||
const currentTrend =
|
||||
period === "日"
|
||||
@@ -33,35 +53,13 @@ function Oxygen(props) {
|
||||
|
||||
function handleDateChange(value) {
|
||||
setPeriod(value);
|
||||
setTimestr(
|
||||
{
|
||||
日:
|
||||
dayjs().subtract(1, "day").format("YYYY.MM.DD") +
|
||||
" 7点 - " +
|
||||
dayjs().format("YYYY.MM.DD") +
|
||||
" 7点",
|
||||
年:
|
||||
dayjs().subtract(1, "year").endOf("year").format("YYYY.MM.") +
|
||||
"29 - " +
|
||||
dayjs().endOf("year").format("YYYY.MM.") +
|
||||
"28",
|
||||
周:
|
||||
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||
" - " +
|
||||
dayjs().subtract(1, "day").format("YYYY.MM.DD"),
|
||||
月:
|
||||
dayjs().subtract(1, "month").format("YYYY.MM.") +
|
||||
"29 - " +
|
||||
dayjs().format("YYYY.MM.") +
|
||||
"28",
|
||||
}[value]
|
||||
);
|
||||
timestr = getTimeStr(value);
|
||||
}
|
||||
return (
|
||||
<GraphBase
|
||||
icon="smoke"
|
||||
title="氧气含量"
|
||||
desc={`能耗趋势图 ${timestr}`}
|
||||
desc={`烟气趋势图 ${timestr}`}
|
||||
switchOptions={false}
|
||||
defaultSelect={period}
|
||||
onSwitch={handleSwitch}
|
||||
|
||||
Reference in New Issue
Block a user