feat(): 添加断面为FB0+010和FB0+030的浸润线

qzc-dev
李神峰 2025-10-13 17:51:21 +08:00
parent a9cde38875
commit b8c0f01cfb
3 changed files with 107 additions and 99 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

After

Width:  |  Height:  |  Size: 181 KiB

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect, useMemo, useRef } from 'react' import React, { useState, useEffect, useMemo, useRef } from 'react'
import { Table, Card, Button, message, Popconfirm,Spin } from 'antd'; import { Table, Card, Button, message, Popconfirm, Spin } from 'antd';
import ToolBar from './toolbar'; import ToolBar from './toolbar';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import ReactEcharts from 'echarts-for-react'; import ReactEcharts from 'echarts-for-react';
@ -36,11 +36,11 @@ export default function Xmzlmb() {
const echartsRef = useRef(null) const echartsRef = useRef(null)
const jrxOptions = useMemo(() => { const jrxOptions = useMemo(() => {
if (dataSources && dbType && dbType1) { if (dataSources && dbType && dbType1) {
return jrxOption(dataSources[0], dbType,dbType1) return jrxOption(dataSources[0], dbType, dbType1)
} else { } else {
return dataSources[0]; return dataSources[0];
} }
}, [dataSources, dbType,dbType1]) }, [dataSources, dbType, dbType1])
const columns = [ const columns = [
{ title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" }, { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align: "center" },
@ -128,8 +128,18 @@ export default function Xmzlmb() {
try { try {
const res = await httppost2(apiurl.gcaqjc.sjtjcx.sycx.list) const res = await httppost2(apiurl.gcaqjc.sjtjcx.sycx.list)
const newData = res.data.map(s => ({ projNm: s.profileName, id: s.profileCode })) const newData = res.data.map(s => ({ projNm: s.profileName, id: s.profileCode }))
const filterData = newData.filter(item => (item?.projNm?.split('+')[0] == 'ZB0' ||item?.projNm?.split('+')[0] == 'FB0')) const filterData = newData.filter(item => (item?.projNm?.split('+')[0] == 'ZB0' || item?.projNm?.split('+')[0] == 'FB0'));
setDmList(filterData); const sortedData = filterData.sort((a, b) => {
// 判断a、b是否为ZB0开头
const isAZB0 = a.projNm.startsWith('ZB0');
const isBZB0 = b.projNm.startsWith('ZB0');
// 规则ZB0开头的排前面同类型都ZB0/都非ZB0保持原顺序
if (isAZB0 && !isBZB0) return -1; // a是ZB0b不是 → a在前
if (!isAZB0 && isBZB0) return 1; // a不是ZB0b是 → b在前
return 0; // 同类型,保持原始相对顺序
});
setDmList(sortedData);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@ -159,7 +169,7 @@ export default function Xmzlmb() {
v.scrollTop = 0; v.scrollTop = 0;
// setTimeout(() => { v.scrollTop = 0 }, 1000) // setTimeout(() => { v.scrollTop = 0 }, 1000)
} }
echartsRef.current.getEchartsInstance().setOption(jrxOption(dataSources[index % dataSources.length], dbType,dbType1)) echartsRef.current.getEchartsInstance().setOption(jrxOption(dataSources[index % dataSources.length], dbType, dbType1))
index++; index++;
}, Number(1000)); }, Number(1000));
setTimer(time); // 定时器保存变量 利于停止 setTimer(time); // 定时器保存变量 利于停止
@ -199,7 +209,7 @@ export default function Xmzlmb() {
setDbType1(type1) setDbType1(type1)
} }
}, [code, dmList]) }, [code, dmList])
useEffect(() => { useEffect(() => {
getDmList() getDmList()
@ -222,91 +232,91 @@ export default function Xmzlmb() {
const fun = (e) => { const fun = (e) => {
// 大于0:滚轮向上滚动 小于0:滚轮向下滚动 // 大于0:滚轮向上滚动 小于0:滚轮向下滚动
if (e.wheelDelta > 0) { if (e.wheelDelta > 0) {
scale += 0.05; scale += 0.05;
img.style.transform = `scale(${scale})`; img.style.transform = `scale(${scale})`;
} else { } else {
if (scale == 1) { if (scale == 1) {
img.style.left = 0 + "px"; img.style.left = 0 + "px";
img.style.top = 0 + "px"; img.style.top = 0 + "px";
} }
// 缩放值大于1时,可以缩小,反之亦然 // 缩放值大于1时,可以缩小,反之亦然
if (scale > 1) { if (scale > 1) {
scale -= 0.05; scale -= 0.05;
img.style.transform = `scale(${scale})`; img.style.transform = `scale(${scale})`;
} }
} }
} }
img.addEventListener("wheel",fun) img.addEventListener("wheel", fun)
return ()=>{ return () => {
img.removeEventListener("wheel",fun) img.removeEventListener("wheel", fun)
} }
},[loading])
return (
<div className='content-box' style={{ backgroundColor: '#fff', height: '100%', display: 'flex', padding: '10px' }}>
<div className='lf adcdTreeSelectorBox' style={{ height: 'calc(100vh - 110px)', width: '260px' }}>
<ListSelect
setAdcd={setCode}
listData={dmList}
/>
</div>
<div className='AdcdTreeTableBox' style={{ width: 'calc(100vw - 625px)' }}>
<Card
className='nonebox'
// onMouseOver={() => {
// clearInterval(timer)
// }}
>
<ToolBar
setSearchVal={setSearchVal}
exportFile={exportExcel}
setSwiper={setSwiper}
role={role}
/>
</Card>
{
!loading ? <div className="ant-card-body" style={{ padding: "20px 0 0 0", overflow: "hidden" }}>
<div style={{ height: 420, width: "100%",overflow:'hidden',position:'relative' }} > }, [loading])
<Rnd
default={{ return (
x: 0, <div className='content-box' style={{ backgroundColor: '#fff', height: '100%', display: 'flex', padding: '10px' }}>
y: 0, <div className='lf adcdTreeSelectorBox' style={{ height: 'calc(100vh - 110px)', width: '260px' }}>
width: 1305, <ListSelect
height: 380 setAdcd={setCode}
}} listData={dmList}
> />
<div id="img"> </div>
<div style={{ textAlign: "center", marginBottom: 10, fontSize: 20 }}>断面名称:{dmList.find(s => s.id == code)?.projNm}</div> <div className='AdcdTreeTableBox' style={{ width: 'calc(100vw - 625px)' }}>
<ReactEcharts <Card
option={jrxOptions} className='nonebox'
style={{ width: "100%", height: 380 }} // onMouseOver={() => {
notMerge={true} // clearInterval(timer)
ref={echartsRef} // }}
>
<ToolBar
setSearchVal={setSearchVal}
exportFile={exportExcel}
setSwiper={setSwiper}
role={role}
/>
</Card>
{
!loading ? <div className="ant-card-body" style={{ padding: "20px 0 0 0", overflow: "hidden" }}>
<div style={{ height: 420, width: "100%", overflow: 'hidden', position: 'relative' }} >
<Rnd
default={{
x: 0,
y: 0,
width: 1305,
height: 380
}}
>
<div id="img">
<div style={{ textAlign: "center", marginBottom: 10, fontSize: 20 }}>断面名称:{dmList.find(s => s.id == code)?.projNm}</div>
<ReactEcharts
option={jrxOptions}
style={{ width: "100%", height: 380 }}
notMerge={true}
ref={echartsRef}
/>
</div>
</Rnd>
</div>
<div className='body-top' style={{ marginTop: 30 }}>
<Table
columns={columns1}
key="inx"
dataSource={dataSources}
pagination={false}
scroll={{ x: width, y: 250, scrollToFirstRowOnChange: true }}
onRow={record => {
return {
onClick: () => { echartsRef.current.getEchartsInstance().setOption(jrxOption(record, dbType, dbType1)) }
}
}}
/> />
</div> </div>
</Rnd> </div> :
</div> <Spin size='large' style={{ width: '100%', margin: '300px auto' }}></Spin>
<div className='body-top' style={{ marginTop: 30 }}> }
<Table
columns={columns1} </div>
key="inx"
dataSource={dataSources}
pagination={false}
scroll={{ x: width, y: 250, scrollToFirstRowOnChange: true }}
onRow={record => {
return {
onClick: () => { echartsRef.current.getEchartsInstance().setOption(jrxOption(record, dbType,dbType1)) }
}
}}
/>
</div>
</div> :
<Spin size='large' style={{width:'100%',margin:'300px auto'}}></Spin>
}
</div> </div>
</div> )
)
} }

View File

@ -28,8 +28,7 @@ export default function jrxOptions(data = {}, type = "1",typeName='1') {
typeName == "6" ? type6 : typeName == "6" ? type6 :
typeName == "7" ? type7 : typeName == "7" ? type7 :
typeName == "8" ? type8 : typeName == "8" ? type8 :
[] [];
;
// 字体颜色 // 字体颜色
const textColor = '#666' const textColor = '#666'
@ -46,10 +45,10 @@ export default function jrxOptions(data = {}, type = "1",typeName='1') {
// rz 是最上面那条线 rz1是那条贴近坝面的线 xValue求解的是最上面那条线的末尾横坐标 // rz 是最上面那条线 rz1是那条贴近坝面的线 xValue求解的是最上面那条线的末尾横坐标
const xValue = type == "3" ? (((data?.rz - 86) + 0.6 * 5) / 0.6) : const xValue = type == "3" ? (((data?.rz - 86) + 0.6 * 5) / 0.6) :
type == "2" ? (((data?.rz - 87) + 0.63 * 7) / 0.63) : type == "2" ? (((data?.rz - 87) + 0.63 * 7) / 0.63) :
type == "1" ? (((data?.rz - 88) + 0.7 * 10) / 0.7) : type == "1" ? (((data?.rz - 88) + 0.7 * 10) / 0.7) :
Math.abs((((data?.rz - 110) + 0.2 * 12) / 0.2)) (((data?.rz - 102) + 0.25 * 4) / 0.25)
const rz = data?.rz ? const rz = data?.rz ?
[[xValue, data?.rz], [0, data?.rz],] : [[xValue, data?.rz], [0, data?.rz]] :
[] []
const rz1 = data?.rz ? const rz1 = data?.rz ?
type == "3" ? type == "3" ?
@ -58,17 +57,16 @@ export default function jrxOptions(data = {}, type = "1",typeName='1') {
[[0, 87], [7, 87], [xValue, data?.rz]] [[0, 87], [7, 87], [xValue, data?.rz]]
: :
type == "1" ? type == "1" ?
[[0, 88], [10, 88], [xValue, data?.rz]] [[0, 88], [10, 88], [xValue, data?.rz]]
: :
[[0, 110], [12, 110], [xValue, data?.rz]] [[0, 102], [4, 102], [xValue, data?.rz]]
: : [];
[]
// gz1、gz2、gz3、gz4分别为渗压管 // gz1、gz2、gz3、gz4分别为渗压管
const gz1 = data[alltype[0]] ? const gz1 = data[alltype[0]] ?
type == "3" ? [[51, typeName =='5' ?76.56:92.18], [51, data[alltype[0]]]] : type == "3" ? [[51, typeName =='5' ?76.56:92.18], [51, data[alltype[0]]]] :
type == "2" ? [[45.5, typeName =='3' ?76.16:77.18], [45.5, data[alltype[0]]]] : type == "2" ? [[45.5, typeName =='3' ?76.16:77.18], [45.5, data[alltype[0]]]] :
type == "1" ? [[44, typeName =='1' ?79.16:77.18], [44, data[alltype[0]]]] : type == "1" ? [[44, typeName =='1' ?79.16:77.18], [44, data[alltype[0]]]] :
[[39, 109.87], [39, data[alltype[0]]]] [[55, 109.87], [55, data[alltype[0]]]]
: []; : [];
@ -76,14 +74,14 @@ export default function jrxOptions(data = {}, type = "1",typeName='1') {
type == "3" ? [[62, typeName =='5' ?77.18:83.50], [62, data[alltype[1]]]] : type == "3" ? [[62, typeName =='5' ?77.18:83.50], [62, data[alltype[1]]]] :
type == "2" ? [[50, typeName =='3' ?77.18:77.50], [50, data[alltype[1]]]] : type == "2" ? [[50, typeName =='3' ?77.18:77.50], [50, data[alltype[1]]]] :
type == "1" ? [[51.5, typeName =='1' ?77.18:74.5], [51.5, data[alltype[1]]]] : type == "1" ? [[51.5, typeName =='1' ?77.18:74.5], [51.5, data[alltype[1]]]] :
[[51, 109.75], [53.6, data[alltype[1]]]] : [[65, 109.75], [65, data[alltype[1]]]] :
[]; [];
const gz3 = data[alltype[2]] ? const gz3 = data[alltype[2]] ?
type == "3" ? [[58.5, 81.50], [58.5, data[alltype[2]]]] : type == "3" ? [[58.5, 81.50], [58.5, data[alltype[2]]]] :
type == "2" ? [[58, 80.50], [58, data[alltype[2]]]] : type == "2" ? [[58, 80.50], [58, data[alltype[2]]]] :
type == "1" ? [[58, 66.50], [58, data[alltype[2]]]] : type == "1" ? [[58, 66.50], [58, data[alltype[2]]]] :
[[66, 109.43], [73, data[alltype[2]]]] : []; [[77, 109.43], [77, data[alltype[2]]]] : [];
const gz4 = data[alltype[3]] ? const gz4 = data[alltype[3]] ?
@ -120,9 +118,9 @@ export default function jrxOptions(data = {}, type = "1",typeName='1') {
]: ]:
[ [
[xValue, data?.rz], [xValue, data?.rz],
[39, data[alltype[0]]], [55, data[alltype[0]]],
[51, data[alltype[1]]], [65, data[alltype[1]]],
[66, data[alltype[2]]], [77, data[alltype[2]]],
[85, data[alltype[3]]] [85, data[alltype[3]]]
] ]
: [] : []
@ -277,7 +275,7 @@ export default function jrxOptions(data = {}, type = "1",typeName='1') {
origin: "end", origin: "end",
color: 'rgba(0, 128, 255, 0.3)' // 设置区域填充颜色 color: 'rgba(0, 128, 255, 0.3)' // 设置区域填充颜色
}, },
data: [...rz, ...rz1] data:[...rz, ...rz1]
}, },
{ {