|
@@ -1,3 +1,4 @@
|
|
|
+import TabsContent from '@/components/TabsContent';
|
|
|
import {
|
|
|
queryBackwash,
|
|
|
queryBackwashList,
|
|
@@ -17,7 +18,7 @@ import { useRequest } from '@umijs/max';
|
|
|
import { DatePicker, Modal, Select, Spin } from 'antd';
|
|
|
import dayjs from 'dayjs';
|
|
|
import * as echarts from 'echarts';
|
|
|
-import { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
+import { useEffect, useRef, useState } from 'react';
|
|
|
import styles from './SimulateDetail.less';
|
|
|
|
|
|
const { RangePicker } = DatePicker;
|
|
@@ -86,36 +87,23 @@ const SimulateDetail = (props) => {
|
|
|
},
|
|
|
});
|
|
|
|
|
|
- const onLeftClick = () => {
|
|
|
- document.getElementById('content').scrollLeft -= 150;
|
|
|
- };
|
|
|
-
|
|
|
- const onRightClick = () => {
|
|
|
- document.getElementById('content').scrollLeft += 150;
|
|
|
- };
|
|
|
-
|
|
|
return (
|
|
|
<div>
|
|
|
- <div className={styles.tabs}>
|
|
|
- <div className={styles.left} onClick={onLeftClick}></div>
|
|
|
- <div id="content" className={styles.content}>
|
|
|
- {data?.map((item) => (
|
|
|
- <div
|
|
|
- key={item}
|
|
|
- className={`${styles.item} ${
|
|
|
- active == item ? styles.active : ''
|
|
|
- }`}
|
|
|
- onClick={() => {
|
|
|
- setActive(item);
|
|
|
- setCurrent(null);
|
|
|
- }}
|
|
|
- >
|
|
|
- {TYPE[item]?.name}
|
|
|
- </div>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- <div className={styles.right} onClick={onRightClick}></div>
|
|
|
- </div>
|
|
|
+ {data && (
|
|
|
+ <TabsContent
|
|
|
+ defaultActiveKey={data[0]}
|
|
|
+ items={data.map((item) => ({
|
|
|
+ label: TYPE[item]?.name,
|
|
|
+ key: item,
|
|
|
+ children: <div></div>,
|
|
|
+ }))}
|
|
|
+ onChange={(value) => {
|
|
|
+ setActive(value);
|
|
|
+ setCurrent(null);
|
|
|
+ }}
|
|
|
+ ></TabsContent>
|
|
|
+ )}
|
|
|
+
|
|
|
<div className={`${styles.box} card-box`}>
|
|
|
<ChartContent
|
|
|
active={active}
|
|
@@ -155,7 +143,7 @@ const ChartContent = (props) => {
|
|
|
const domRef = useRef(null);
|
|
|
const chartRef = useRef(null);
|
|
|
|
|
|
- const { data, run } = useRequest(
|
|
|
+ const { data, run, loading } = useRequest(
|
|
|
() => {
|
|
|
let params = {
|
|
|
device_code: current.device_code,
|
|
@@ -178,19 +166,6 @@ const ChartContent = (props) => {
|
|
|
},
|
|
|
);
|
|
|
|
|
|
- const optimization = useMemo(() => {
|
|
|
- const result = data?.list?.filter((item) => item.optimization);
|
|
|
- if (result?.length > 0) {
|
|
|
- const lastItem = result[result.length - 1].optimization;
|
|
|
- const valueList = Object.values(lastItem).map((item) => item.remark);
|
|
|
- return valueList.join(',');
|
|
|
- }
|
|
|
- // if (data?.list?.[0]?.optimization?.peb_interval) {
|
|
|
- // return data.list[0].optimization.peb_interval.remark;
|
|
|
- // }
|
|
|
- return '';
|
|
|
- }, [data]);
|
|
|
-
|
|
|
const searchTime = (type) => {
|
|
|
setDateActive(type);
|
|
|
let time = [dayjs().startOf(type), dayjs()];
|
|
@@ -257,28 +232,10 @@ const ChartContent = (props) => {
|
|
|
)}
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- {/* <Spin spinning={loading} wrapperClassName={styles.loadingBox}>
|
|
|
- {!loading && !data?.list && <Empty style={{ height: 195 }} />}
|
|
|
- </Spin> */}
|
|
|
- <div
|
|
|
- ref={domRef}
|
|
|
- style={{ height: '100%', display: !data?.list ? 'none' : 'block' }}
|
|
|
- />
|
|
|
- {optimization && (
|
|
|
- <div
|
|
|
- style={{
|
|
|
- fontSize: 22,
|
|
|
- // color: '#fff',
|
|
|
- textIndent: 30,
|
|
|
- padding: '10px 0',
|
|
|
- flexShrink: 1,
|
|
|
- }}
|
|
|
- >
|
|
|
- 优化建议:{optimization}
|
|
|
- </div>
|
|
|
- )}
|
|
|
-
|
|
|
+ <Spin spinning={loading}>
|
|
|
+ <div ref={domRef} style={{ height: '30vh' }} />
|
|
|
+ </Spin>
|
|
|
+ <Optimization data={data?.list?.[0]} />
|
|
|
<MembraneModal
|
|
|
visible={visible}
|
|
|
onCancel={() => setVisible(false)}
|
|
@@ -663,7 +620,7 @@ const MembraneModal = (props) => {
|
|
|
<Modal
|
|
|
forceRender
|
|
|
title="渗透率图表"
|
|
|
- visible={visible}
|
|
|
+ open={visible}
|
|
|
onCancel={onCancel}
|
|
|
footer={null}
|
|
|
>
|
|
@@ -746,4 +703,21 @@ function getMembraneOption(data = []) {
|
|
|
return option;
|
|
|
}
|
|
|
|
|
|
+const Optimization = ({ data }) => {
|
|
|
+ if (!data?.optimization) return '';
|
|
|
+ return (
|
|
|
+ <div className={styles.optimization}>
|
|
|
+ <div className={styles.title1}>
|
|
|
+ {dayjs(data.c_time).format('YYYY-MM-DD HH:mm')}
|
|
|
+ </div>
|
|
|
+ <div className={styles.title2}>调整内容</div>
|
|
|
+ {Object.entries(data.optimization).map(([key, item]) => (
|
|
|
+ <div className={styles.content}>
|
|
|
+ {key}:{item.remark}
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
export default SimulateDetail;
|