1
This commit is contained in:
parent
b27a20f3cf
commit
2fb3d05f8c
@ -171,6 +171,7 @@ function WindFrequence(props) {
|
|||||||
switchPosition={[null, 200]} // [top, left]
|
switchPosition={[null, 200]} // [top, left]
|
||||||
onSwitch={handleSwitchChange}
|
onSwitch={handleSwitchChange}
|
||||||
dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
|
dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
|
||||||
|
selectWidth={70}
|
||||||
defaultSelect={currLine}
|
defaultSelect={currLine}
|
||||||
onDateChange={handleLineChange}
|
onDateChange={handleLineChange}
|
||||||
>
|
>
|
||||||
|
12
src/components/Common/Arrow/index.jsx
Normal file
12
src/components/Common/Arrow/index.jsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import cls from './index.module.css';
|
||||||
|
|
||||||
|
const Arrow = ({direction, disabled, onClick}) => {
|
||||||
|
return (
|
||||||
|
<div className={cls["arrow"]}>
|
||||||
|
<div className={cls['arrow-top']}></div>
|
||||||
|
<div className={cls["arrow-bottom"]}></div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Arrow;
|
25
src/components/Common/Arrow/index.module.css
Normal file
25
src/components/Common/Arrow/index.module.css
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
.arrow {
|
||||||
|
width: 16px;
|
||||||
|
height: 48px;
|
||||||
|
background: #ccc;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow-top {
|
||||||
|
background: #00f3ed;
|
||||||
|
width: 8px;
|
||||||
|
height: 24px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.arrow-bottom {
|
||||||
|
background: #00f3ed;
|
||||||
|
width: 8px;
|
||||||
|
height: 24px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
@ -64,6 +64,7 @@ function WindFrequence(props) {
|
|||||||
icon="temp"
|
icon="temp"
|
||||||
title="当前温度"
|
title="当前温度"
|
||||||
dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
|
dateOptions={["Y61", "Y62", "Y63", "Y64", "Y65"]}
|
||||||
|
selectWidth={70}
|
||||||
defaultSelect={dataSource}
|
defaultSelect={dataSource}
|
||||||
onDateChange={handleSourceChange}
|
onDateChange={handleSourceChange}
|
||||||
size={["middle", "long"]}
|
size={["middle", "long"]}
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
.headWidget {
|
.headWidget {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 22px;
|
top: 22px;
|
||||||
right: 24px;
|
left: 178px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
width: 400px;
|
width: calc(100% - 200px);
|
||||||
/* background: #12fff5; */
|
/* background: #12fff5; */
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -172,7 +172,7 @@ function getOptions(dataList, showMore, dateType) {
|
|||||||
if (list.length === 0 || list.filter((item) => item.sum).length == 0)
|
if (list.length === 0 || list.filter((item) => item.sum).length == 0)
|
||||||
return null;
|
return null;
|
||||||
const color = ["#FFD160", "#12FFF5", "#2760FF"];
|
const color = ["#FFD160", "#12FFF5", "#2760FF"];
|
||||||
const grid = { top: 28, right: 12, bottom: 48, left: 48 };
|
const grid = { top: 28, right: 12, bottom: showMore ? 72 : 64, left: 48 };
|
||||||
const xAxis = {
|
const xAxis = {
|
||||||
type: "category",
|
type: "category",
|
||||||
data: list.map((item) =>
|
data: list.map((item) =>
|
||||||
|
@ -5,11 +5,16 @@ import { useSelector } from "react-redux";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import { lunarYear } from "../../../../utils/energeChartOption";
|
import { lunarYear } from "../../../../utils/energeChartOption";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
function Gas(props) {
|
function Gas(props) {
|
||||||
const elecTrend = useSelector((state) => state.energy.trend.natGas2);
|
const elecTrend = useSelector((state) => state.energy.trend.natGas2);
|
||||||
const [period, setPeriod] = useState("周");
|
const [period, setPeriod] = useState("周");
|
||||||
|
const [timestr, setTimestr] = useState(
|
||||||
|
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||||
|
" - " +
|
||||||
|
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||||
|
);
|
||||||
const options = getOptions(
|
const options = getOptions(
|
||||||
{ 周: "week", 月: "month", 年: "year" }[period],
|
{ 周: "week", 月: "month", 年: "year" }[period],
|
||||||
elecTrend ?? { week: [], month: [], year: [] }
|
elecTrend ?? { week: [], month: [], year: [] }
|
||||||
@ -19,16 +24,33 @@ function Gas(props) {
|
|||||||
// console.log('switched ', v);
|
// console.log('switched ', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDateChange(v) {
|
|
||||||
// console.log('date ', v);
|
|
||||||
setPeriod(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function handleDateChange(value) {
|
||||||
|
setPeriod(value);
|
||||||
|
setTimestr(
|
||||||
|
{
|
||||||
|
年:
|
||||||
|
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]
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<GraphBase
|
<GraphBase
|
||||||
icon="battery"
|
icon="battery"
|
||||||
title="天然气II"
|
title="天然气II"
|
||||||
desc="能耗趋势图"
|
desc={`能耗趋势图 ${timestr}`}
|
||||||
switchOptions={false}
|
switchOptions={false}
|
||||||
onSwitch={handleSwitch}
|
onSwitch={handleSwitch}
|
||||||
defaultSelect={period}
|
defaultSelect={period}
|
||||||
|
@ -4,11 +4,16 @@ import ReactECharts from "echarts-for-react";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
function ElecCost(props) {
|
function ElecCost(props) {
|
||||||
const elecTrend = useSelector((state) => state.energy.trend.elec);
|
const elecTrend = useSelector((state) => state.energy.trend.elec);
|
||||||
const [period, setPeriod] = useState("周");
|
const [period, setPeriod] = useState("周");
|
||||||
|
const [timestr, setTimestr] = useState(
|
||||||
|
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||||
|
" - " +
|
||||||
|
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||||
|
);
|
||||||
const options = getOptions(
|
const options = getOptions(
|
||||||
{ 周: "week", 月: "month", 年: "year" }[period],
|
{ 周: "week", 月: "month", 年: "year" }[period],
|
||||||
elecTrend ?? { week: [], month: [], year: [] }
|
elecTrend ?? { week: [], month: [], year: [] }
|
||||||
@ -18,15 +23,32 @@ function ElecCost(props) {
|
|||||||
// console.log('switched ', v);
|
// console.log('switched ', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDateChange(v) {
|
function handleDateChange(value) {
|
||||||
setPeriod(v);
|
setPeriod(value);
|
||||||
|
setTimestr(
|
||||||
|
{
|
||||||
|
年:
|
||||||
|
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]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GraphBase
|
<GraphBase
|
||||||
icon="battery"
|
icon="battery"
|
||||||
title="电耗能"
|
title="电耗能"
|
||||||
desc="能耗趋势图"
|
desc={`能耗趋势图 ${timestr}`}
|
||||||
switchOptions={false}
|
switchOptions={false}
|
||||||
onSwitch={handleSwitch}
|
onSwitch={handleSwitch}
|
||||||
defaultSelect={period}
|
defaultSelect={period}
|
||||||
|
@ -4,6 +4,7 @@ import ReactECharts from "echarts-for-react";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
function NO(props) {
|
function NO(props) {
|
||||||
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
||||||
@ -11,6 +12,11 @@ function NO(props) {
|
|||||||
const monthTrend = useSelector((state) => state.smoke?.monthTrend);
|
const monthTrend = useSelector((state) => state.smoke?.monthTrend);
|
||||||
const yearTrend = useSelector((state) => state.smoke?.yearTrend);
|
const yearTrend = useSelector((state) => state.smoke?.yearTrend);
|
||||||
const [period, setPeriod] = useState("日");
|
const [period, setPeriod] = useState("日");
|
||||||
|
const [timestr, setTimestr] = useState(
|
||||||
|
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||||
|
" - " +
|
||||||
|
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||||
|
);
|
||||||
|
|
||||||
const currentTrend =
|
const currentTrend =
|
||||||
period === "日"
|
period === "日"
|
||||||
@ -27,16 +33,45 @@ function NO(props) {
|
|||||||
// console.log('switched ', v);
|
// console.log('switched ', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDateChange(v) {
|
|
||||||
setPeriod(v);
|
|
||||||
// console.log('date ', v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function handleDateChange(value) {
|
||||||
|
setPeriod(
|
||||||
|
{
|
||||||
|
日: "day",
|
||||||
|
周: "week",
|
||||||
|
月: "month",
|
||||||
|
年: "year",
|
||||||
|
}[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]
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<GraphBase
|
<GraphBase
|
||||||
icon="smoke"
|
icon="smoke"
|
||||||
title="氮氧化物"
|
title="氮氧化物"
|
||||||
desc="能耗趋势图"
|
desc={`能耗趋势图 ${timestr}`}
|
||||||
switchOptions={false}
|
switchOptions={false}
|
||||||
defaultSelect={period}
|
defaultSelect={period}
|
||||||
onSwitch={handleSwitch}
|
onSwitch={handleSwitch}
|
||||||
|
@ -4,6 +4,7 @@ import ReactECharts from "echarts-for-react";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
function Dust(props) {
|
function Dust(props) {
|
||||||
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
||||||
@ -11,7 +12,11 @@ function Dust(props) {
|
|||||||
const monthTrend = useSelector((state) => state.smoke?.monthTrend);
|
const monthTrend = useSelector((state) => state.smoke?.monthTrend);
|
||||||
const yearTrend = useSelector((state) => state.smoke?.yearTrend);
|
const yearTrend = useSelector((state) => state.smoke?.yearTrend);
|
||||||
const [period, setPeriod] = useState("日");
|
const [period, setPeriod] = useState("日");
|
||||||
|
const [timestr, setTimestr] = useState(
|
||||||
|
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||||
|
" - " +
|
||||||
|
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||||
|
);
|
||||||
const currentTrend =
|
const currentTrend =
|
||||||
period === "日"
|
period === "日"
|
||||||
? dayTrend
|
? dayTrend
|
||||||
@ -27,16 +32,47 @@ function Dust(props) {
|
|||||||
// console.log('switched ', v);
|
// console.log('switched ', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDateChange(v) {
|
|
||||||
setPeriod(v);
|
function handleDateChange(value) {
|
||||||
// console.log('date ', v);
|
setPeriod(
|
||||||
|
{
|
||||||
|
日: "day",
|
||||||
|
周: "week",
|
||||||
|
月: "month",
|
||||||
|
年: "year",
|
||||||
|
}[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]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GraphBase
|
<GraphBase
|
||||||
icon="smoke"
|
icon="smoke"
|
||||||
title="颗粒物"
|
title="颗粒物"
|
||||||
desc="能耗趋势图"
|
desc={`能耗趋势图 ${timestr}`}
|
||||||
switchOptions={false}
|
switchOptions={false}
|
||||||
defaultSelect={period}
|
defaultSelect={period}
|
||||||
onSwitch={handleSwitch}
|
onSwitch={handleSwitch}
|
||||||
|
@ -5,10 +5,16 @@ import { useSelector } from "react-redux";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import { lunarYear } from "../../../../utils/energeChartOption";
|
import { lunarYear } from "../../../../utils/energeChartOption";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
function NatGas(props) {
|
function NatGas(props) {
|
||||||
const elecTrend = useSelector((state) => state.energy.trend.natGas1);
|
const elecTrend = useSelector((state) => state.energy.trend.natGas1);
|
||||||
const [period, setPeriod] = useState("周");
|
const [period, setPeriod] = useState("周");
|
||||||
|
const [timestr, setTimestr] = useState(
|
||||||
|
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||||
|
" - " +
|
||||||
|
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||||
|
);
|
||||||
|
|
||||||
const options = getOptions(
|
const options = getOptions(
|
||||||
{ 周: "week", 月: "month", 年: "year" }[period],
|
{ 周: "week", 月: "month", 年: "year" }[period],
|
||||||
@ -19,16 +25,33 @@ function NatGas(props) {
|
|||||||
// console.log('switched ', v);
|
// console.log('switched ', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDateChange(v) {
|
function handleDateChange(value) {
|
||||||
setPeriod(v);
|
setPeriod(value);
|
||||||
// console.log('date ', v);
|
setTimestr(
|
||||||
|
{
|
||||||
|
年:
|
||||||
|
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]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GraphBase
|
<GraphBase
|
||||||
icon="battery"
|
icon="battery"
|
||||||
title="天然气I"
|
title="天然气I"
|
||||||
desc="能耗趋势图"
|
desc={`能耗趋势图 ${timestr}`}
|
||||||
switchOptions={false}
|
switchOptions={false}
|
||||||
onSwitch={handleSwitch}
|
onSwitch={handleSwitch}
|
||||||
defaultSelect={period}
|
defaultSelect={period}
|
||||||
@ -114,7 +137,7 @@ function getOptions(period, trend) {
|
|||||||
.fill(1)
|
.fill(1)
|
||||||
.map((_, index) => {
|
.map((_, index) => {
|
||||||
if (period == "week") {
|
if (period == "week") {
|
||||||
const dtimestamp = today - (index+1) * 24 * 60 * 60 * 1000;
|
const dtimestamp = today - (index + 1) * 24 * 60 * 60 * 1000;
|
||||||
return `${new Date(dtimestamp).getMonth() + 1}.${new Date(
|
return `${new Date(dtimestamp).getMonth() + 1}.${new Date(
|
||||||
dtimestamp
|
dtimestamp
|
||||||
).getDate()}`;
|
).getDate()}`;
|
||||||
@ -163,7 +186,9 @@ function getOptions(period, trend) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
series: {
|
series: {
|
||||||
data: trend[period].map(item => item != null ? (+item).toFixed(2) : null),
|
data: trend[period].map((item) =>
|
||||||
|
item != null ? (+item).toFixed(2) : null
|
||||||
|
),
|
||||||
type: "line",
|
type: "line",
|
||||||
symbol: "circle",
|
symbol: "circle",
|
||||||
symbolSize: 6,
|
symbolSize: 6,
|
||||||
|
@ -4,6 +4,7 @@ import ReactECharts from "echarts-for-react";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
function Oxygen(props) {
|
function Oxygen(props) {
|
||||||
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
||||||
@ -11,6 +12,11 @@ function Oxygen(props) {
|
|||||||
const monthTrend = useSelector((state) => state.smoke?.monthTrend);
|
const monthTrend = useSelector((state) => state.smoke?.monthTrend);
|
||||||
const yearTrend = useSelector((state) => state.smoke?.yearTrend);
|
const yearTrend = useSelector((state) => state.smoke?.yearTrend);
|
||||||
const [period, setPeriod] = useState("日");
|
const [period, setPeriod] = useState("日");
|
||||||
|
const [timestr, setTimestr] = useState(
|
||||||
|
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||||
|
" - " +
|
||||||
|
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||||
|
);
|
||||||
|
|
||||||
const currentTrend =
|
const currentTrend =
|
||||||
period === "日"
|
period === "日"
|
||||||
@ -27,16 +33,44 @@ function Oxygen(props) {
|
|||||||
// console.log('switched ', v);
|
// console.log('switched ', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDateChange(v) {
|
function handleDateChange(value) {
|
||||||
setPeriod(v);
|
setPeriod(
|
||||||
// console.log('date ', v);
|
{
|
||||||
|
日: "day",
|
||||||
|
周: "week",
|
||||||
|
月: "month",
|
||||||
|
年: "year",
|
||||||
|
}[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]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GraphBase
|
<GraphBase
|
||||||
icon="smoke"
|
icon="smoke"
|
||||||
title="氧气含量"
|
title="氧气含量"
|
||||||
desc="能耗趋势图"
|
desc={`能耗趋势图 ${timestr}`}
|
||||||
switchOptions={false}
|
switchOptions={false}
|
||||||
defaultSelect={period}
|
defaultSelect={period}
|
||||||
onSwitch={handleSwitch}
|
onSwitch={handleSwitch}
|
||||||
|
@ -4,6 +4,7 @@ import ReactECharts from "echarts-for-react";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
function SO2(props) {
|
function SO2(props) {
|
||||||
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
|
||||||
@ -20,22 +21,56 @@ function SO2(props) {
|
|||||||
: period === "月"
|
: period === "月"
|
||||||
? monthTrend
|
? monthTrend
|
||||||
: yearTrend;
|
: yearTrend;
|
||||||
|
const [timestr, setTimestr] = useState(
|
||||||
|
dayjs().subtract(7, "day").format("YYYY.MM.DD") +
|
||||||
|
" - " +
|
||||||
|
dayjs().subtract(1, "day").format("YYYY.MM.DD")
|
||||||
|
);
|
||||||
const options = getOptions("SO2_float", period, currentTrend);
|
const options = getOptions("SO2_float", period, currentTrend);
|
||||||
|
|
||||||
function handleSwitch(v) {
|
function handleSwitch(v) {
|
||||||
// console.log('switched ', v);
|
// console.log('switched ', v);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDateChange(v) {
|
function handleDateChange(value) {
|
||||||
setPeriod(v);
|
setPeriod(
|
||||||
// console.log('date ', v);
|
{
|
||||||
|
日: "day",
|
||||||
|
周: "week",
|
||||||
|
月: "month",
|
||||||
|
年: "year",
|
||||||
|
}[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]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GraphBase
|
<GraphBase
|
||||||
icon="smoke"
|
icon="smoke"
|
||||||
title="二氧化硫"
|
title="二氧化硫"
|
||||||
desc="能耗趋势图"
|
desc={`能耗趋势图 ${timestr}`}
|
||||||
switchOptions={false}
|
switchOptions={false}
|
||||||
defaultSelect={period}
|
defaultSelect={period}
|
||||||
onSwitch={handleSwitch}
|
onSwitch={handleSwitch}
|
||||||
|
Loading…
Reference in New Issue
Block a user