tsg-app/pages/aqjc/jrxOptions.js

385 lines
11 KiB
JavaScript
Raw Normal View History

2024-11-13 09:42:42 +08:00
import { imageUrl060,imageUrl090,rule } from './dataUrl'
2025-04-15 17:48:27 +08:00
import imageUrl130 from './dataUrl1/zb130';
import imageUrl250 from './dataUrl1/zb250';
import imageUrl370 from './dataUrl1/zb370';
2025-10-13 17:52:14 +08:00
import imageUrl010 from './dataUrl1/fb010';
2024-11-13 09:42:42 +08:00
2025-04-15 17:48:27 +08:00
2025-10-13 17:52:14 +08:00
export default function jrxOptions(data = {}, type = "1", typeName = '1') {
2025-04-15 17:48:27 +08:00
const yMin = type == "3" ? 70 : type == "2" ? 67 :
2025-10-13 17:52:14 +08:00
type == '1' ? 58 : 99;
2025-04-15 17:48:27 +08:00
const yMax = type == "3" ? 129 : type == "2" ? 117
2025-10-13 17:52:14 +08:00
: type == "1" ? 118 : 116;
2025-10-14 13:22:48 +08:00
const type1 = ["UPD1", "UPD4", "UPD7", "UPD16"];
const type2 = ["UPD10", "UPD13"];
2025-09-26 17:15:37 +08:00
const type3 = ["UPD2", "UPD5", "UPD8", "UPD17"];
const type4 = ["UPD11", "UPD14"];
const type5 = ["UPD3", "UPD6", "UPD9"];
const type6 = ["UPD12", "UPD15"];
2025-10-13 17:52:14 +08:00
const type7 = ["UPD24", "UPD26","UPD28"]; //UPD24:109.87,UPD26:109.75,UPD28:109.43
const type8 = ["UPD25", "UPD27","UPD29"]; //UPD25:109.87,UPD27:109.75,UPD29:109.43
2025-04-15 17:48:27 +08:00
const alltype = typeName == "1" ? type1 :
typeName == "2" ? type2 :
typeName == "3" ? type3 :
typeName == "4" ? type4 :
typeName == "5" ? type5 :
2025-10-13 17:52:14 +08:00
typeName == "6" ? type6 :
typeName == "7" ? type7 :
typeName == "8" ? type8 :
[];
2025-04-15 17:48:27 +08:00
;
// 字体颜色
2024-11-13 09:42:42 +08:00
const textColor = '#666'
2025-04-15 17:48:27 +08:00
// const imageUrl370 = `${process.env.PUBLIC_URL}/assets/images/zb370.png `
// const imageUrl250 = `${process.env.PUBLIC_URL}/assets/images/zb250.png `
// const imageUrl130 = `${process.env.PUBLIC_URL}/assets/images/zb130.png `
const imageUrl = type == "1" ? imageUrl130 :
type == "2" ? imageUrl250 :
2025-10-13 17:52:14 +08:00
type == "3" ? imageUrl370 : imageUrl010;
2025-04-15 17:48:27 +08:00
// const rule = `${process.env.PUBLIC_URL}/assets/images/ruler.png `
// rz 是最上面那条线 rz1是那条贴近坝面的线 xValue求解的是最上面那条线的末尾横坐标
const xValue = type == "3" ? (((data?.rz - 86) + 0.6 * 5) / 0.6) :
type == "2" ? (((data?.rz - 87) + 0.63 * 7) / 0.63) :
type == "1" ? (((data?.rz - 87) + 0.67 * 10) / 0.67) :
2025-10-13 17:52:14 +08:00
(((data?.rz - 102) + 0.25 * 4) / 0.25)
2024-11-13 09:42:42 +08:00
const rz = data?.rz ?
2025-04-15 17:48:27 +08:00
[[xValue, data?.rz], [0, data?.rz],] :
2024-11-13 09:42:42 +08:00
[]
2024-11-15 16:40:47 +08:00
const rz1 = data?.rz ?
2025-04-15 17:48:27 +08:00
type == "3" ?
[[0, 86], [4, 86], [xValue, data?.rz]] :
2024-11-15 16:40:47 +08:00
type == "2" ?
2025-04-15 17:48:27 +08:00
[[0, 87], [6, 87], [xValue, data?.rz]]
:
type == "1" ?
[[0, 87], [8, 87], [xValue, data?.rz]]
:
2025-10-13 17:52:14 +08:00
[[0, 102], [4, 102], [xValue, data?.rz]]
2025-04-15 17:48:27 +08:00
:
2024-11-13 09:42:42 +08:00
[]
2025-04-15 17:48:27 +08:00
// gz1、gz2、gz3、gz4分别为渗压管
2024-11-15 16:40:47 +08:00
const gz1 = data[alltype[0]] ?
2025-11-06 15:56:02 +08:00
type == "3" ? [[typeName =='6' ?57:52, typeName =='5' ?90.50:81.85], [typeName =='6' ?57:52, data[alltype[0]]]] :
type == "2" ? [[typeName =='3' ?50:55, typeName =='3' ?84.41:83.78], [typeName =='3' ?50:55, data[alltype[0]]]] :
type == "1" ? [[typeName =='1' ?49:57, typeName =='1' ?80.11:78.64], [typeName =='1' ?49:57, data[alltype[0]]]] :
2025-10-27 17:22:23 +08:00
[[62, typeName =='7'?109.08:108.77], [62, data[alltype[0]]]]
2024-11-13 09:42:42 +08:00
: [];
2025-04-15 17:48:27 +08:00
2024-11-13 09:42:42 +08:00
const gz2 = data[alltype[1]] ?
2025-11-06 15:56:02 +08:00
type == "3" ? [[typeName =='6' ?71:57, typeName =='5' ?90.94:84.85], [typeName =='6' ?71:57, data[alltype[1]]]] :
type == "2" ? [[typeName =='3' ?55:68, typeName =='3' ?84.04:81.05], [typeName =='3' ?55:68, data[alltype[1]]]] :
type == "1" ? [[typeName =='1' ?57:67, typeName =='1' ?78.61:82.75], [typeName =='1' ?57:67, data[alltype[1]]]] :
2025-10-27 17:22:23 +08:00
[[72, typeName =='7'?109.32:109.36], [72, data[alltype[1]]]] :
2024-11-13 09:42:42 +08:00
[];
2025-04-15 17:48:27 +08:00
2024-11-13 09:42:42 +08:00
const gz3 = data[alltype[2]] ?
2025-11-06 15:56:02 +08:00
type == "3" ? [[71, 92.65], [71, data[alltype[2]]]] :
type == "2" ? [[68, 83.93], [68, data[alltype[2]]]] :
type == "1" ? [[67, 81.38], [67, data[alltype[2]]]] :
2025-10-27 17:22:23 +08:00
[[87, typeName =='7'?109.01:108.87], [87, data[alltype[2]]]] : [];
2024-11-15 16:40:47 +08:00
2025-04-15 17:48:27 +08:00
2024-11-13 09:42:42 +08:00
const gz4 = data[alltype[3]] ?
2025-04-15 17:48:27 +08:00
type == "3" ? [] :
2025-11-06 15:56:02 +08:00
type == "2" ? [[91,79.57], [91, data[alltype[3]]]] :
type == "1" ? [[89, 79.09], [89, data[alltype[3]]]] :
2024-11-13 09:42:42 +08:00
[[85, 166], [85, data[alltype[3]]]] : [];
2024-11-15 16:40:47 +08:00
2025-04-15 17:48:27 +08:00
// 将渗压管连起来的线
2024-11-13 09:42:42 +08:00
const line = data?.rz ?
2025-04-15 17:48:27 +08:00
type == "3" ?
[
[xValue, data?.rz],
2025-10-14 13:22:48 +08:00
[typeName =='6' ?57:52, data[alltype[0]]],
[typeName =='6' ?71:57, data[alltype[1]]],
[71, data[alltype[2]]],
2025-04-15 17:48:27 +08:00
2024-11-13 09:42:42 +08:00
] :
type == "2" ?
2025-04-15 17:48:27 +08:00
[
[xValue, data?.rz],
2025-10-14 13:22:48 +08:00
[typeName =='3' ?50:55, data[alltype[0]]],
[typeName =='3' ?55:68, data[alltype[1]]],
[68, data[alltype[2]]],
[91, data[alltype[3]]]
2024-11-13 09:42:42 +08:00
] :
2025-09-30 17:23:21 +08:00
type == "1" ?
[
[xValue, data?.rz],
2025-11-06 15:56:02 +08:00
[typeName =='1' ?49:57, data[alltype[0]]],
[typeName =='1' ?57:67, data[alltype[1]]],
2025-09-30 17:23:21 +08:00
[67, data[alltype[2]]],
[89, data[alltype[3]]]
] :
[
[xValue, data?.rz],
2025-10-13 17:52:14 +08:00
[62, data[alltype[0]]],
[72, data[alltype[1]]],
[87, data[alltype[2]]],
2025-09-30 17:23:21 +08:00
[85, data[alltype[3]]]
]
: [];
const filteredArray = line.filter(subArray => {
return subArray.every(item => item !== null && item !== undefined);
});
2024-11-13 09:42:42 +08:00
let eopts = {
toolbox: {
show: true,
feature: {
saveAsImage: {
show: true,
excludeComponents: ['toolbox'],
pixelRatio: 2,
name:"测值图"
},
},
right: "10%",
top:"4%"
},
graphic: [
{
type: 'image',
left: '5%',
top: 0,
bottom:0,
z: 1,
bounding: 'raw',
style: {
image: imageUrl,
width: 1310,
height: 380
}
},
{
type: 'image',
// id: 'background',
left: '5%',
bottom:"5%",
z: 1,
bounding: 'all',
style: {
image: rule,
width: 10,
height: 450
}
}
],
grid: {
top: '0%',
left: '2%',
right: '5%',
bottom: '0%',
containLabel: true
},
xAxis: {
min: 0,
max:100,
axisLabel: {
show:false,
// 坐标轴字体颜色
color: textColor,
fontSize: 18
},
axisLine: {
show:false,
lineStyle: {
color: textColor
}
},
axisTick: {
// y轴刻度线
show: false
},
splitLine: {
// 网格
show: false
},
boundaryGap: false
},
yAxis: {
type: 'value',
min: yMin,
max: yMax,
interval:5,
// data:[155,160,180,190,210],
nameTextStyle: {
color: '#333',
fontSize: 18,
padding: [0, 0, 0, 80]
},
axisLabel: {
// 坐标轴字体颜色
color: textColor,
fontSize: 18,
showMinLabel: false,
showMaxLabel: false
},
axisLine: {
show: false
},
axisTick: {
// y轴刻度线
show: false
},
splitLine: {
// 网格
show: false,
lineStyle: {
color: '#CCCCCC',
type: 'dashed'
}
}
},
}
let chartData = {
series: [
// 和大坝坡面重合的线 斜率为0.75
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
itemStyle: {
color: '#fff'
},
lineStyle: {
color: '#fff'
},
areaStyle: {
origin: "end",
color: 'rgba(0, 128, 255, 0.3)' // 设置区域填充颜色
},
2025-10-13 17:52:14 +08:00
data:[...rz, ...rz1]
2024-11-13 09:42:42 +08:00
},
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
itemStyle: {
color: '#5487FF'
},
lineStyle: {
color: '#5487FF'
},
markPoint: {
data: [{ type: 'max',x:"20%", coord: [xValue, data?.rz] }],
symbol: 'pin',
symbolSize: [30, 10],
itemStyle: {
color: '#fff', // 标注点颜色
borderColor: '#ffa500', // 标注点边框颜色
borderWidth: 0 // 标注点边框宽度
},
label: {
show: true, // 是否显示标签
formatter: "库水位" +data?.rz + "m", // 标签格式
color: '#5487FF', // 标签文字颜色
fontSize: 12, // 标签文字大小
}
},
data:rz
},
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
itemStyle: {
color: '#5487FF'
},
lineStyle: {
color: '#5487FF'
},
data:rz1
},
// 管位
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
itemStyle: {
color: '#5487FF'
},
lineStyle: {
color: '#5487FF',
width:6
},
data: gz1
},
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
itemStyle: {
color: '#5487FF'
},
lineStyle: {
color: '#5487FF',
width:6
},
data: gz2
},
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
itemStyle: {
color: '#5487FF'
},
lineStyle: {
color: '#5487FF',
width:6
},
data: gz3
},
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
itemStyle: {
color: '#5487FF'
},
lineStyle: {
color: '#5487FF',
width:6
},
data: gz4
},
// 管位连接线
{
type: 'line',
symbol: 'none',
symbolSize: 10,
z: 1,
2025-10-11 10:37:07 +08:00
smooth: 0.6, // 设置平滑度
smoothMonotone: 'x', // 保持 x 方向的单调性
2024-11-13 09:42:42 +08:00
itemStyle: {
color: '#5487FF'
},
lineStyle: {
2025-10-11 10:37:07 +08:00
color: '#5487FF',
width: 2,
curveness: 0.5 // 增加曲线程度
2024-11-13 09:42:42 +08:00
},
2025-09-30 17:23:21 +08:00
data: filteredArray
2024-11-13 09:42:42 +08:00
},
]
}
return {
eopts,
chartData
}
}