merge bugfix
This commit is contained in:
@@ -6,6 +6,30 @@ 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 SO2(props) {
|
||||
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
||||
const weekTrend = useSelector((state) => state.smoke?.weekTrend);
|
||||
@@ -21,47 +45,22 @@ function SO2(props) {
|
||||
: period === "月"
|
||||
? monthTrend
|
||||
: yearTrend;
|
||||
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 options = getOptions("SO2_float", period, currentTrend);
|
||||
|
||||
function handleSwitch(v) {}
|
||||
|
||||
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