Commit 0a22694f by jiang'yun

修改

parent 4059f610
......@@ -15,37 +15,37 @@
</template>
<script>
import * as echarts from 'echarts';
import { getljqxData } from '@/api/system/cjsjLas';
import { listLjSssjSd } from '@/api/optimization/ljSssjSd';
import * as echarts from "echarts";
import { getljqxData } from "@/api/system/cjsjLas";
import { listLjSssjSd } from "@/api/optimization/ljSssjSd";
export default {
name: "DrillingTimeChart",
props: {
jh: {
type: String,
default: ''
}
default: "",
},
},
data() {
return {
chartData: null,
myChart: null,
resizeHandler: null,
loading: false
loading: false,
};
},
mounted() {
this.loadChartData();
this.$once('hook:beforeDestroy', this.cleanup);
this.$once("hook:beforeDestroy", this.cleanup);
},
watch: {
jh: {
handler() {
this.loadChartData();
},
immediate: false
}
immediate: false,
},
},
methods: {
loadChartData() {
......@@ -54,16 +54,15 @@ export default {
}
this.loading = true;
// 获取录井曲线数据和录井整米数据
Promise.all([
getljqxData({ jh: this.jh }),
listLjSssjSd({ jh: this.jh })
]).then(([ljqxRes, ljSssjRes]) => {
Promise.all([getljqxData({ jh: this.jh }), listLjSssjSd({ jh: this.jh })])
.then(([ljqxRes, ljSssjRes]) => {
this.chartData = this.processData(ljqxRes, ljSssjRes);
this.initChart();
this.loading = false;
}).catch(error => {
console.error('获取数据失败:', error);
this.$message.error('获取数据失败,请重试');
})
.catch((error) => {
console.error("获取数据失败:", error);
this.$message.error("获取数据失败,请重试");
// 如果API失败,使用模拟数据
this.chartData = this.generateMockData();
this.initChart();
......@@ -78,46 +77,69 @@ export default {
return [];
}
// 如果数据是对象数组格式 [{dept: xxx, value: xxx}, ...]
if (typeof dataList[0] === 'object' && dataList[0].hasOwnProperty('dept')) {
return dataList.map(item => ({
if (
typeof dataList[0] === "object" &&
dataList[0].hasOwnProperty("dept")
) {
return dataList.map((item) => ({
depth: item.dept || item.depth,
value: item[fieldName] || item.value || item
value: item[fieldName] || item.value || item,
}));
}
// 如果是普通数组,需要从录井整米数据中获取深度
return dataList.map((value, index) => {
const depth = ljSssjRes && ljSssjRes.rows && ljSssjRes.rows[index]
return dataList
.map((value, index) => {
const depth =
ljSssjRes && ljSssjRes.rows && ljSssjRes.rows[index]
? ljSssjRes.rows[index].js
: null;
return { depth, value };
}).filter(item => item.depth !== null && item.value !== null && item.value !== undefined);
})
.filter(
(item) =>
item.depth !== null &&
item.value !== null &&
item.value !== undefined
);
};
// 处理钻时数据(从录井整米数据中获取)
let drillingTimeData = [];
if (ljSssjRes && ljSssjRes.rows && Array.isArray(ljSssjRes.rows)) {
drillingTimeData = ljSssjRes.rows
.filter(item => item.js !== null && item.js !== undefined && item.zs !== null && item.zs !== undefined)
.map(item => ({
.filter(
(item) =>
item.js !== null &&
item.js !== undefined &&
item.zs !== null &&
item.zs !== undefined
)
.map((item) => ({
depth: item.js,
value: item.zs
value: item.zs,
}));
}
// 处理其他数据
const torqueData = processArrayData(ljqxRes.njList, 'nj');
const standpipePressureData = processArrayData(ljqxRes.lyList, 'ly');
const drillingPressureData = processArrayData(ljqxRes.zyList, 'zy');
const rpmData = processArrayData(ljqxRes.zs1List, 'zs1');
const torqueData = processArrayData(ljqxRes.njList, "nj");
const standpipePressureData = processArrayData(ljqxRes.lyList, "ly");
const drillingPressureData = processArrayData(ljqxRes.zyList, "zy");
const rpmData = processArrayData(ljqxRes.zs1List, "zs1");
// 处理泵冲数据(总泵冲)
let pumpStrokeData = [];
if (ljSssjRes && ljSssjRes.rows && Array.isArray(ljSssjRes.rows)) {
pumpStrokeData = ljSssjRes.rows
.filter(item => item.js !== null && item.js !== undefined && item.zbc !== null && item.zbc !== undefined)
.map(item => ({
.filter(
(item) =>
item.js !== null &&
item.js !== undefined &&
item.zbc !== null &&
item.zbc !== undefined
)
.map((item) => ({
depth: item.js,
value: item.zbc
value: item.zbc,
}));
}
......@@ -127,7 +149,7 @@ export default {
standpipePressure: standpipePressureData,
drillingPressure: drillingPressureData,
rpm: rpmData,
pumpStroke: pumpStrokeData
pumpStroke: pumpStrokeData,
};
},
......@@ -161,27 +183,27 @@ export default {
standpipePressure: standpipePressureData,
drillingPressure: drillingPressureData,
rpm: rpmData,
pumpStroke: pumpStrokeData
pumpStroke: pumpStrokeData,
};
},
initChart() {
if (!this.chartData) {
const chartDom = document.getElementById('drillingTimeChart');
const chartDom = document.getElementById("drillingTimeChart");
if (chartDom && this.myChart) {
this.myChart.clear();
}
return;
}
const chartDom = document.getElementById('drillingTimeChart');
const chartDom = document.getElementById("drillingTimeChart");
if (!chartDom) {
console.error('未找到图表容器');
console.error("未找到图表容器");
return;
}
if (chartDom.offsetWidth === 0 || chartDom.offsetHeight === 0) {
console.log('容器尺寸为0,200ms后重试');
console.log("容器尺寸为0,200ms后重试");
setTimeout(() => this.initChart(), 200);
return;
}
......@@ -192,7 +214,14 @@ export default {
this.myChart = echarts.init(chartDom);
const { drillingTime, torque, standpipePressure, drillingPressure, rpm, pumpStroke } = this.chartData;
const {
drillingTime,
torque,
standpipePressure,
drillingPressure,
rpm,
pumpStroke,
} = this.chartData;
// 转换数据格式为 [depth, value] 格式
const convertToChartData = (dataArray) => {
......@@ -200,13 +229,20 @@ export default {
return [];
}
return dataArray
.filter(item => item && item.depth !== null && item.depth !== undefined && item.value !== null && item.value !== undefined)
.map(item => [item.depth, item.value])
.filter(
(item) =>
item &&
item.depth !== null &&
item.depth !== undefined &&
item.value !== null &&
item.value !== undefined
)
.map((item) => [item.depth, item.value])
.sort((a, b) => a[0] - b[0]); // 按深度排序
};
const drillingTimeChartData = convertToChartData(drillingTime);
console.log(drillingTimeChartData, 'drillingTimeChartData');
console.log(drillingTimeChartData, "drillingTimeChartData");
const torqueChartData = convertToChartData(torque);
const standpipePressureChartData = convertToChartData(standpipePressure);
const drillingPressureChartData = convertToChartData(drillingPressure);
......@@ -215,216 +251,213 @@ export default {
// 计算深度范围
const allDepths = [
...drillingTimeChartData.map(d => d[0]),
...torqueChartData.map(d => d[0]),
...standpipePressureChartData.map(d => d[0]),
...drillingPressureChartData.map(d => d[0]),
...rpmChartData.map(d => d[0]),
...pumpStrokeChartData.map(d => d[0])
].filter(d => d !== null && d !== undefined);
const minDepth = allDepths.length > 0 ? Math.floor(Math.min(...allDepths) / 10) * 10 : 0;
const maxDepth = allDepths.length > 0 ? Math.ceil(Math.max(...allDepths) / 10) * 10 : 1000;
...drillingTimeChartData.map((d) => d[0]),
...torqueChartData.map((d) => d[0]),
...standpipePressureChartData.map((d) => d[0]),
...drillingPressureChartData.map((d) => d[0]),
...rpmChartData.map((d) => d[0]),
...pumpStrokeChartData.map((d) => d[0]),
].filter((d) => d !== null && d !== undefined);
const minDepth =
allDepths.length > 0 ? Math.floor(Math.min(...allDepths) / 10) * 10 : 0;
const maxDepth =
allDepths.length > 0
? Math.ceil(Math.max(...allDepths) / 10) * 10
: 1000;
const option = {
title: {
text: '录井钻时图',
left: 'center',
top: 10
text: "录井钻时图",
left: "center",
top: 10,
},
tooltip: {
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'cross'
type: "cross",
},
formatter: (params) => {
if (!params || params.length === 0) {
return '';
return "";
}
// 获取深度值(x轴的值)
const depth = params[0].axisValue || (params[0].data && params[0].data[0]) || '';
const depth =
params[0].axisValue ||
(params[0].data && params[0].data[0]) ||
"";
let result = `井深: ${depth} m<br/>`;
params.forEach(param => {
params.forEach((param) => {
if (param.value !== null && param.value !== undefined) {
const unit = param.seriesName.includes('钻时') ? 'min/m' :
param.seriesName.includes('扭矩') ? 'kN•m' :
param.seriesName.includes('立压') ? 'MPa' :
param.seriesName.includes('钻压') ? 'kN' :
param.seriesName.includes('转速') ? 'rpm' : '';
result += `${param.seriesName}: ${param.value}${unit ? ' ' + unit : ''}<br/>`;
const unit = param.seriesName.includes("钻时")
? "min/m"
: param.seriesName.includes("扭矩")
? "kN•m"
: param.seriesName.includes("立压")
? "MPa"
: param.seriesName.includes("钻压")
? "kN"
: param.seriesName.includes("转速")
? "rpm"
: "";
result += `${param.seriesName}: ${param.value}${
unit ? " " + unit : ""
}<br/>`;
}
});
return result;
}
},
},
legend: {
data: ['钻时 (min/m)', '扭矩 (kN•m)', '立压 (MPa)', '钻压 (kN)', '转速 (rpm)', '泵冲'],
data: [
"钻时 (min/m)",
"扭矩 (kN•m)",
"立压 (MPa)",
"钻压 (kN)",
"转速 (rpm)",
"泵冲",
],
top: 40,
right: 50,
icon: 'rect',
icon: "rect",
itemWidth: 20,
itemHeight: 2,
itemGap: 10
itemGap: 10,
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
top: '15%',
containLabel: true
left: "3%",
right: "4%",
bottom: "3%",
top: "15%",
containLabel: true,
},
xAxis: {
type: 'value',
name: '井深 (m)',
nameLocation: 'center',
type: "value",
name: "井深 (m)",
nameLocation: "center",
nameGap: 30,
axisLabel: {
formatter: '{value}'
formatter: "{value}",
},
min: minDepth,
max: maxDepth
max: maxDepth,
},
yAxis: [
{
type: 'value',
name: '钻时 / 扭矩 / 立压',
position: 'left',
nameLocation: 'center',
type: "value",
name: "钻时 / 扭矩 / 立压",
position: "left",
nameLocation: "center",
nameGap: 50,
axisLabel: {
formatter: '{value}'
formatter: "{value}",
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed'
}
}
type: "dashed",
},
},
},
{
type: 'value',
name: '钻压 / 转速 / 泵冲',
position: 'right',
nameLocation: 'center',
type: "value",
name: "钻压 / 转速 / 泵冲",
position: "right",
nameLocation: "center",
nameGap: 50,
axisLabel: {
formatter: '{value}'
formatter: "{value}",
},
splitLine: {
show: false
}
}
show: false,
},
},
],
series: [
{
name: '钻时 (min/m)',
type: 'line',
name: "钻时 (min/m)",
type: "line",
yAxisIndex: 0,
data: drillingTimeChartData,
smooth: true,
lineStyle: {
color: '#ff6e6e',
width: 2,
type: 'solid'
},
symbol: 'none'
symbol: "none",
},
{
name: '扭矩 (kN•m)',
type: 'line',
name: "扭矩 (kN•m)",
type: "line",
yAxisIndex: 0,
data: torqueChartData,
smooth: true,
lineStyle: {
color: '#275081',
width: 2,
type: 'dashed'
},
symbol: 'none'
symbol: "none",
},
{
name: '立压 (MPa)',
type: 'line',
name: "立压 (MPa)",
type: "line",
yAxisIndex: 0,
data: standpipePressureChartData,
smooth: true,
lineStyle: {
color: '#e57113',
width: 2,
type: 'dashed'
},
symbol: 'none'
symbol: "none",
},
{
name: '钻压 (kN)',
type: 'line',
name: "钻压 (kN)",
type: "line",
yAxisIndex: 1,
data: drillingPressureChartData,
smooth: true,
lineStyle: {
color: '#757575',
width: 2,
type: 'solid'
},
symbol: 'none'
symbol: "none",
},
{
name: '转速 (rpm)',
type: 'line',
name: "转速 (rpm)",
type: "line",
yAxisIndex: 1,
data: rpmChartData,
smooth: true,
lineStyle: {
color: '#cda2a1',
width: 2,
type: 'dashed'
},
symbol: 'none'
symbol: "none",
},
{
name: '泵冲',
type: 'line',
name: "泵冲",
type: "line",
yAxisIndex: 1,
data: pumpStrokeChartData,
smooth: true,
lineStyle: {
color: '#637441',
width: 2,
type: 'solid'
symbol: "none",
},
symbol: 'none'
}
]
],
};
this.myChart.setOption(option);
this.resizeHandler = () => this.myChart.resize();
window.addEventListener('resize', this.resizeHandler);
window.addEventListener("resize", this.resizeHandler);
},
exportChart() {
if (!this.myChart) {
this.$message.warning('图表未初始化,无法导出');
this.$message.warning("图表未初始化,无法导出");
return;
}
try {
const url = this.myChart.getDataURL({
type: 'png',
type: "png",
pixelRatio: 2,
backgroundColor: '#fff'
backgroundColor: "#fff",
});
const link = document.createElement('a');
const link = document.createElement("a");
link.href = url;
link.download = `录井钻时图_${this.jh}_${new Date().getTime()}.png`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
this.$message.success('图片导出成功');
this.$message.success("图片导出成功");
} catch (error) {
console.error('导出图片失败:', error);
this.$message.error('导出图片失败,请重试');
console.error("导出图片失败:", error);
this.$message.error("导出图片失败,请重试");
}
},
......@@ -434,11 +467,11 @@ export default {
this.myChart = null;
}
if (this.resizeHandler) {
window.removeEventListener('resize', this.resizeHandler);
window.removeEventListener("resize", this.resizeHandler);
this.resizeHandler = null;
}
}
}
},
},
};
</script>
......@@ -460,7 +493,7 @@ export default {
display: flex;
align-items: center;
gap: 6px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
transition: all 0.3s ease;
opacity: 0.9;
}
......
......@@ -5,8 +5,13 @@
<span class="well-number">{{ jh }}</span>
</div>
<div class="export-button-container">
<el-button class="export-btn" @click="exportChart" :disabled="loading || !myChart" title="导出图表为图片"
icon="el-icon-download">
<el-button
class="export-btn"
@click="exportChart"
:disabled="loading || !myChart"
title="导出图表为图片"
icon="el-icon-download"
>
导出
</el-button>
</div>
......@@ -15,9 +20,13 @@
<aside v-if="legendItems && legendItems.length" class="strata-legend">
<div class="legend-header">层位图例</div>
<div class="legend-list">
<div v-for="(item, index) in legendItems" :key="item.name || index" class="legend-item">
<div
v-for="(item, index) in legendItems"
:key="item.name || index"
class="legend-item"
>
<div class="legend-icon" :style="getLegendSwatchStyle(item)"></div>
<span class="legend-label">{{ item.name || '-' }}</span>
<span class="legend-label">{{ item.name || "-" }}</span>
</div>
</div>
</aside>
......@@ -45,8 +54,8 @@ export default {
theme: {
type: String,
default: "modern", // modern, elegant, vibrant
validator: value => ["modern", "elegant", "vibrant"].includes(value)
}
validator: (value) => ["modern", "elegant", "vibrant"].includes(value),
},
},
data() {
return {
......@@ -76,8 +85,8 @@ export default {
border: "#E5E7EB",
gradient: {
start: "#3B82F6",
end: "#1D4ED8"
}
end: "#1D4ED8",
},
},
elegant: {
primary: "#6366F1",
......@@ -88,8 +97,8 @@ export default {
border: "#D1D5DB",
gradient: {
start: "#6366F1",
end: "#4F46E5"
}
end: "#4F46E5",
},
},
vibrant: {
primary: "#EF4444",
......@@ -100,15 +109,15 @@ export default {
border: "#F3F4F6",
gradient: {
start: "#EF4444",
end: "#DC2626"
}
}
end: "#DC2626",
},
},
};
return schemes[this.theme];
},
legendPanelWidth() {
return this.legendItems && this.legendItems.length ? 260 : 0;
}
},
},
watch: {
jh: {
......@@ -117,7 +126,7 @@ export default {
this.refreshChart();
}
},
immediate: true
immediate: true,
},
legendItems: {
handler() {
......@@ -129,8 +138,8 @@ export default {
}
});
},
deep: true
}
deep: true,
},
},
mounted() {
this.initChart();
......@@ -169,7 +178,6 @@ export default {
}
await this.renderRealData(mockData);
} catch (error) {
console.error("图表初始化失败:", error);
this.handleError(error);
......@@ -189,12 +197,17 @@ export default {
const containerPadding = 20;
const panelGap = legendWidth ? 5 : 0;
const safetyMargin = 12;
const widthPadding = containerPadding + panelGap + legendWidth + safetyMargin;
const widthPadding =
containerPadding + panelGap + legendWidth + safetyMargin;
const availableWidth = Math.max(360, containerWidth - widthPadding);
const verticalPadding = 40;
const heightByViewport = viewportHeight - topOffset - verticalPadding;
const fallbackHeight = this.$el?.clientHeight || viewportHeight;
const availableHeight = Math.max(360, heightByViewport, fallbackHeight - 20);
const availableHeight = Math.max(
360,
heightByViewport,
fallbackHeight - 20
);
chartDom.style.width = `${availableWidth}px`;
chartDom.style.height = `${availableHeight}px`;
chartDom.offsetHeight; // 强制重排
......@@ -206,7 +219,10 @@ export default {
const viewportHeight = window.innerHeight;
const availableHeight = viewportHeight - 120;
const availableWidth = viewportWidth - 80;
return (availableWidth <= 0 || availableHeight <= 0) && this.initRetryCount < this.maxRetryCount;
return (
(availableWidth <= 0 || availableHeight <= 0) &&
this.initRetryCount < this.maxRetryCount
);
},
// 安排重试
......@@ -230,17 +246,19 @@ export default {
// 创建图表实例
createChart(chartDom) {
this.myChart = echarts.init(chartDom, null, {
renderer: 'canvas',
useDirtyRect: true
renderer: "canvas",
useDirtyRect: true,
});
},
// 检查数据有效性
hasValidData(mockData) {
return mockData &&
return (
mockData &&
mockData.wellData &&
mockData.wellData.depthLine &&
mockData.wellData.depthLine.length > 0;
mockData.wellData.depthLine.length > 0
);
},
// 设置事件监听器
......@@ -316,8 +334,16 @@ export default {
}
this.myChart.resize();
// 重新绘制地层标签,确保在缩放/尺寸变化后位置正确
if (this.lastStackedAreas && this.lastChartConfig && this.lastXAxisLabels) {
this.drawStratumLabels(this.lastStackedAreas, this.lastChartConfig, this.lastXAxisLabels);
if (
this.lastStackedAreas &&
this.lastChartConfig &&
this.lastXAxisLabels
) {
this.drawStratumLabels(
this.lastStackedAreas,
this.lastChartConfig,
this.lastXAxisLabels
);
}
}
},
......@@ -335,14 +361,20 @@ export default {
const { wellData } = mockData;
// 调试信息:打印深度区间数据
if (wellData.depthIntervals && wellData.depthIntervals.length > 0) {
console.log('深度区间数据:', wellData.depthIntervals.map(item => ({
console.log(
"深度区间数据:",
wellData.depthIntervals.map((item) => ({
型号: item.x,
尺寸: item.ztcc,
进尺: item.jc,
深度区间: item.interval,
占位: item.placeholder,
计算高度: item.jc !== undefined && item.jc !== null ? item.jc : (item.interval - item.placeholder)
})));
计算高度:
item.jc !== undefined && item.jc !== null
? item.jc
: item.interval - item.placeholder,
}))
);
}
const xAxisLabels = wellData.depthLine.map((point) => point.x);
......@@ -353,7 +385,7 @@ export default {
...this.getDefaultChartOption(),
xAxis: this.createXAxis(xAxisLabels),
yAxis: this.createYAxis(mockData.chartConfig),
series: this.createSeries(wellData, areaSeries)
series: this.createSeries(wellData, areaSeries),
};
this.myChart.setOption(option, true);
......@@ -365,9 +397,12 @@ export default {
this.lastStackedAreas = wellData.stackedAreas;
this.lastChartConfig = mockData.chartConfig;
this.lastXAxisLabels = xAxisLabels;
this.drawStratumLabels(this.lastStackedAreas, this.lastChartConfig, this.lastXAxisLabels);
this.drawStratumLabels(
this.lastStackedAreas,
this.lastChartConfig,
this.lastXAxisLabels
);
});
} catch (error) {
console.error("渲染数据失败:", error);
this.handleError(error);
......@@ -386,23 +421,25 @@ export default {
axisPointer: {
type: "cross",
label: { backgroundColor: colors.primary },
crossStyle: { color: colors.border }
crossStyle: { color: colors.border },
},
backgroundColor: 'rgba(255,255,255,0.95)',
backgroundColor: "rgba(255,255,255,0.95)",
borderColor: colors.border,
borderWidth: 1,
textStyle: { color: colors.text },
extraCssText: 'box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px;',
extraCssText:
"box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-radius: 8px;",
formatter: (params) => {
if (!params || params.length === 0) return '';
if (!params || params.length === 0) return "";
const dataIndex = params[0].dataIndex;
const depthInterval = this.mockData?.wellData?.depthIntervals?.[dataIndex];
const depthInterval =
this.mockData?.wellData?.depthIntervals?.[dataIndex];
if (!depthInterval) {
// 如果没有depthInterval数据,使用默认格式
let result = `<div style="font-weight: 600; margin-bottom: 8px; color: ${colors.primary};">${params[0].axisValue}</div>`;
params.forEach(param => {
params.forEach((param) => {
const color = param.color;
result += `<div style="margin: 4px 0;">
<span style="display: inline-block; width: 10px; height: 10px; background-color: ${color}; border-radius: 50%; margin-right: 8px;"></span>
......@@ -414,26 +451,41 @@ export default {
}
// 显示井号信息
let result = `<div style="font-weight: 600; margin-bottom: 8px; color: ${colors.primary};">${depthInterval.jh || depthInterval.x}</div>`;
let result = `<div style="font-weight: 600; margin-bottom: 8px; color: ${
colors.primary
};">${depthInterval.jh || depthInterval.x}</div>`;
// 计算深度区间显示
const startDepth = depthInterval.placeholder || 0;
const height = depthInterval.jc !== undefined && depthInterval.jc !== null
const height =
depthInterval.jc !== undefined && depthInterval.jc !== null
? depthInterval.jc
: (depthInterval.interval - depthInterval.placeholder);
: depthInterval.interval - depthInterval.placeholder;
const endDepth = startDepth + height;
const depthRange = `${startDepth}-${endDepth}`;
// 显示详细信息
result += `<div style="margin: 4px 0; padding: 4px 0; border-top: 1px solid ${colors.border};">
<div style="margin: 2px 0;"><span style="font-weight: 500;">型号:</span> <span style="margin-left: 8px; font-weight: 600;">${depthInterval.x || '-'}</span></div>
<div style="margin: 2px 0;"><span style="font-weight: 500;">尺寸:</span> <span style="margin-left: 8px; font-weight: 600;">${depthInterval.ztcc || '-'}</span></div>
<div style="margin: 2px 0;"><span style="font-weight: 500;">进尺m:</span> <span style="margin-left: 8px; font-weight: 600;">${depthInterval.jc !== undefined && depthInterval.jc !== null ? depthInterval.jc : (depthInterval.interval - depthInterval.placeholder)}</span></div>
result += `<div style="margin: 4px 0; padding: 4px 0; border-top: 1px solid ${
colors.border
};">
<div style="margin: 2px 0;"><span style="font-weight: 500;">型号:</span> <span style="margin-left: 8px; font-weight: 600;">${
depthInterval.x || "-"
}</span></div>
<div style="margin: 2px 0;"><span style="font-weight: 500;">尺寸:</span> <span style="margin-left: 8px; font-weight: 600;">${
depthInterval.ztcc || "-"
}</span></div>
<div style="margin: 2px 0;"><span style="font-weight: 500;">进尺m:</span> <span style="margin-left: 8px; font-weight: 600;">${
depthInterval.jc !== undefined &&
depthInterval.jc !== null
? depthInterval.jc
: depthInterval.interval -
depthInterval.placeholder
}</span></div>
<div style="margin: 2px 0;"><span style="font-weight: 500;">深度区间:</span> <span style="margin-left: 8px; font-weight: 600;">${depthRange}</span></div>
</div>`;
return result;
}
},
},
grid: {
top: 10,
......@@ -445,10 +497,10 @@ export default {
},
animation: true,
animationDuration: 1500,
animationEasing: 'cubicOut',
animationEasing: "cubicOut",
animationDelay: function (idx) {
return idx * 100;
}
},
};
},
......@@ -456,7 +508,7 @@ export default {
async processAreaSeries(stackedAreas) {
return await Promise.all(
stackedAreas
.filter(area => area.svg !== null)
.filter((area) => area.svg !== null)
.map(async (area) => {
let areaStyle = { opacity: 0.6 };
if (area.svg) {
......@@ -464,7 +516,7 @@ export default {
const svgImage = await this.createSvgImage(area.svg);
areaStyle.color = { image: svgImage, repeat: "repeat" };
} catch (error) {
console.error('SVG转换失败:', error);
console.error("SVG转换失败:", error);
}
}
return {
......@@ -499,28 +551,28 @@ export default {
align: "center",
fontSize: 13,
color: colors.text,
fontWeight: 500
fontWeight: 500,
},
axisTick: {
alignWithLabel: true,
length: 6,
lineStyle: { color: colors.border }
lineStyle: { color: colors.border },
},
splitLine: { show: false },
axisLine: {
show: true,
lineStyle: {
color: colors.border,
width: 2
}
}
width: 2,
},
},
},
{
type: "category",
boundaryGap: false,
position: "top",
show: false,
data: xAxisLabels
data: xAxisLabels,
},
];
},
......@@ -536,7 +588,7 @@ export default {
color: colors.text,
fontSize: 13,
fontWeight: 600,
padding: [0, 0, 0, 8]
padding: [0, 0, 0, 8],
},
min: chartConfig.yAxis.min,
max: chartConfig.yAxis.max,
......@@ -546,27 +598,27 @@ export default {
formatter: "{value}",
fontSize: 12,
color: colors.text,
fontWeight: 500
fontWeight: 500,
},
splitLine: {
show: true,
lineStyle: {
color: colors.border,
type: 'dashed',
opacity: 0.3
}
type: "dashed",
opacity: 0.3,
},
},
axisLine: {
show: true,
lineStyle: {
color: colors.border,
width: 2
}
width: 2,
},
},
axisTick: {
show: true,
lineStyle: { color: colors.border }
}
lineStyle: { color: colors.border },
},
},
{
type: "value",
......@@ -575,7 +627,7 @@ export default {
color: colors.text,
fontSize: 13,
fontWeight: 600,
padding: [0, 8, 0, 0]
padding: [0, 8, 0, 0],
},
min: chartConfig.yAxis2.min,
max: chartConfig.yAxis2.max,
......@@ -585,20 +637,20 @@ export default {
formatter: "{value}",
fontSize: 12,
color: colors.text,
fontWeight: 500
fontWeight: 500,
},
splitLine: { show: false },
axisLine: {
show: true,
lineStyle: {
color: colors.border,
width: 2
}
width: 2,
},
},
axisTick: {
show: true,
lineStyle: { color: colors.border }
}
lineStyle: { color: colors.border },
},
},
];
},
......@@ -616,17 +668,17 @@ export default {
symbolSize: 10,
itemStyle: {
color: colors.accent,
borderColor: '#fff',
borderColor: "#fff",
borderWidth: 3,
shadowColor: 'rgba(0,0,0,0.2)',
shadowBlur: 8
shadowColor: "rgba(0,0,0,0.2)",
shadowBlur: 8,
},
lineStyle: {
color: colors.accent,
width: 3,
type: 'solid',
shadowColor: 'rgba(0,0,0,0.1)',
shadowBlur: 4
type: "solid",
shadowColor: "rgba(0,0,0,0.1)",
shadowBlur: 4,
},
label: {
show: true,
......@@ -640,8 +692,8 @@ export default {
borderRadius: 6,
borderColor: colors.accent,
borderWidth: 2,
shadowColor: 'rgba(0,0,0,0.1)',
shadowBlur: 4
shadowColor: "rgba(0,0,0,0.1)",
shadowBlur: 4,
},
data: wellData.depthLine.map((point) => point.y),
},
......@@ -653,13 +705,13 @@ export default {
barWidth: "8%",
itemStyle: {
borderColor: "transparent",
color: "transparent"
color: "transparent",
},
emphasis: {
itemStyle: {
borderColor: "transparent",
color: "transparent"
}
color: "transparent",
},
},
data: wellData.depthIntervals.map((item) => item.placeholder),
},
......@@ -670,78 +722,88 @@ export default {
barWidth: "6%",
label: {
show: true,
position: 'insideTop',
color: '#fff',
position: "insideTop",
color: "#fff",
fontSize: 11,
fontWeight: 600,
backgroundColor: "rgba(0,0,0,0.1)",
padding: [2, 3],
borderRadius: 4,
borderColor: 'rgba(255,255,255,0.3)',
borderColor: "rgba(255,255,255,0.3)",
borderWidth: 1,
formatter: (params) => {
const di = wellData.depthIntervals[params.dataIndex];
return di && di.ztcc !== undefined ? di.ztcc : params.data;
}
},
},
itemStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: colors.gradient.start },
{ offset: 1, color: colors.gradient.end }
]
{ offset: 1, color: colors.gradient.end },
],
},
borderRadius: [4, 4, 0, 0],
shadowColor: 'rgba(0,0,0,0.2)',
shadowColor: "rgba(0,0,0,0.2)",
shadowBlur: 8,
shadowOffsetY: 2
shadowOffsetY: 2,
},
emphasis: {
itemStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: this.adjustColor(colors.gradient.start, 1.2) },
{ offset: 1, color: this.adjustColor(colors.gradient.end, 1.2) }
]
{
offset: 0,
color: this.adjustColor(colors.gradient.start, 1.2),
},
{
offset: 1,
color: this.adjustColor(colors.gradient.end, 1.2),
},
],
},
shadowBlur: 12,
shadowOffsetY: 4
}
shadowOffsetY: 4,
},
},
// 使用 jc(进尺)作为柱子的高度,如果没有 jc 则使用 interval - placeholder 计算
data: wellData.depthIntervals.map((item) => {
// 优先使用 jc(进尺),如果没有则计算 interval - placeholder
return item.jc !== undefined && item.jc !== null ? item.jc : (item.interval - item.placeholder);
return item.jc !== undefined && item.jc !== null
? item.jc
: item.interval - item.placeholder;
}),
},
// 底部显示 placeholder 数值的透明条,用于放置底部标签
{
name: '深度区间-底部标签',
type: 'bar',
barGap: '-100%',
barWidth: '6%',
itemStyle: { color: 'transparent', borderColor: 'transparent' },
emphasis: { itemStyle: { color: 'transparent', borderColor: 'transparent' } },
name: "深度区间-底部标签",
type: "bar",
barGap: "-100%",
barWidth: "6%",
itemStyle: { color: "transparent", borderColor: "transparent" },
emphasis: {
itemStyle: { color: "transparent", borderColor: "transparent" },
},
label: {
show: true,
position: 'insideBottom',
color: '#fff',
position: "insideBottom",
color: "#fff",
fontSize: 11,
fontWeight: 600,
backgroundColor: 'rgba(0,0,0,0.1)',
backgroundColor: "rgba(0,0,0,0.1)",
padding: [2, 3],
borderRadius: 4,
borderColor: 'rgba(255,255,255,0.3)',
borderColor: "rgba(255,255,255,0.3)",
borderWidth: 1,
distance: 0,
formatter: (params) => {
......@@ -751,13 +813,17 @@ export default {
const endDepth = di.placeholder + di.jc;
return `${di.placeholder}-${endDepth}`;
}
return di && di.interval !== undefined ? di.interval : params.data;
}
return di && di.interval !== undefined
? di.interval
: params.data;
},
},
// 使用相同的计算方式,确保标签位置正确
data: wellData.depthIntervals.map((item) => {
return item.jc !== undefined && item.jc !== null ? item.jc : (item.interval - item.placeholder);
})
return item.jc !== undefined && item.jc !== null
? item.jc
: item.interval - item.placeholder;
}),
},
...areaSeries,
];
......@@ -765,7 +831,7 @@ export default {
// 颜色调整工具方法
adjustColor(color, factor) {
if (color.startsWith('#')) {
if (color.startsWith("#")) {
const r = parseInt(color.slice(1, 3), 16);
const g = parseInt(color.slice(3, 5), 16);
const b = parseInt(color.slice(5, 7), 16);
......@@ -823,7 +889,9 @@ export default {
// 创建SVG图片
createSvgImage(svgString) {
return new Promise((resolve, reject) => {
const svgBlob = new Blob([svgString], { type: 'image/svg+xml;charset=utf-8' });
const svgBlob = new Blob([svgString], {
type: "image/svg+xml;charset=utf-8",
});
const svgUrl = URL.createObjectURL(svgBlob);
const img = new Image();
img.onload = () => {
......@@ -840,28 +908,30 @@ export default {
// 为右侧图例生成纹理样式
getLegendSwatchStyle(item = {}) {
const baseStyle = {
backgroundColor: '#d1d5db',
backgroundRepeat: 'repeat',
backgroundSize: '36px 36px'
backgroundColor: "#d1d5db",
backgroundRepeat: "repeat",
backgroundSize: "36px 36px",
};
if (!item?.svg) return baseStyle;
const dataUrl = this.getSvgDataUrl(item.svg);
if (!dataUrl) return baseStyle;
return {
backgroundImage: `url("${dataUrl}")`,
backgroundRepeat: 'repeat',
backgroundSize: '36px 36px',
backgroundColor: 'transparent'
backgroundRepeat: "repeat",
backgroundSize: "36px 36px",
backgroundColor: "transparent",
};
},
getSvgDataUrl(svgString) {
if (!svgString || typeof svgString !== 'string') return '';
if (!svgString || typeof svgString !== "string") return "";
try {
const compact = svgString.replace(/\s+/g, ' ').trim();
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(compact)}`;
const compact = svgString.replace(/\s+/g, " ").trim();
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
compact
)}`;
} catch (e) {
console.warn('SVG 编码失败:', e);
return '';
console.warn("SVG 编码失败:", e);
return "";
}
},
......@@ -869,7 +939,20 @@ export default {
drawStratumLabels() {
if (!this.myChart) return;
this.myChart.setOption({ graphic: { elements: [] } });
}
},
exportChart() {
if (!this.myChart) return;
const img = this.myChart.getDataURL({
type: "png",
pixelRatio: 2,
backgroundColor: "#fff",
});
const a = document.createElement("a");
a.href = img;
a.download = this.jh + "直方图.png";
a.click();
},
},
};
</script>
......@@ -970,7 +1053,7 @@ export default {
display: flex;
align-items: center;
gap: 6px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
transition: all 0.3s ease;
opacity: 0.9;
}
......@@ -1146,7 +1229,7 @@ export default {
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.export-btn:hover:not(:disabled) {
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
>
<el-form-item prop="jh">
<el-input v-model="queryParams.jh" placeholder="请输入井号" clearable @keyup.enter.native="handleQuery" />
<el-input
v-model="queryParams.jh"
placeholder="请输入井号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新建井</el-button>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新建井</el-button
>
</el-form-item>
</el-form>
<div class="card-container">
<el-card class="box-card" v-for="item in ytLists" :key="item.id"
style="margin: 10px 10px 0 0; width: calc(20% - 10px);">
<el-card
class="box-card"
v-for="item in ytLists"
:key="item.id"
style="margin: 10px 10px 0 0; width: calc(20% - 10px)"
>
<div slot="header" class="clearfix header">
<div class="header-content">
<div class="left">
<img style="width: 80px;height: 80px" :src="wellImg" class="sidebar-logo" />
<img
style="width: 80px; height: 80px"
:src="wellImg"
class="sidebar-logo"
/>
</div>
<div class="right">
<div> <!-- 使用v-for指令循环渲染每一条数据 -->
<div style="font-size: 24px;color: #1c84c6;font-weight: bold;cursor: pointer"
@click="toDesignScheme(item)">{{ item.jh }} <!-- 在循环中使用当前数据项的属性 -->
<div>
<!-- 使用v-for指令循环渲染每一条数据 -->
<div
style="
font-size: 24px;
color: #1c84c6;
font-weight: bold;
cursor: pointer;
"
@click="toDesignScheme(item)"
>
{{ item.jh }}
<!-- 在循环中使用当前数据项的属性 -->
</div>
<div>
<i style="color: #909399" class="el-icon-user-solid"></i>
<span style="color: #909399">{{ item.jd }}</span> <!-- 在循环中使用当前数据项的属性 -->
<span style="color: #909399">{{ item.jd }}</span>
</div>
</div>
</div>
</div>
<div class="text item" style="display: flex; justify-content: flex-end;margin: 10px;">
<el-button size="large" icon="el-icon-edit-outline" style="margin-right: 10px" type="text"
@click="handleEdit(item)"></el-button>
<el-button size="medium" icon="el-icon-delete" style="margin-right: 10px" type="text"
@click="handleDelete(item)"></el-button>
<el-button size="medium" icon="el-icon-lock" style="margin-right: 10px" type="text"
@click="handleLock(item)"></el-button>
<div
class="text item"
style="display: flex; justify-content: flex-end; margin: 10px"
>
<el-button
size="large"
icon="el-icon-edit-outline"
style="margin-right: 10px"
type="text"
@click="handleEdit(item)"
></el-button>
<el-button
size="medium"
icon="el-icon-delete"
style="margin-right: 10px"
type="text"
@click="handleDelete(item)"
></el-button>
<el-button
size="medium"
icon="el-icon-lock"
style="margin-right: 10px"
type="text"
@click="handleLock(item)"
></el-button>
<!-- <el-button size="medium" icon="el-icon-unlock" style=" margin-right: 10px" type="text" @click="handleFinalize"></el-button> -->
</div>
</div>
</el-card>
</div>
<!-- 添加或修改菜单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
<div class="jsjStyle"
style="background-color: #f4f8fe;border-radius: 10px;margin: -30px -10px -30px;padding: 10px;">
<div
class="jsjStyle"
style="
background-color: #f4f8fe;
border-radius: 10px;
margin: -30px -10px -30px;
padding: 10px;
"
>
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<div class="cardStyle" style="border: 1px solid #eee">
<div style="font-size: 14px;padding: 10px;border-bottom: 1px solid #eee;margin-top: -10px;">基本信息
<div
style="
font-size: 14px;
padding: 10px;
border-bottom: 1px solid #eee;
margin-top: -10px;
"
>
基本信息
</div>
<el-row style="margin-top: 10px">
<el-col :span="8">
<el-form-item label="钻井公司" prop="zjgs">
<el-input style="width: 200px" v-model="form.zjgs" clearable />
<el-input
style="width: 200px"
v-model="form.zjgs"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="区块名称" prop="qkmc">
<el-select v-model="form.qkmc" placeholder="请选择区块名称" clearable filterable
style="width: 200px;">
<el-option v-for="opt in filteredBlockOptions" :key="opt.value"
:label="opt.label" :value="opt.value" />
<el-select
v-model="form.qkmc"
placeholder="请选择区块名称"
clearable
filterable
style="width: 200px"
>
<el-option
v-for="opt in filteredBlockOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="油田公司" prop="ytgs">
<el-input style="width: 200px" v-model="form.ytgs" clearable />
<el-input
style="width: 200px"
v-model="form.ytgs"
clearable
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="井号" prop="jh">
<el-input style="width: 200px" v-model="form.jh" clearable />
......@@ -95,12 +184,15 @@
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="设计作业周期" prop="sjzyzq">
<el-input style="width: 200px" v-model="form.sjzyzq" clearable
<el-input
style="width: 200px"
v-model="form.sjzyzq"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.sjzyzq = $event.target.value" />
@blur="form.sjzyzq = $event.target.value"
/>
</el-form-item>
</el-col>
<el-col :span="8">
......@@ -109,74 +201,124 @@
</el-form-item>
</el-col>
</el-row>
</div>
<div class="cardStyle" style="border: 1px solid #eee;margin-top: 10px">
<div style="font-size: 14px;padding: 10px;border-bottom: 1px solid #eee;margin-top: -10px;">地质信息
<div
class="cardStyle"
style="border: 1px solid #eee; margin-top: 10px"
>
<div
style="
font-size: 14px;
padding: 10px;
border-bottom: 1px solid #eee;
margin-top: -10px;
"
>
地质信息
</div>
<el-row style="margin-top: 10px">
<el-col :span="8">
<el-form-item label="井口坐标(X)" prop="jkzbx">
<el-input style="width: 200px" v-model="form.jkzbx" clearable
<el-input
style="width: 200px"
v-model="form.jkzbx"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.jkzbx = $event.target.value" />
@blur="form.jkzbx = $event.target.value"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="井口坐标(Y)" prop="jkzby">
<el-input style="width: 200px" v-model="form.jkzby" clearable
<el-input
style="width: 200px"
v-model="form.jkzby"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.jkzby = $event.target.value" />
@blur="form.jkzby = $event.target.value"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="入靶点A坐标(X)" prop="rbdazb">
<el-input style="width: 180px" v-model="form.rbdazb" clearable
<el-input
style="width: 180px"
v-model="form.rbdazb"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.rbdazb = $event.target.value" />
@blur="form.rbdazb = $event.target.value"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="入靶点A坐标(Y)" prop="rbdbzb">
<el-input style="width: 200px" v-model="form.rbdbzb" clearable
<el-input
style="width: 200px"
v-model="form.rbdbzb"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.rbdbzb = $event.target.value" />
@blur="form.rbdbzb = $event.target.value"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="地面海拔" prop="dmhb">
<el-input style="width: 200px" v-model="form.dmhb" clearable
<el-input
style="width: 200px"
v-model="form.dmhb"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.dmhb = $event.target.value" />
@blur="form.dmhb = $event.target.value"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="完井方式" prop="wjfs">
<el-input style="width: 180px" v-model="form.wjfs" clearable />
<el-input
style="width: 180px"
v-model="form.wjfs"
clearable
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="定稿设计井深m" prop="dgsjjs" style="width: 200px">
<el-input style="width: 200px" v-model="form.dgsjjs" clearable
<el-form-item
label="定稿设计井深m"
prop="dgsjjs"
style="width: 200px"
>
<el-input
style="width: 200px"
v-model="form.dgsjjs"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.dgsjjs = $event.target.value" />
@blur="form.dgsjjs = $event.target.value"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="深度零点" prop="sdld">
<el-input style="width: 200px" v-model="form.sdld" clearable />
<el-input
style="width: 200px"
v-model="form.sdld"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="定稿设计水平段长度" prop="dgsjspdcd">
<el-input style="width: 200px" v-model="form.dgsjspdcd" clearable
<el-input
style="width: 200px"
v-model="form.dgsjspdcd"
clearable
oninput="value=value.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')"
@blur="form.dgsjspdcd = $event.target.value" />
@blur="form.dgsjspdcd = $event.target.value"
/>
</el-form-item>
</el-col>
<!-- <el-col :span="8">
......@@ -194,9 +336,12 @@
</el-row> -->
</div>
</el-form>
<div style="display: flex;justify-content: center;margin: 10px;" slot="footer" class="dialog-footer">
<div
style="display: flex; justify-content: center; margin: 10px"
slot="footer"
class="dialog-footer"
>
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
......@@ -217,29 +362,56 @@
<el-button @click="cancelFinalizeForm">取 消</el-button>
</div>
</el-dialog> -->
<el-dialog title="算法选择" width="20%" :visible.sync="dialogFormVisibleAr">
<el-form :model="formAr">
<el-form-item label="" label-width="80px">
<el-radio-group
size="medium"
v-model="formAr.radio"
@change="handleChangeAr"
>
<el-radio label="3">固定算法</el-radio>
<el-radio label="6">智能算法</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<!-- <div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
</div> -->
</el-dialog>
</div>
</template>
<script>
import { getQkxl } from "@/api/system/jsaa";
import wellImg from '../../assets/images/home/well.png'
import { listFayh, deptTreeSelect, getBasinSelect, getBlockByPdid, deleteJtDjjc, addJtDjjc, getJtDjjc, updateJtDjjc, getMdcByQkid, LockJtDjjc } from "@/api/scientificDrill/schemeOptimization";
import { blob } from 'd3';
import wellImg from "../../assets/images/home/well.png";
import {
listFayh,
deptTreeSelect,
getBasinSelect,
getBlockByPdid,
deleteJtDjjc,
addJtDjjc,
getJtDjjc,
updateJtDjjc,
getMdcByQkid,
LockJtDjjc,
} from "@/api/scientificDrill/schemeOptimization";
import { blob } from "d3";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "tabsCard",
components: { Treeselect },
dicts: ['jt_ytgs', 'jt_jx', 'jt_jb', 'jt_wjfs', 'jt_sdld', 'jt_qklx'],
dicts: ["jt_ytgs", "jt_jx", "jt_jb", "jt_wjfs", "jt_sdld", "jt_qklx"],
props: {
tabsId: {
type: String,
default: ''
default: "",
},
},
watch: {
tabsId: {
handler(val) {
......@@ -266,7 +438,7 @@ export default {
queryParams: {
jh: undefined,
pageNum: 1,
pageSize: 10
pageSize: 10,
},
// 弹出层标题
title: "",
......@@ -303,19 +475,14 @@ export default {
finalizeForm: {},
// 表单校验
rules: {
jh: [
{ required: true, message: "井号不能为空", trigger: "blur" }
],
jh: [{ required: true, message: "井号不能为空", trigger: "blur" }],
ytgs: [
{ required: true, message: "油田公司不能为空", trigger: "blur" }
{ required: true, message: "油田公司不能为空", trigger: "blur" },
],
zjgs: [
{ required: true, message: "钻井公司不能为空", trigger: "blur" }
],
jd: [
{ required: true, message: "井队不能为空", trigger: "blur" }
{ required: true, message: "钻井公司不能为空", trigger: "blur" },
],
jd: [{ required: true, message: "井队不能为空", trigger: "blur" }],
},
basinValue: "",
selectedBasinId: "",
......@@ -331,46 +498,48 @@ export default {
pd: "",
mdc: {
lazy: true,
lazyLoad: this.loadTreeNode // 直接将 loadTreeNode 方法作为 lazyLoad 属性传递
lazyLoad: this.loadTreeNode, // 直接将 loadTreeNode 方法作为 lazyLoad 属性传递
},
dialogFormVisibleAr: false,
formAr: {
radio: "",
},
sfcs: {},
selectedBasinId: null, // 添加一个用于存储选中盆地的变量
oilOptions: [] // 用于存储 MDC 数据
}
oilOptions: [], // 用于存储 MDC 数据
};
},
computed: {
filteredBlockOptions() {
if (!Array.isArray(this.blockOptions)) return []
if (!Array.isArray(this.blockOptions)) return [];
return this.blockOptions
.filter(item => item && (item.qk || item.qkmc))
.map(item => ({ label: item.qk || item.qkmc, value: item.qk || item.qkmc }))
}
.filter((item) => item && (item.qk || item.qkmc))
.map((item) => ({
label: item.qk || item.qkmc,
value: item.qk || item.qkmc,
}));
},
},
mounted() {
console.log('this.tabsId', this.tabsId);
console.log("this.tabsId", this.tabsId);
this.getList();
this.getDeptTree();
this.getBlockOptions();
this.getBasinSelect();
},
methods: {
onBlockChange(val) {
this.form.qkmc = val || '';
this.form.qkmc = val || "";
},
/** 获取区块下拉选项 */
getBlockOptions() {
getQkxl().then(response => {
getQkxl().then((response) => {
// 过滤掉无效的选项
this.blockOptions = response.data.filter(item => item && item.qk);
console.log(this.blockOptions, ' this.blockOptions ');
this.blockOptions = response.data.filter((item) => item && item.qk);
console.log(this.blockOptions, " this.blockOptions ");
});
},
/** 搜索按钮操作 */
......@@ -380,26 +549,25 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.queryParams.jh = ''
this.queryParams.jh = "";
this.resetForm("queryForm");
this.queryParams.pageNum = 1;
this.getList()
this.getList();
},
openCascader() {
this.showCascader = true;
},
change(val) {
this.showCascader = false; // 选择后关闭级联选择器
let nodesObj = this.$refs['cascader'].getCheckedNodes();
console.log(nodesObj, 'nodesObj');
let nodesObj = this.$refs["cascader"].getCheckedNodes();
console.log(nodesObj, "nodesObj");
if (nodesObj && nodesObj.length > 0) {
const lastNode = nodesObj[nodesObj.length - 1];
this.form.mdc = lastNode.label; // 设置选中层的 mc 到表单中
console.log(this.form.mdc, 'this.form.mdc ');
console.log(this.form.mdc, "this.form.mdc ");
this.form.mdcid = lastNode.value; // 设置选中层的 id 到表单中
console.log(this.form.mdcid, 'this.form.mdcid ');
console.log(this.form.mdcid, "this.form.mdcid ");
}
},
......@@ -414,44 +582,45 @@ export default {
const val = {
ytgs: localTabsId,
jh: this.queryParams.jh
}
listFayh(val).then(response => {
console.log('this.tabsId', localTabsId);
console.log('查询');
jh: this.queryParams.jh,
};
listFayh(val).then((response) => {
console.log("this.tabsId", localTabsId);
console.log("查询");
this.ytLists = response.rows;
console.log(this.ytLists, 'this.ytLists');
console.log(this.ytLists, "this.ytLists");
});
},
/** 查询部门树结构 */
getDeptTree() {
deptTreeSelect({ level: "3" }).then(response => {
deptTreeSelect({ level: "3" }).then((response) => {
this.deptOptions = response.data;
console.log(this.deptOptions, 'this.deptOptions');
console.log(this.deptOptions, "this.deptOptions");
});
},
// 查询盆地结构
getBasinSelect() {
getBasinSelect().then(response => {
getBasinSelect().then((response) => {
this.basinOptions = response;
console.log(this.basinOptions, ' this.basinOptions');
console.log(this.basinOptions, " this.basinOptions");
// 不要在这里清空或覆盖 blockOptions,避免和区块下拉数据竞争
// 仅在用户选择盆地后,再通过 basinChange 主动更新区块选项
});
},
// 盆地选项改变时触发 区块
basinChange() {
const selectedBasinName = this.form.pd; // 获取选中的盆地名称
console.log(selectedBasinName, 'selectedBasinName');
const selectedBasin = this.basinOptions.find(item => item.pdmc === selectedBasinName); // 根据名称获取相应的盆地对象
console.log(selectedBasin, 'selectedBasin');
console.log(selectedBasinName, "selectedBasinName");
const selectedBasin = this.basinOptions.find(
(item) => item.pdmc === selectedBasinName
); // 根据名称获取相应的盆地对象
console.log(selectedBasin, "selectedBasin");
if (selectedBasin) {
getBlockByPdid(selectedBasin.id).then(response => { // 使用盆地对象的ID来获取区块
getBlockByPdid(selectedBasin.id).then((response) => {
// 使用盆地对象的ID来获取区块
this.blockOptions = response.rows;
});
}
......@@ -475,90 +644,83 @@ export default {
// });
// },
loadTreeNode(node, resolve) {
console.log(node, 'node');
console.log(resolve, 'resolve');
console.log(node, "node");
console.log(resolve, "resolve");
const params = {
dclevel: node.level + 1,
pid: node.value,
};
console.log(params, 'params');
console.log(params, "params");
// 发起请求获取节点数据
getMdcByQkid(params).then(response => {
getMdcByQkid(params)
.then((response) => {
const oilOptions = response.data; // 获取到的数据
console.log(oilOptions, 'this.oilOptions');
console.log(oilOptions, "this.oilOptions");
if (Array.isArray(oilOptions)) {
// 将数据转换为符合 Cascader 要求的格式
const nodes = oilOptions.map(item => ({
const nodes = oilOptions.map((item) => ({
value: item.id,
label: item.mc,
leaf: item.dclevel >= 5
leaf: item.dclevel >= 5,
}));
console.log(nodes, 'nodes');
console.log(nodes, "nodes");
resolve(nodes);
} else {
// 处理异常情况
}
}).catch(error => {
})
.catch((error) => {
// 处理请求失败的情况
});
},
//点击卡片
toDesignScheme(item) {
this.$store.dispatch('setJh', item.jh);
this.$store.dispatch('setJhdm', item.jhdm);
console.log(item, 'item');
this.$router.push({
path: "/wellDesign",
query: {
jhdm: item.jhdm,
jh: item.jh,
qkmc: item.qkmc
}
})
this.sfcs = item;
this.$store.dispatch("setJh", item.jh);
this.$store.dispatch("setJhdm", item.jhdm);
this.dialogFormVisibleAr = true;
},
//新建井
handleAdd() {
this.reset();
this.open = true;
this.title = "新增井设计"
this.title = "新增井设计";
},
//编辑
handleEdit(item) {
this.reset();
this.open = true;
console.log(item, 'item');
console.log(item, "item");
const jhdm = item.jhdm;
getJtDjjc(jhdm).then(response => {
getJtDjjc(jhdm).then((response) => {
this.form = response.data;
// this.form.mdc = response.data.mdcid;
console.log(response, 'response');
console.log(response, "response");
this.open = true;
this.title = "修改";
});
this.title = "修改井设计"
this.title = "修改井设计";
},
/** 提交按钮 */
submitForm() {
// const pd = this.form.pd
// this.form.pdid = pd == '' ? '' : this.basinOptions.find(item => item.pdmc == pd).pdid
// const qkmc = this.form.qkmc
// this.form.qkdm = qkmc == '' ? '' : this.blockOptions.find(item => item.qkmc == qkmc).qkdm
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.jhdm != null && this.form.jhdm !== '') {
if (this.form.jhdm != null && this.form.jhdm !== "") {
// 如果 jhdm 存在且不为空,则执行更新操作
updateJtDjjc(this.form).then(response => {
updateJtDjjc(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
// 否则执行新增操作
addJtDjjc(this.form).then(response => {
addJtDjjc(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
......@@ -570,52 +732,72 @@ export default {
// 表单重置
reset() {
this.form = {
};
this.form = {};
this.resetForm("form");
},
cancel() {
this.open = false;
},
/** 删除按钮操作 */
handleDelete(item) {
const jhdms = item.jhdm;
this.$modal.confirm('是否确认删除编号为"' + jhdms + '"的数据项?').then(function () {
this.$modal
.confirm('是否确认删除编号为"' + jhdms + '"的数据项?')
.then(function () {
return deleteJtDjjc(jhdms);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
})
.catch(() => {});
},
/** 锁定按钮操作 */
handleLock(item) {
const jhdm = item.jhdm;
this.$modal.confirm('是否确认锁定?').then(function () {
this.$modal
.confirm("是否确认锁定?")
.then(function () {
return LockJtDjjc(jhdm);
}).then(() => {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("已锁定");
}).catch(() => { });
})
.catch(() => {});
},
submitFinalizeForm() {
this.openFinalize = false
this.openFinalize = false;
},
cancelFinalizeForm() {
this.openFinalize = false
this.openFinalize = false;
},
handleChangeAr() {
if (this.radio == "3") {
var item = this.sfcs;
console.log(item, "item");
this.$router.push({
path: "/wellDesign",
query: {
jhdm: item.jhdm,
jh: item.jh,
qkmc: item.qkmc,
},
});
} else if (this.radio == "6") {
this.$message({
message: "正在开发中!",
type: "warning",
});
}
}
},
},
};
</script>
<style scoped lang="scss">
......@@ -640,8 +822,6 @@ export default {
font-size: 14px;
}
.clearfix:before,
.clearfix:after {
display: table;
......@@ -649,7 +829,7 @@ export default {
}
.clearfix:after {
clear: both
clear: both;
}
.card-container {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment