This commit is contained in:
lb
2024-01-24 15:58:16 +08:00
parent b7b2ad2ee5
commit 1ebda5cf6f
9 changed files with 109 additions and 28 deletions

View File

@@ -1,10 +1,11 @@
import cls from "./index.module.css";
import { randomInt } from "../../../../utils";
import * as echarts from "echarts";
import { Radio } from "antd";
import { Radio , Select } from "antd";
import ReactECharts from "echarts-for-react";
import { useState } from "react";
import { useSelector } from "react-redux";
import triangle from "../../../../assets/Icon/triangle.svg";
const SmokeTrendChart = (props) => {
const dayTrend = useSelector((state) => state.smoke?.dayTrend);
@@ -26,6 +27,12 @@ const SmokeTrendChart = (props) => {
const options = getOptions(source, period, currentTrend);
function handleDateChange(value) {
setPeriod({
: 'day', : 'week', : 'month', : 'year'
}[value])
}
return (
<div className={cls.energyCostChart}>
<div className={cls.titleBar}>
@@ -62,7 +69,7 @@ const SmokeTrendChart = (props) => {
</Radio.Button>
</Radio.Group>
<Radio.Group
{/* <Radio.Group
value={period}
onChange={(e) => setPeriod(e.target.value)}
buttonStyle="solid"
@@ -80,7 +87,32 @@ const SmokeTrendChart = (props) => {
<Radio.Button value="year" className="radio-group__item">
</Radio.Button>
</Radio.Group>
</Radio.Group> */}
<Select
defaultValue={"日"}
style={{ width: 60 }}
popupClassName="xc-date-selector-menu"
className={cls.radioGroupShort}
options={["日", "周", "月", '年'].map((item) => ({
label: item,
value: item,
}))}
suffixIcon={<img src={triangle} alt="#" />}
notFoundContent={
<span
style={{
color: "#fff",
fontSize: "14px",
lineHeight: 1,
paddingLeft: "12px",
}}
>
- -
</span>
}
onChange={(value, option) => handleDateChange(value)}
/>
</div>
{options && <ReactECharts option={options} style={{ height: "240px" }} />}
{!options && (

View File

@@ -73,6 +73,10 @@
border: none !important;
border-radius: 0 !important;
}
.radioGroupShort * {
border: none !important;
border-radius: 6px !important;
}
.radioGroup *:focus-within {
box-shadow: none !important;
}