|
@@ -49,7 +49,8 @@ function Quality() {
|
|
start_time: timerRef.current.s_time,
|
|
start_time: timerRef.current.s_time,
|
|
end_time: timerRef.current.e_time,
|
|
end_time: timerRef.current.e_time,
|
|
},
|
|
},
|
|
- codeList?.map((item) => item.metric_code),
|
|
|
|
|
|
+ // codeList?.map((item) => item.metric_code),
|
|
|
|
+ [currentCode.metric_code],
|
|
);
|
|
);
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -57,16 +58,15 @@ function Quality() {
|
|
},
|
|
},
|
|
);
|
|
);
|
|
const column = useMemo(() => {
|
|
const column = useMemo(() => {
|
|
- const col = { title: '时间', dataIndex: 'time', width: '250px' };
|
|
|
|
- let other = codeList?.map((item) => {
|
|
|
|
- return {
|
|
|
|
- title: item.metric,
|
|
|
|
- dataIndex: item.metric_code,
|
|
|
|
- width: '200px',
|
|
|
|
- };
|
|
|
|
- });
|
|
|
|
- return other && other.length > 0 ? [col, ...other] : [];
|
|
|
|
- }, [codeList]);
|
|
|
|
|
|
+ if (!currentCode) return [];
|
|
|
|
+ return [
|
|
|
|
+ { title: '时间', dataIndex: 'time', width: '40%' },
|
|
|
|
+ {
|
|
|
|
+ title: currentCode.metric,
|
|
|
|
+ dataIndex: currentCode.metric_code,
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ }, [currentCode]);
|
|
|
|
|
|
//图表配置
|
|
//图表配置
|
|
const chartProps = useMemo(() => {
|
|
const chartProps = useMemo(() => {
|
|
@@ -76,18 +76,8 @@ function Quality() {
|
|
let yName = currentCode.metric;
|
|
let yName = currentCode.metric;
|
|
let data = [...mainRes.data].reverse();
|
|
let data = [...mainRes.data].reverse();
|
|
xData = data.map((item) => item.time);
|
|
xData = data.map((item) => item.time);
|
|
- // dataList.push({
|
|
|
|
- // type: 0,
|
|
|
|
- // name: '出水水量',
|
|
|
|
- // data: data.map((item) => item.permeate),
|
|
|
|
- // });
|
|
|
|
- // dataList.push({
|
|
|
|
- // type: 1,
|
|
|
|
- // name: '进水水量',
|
|
|
|
- // data: data.map((item) => item.feed),
|
|
|
|
- // });
|
|
|
|
dataList.push({
|
|
dataList.push({
|
|
- type: 2,
|
|
|
|
|
|
+ type: 0,
|
|
name: currentCode.metric,
|
|
name: currentCode.metric,
|
|
data: data.map((item) => item[currentCode.metric_code]),
|
|
data: data.map((item) => item[currentCode.metric_code]),
|
|
});
|
|
});
|
|
@@ -95,16 +85,16 @@ function Quality() {
|
|
yName,
|
|
yName,
|
|
xData,
|
|
xData,
|
|
dataList,
|
|
dataList,
|
|
- typeList: codeList?.map((item) => item.metric),
|
|
|
|
- currentType: currentCode.metric,
|
|
|
|
|
|
+ // typeList: codeList?.map((item) => item.metric),
|
|
|
|
+ // currentType: currentCode.metric,
|
|
};
|
|
};
|
|
}, [mainRes.data, currentCode]);
|
|
}, [mainRes.data, currentCode]);
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- if (codeList) {
|
|
|
|
|
|
+ if (currentCode) {
|
|
mainRes.run();
|
|
mainRes.run();
|
|
}
|
|
}
|
|
- }, [codeList]);
|
|
|
|
|
|
+ }, [currentCode]);
|
|
|
|
|
|
const onChange = (name) => {
|
|
const onChange = (name) => {
|
|
const code = codeList.find((item) => item.metric == name);
|
|
const code = codeList.find((item) => item.metric == name);
|
|
@@ -116,8 +106,24 @@ function Quality() {
|
|
<PageTitle onReturn={() => UnityAction.sendMsg('menuItem', '首页')}>
|
|
<PageTitle onReturn={() => UnityAction.sendMsg('menuItem', '首页')}>
|
|
水质监测
|
|
水质监测
|
|
</PageTitle>
|
|
</PageTitle>
|
|
- <div className="card-box" style={{ padding: 20, marginTop: 40 }}>
|
|
|
|
- <PageTitle>数据曲线</PageTitle>
|
|
|
|
|
|
+
|
|
|
|
+ <div className="card-box" style={{ padding: 20, marginTop: 26 }}>
|
|
|
|
+ <div className="tabs" style={{ marginBottom: 20 }}>
|
|
|
|
+ {codeList?.map((item) => (
|
|
|
|
+ <div
|
|
|
|
+ onClick={() => {
|
|
|
|
+ setCode(item);
|
|
|
|
+ }}
|
|
|
|
+ className={`tabs-item ${item == currentCode ? 'active' : ''}`}
|
|
|
|
+ >
|
|
|
|
+ {item.metric}
|
|
|
|
+ </div>
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
|
|
+ <div className="section-title">
|
|
|
|
+ <div className="section-line"></div>
|
|
|
|
+ 数据曲线
|
|
|
|
+ </div>
|
|
<Spin spinning={mainRes.loading}>
|
|
<Spin spinning={mainRes.loading}>
|
|
<div style={{ height: 500, marginTop: 20 }}>
|
|
<div style={{ height: 500, marginTop: 20 }}>
|
|
{mainRes?.data ? (
|
|
{mainRes?.data ? (
|
|
@@ -128,12 +134,14 @@ function Quality() {
|
|
</div>
|
|
</div>
|
|
</Spin>
|
|
</Spin>
|
|
<div style={{ marginTop: 30 }}>
|
|
<div style={{ marginTop: 30 }}>
|
|
- <PageTitle>数据列表</PageTitle>
|
|
|
|
|
|
+ <div className="section-title">
|
|
|
|
+ <div className="section-line"></div>
|
|
|
|
+ 数据列表
|
|
|
|
+ </div>
|
|
<Table
|
|
<Table
|
|
columns={column}
|
|
columns={column}
|
|
style={{ marginTop: 20 }}
|
|
style={{ marginTop: 20 }}
|
|
dataSource={mainRes?.data}
|
|
dataSource={mainRes?.data}
|
|
- scroll={{ x: 2500 }}
|
|
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|