|
@@ -3,9 +3,10 @@ import ChartModule from '@/components/ManagementPage/chartModule';
|
|
|
import PageContent from '@/components/PageContent';
|
|
|
import PageTitle from '@/components/PageTitle';
|
|
|
import { getComparisonData } from '@/services/OperationManagement';
|
|
|
+import { queryConditionSnapshot } from '@/services/SmartOps';
|
|
|
import { UnityAction } from '@/utils/utils';
|
|
|
import { LineChartOutlined } from '@ant-design/icons';
|
|
|
-import { history, useParams } from '@umijs/max';
|
|
|
+import { history, useParams, useRequest } from '@umijs/max';
|
|
|
import { message } from 'antd';
|
|
|
import dayjs from 'dayjs';
|
|
|
import { useEffect, useState } from 'react';
|
|
@@ -48,7 +49,7 @@ const CostComparison = () => {
|
|
|
}}
|
|
|
style={{ marginLeft: '0.1rem' }}
|
|
|
className={`password-eye ${open ? 'open' : ''}`}
|
|
|
- ></div>
|
|
|
+ />
|
|
|
</PageTitle>
|
|
|
<EnergyCost open={open} />
|
|
|
</PageContent>
|
|
@@ -75,6 +76,34 @@ export const EnergyCost = ({ open, detailClick }) => {
|
|
|
end: defaultTime.e_time,
|
|
|
};
|
|
|
|
|
|
+ const getValue = (str) => {
|
|
|
+ const result = str?.match(/.*?(\d+(?:\.\d+)?)\D*$/);
|
|
|
+ if (result && result[1]) return result[1];
|
|
|
+ return 0;
|
|
|
+ };
|
|
|
+
|
|
|
+ const { data: snapshot } = useRequest(queryConditionSnapshot, {
|
|
|
+ defaultParams: [{ project_id: projectId }],
|
|
|
+ formatResult: (result) => {
|
|
|
+ const elec = Number(getValue(result.data.elec_unit));
|
|
|
+ let resultText = `当前电耗持平理论值 ${
|
|
|
+ result?.data?.elec_unit_theory || 0
|
|
|
+ }KWh/m³`;
|
|
|
+ if (elec) {
|
|
|
+ if (elec > result.data.elec_unit_theory) {
|
|
|
+ resultText = `当前电耗高于理论值 ${result.data.elec_unit_theory}KWh/m³`;
|
|
|
+ }
|
|
|
+ if (elec === result.data.elec_unit_theory) {
|
|
|
+ resultText = `当前电耗持平理论值 ${result.data.elec_unit_theory}KWh/m³`;
|
|
|
+ }
|
|
|
+ if (elec < result.data.elec_unit_theory) {
|
|
|
+ resultText = `当前电耗低于理论值 ${result.data.elec_unit_theory}KWh/m³`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return { ...result.data, resultText };
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
const getChartData = () => {
|
|
|
// 构建请求列表
|
|
|
const queryList = [];
|
|
@@ -260,6 +289,17 @@ export const EnergyCost = ({ open, detailClick }) => {
|
|
|
className="card-box"
|
|
|
style={{ padding: '0.2rem', position: 'relative' }}
|
|
|
>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ fontSize: '0.28rem',
|
|
|
+ position: 'absolute',
|
|
|
+ top: '-0.6rem',
|
|
|
+ right: '0.3rem',
|
|
|
+ display: `${detailClick ? 'none' : ''}`,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {snapshot?.resultText}
|
|
|
+ </div>
|
|
|
<LineChartOutlined
|
|
|
style={{
|
|
|
fontSize: '0.4rem',
|
|
@@ -276,23 +316,12 @@ export const EnergyCost = ({ open, detailClick }) => {
|
|
|
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/m³</span>
|
|
|
- </div>
|
|
|
- <div className={styles.name}>近一天吨水电耗</div>
|
|
|
+ >
|
|
|
+ <div className={styles.value}>
|
|
|
+ {open ? getValue(snapshot?.elec_unit || '') : '***'}
|
|
|
+ <span className={styles.unit}>kWh/t</span>
|
|
|
</div>
|
|
|
- <div className={styles.name}>近一天吨水电耗</div>
|
|
|
+ <div className={styles.name}>近一小时吨水电耗</div>
|
|
|
</div>
|
|
|
<div
|
|
|
className={styles.item}
|
|
@@ -301,20 +330,20 @@ export const EnergyCost = ({ open, detailClick }) => {
|
|
|
}}
|
|
|
>
|
|
|
<div className={styles.value}>
|
|
|
- {open ? curElecUsed : '***'}
|
|
|
+ {open ? getValue(snapshot?.elec || '') : '***'}
|
|
|
<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/m³</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.name}>当月吨水电耗</div>
|
|
|
</div>
|