|
@@ -35,9 +35,31 @@ const typeParams = [
|
|
|
];
|
|
|
|
|
|
const CostComparison = () => {
|
|
|
+ const [open, setOpen] = useState(false);
|
|
|
+
|
|
|
+ return (
|
|
|
+ <PageContent closeable={false}>
|
|
|
+ <PageTitle onReturn={() => UnityAction.sendMsg('menuItem', '首页')}>
|
|
|
+ 能耗数据
|
|
|
+ <div
|
|
|
+ onClick={(e) => {
|
|
|
+ e.stopPropagation();
|
|
|
+ setOpen(!open);
|
|
|
+ }}
|
|
|
+ style={{ marginLeft: '0.1rem' }}
|
|
|
+ className={`password-eye ${open ? 'open' : ''}`}
|
|
|
+ ></div>
|
|
|
+ </PageTitle>
|
|
|
+ <EnergyCost open={open} />
|
|
|
+ </PageContent>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+export default CostComparison;
|
|
|
+
|
|
|
+export const EnergyCost = ({ open, detailClick }) => {
|
|
|
const { projectId } = useParams();
|
|
|
|
|
|
- const [open, setOpen] = useState(false);
|
|
|
const [chartData, setChartData] = useState([]);
|
|
|
const [curElecPerCost, setElecPerCost] = useState(0); // 当前月实际吨水电耗
|
|
|
const [curElecUsed, setCurElecUsed] = useState(0); // 当前月实际用电量
|
|
@@ -226,103 +248,92 @@ const CostComparison = () => {
|
|
|
}, []);
|
|
|
|
|
|
const goEnergyDetail = () => {
|
|
|
- history.push(`/home/energy/detail/${projectId}`);
|
|
|
+ if (detailClick) {
|
|
|
+ detailClick();
|
|
|
+ } else {
|
|
|
+ history.push(`/home/energy/detail/${projectId}`);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
return (
|
|
|
- <PageContent closeable={false}>
|
|
|
- <PageTitle onReturn={() => UnityAction.sendMsg('menuItem', '首页')}>
|
|
|
- 能耗数据
|
|
|
+ <div
|
|
|
+ className="card-box"
|
|
|
+ style={{ padding: '0.2rem', position: 'relative' }}
|
|
|
+ >
|
|
|
+ <LineChartOutlined
|
|
|
+ style={{
|
|
|
+ fontSize: '0.4rem',
|
|
|
+ position: 'absolute',
|
|
|
+ right: '0.3rem',
|
|
|
+ color: '#0139f1',
|
|
|
+ }}
|
|
|
+ onClick={goEnergyDetail}
|
|
|
+ />
|
|
|
+ <div className={styles.curEnergyCost}>
|
|
|
<div
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- setOpen(!open);
|
|
|
- }}
|
|
|
- style={{ marginLeft: '0.1rem' }}
|
|
|
- className={`password-eye ${open ? 'open' : ''}`}
|
|
|
- ></div>
|
|
|
- </PageTitle>
|
|
|
- <div
|
|
|
- className="card-box"
|
|
|
- style={{ padding: '0.2rem', position: 'relative' }}
|
|
|
- >
|
|
|
- <LineChartOutlined
|
|
|
+ className={styles.item}
|
|
|
style={{
|
|
|
- fontSize: '0.4rem',
|
|
|
- position: 'absolute',
|
|
|
- right: '0.3rem',
|
|
|
- color: '#0139f1',
|
|
|
+ borderRight: '1px solid #eaeaea',
|
|
|
+ borderBottom: '1px solid #eaeaea',
|
|
|
}}
|
|
|
- onClick={goEnergyDetail}
|
|
|
- />
|
|
|
- <div className={styles.curEnergyCost}>
|
|
|
- <div
|
|
|
- className={styles.item}
|
|
|
- style={{
|
|
|
- borderRight: '1px solid #eaeaea',
|
|
|
- borderBottom: '1px solid #eaeaea',
|
|
|
- }}
|
|
|
- >
|
|
|
- <div className={styles.value}>
|
|
|
- {open ? curElecPerCost : '***'}
|
|
|
- <span className={styles.unit}>kWh/t</span>
|
|
|
- </div>
|
|
|
- <div className={styles.name}>近一天吨水电耗</div>
|
|
|
+ >
|
|
|
+ <div className={styles.value}>
|
|
|
+ {open ? curElecPerCost : '***'}
|
|
|
+ <span className={styles.unit}>kWh/t</span>
|
|
|
</div>
|
|
|
- <div
|
|
|
- className={styles.item}
|
|
|
- style={{
|
|
|
- borderBottom: '1px solid #eaeaea',
|
|
|
- }}
|
|
|
- >
|
|
|
- <div className={styles.value}>
|
|
|
- {open ? curElecUsed : '***'}
|
|
|
- <span className={styles.unit}>kWh</span>
|
|
|
- </div>
|
|
|
- <div className={styles.name}>近一天实际用电量</div>
|
|
|
+ <div className={styles.name}>近一天吨水电耗</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ className={styles.item}
|
|
|
+ style={{
|
|
|
+ borderBottom: '1px solid #eaeaea',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div className={styles.value}>
|
|
|
+ {open ? curElecUsed : '***'}
|
|
|
+ <span className={styles.unit}>kWh</span>
|
|
|
</div>
|
|
|
- <div
|
|
|
- className={styles.item}
|
|
|
- style={{
|
|
|
- borderRight: '1px solid #eaeaea',
|
|
|
- }}
|
|
|
- >
|
|
|
- <div className={styles.value}>
|
|
|
- {open ? curElecPerCost : '***'}
|
|
|
- <span className={styles.unit}>kWh/t</span>
|
|
|
- </div>
|
|
|
- <div className={styles.name}>当月吨水电耗</div>
|
|
|
+ <div className={styles.name}>近一天实际用电量</div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ className={styles.item}
|
|
|
+ style={{
|
|
|
+ borderRight: '1px solid #eaeaea',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div className={styles.value}>
|
|
|
+ {open ? curElecPerCost : '***'}
|
|
|
+ <span className={styles.unit}>kWh/t</span>
|
|
|
</div>
|
|
|
- <div className={styles.item}>
|
|
|
- <div className={styles.value}>
|
|
|
- {open ? curElecUsed : '***'}
|
|
|
- <span className={styles.unit}>kWh</span>
|
|
|
- </div>
|
|
|
- <div className={styles.name}>当月实际用电量</div>
|
|
|
+ <div className={styles.name}>当月吨水电耗</div>
|
|
|
+ </div>
|
|
|
+ <div className={styles.item}>
|
|
|
+ <div className={styles.value}>
|
|
|
+ {open ? curElecUsed : '***'}
|
|
|
+ <span className={styles.unit}>kWh</span>
|
|
|
</div>
|
|
|
+ <div className={styles.name}>当月实际用电量</div>
|
|
|
</div>
|
|
|
- {chartData.length !== 0 && (
|
|
|
- <div
|
|
|
- style={{
|
|
|
- height: '9.2rem',
|
|
|
- display: 'flex',
|
|
|
- flexDirection: 'column',
|
|
|
- justifyContent: 'space-between',
|
|
|
- padding: '0.6rem 0 0.4rem',
|
|
|
- }}
|
|
|
- >
|
|
|
- <div style={{ height: '3.5rem' }}>
|
|
|
- <ChartModule {...chartData[0]} />
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ {chartData.length !== 0 && (
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ height: '9.2rem',
|
|
|
+ display: 'flex',
|
|
|
+ flexDirection: 'column',
|
|
|
+ justifyContent: 'space-between',
|
|
|
+ padding: '0.6rem 0 0.4rem',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div style={{ height: '3.5rem' }}>
|
|
|
+ <ChartModule {...chartData[0]} />
|
|
|
+ </div>
|
|
|
|
|
|
- <div style={{ height: '3.5rem' }}>
|
|
|
- <ChartModule {...chartData[1]} />
|
|
|
- </div>
|
|
|
+ <div style={{ height: '3.5rem' }}>
|
|
|
+ <ChartModule {...chartData[1]} />
|
|
|
</div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- </PageContent>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
);
|
|
|
};
|
|
|
-
|
|
|
-export default CostComparison;
|