Commit a0ac2dff by jiang'yun

Merge branch 'master' of D:\qianhe\project\dizhen\dizhen-ui with conflicts.

parent 8fa5f746
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"author": "若依", "author": "若依",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "vue-cli-service serve", "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "vue-cli-service build", "build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging", "build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
"url": "https://gitee.com/y_project/RuoYi-Vue.git" "url": "https://gitee.com/y_project/RuoYi-Vue.git"
}, },
"dependencies": { "dependencies": {
"@mdi/font": "^7.4.47", "@jsonforms/core": "^3.6.0",
"@jsonforms/vue": "^3.6.0",
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"axios": "0.28.1", "axios": "0.28.1",
"clipboard": "2.0.8", "clipboard": "2.0.8",
......
...@@ -445,6 +445,7 @@ export default { ...@@ -445,6 +445,7 @@ export default {
}, },
methods: { methods: {
init() { init() {
//创建 //创建
seismicPlot = new SeismicPlot({ seismicPlot = new SeismicPlot({
'canvas': this.$refs.plot, 'canvas': this.$refs.plot,
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
</div> </div>
<!-- 缩略图 end--> <!-- 缩略图 end-->
<!-- 缩略图弹窗 start --> <!-- 缩略图弹窗 start -->
<!-- 缩略图弹窗 start -->
<el-dialog v-if="shouldShowThumb" title="缩略图预览" :visible.sync="showThumbDialog" width="80%" append-to-body <el-dialog v-if="shouldShowThumb" title="缩略图预览" :visible.sync="showThumbDialog" width="80%" append-to-body
:z-index="9999999" :modal="true" :close-on-click-modal="true" :close-on-press-escape="true" :z-index="9999999" :modal="true" :close-on-click-modal="true" :close-on-press-escape="true"
custom-class="thumbnail-dialog"> custom-class="thumbnail-dialog">
...@@ -77,6 +78,7 @@ ...@@ -77,6 +78,7 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 缩略图弹窗 end --> <!-- 缩略图弹窗 end -->
<!-- 缩略图弹窗 end -->
</div> </div>
<!-- 添加加载状态和错误提示 --> <!-- 添加加载状态和错误提示 -->
...@@ -811,14 +813,6 @@ export default { ...@@ -811,14 +813,6 @@ export default {
// height: 0.1452145214521452 // height: 0.1452145214521452
// } // }
// }], // }],
// 添加鼠标悬停相关的数据
cursorInfo: {
depth: null,
trace: null,
value: null
},
showCursorInfo: true,
isHovering: false,
// 添加画笔工具相关属性 // 添加画笔工具相关属性
pencilTool: null, pencilTool: null,
selectedShape: null, selectedShape: null,
...@@ -887,9 +881,6 @@ export default { ...@@ -887,9 +881,6 @@ export default {
'DashDot': [20, 4, 2, 4], 'DashDot': [20, 4, 2, 4],
'DashDotDot': [20, 4, 2, 4, 2, 4] 'DashDotDot': [20, 4, 2, 4, 2, 4]
}, },
isWidgetReady: false,
loadingError: null,
pipeline: null,
colorProvider: null, colorProvider: null,
// 右键菜单相关数据 // 右键菜单相关数据
contextMenu: { contextMenu: {
...@@ -1163,7 +1154,7 @@ export default { ...@@ -1163,7 +1154,7 @@ export default {
}, },
// 监听routeId变化 // 监听routeId变化
routeId(newId, oldId) { routeId(newId, oldId) {
//console.log('[index2] routeId变化:', newId, oldId); // console.log('[index2] routeId变化:', newId, oldId);
if (newId !== oldId) { if (newId !== oldId) {
this.handleRouteChange(); this.handleRouteChange();
// 强制刷新缩略图 // 强制刷新缩略图
...@@ -1171,66 +1162,69 @@ export default { ...@@ -1171,66 +1162,69 @@ export default {
} }
} }
}, },
// mounted() {
//
// console.log(1111)
// // 初始化时强制设置为初始状态
// this.resetToInitialState();
//
// // 立即禁用滚动条工具
// this.disableScrollbarTools();
//
// // 添加强制隐藏滚动条的CSS
// this.addForceHideScrollbarCSS();
//
// // 关闭强力滚动条监控,避免影响全局布局
// // this.startAggressiveScrollbarMonitor();
//
// this.$nextTick(async () => {
// ['thumb-test-container', 'thumb-chart-container', 'super-visible-thumb'].forEach(id => {
// const el = document.getElementById(id);
// if (el) try { el.remove(); } catch (e) { }
// });
// // 保持缩略图容器在组件内部,避免在DOM树中难以定位
// // 初始化场景时不自动加载演示数据,等待接口结果决定
// this.shouldLoadDemo = false;
// this.createScene(this.$refs.plot, { autoloadDemo: false });
// // 等DOM稳定后再渲染缩略图组件
// setTimeout(() => {
// this.thumbReady = true;
// // 再兜底:确保右上角出现内容,并直接绘制缩略图
// setTimeout(() => {
// this.ensureThumbRendered();
// this.drawThumbDirect();
// }, 200);
// }, 100);
// // 已改为内嵌 YsgcIndex 缩略图,不再走旧的 ECharts 缩略图初始化
//
// // 自动拉取接口数据并加载第一组上/下部 SEGY(jbsegy -> 顶部,xbsegy -> 底部)
// try {
// await this.loadThumbData();
// if (Array.isArray(this.segyList) && this.segyList.length > 0) {
// await this.loadCurrentSegy();
// } else {
// // 无接口数据:若没有路由id,允许加载演示数据;若有id但无数据,保持空白
// const hasId = !!this.routeId;
// if (!hasId) {
// this.shouldLoadDemo = true;
// try { await this.handleFileSelect(this.plots); } catch (e) { }
// } else {
// this.clearCurrentPlots();
// console.info('[index2] 该项目无可用SEGY数据');
// }
// }
// } catch (e) {
// console.warn('[index2] 自动加载数据失败:', e);
// // 加载失败时,如果没有路由ID,尝试加载演示数据
// if (!this.routeId) {
// this.shouldLoadDemo = true;
// try { await this.handleFileSelect(this.plots); } catch (e) { }
// }
// }
// });
// },
mounted() { mounted() {
// 初始化时强制设置为初始状态 console.log(2222)
this.resetToInitialState();
// 立即禁用滚动条工具
this.disableScrollbarTools();
// 添加强制隐藏滚动条的CSS
this.addForceHideScrollbarCSS();
// 关闭强力滚动条监控,避免影响全局布局
// this.startAggressiveScrollbarMonitor();
this.$nextTick(async () => {
['thumb-test-container', 'thumb-chart-container', 'super-visible-thumb'].forEach(id => {
const el = document.getElementById(id);
if (el) try { el.remove(); } catch (e) { }
});
// 保持缩略图容器在组件内部,避免在DOM树中难以定位
// 初始化场景时不自动加载演示数据,等待接口结果决定
this.shouldLoadDemo = false;
this.createScene(this.$refs.plot, { autoloadDemo: false });
// 等DOM稳定后再渲染缩略图组件
setTimeout(() => {
this.thumbReady = true;
// 再兜底:确保右上角出现内容,并直接绘制缩略图
setTimeout(() => {
this.ensureThumbRendered();
this.drawThumbDirect();
}, 200);
}, 100);
// 已改为内嵌 YsgcIndex 缩略图,不再走旧的 ECharts 缩略图初始化
// 自动拉取接口数据并加载第一组上/下部 SEGY(jbsegy -> 顶部,xbsegy -> 底部)
try {
await this.loadThumbData();
if (Array.isArray(this.segyList) && this.segyList.length > 0) {
await this.loadCurrentSegy();
} else {
// 无接口数据:若没有路由id,允许加载演示数据;若有id但无数据,保持空白
const hasId = !!this.routeId;
if (!hasId) {
this.shouldLoadDemo = true;
try { await this.handleFileSelect(this.plots); } catch (e) { }
} else {
this.clearCurrentPlots();
console.info('[index2] 该项目无可用SEGY数据');
}
}
} catch (e) {
console.warn('[index2] 自动加载数据失败:', e);
// 加载失败时,如果没有路由ID,尝试加载演示数据
if (!this.routeId) {
this.shouldLoadDemo = true;
try { await this.handleFileSelect(this.plots); } catch (e) { }
}
}
});
},
mounted() {
// 将缩略图容器移动到body,确保fixed基于视口 // 将缩略图容器移动到body,确保fixed基于视口
if (this.$refs.thumbContainer && this.$refs.thumbContainer.parentNode !== document.body) { if (this.$refs.thumbContainer && this.$refs.thumbContainer.parentNode !== document.body) {
document.body.appendChild(this.$refs.thumbContainer); document.body.appendChild(this.$refs.thumbContainer);
...@@ -2186,6 +2180,8 @@ export default { ...@@ -2186,6 +2180,8 @@ export default {
//console.log('[index2] 加载segy文件 Top/Bottom:', (currentSegy.jbsegyName || currentSegy.jbsegy), (currentSegy.xbsegyName || currentSegy.xbsegy)); //console.log('[index2] 加载segy文件 Top/Bottom:', (currentSegy.jbsegyName || currentSegy.jbsegy), (currentSegy.xbsegyName || currentSegy.xbsegy));
//console.log('[index2] segy文件路径 Top/Bottom:', currentSegy.jbsegy, currentSegy.xbsegy); //console.log('[index2] segy文件路径 Top/Bottom:', currentSegy.jbsegy, currentSegy.xbsegy);
//
try { try {
// 双图加载:jbsegy -> 顶部;xbsegy -> 底部 // 双图加载:jbsegy -> 顶部;xbsegy -> 底部
// 根据后台返回的 ysqqXmxxSegy 数据,jbsegy 顶部展示,xbsegy 底部展示 // 根据后台返回的 ysqqXmxxSegy 数据,jbsegy 顶部展示,xbsegy 底部展示
...@@ -2209,11 +2205,14 @@ export default { ...@@ -2209,11 +2205,14 @@ export default {
try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { } try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { }
// 关键修复:切换下一道后,强制将底部 widget 绑定为当前 pipeline,并重新插入绘制工具,防止短暂显示上一道 // 关键修复:切换下一道后,强制将底部 widget 绑定为当前 pipeline,并重新插入绘制工具,防止短暂显示上一道
try { try {
// 确保 pipeline/路径键为当前
// await this.assertBottomPipelineCurrent();
this.refreshBottomDisplay();
// 确保 pipeline/路径键为当前(只在必要时调用,避免频繁刷新) // 确保 pipeline/路径键为当前(只在必要时调用,避免频繁刷新)
await this.assertBottomPipelineCurrent(); await this.assertBottomPipelineCurrent();
// 移除重复的 refreshBottomDisplay 调用,避免闪烁 // 移除重复的 refreshBottomDisplay 调用,避免闪烁
// this.refreshBottomDisplay(); // 注释掉,因为 assertBottomPipelineCurrent 已经会刷新 // this.refreshBottomDisplay(); // 注释掉,因为 assertBottomPipelineCurrent 已经会刷新
// 确保 plots 对象存在(如果为 null,重新创建) // 确保 plots 对象存在(如果为 null,重新创建)
if (!this.plots && this._seismicWidget && this.$refs.plot) { if (!this.plots && this._seismicWidget && this.$refs.plot) {
try { try {
...@@ -2225,7 +2224,7 @@ export default { ...@@ -2225,7 +2224,7 @@ export default {
console.warn('[loadCurrentSegy] 重新创建 plots 失败:', e); console.warn('[loadCurrentSegy] 重新创建 plots 失败:', e);
} }
} }
// 重新插入顶部工具(有些环境下 setPipeline 后工具管理器会丢失已插入的工具) // 重新插入顶部工具(有些环境下 setPipeline 后工具管理器会丢失已插入的工具)
if (this._seismicWidget && this.checkWidgetStatus()) { if (this._seismicWidget && this.checkWidgetStatus()) {
// 如果工具还没有初始化,先初始化它们 // 如果工具还没有初始化,先初始化它们
...@@ -2236,7 +2235,7 @@ export default { ...@@ -2236,7 +2235,7 @@ export default {
console.warn('[loadCurrentSegy] 初始化顶部注释工具失败:', e); console.warn('[loadCurrentSegy] 初始化顶部注释工具失败:', e);
} }
} }
const tm = this._seismicWidget.getTool && this._seismicWidget.getTool(); const tm = this._seismicWidget.getTool && this._seismicWidget.getTool();
if (tm) { if (tm) {
// 重新插入顶部 annotationTool // 重新插入顶部 annotationTool
...@@ -2255,7 +2254,7 @@ export default { ...@@ -2255,7 +2254,7 @@ export default {
} }
} }
} }
// 重新插入底部工具(有些环境下 setPipeline 后工具管理器会丢失已插入的工具) // 重新插入底部工具(有些环境下 setPipeline 后工具管理器会丢失已插入的工具)
if (this._seismicWidgetBottom) { if (this._seismicWidgetBottom) {
// 如果底部工具还没有初始化,先初始化它们 // 如果底部工具还没有初始化,先初始化它们
...@@ -2266,13 +2265,13 @@ export default { ...@@ -2266,13 +2265,13 @@ export default {
console.warn('[loadCurrentSegy] 初始化底部注释工具失败:', e); console.warn('[loadCurrentSegy] 初始化底部注释工具失败:', e);
} }
} }
const tm = this._seismicWidgetBottom.getTool && this._seismicWidgetBottom.getTool(); const tm = this._seismicWidgetBottom.getTool && this._seismicWidgetBottom.getTool();
if (tm) { if (tm) {
// 先移除所有工具 // 先移除所有工具
try { this.pencilToolBottom && tm.remove(this.pencilToolBottom); } catch (e) { } try { this.pencilToolBottom && tm.remove(this.pencilToolBottom); } catch (e) { }
try { this.annotationToolBottom && tm.remove(this.annotationToolBottom); } catch (e) { } try { this.annotationToolBottom && tm.remove(this.annotationToolBottom); } catch (e) { }
// 根据当前激活的工具,只插入需要的工具,并确保顺序正确 // 根据当前激活的工具,只插入需要的工具,并确保顺序正确
if (this.showLineStylePanel && this.pencilToolBottom) { if (this.showLineStylePanel && this.pencilToolBottom) {
// 线条工具激活时,只插入线条工具,确保文本工具被禁用 // 线条工具激活时,只插入线条工具,确保文本工具被禁用
...@@ -2283,12 +2282,12 @@ export default { ...@@ -2283,12 +2282,12 @@ export default {
this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
tm.insert(0, this.pencilToolBottom); tm.insert(0, this.pencilToolBottom);
this.pencilToolBottom.setMode(PaintMode.Pencil); this.pencilToolBottom.setMode(PaintMode.Pencil);
this.pencilToolBottom.setEditMode(EditMode.Create); this.pencilToolBottom.setEditMode(EditMode.Create);
this.pencilToolBottom.setEnabled(true); this.pencilToolBottom.setEnabled(true);
// 恢复 widget 更新 // 恢复 widget 更新
try { try {
if (this._seismicWidgetBottom.setOptions) { if (this._seismicWidgetBottom.setOptions) {
...@@ -2319,7 +2318,7 @@ export default { ...@@ -2319,7 +2318,7 @@ export default {
this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
tm.insert(0, this.annotationToolBottom); tm.insert(0, this.annotationToolBottom);
// 关键修复:设置文本工具属性,确保底部图可以输入文本 // 关键修复:设置文本工具属性,确保底部图可以输入文本
const fontString = `${this.textStyle.bold ? 'bold ' : ''}${this.textStyle.italic ? 'italic ' : ''}${this.textStyle.size || 22}px ${this.textStyle.font || 'Sans-serif'}`; const fontString = `${this.textStyle.bold ? 'bold ' : ''}${this.textStyle.italic ? 'italic ' : ''}${this.textStyle.size || 22}px ${this.textStyle.font || 'Sans-serif'}`;
...@@ -2354,7 +2353,7 @@ export default { ...@@ -2354,7 +2353,7 @@ export default {
}; };
this.annotationToolBottom.setProperties(textProperties); this.annotationToolBottom.setProperties(textProperties);
this.annotationToolBottom.setEnabled(true); this.annotationToolBottom.setEnabled(true);
// 恢复 widget 更新 // 恢复 widget 更新
try { try {
if (this._seismicWidgetBottom.setOptions) { if (this._seismicWidgetBottom.setOptions) {
...@@ -2387,12 +2386,12 @@ export default { ...@@ -2387,12 +2386,12 @@ export default {
// 移除这里的 invalidate,避免频繁刷新导致闪烁 // 移除这里的 invalidate,避免频繁刷新导致闪烁
// try { this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { } // try { this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { }
} }
// 关键:确保 isWidgetReady 在加载完成后为 true // 关键:确保 isWidgetReady 在加载完成后为 true
if (this._seismicWidget && this.checkWidgetStatus()) { if (this._seismicWidget && this.checkWidgetStatus()) {
this.isWidgetReady = true; this.isWidgetReady = true;
} }
} catch (e) { } catch (e) {
console.warn('[loadCurrentSegy] 重新插入工具时出错:', e); console.warn('[loadCurrentSegy] 重新插入工具时出错:', e);
} }
} catch (e) { } catch (e) {
...@@ -2468,7 +2467,7 @@ export default { ...@@ -2468,7 +2467,7 @@ export default {
} }
console.log('[renderAnnotationsFromXbbznr] 开始解析标注数据,数量:', annotationList.length); console.log('[renderAnnotationsFromXbbznr] 开始解析标注数据,数量:', annotationList.length);
console.log('[renderAnnotationsFromXbbznr] annotationList 详细内容:', JSON.stringify(annotationList, null, 2)); // console.log('[renderAnnotationsFromXbbznr] annotationList 详细内容:', JSON.stringify(annotationList, null, 2));
// 清空现有的底部 savedAnnotations 和 savedLineAnnotations // 清空现有的底部 savedAnnotations 和 savedLineAnnotations
this.savedAnnotationsBottom = []; this.savedAnnotationsBottom = [];
...@@ -2879,116 +2878,143 @@ export default { ...@@ -2879,116 +2878,143 @@ export default {
this.isHovering = false; this.isHovering = false;
// 打开双图布局 // 打开双图布局
this.showDualChart(); // this.showDualChart();
// 不再隐藏容器,避免首次绘制依赖鼠标事件触发 // 不再隐藏容器,避免首次绘制依赖鼠标事件触发
const topScroll = this.$refs.topScroll; const topScroll = this.$refs.topScroll;
const bottomScroll = this.$refs.bottomScroll; const bottomScroll = this.$refs.bottomScroll;
// 清空现有图表 // if (this.annotationTool){
this.clearCurrentPlots(); // // if (this.annotationTool.isEnabled() && this.annotationTool.getMode() === PaintMode.Edit && this.annotationTool.getShape() != null) {
// if (Array.isArray(this.annotationTool.getShape())) {
// this.annotationTool.getShape().forEach((shape) => shape.dispose());
// } else {
// this.annotationTool.getShape().dispose();
// }
// this.annotationTool.editNode(null);
// // }
// }
var theCanvas = document.getElementById("canvasTop");
var w = theCanvas.width;
var h = theCanvas.height;
var context = theCanvas.getContext("2d");
context.clearRect(0, 0, w, h);
// 清空 pipeline 引用,确保旧数据被清除
this.pipeline = null;
this.pipelineBottom = null;
this.plots = null;
this.plotsBottom = null;
// 确保两个画布已初始化(如果widget不存在,才创建新的)
if (this.$refs.plot && !this._seismicWidget) { if(this.plots){
this.createScene(this.$refs.plot, { autoloadDemo: false }); this.plots.dispose();
} }
if (this.$refs.plot2 && !this._seismicWidgetBottom) { if(this.plotsBottom){
this.initSecondWidget(this.$refs.plot2); this.plotsBottom.dispose();
} }
// 重新绑定事件监听器
this.$nextTick(() => {
this.bindContextMenuListeners();
});
// 等待一小段时间,确保清空操作完成
await new Promise(resolve => setTimeout(resolve, 50));
// 顺序加载,分别统计成功与失败,但不立即刷新
let topOk = false;
let bottomOk = false;
try {
if (jbPath) {
const topTitle = jbName || this.extractFileName(jbPath) || 'jbsegy';
await this.loadSegyIntoWidget('top', jbPath, topTitle, false); // 不立即刷新
topOk = true;
}
} catch (e) {
console.warn('加载上部SEGY失败:', e);
}
try {
if (xbPath) {
const bottomTitle = xbName || this.extractFileName(xbPath) || 'xbsegy';
await this.loadSegyIntoWidget('bottom', xbPath, bottomTitle, false); // 不立即刷新
bottomOk = true;
}
} catch (e) {
console.warn('加载下部SEGY失败:', e);
}
// 等待所有数据加载完成后再统一刷新 // 清空现有图表
if (topOk || bottomOk) { this.clearCurrentPlots();
// 使用 requestAnimationFrame 确保在下一帧统一刷新
await this.$nextTick();
requestAnimationFrame(() => {
try {
if (topOk && this._seismicWidget) {
if (this._seismicWidget.invalidate) {
this._seismicWidget.invalidate();
}
this.setScrollbarCSS(this._seismicWidget);
this.forceDisableInternalScrollbars();
setTimeout(() => {
try {
if (this._seismicWidget && this._seismicWidget.fitToBounds) {
this._seismicWidget.fitToBounds();
}
} catch (e) { }
}, 100);
}
if (bottomOk && this._seismicWidgetBottom) {
if (this._seismicWidgetBottom.invalidate) {
this._seismicWidgetBottom.invalidate();
}
this.setScrollbarCSS(this._seismicWidgetBottom);
this.forceDisableInternalScrollbars();
setTimeout(() => {
try {
if (this._seismicWidgetBottom && this._seismicWidgetBottom.fitToBounds) {
this._seismicWidgetBottom.fitToBounds();
}
// 额外在显示前进行一次尺寸同步与重绘
try { this.updateBaseCanvasSize(); } catch (e) { }
try { this.plotsBottom && typeof this.plotsBottom.redraw === 'function' && this.plotsBottom.redraw(); } catch (e) { }
} catch (e) { }
}, 100);
}
} catch (e) {
console.warn('最终刷新widget时出错:', e);
}
});
// 刷新完成后,额外进行一次尺寸同步与重绘,确保无悬浮也正确 //
setTimeout(() => { // 清空 pipeline 引用,确保旧数据被清除
try { this.updateBaseCanvasSize(); } catch (e) { } this.pipeline = null;
try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { } this.pipelineBottom = null;
try { this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { } this.plots = null;
requestAnimationFrame(() => { this.plotsBottom = null;
try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { } // // 确保两个画布已初始化(如果widget不存在,才创建新的)
try { this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { } // if (this.$refs.plot && !this._seismicWidget) {
}); // this.createScene(this.$refs.plot, { autoloadDemo: false });
}, 200); // }
} else { // if (this.$refs.plot2 && !this._seismicWidgetBottom) {
// 加载失败也做一次重绘尝试 // this.initSecondWidget(this.$refs.plot2);
try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { } // }
try { this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { } // // 重新绑定事件监听器
} // this.$nextTick(() => {
// this.bindContextMenuListeners();
// });
//
// // 等待一小段时间,确保清空操作完成
// await new Promise(resolve => setTimeout(resolve, 50));
//
// // 顺序加载,分别统计成功与失败,但不立即刷新
// let topOk = false;
// let bottomOk = false;
// try {
// if (jbPath) {
// const topTitle = jbName || this.extractFileName(jbPath) || 'jbsegy';
// await this.loadSegyIntoWidget('top', jbPath, topTitle, false); // 不立即刷新
// topOk = true;
// }
// } catch (e) {
// console.warn('加载上部SEGY失败:', e);
// }
//
// try {
// if (xbPath) {
// const bottomTitle = xbName || this.extractFileName(xbPath) || 'xbsegy';
// await this.loadSegyIntoWidget('bottom', xbPath, bottomTitle, false); // 不立即刷新
// bottomOk = true;
// }
// } catch (e) {
// console.warn('加载下部SEGY失败:', e);
// }
//
// // 等待所有数据加载完成后再统一刷新
// if (topOk || bottomOk) {
// // 使用 requestAnimationFrame 确保在下一帧统一刷新
// await this.$nextTick();
// requestAnimationFrame(() => {
// try {
// if (topOk && this._seismicWidget) {
// if (this._seismicWidget.invalidate) {
// this._seismicWidget.invalidate();
// }
// this.setScrollbarCSS(this._seismicWidget);
// this.forceDisableInternalScrollbars();
// setTimeout(() => {
// try {
// if (this._seismicWidget && this._seismicWidget.fitToBounds) {
// this._seismicWidget.fitToBounds();
// }
// } catch (e) { }
// }, 100);
// }
// if (bottomOk && this._seismicWidgetBottom) {
// if (this._seismicWidgetBottom.invalidate) {
// this._seismicWidgetBottom.invalidate();
// }
// this.setScrollbarCSS(this._seismicWidgetBottom);
// this.forceDisableInternalScrollbars();
// setTimeout(() => {
// try {
// if (this._seismicWidgetBottom && this._seismicWidgetBottom.fitToBounds) {
// this._seismicWidgetBottom.fitToBounds();
// }
// // 额外在显示前进行一次尺寸同步与重绘
// try { this.updateBaseCanvasSize(); } catch (e) { }
// try { this.plotsBottom && typeof this.plotsBottom.redraw === 'function' && this.plotsBottom.redraw(); } catch (e) { }
// } catch (e) { }
// }, 100);
// }
// } catch (e) {
// console.warn('最终刷新widget时出错:', e);
// }
// });
//
// // 刷新完成后,额外进行一次尺寸同步与重绘,确保无悬浮也正确
// setTimeout(() => {
// try { this.updateBaseCanvasSize(); } catch (e) { }
// try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { }
// try { this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { }
// requestAnimationFrame(() => {
// try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { }
// try { this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { }
// });
// }, 200);
// } else {
// // 加载失败也做一次重绘尝试
// try { this._seismicWidget && this._seismicWidget.invalidate && this._seismicWidget.invalidate(); } catch (e) { }
// try { this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate && this._seismicWidgetBottom.invalidate(); } catch (e) { }
// }
}, },
// 将指定segy加载到顶部/底部widget // 将指定segy加载到顶部/底部widget
// skipRefresh: 如果为 true,则不立即刷新,等待统一刷新 // skipRefresh: 如果为 true,则不立即刷新,等待统一刷新
...@@ -3155,17 +3181,17 @@ export default { ...@@ -3155,17 +3181,17 @@ export default {
this.pipelineBottom = pipeline; this.pipelineBottom = pipeline;
const newKey = displayName || this.extractFileName(segyPath) || pipeline.getName(); const newKey = displayName || this.extractFileName(segyPath) || pipeline.getName();
const newPath = segyPath; const newPath = segyPath;
// 关键修复:如果 pipeline、路径和名称都没有变化,不需要重新设置,避免不必要的刷新 // 关键修复:如果 pipeline、路径和名称都没有变化,不需要重新设置,避免不必要的刷新
if (this._seismicWidgetBottom.getPipeline && this._seismicWidgetBottom.getPipeline() === pipeline && if (this._seismicWidgetBottom.getPipeline && this._seismicWidgetBottom.getPipeline() === pipeline &&
String(this._bottomSegyPath) === String(newPath) && String(this._bottomSegyKey) === String(newKey)) { String(this._bottomSegyPath) === String(newPath) && String(this._bottomSegyKey) === String(newKey)) {
// 完全一致,不需要做任何操作 // 完全一致,不需要做任何操作
return; return;
} }
this._bottomSegyKey = newKey; this._bottomSegyKey = newKey;
this._bottomSegyPath = newPath; this._bottomSegyPath = newPath;
// 关键修复:在设置 pipeline 前冻结更新,避免中间状态刷新 // 关键修复:在设置 pipeline 前冻结更新,避免中间状态刷新
let wasFrozen = false; let wasFrozen = false;
try { try {
...@@ -3173,10 +3199,10 @@ export default { ...@@ -3173,10 +3199,10 @@ export default {
wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
this._seismicWidgetBottom.setPipeline(pipeline); this._seismicWidgetBottom.setPipeline(pipeline);
this._seismicWidgetBottom.setOptions({ 'axes': { 'samples': { 'title': { 'visible': true, 'text': newKey } } } }); this._seismicWidgetBottom.setOptions({ 'axes': { 'samples': { 'title': { 'visible': true, 'text': newKey } } } });
// 恢复更新(如果 skipRefresh 为 false,会在后面刷新) // 恢复更新(如果 skipRefresh 为 false,会在后面刷新)
try { try {
if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined && skipRefresh) { if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined && skipRefresh) {
...@@ -3193,7 +3219,7 @@ export default { ...@@ -3193,7 +3219,7 @@ export default {
this._seismicWidgetBottom.setOptions({ 'freezeupdate': false }); this._seismicWidgetBottom.setOptions({ 'freezeupdate': false });
} }
} catch (e) { } } catch (e) { }
// 强制刷新以确保显示新的数据 // 强制刷新以确保显示新的数据
this.$nextTick(() => { this.$nextTick(() => {
try { try {
...@@ -3486,12 +3512,12 @@ export default { ...@@ -3486,12 +3512,12 @@ export default {
const seg = this.segyList[lineIdx]; const seg = this.segyList[lineIdx];
console.log('[index2] 设置 currentSegyIndex:', { lineIdx, segId: seg && seg.id, segName: seg && (seg.name || seg.segyName || seg.jbsegyName || seg.xbsegyName) }); console.log('[index2] 设置 currentSegyIndex:', { lineIdx, segId: seg && seg.id, segName: seg && (seg.name || seg.segyName || seg.jbsegyName || seg.xbsegyName) });
this.currentSegyIndex = lineIdx; this.currentSegyIndex = lineIdx;
// 立即关闭弹窗,给用户反馈 // 立即关闭弹窗,给用户反馈
if (this.showThumbDialog) { if (this.showThumbDialog) {
this.showThumbDialog = false; this.showThumbDialog = false;
} }
// 设置加载状态,避免显示错误的图 // 设置加载状态,避免显示错误的图
if (seg) { if (seg) {
this.isLoading = true; this.isLoading = true;
...@@ -4518,12 +4544,12 @@ export default { ...@@ -4518,12 +4544,12 @@ export default {
wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
this._seismicWidgetBottom.setPipeline(this.pipelineBottom); this._seismicWidgetBottom.setPipeline(this.pipelineBottom);
this._seismicWidgetBottom.setOptions({ this._seismicWidgetBottom.setOptions({
'axes': { 'headers': { 'fields': this._headers }, 'samples': { 'title': { 'visible': true, 'text': this.pipelineBottom.getName && this.pipelineBottom.getName() } } } 'axes': { 'headers': { 'fields': this._headers }, 'samples': { 'title': { 'visible': true, 'text': this.pipelineBottom.getName && this.pipelineBottom.getName() } } }
}); });
// 恢复更新 // 恢复更新
try { try {
if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) { if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) {
...@@ -4531,7 +4557,7 @@ export default { ...@@ -4531,7 +4557,7 @@ export default {
} }
} catch (e) { } } catch (e) { }
} }
setTimeout(() => { try { this._seismicWidgetBottom.fitToBounds(); } catch (e) { } }, 200); setTimeout(() => { try { this._seismicWidgetBottom.fitToBounds(); } catch (e) { } }, 200);
this.setScrollbarCSS(this._seismicWidgetBottom); this.setScrollbarCSS(this._seismicWidgetBottom);
try { this.initAnnotationToolsBottom(this._seismicWidgetBottom); } catch (e) { } try { this.initAnnotationToolsBottom(this._seismicWidgetBottom); } catch (e) { }
...@@ -4554,7 +4580,7 @@ export default { ...@@ -4554,7 +4580,7 @@ export default {
try { pipelineBottom.addTraceProcessor(new Reverse({ 'apply': false, 'name': 'Reverse' })); } catch (e) { } try { pipelineBottom.addTraceProcessor(new Reverse({ 'apply': false, 'name': 'Reverse' })); } catch (e) { }
this.pipelineBottom = pipelineBottom; this.pipelineBottom = pipelineBottom;
// 关键修复:使用 freezeupdate 避免设置 pipeline 时的闪烁 // 关键修复:使用 freezeupdate 避免设置 pipeline 时的闪烁
let wasFrozen = false; let wasFrozen = false;
try { try {
...@@ -4562,7 +4588,7 @@ export default { ...@@ -4562,7 +4588,7 @@ export default {
wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
this._seismicWidgetBottom.setPipeline(pipelineBottom); this._seismicWidgetBottom.setPipeline(pipelineBottom);
this._seismicWidgetBottom.setOptions({ this._seismicWidgetBottom.setOptions({
'axes': { 'axes': {
...@@ -4572,7 +4598,7 @@ export default { ...@@ -4572,7 +4598,7 @@ export default {
} }
} }
}); });
// 恢复更新 // 恢复更新
try { try {
if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) { if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) {
...@@ -4589,7 +4615,7 @@ export default { ...@@ -4589,7 +4615,7 @@ export default {
try { this.initAnnotationToolsBottom(this._seismicWidgetBottom); } catch (e) { console.warn('初始化底部注释工具失败:', e); } try { this.initAnnotationToolsBottom(this._seismicWidgetBottom); } catch (e) { console.warn('初始化底部注释工具失败:', e); }
} catch (e) { } catch (e) {
console.warn('初始化下半屏流水线失败:', e); console.warn('初始化下半屏流水线失败:', e);
} }
} }
} catch (error) { } catch (error) {
console.error('创建下半屏视图失败:', error); console.error('创建下半屏视图失败:', error);
...@@ -4632,7 +4658,7 @@ export default { ...@@ -4632,7 +4658,7 @@ export default {
wasFrozen = widget.setOptions({ 'freezeupdate': true }); wasFrozen = widget.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
try { try {
const selection = eventArgs.getSelection(); const selection = eventArgs.getSelection();
const length = selection.length; const length = selection.length;
...@@ -4652,15 +4678,15 @@ export default { ...@@ -4652,15 +4678,15 @@ export default {
} else if (length > 0) { } else if (length > 0) {
// 选中了节点,根据节点类型决定使用哪个工具 // 选中了节点,根据节点类型决定使用哪个工具
const selectedNode = selection[length - 1]; const selectedNode = selection[length - 1];
// 检查节点是否是文本节点 // 检查节点是否是文本节点
const isTextNode = (selectedNode.text !== undefined && selectedNode.text !== null) || const isTextNode = (selectedNode.text !== undefined && selectedNode.text !== null) ||
(typeof selectedNode.getText === 'function'); (typeof selectedNode.getText === 'function');
// 检查节点是否是路径节点(线条) // 检查节点是否是路径节点(线条)
const isPathNode = selectedNode.getType && selectedNode.getType() === 'Path' || const isPathNode = selectedNode.getType && selectedNode.getType() === 'Path' ||
(selectedNode.getProperties && selectedNode.getProperties().linestyle); (selectedNode.getProperties && selectedNode.getProperties().linestyle);
if (isTextNode && this.annotationToolBottom) { if (isTextNode && this.annotationToolBottom) {
// 文本节点:使用 annotationToolBottom 编辑 // 文本节点:使用 annotationToolBottom 编辑
if (this.annotationToolBottom.getMode() !== PaintMode.Edit || this.annotationToolBottom.getShape() !== selectedNode) { if (this.annotationToolBottom.getMode() !== PaintMode.Edit || this.annotationToolBottom.getShape() !== selectedNode) {
...@@ -4686,7 +4712,7 @@ export default { ...@@ -4686,7 +4712,7 @@ export default {
this.annotationToolBottom.editNode(null); this.annotationToolBottom.editNode(null);
} }
} }
eventArgs.stopPropagation(true, true); eventArgs.stopPropagation(true, true);
} }
} finally { } finally {
...@@ -4762,16 +4788,16 @@ export default { ...@@ -4762,16 +4788,16 @@ export default {
this.collectedAnnotations.push({ type: 'path', properties: props, panel: 'bottom', _nodeRef: node }); this.collectedAnnotations.push({ type: 'path', properties: props, panel: 'bottom', _nodeRef: node });
} catch (e) { } } catch (e) { }
if (this.annotationsBottom.indexOfChild(node) === -1) this.annotationsBottom.addChild(node); if (this.annotationsBottom.indexOfChild(node) === -1) this.annotationsBottom.addChild(node);
// 关键修复:绘制完成后,确保节点保持可编辑属性 // 关键修复:绘制完成后,确保节点保持可编辑属性
try { try {
const props = typeof node.getProperties === 'function' ? node.getProperties() : {}; const props = typeof node.getProperties === 'function' ? node.getProperties() : {};
if (!props.selectable || !props.movable || !props.editable) { if (!props.selectable || !props.movable || !props.editable) {
// 如果属性丢失,重新设置 // 如果属性丢失,重新设置
const currentLineStyle = props.linestyle || new LineStyle({ const currentLineStyle = props.linestyle || new LineStyle({
color: this.lineStyle?.color || '#0351ad', color: this.lineStyle?.color || '#0351ad',
width: this.lineStyle?.width || 2, width: this.lineStyle?.width || 2,
pattern: this.getProcessedLinePattern ? this.getProcessedLinePattern(this.lineStyle?.pattern) : [] pattern: this.getProcessedLinePattern ? this.getProcessedLinePattern(this.lineStyle?.pattern) : []
}); });
node.setProperties({ node.setProperties({
...props, ...props,
...@@ -4784,7 +4810,7 @@ export default { ...@@ -4784,7 +4810,7 @@ export default {
} catch (e) { } catch (e) {
console.warn('设置底部线条节点编辑属性失败:', e); console.warn('设置底部线条节点编辑属性失败:', e);
} }
// 修复:绘制完成后,保持编辑模式,让用户可以立即编辑刚绘制的线条 // 修复:绘制完成后,保持编辑模式,让用户可以立即编辑刚绘制的线条
try { try {
if (this.pencilToolBottom && this.pencilToolBottom.isEnabled() && this.showLineStylePanel) { if (this.pencilToolBottom && this.pencilToolBottom.isEnabled() && this.showLineStylePanel) {
...@@ -4820,20 +4846,20 @@ export default { ...@@ -4820,20 +4846,20 @@ export default {
wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
try { try {
this._seismicWidgetBottom.setPipeline(this.pipelineBottom); this._seismicWidgetBottom.setPipeline(this.pipelineBottom);
} catch (e) { } } catch (e) { }
// 恢复更新 // 恢复更新
try { try {
if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) { if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) {
this._seismicWidgetBottom.setOptions({ 'freezeupdate': false }); this._seismicWidgetBottom.setOptions({ 'freezeupdate': false });
} }
} catch (e) { } } catch (e) { }
// 只有在 pipeline 改变时才刷新 // 只有在 pipeline 改变时才刷新
try { try {
this.$nextTick(() => { this.$nextTick(() => {
if (this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate) { if (this._seismicWidgetBottom && this._seismicWidgetBottom.invalidate) {
this._seismicWidgetBottom.invalidate(); this._seismicWidgetBottom.invalidate();
...@@ -4860,13 +4886,13 @@ export default { ...@@ -4860,13 +4886,13 @@ export default {
try { try {
const info = this.getExpectedBottomInfo(); const info = this.getExpectedBottomInfo();
if (!info || !info.path) return; if (!info || !info.path) return;
// 关键修复:如果路径和名称都匹配,不需要做任何操作,直接返回,避免任何刷新 // 关键修复:如果路径和名称都匹配,不需要做任何操作,直接返回,避免任何刷新
// 使用严格相等比较,确保不会因为类型不同而误判 // 使用严格相等比较,确保不会因为类型不同而误判
if (String(this._bottomSegyPath) === String(info.path) && String(this._bottomSegyKey) === String(info.name)) { if (String(this._bottomSegyPath) === String(info.path) && String(this._bottomSegyKey) === String(info.name)) {
return; return;
} }
// 关键修复:在切换 pipeline 前冻结 widget 更新,避免闪烁 // 关键修复:在切换 pipeline 前冻结 widget 更新,避免闪烁
let wasFrozen = false; let wasFrozen = false;
try { try {
...@@ -4874,7 +4900,7 @@ export default { ...@@ -4874,7 +4900,7 @@ export default {
wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
// 优先用路径判断是否一致 // 优先用路径判断是否一致
if (!this._bottomSegyPath || String(this._bottomSegyPath) !== String(info.path)) { if (!this._bottomSegyPath || String(this._bottomSegyPath) !== String(info.path)) {
// 使用 skipRefresh=true 并手动控制刷新,避免不必要的刷新 // 使用 skipRefresh=true 并手动控制刷新,避免不必要的刷新
...@@ -4920,7 +4946,7 @@ export default { ...@@ -4920,7 +4946,7 @@ export default {
} }
} catch (e) { } } catch (e) { }
} }
} catch (e) { } catch (e) {
// 确保即使出错也恢复更新 // 确保即使出错也恢复更新
try { try {
if (this._seismicWidgetBottom && this._seismicWidgetBottom.setOptions) { if (this._seismicWidgetBottom && this._seismicWidgetBottom.setOptions) {
...@@ -6260,6 +6286,9 @@ export default { ...@@ -6260,6 +6286,9 @@ export default {
} }
}, },
async handleFileSelect(plot) { async handleFileSelect(plot) {
let segys = []; let segys = [];
...@@ -6382,7 +6411,7 @@ export default { ...@@ -6382,7 +6411,7 @@ export default {
}); });
// Set the pipeline first // Set the pipeline first
this.pipeline = pipeline; this.pipeline= pipeline;
this._seismicWidget.setPipeline(pipeline); this._seismicWidget.setPipeline(pipeline);
// Then set widget options // Then set widget options
...@@ -6488,11 +6517,11 @@ export default { ...@@ -6488,11 +6517,11 @@ export default {
}); });
}, },
handleMouseMove(event) { // handleMouseMove(event) {
if (!this._seismicWidget || !this.isHovering) return; // if (!this._seismicWidget || !this.isHovering) return;
//
// 使用内置状态栏,不需要额外的处理逻辑 // // 使用内置状态栏,不需要额外的处理逻辑
}, // },
onFileOpen(evt, plot, fileInfo) { onFileOpen(evt, plot, fileInfo) {
evt.stopPropagation(); evt.stopPropagation();
...@@ -6568,15 +6597,15 @@ export default { ...@@ -6568,15 +6597,15 @@ export default {
} else if (length > 0) { } else if (length > 0) {
// 选中了节点,根据节点类型决定使用哪个工具 // 选中了节点,根据节点类型决定使用哪个工具
const selectedNode = selection[length - 1]; const selectedNode = selection[length - 1];
// 检查节点是否是文本节点(通过检查是否有 text 属性或 getText 方法) // 检查节点是否是文本节点(通过检查是否有 text 属性或 getText 方法)
const isTextNode = (selectedNode.text !== undefined && selectedNode.text !== null) || const isTextNode = (selectedNode.text !== undefined && selectedNode.text !== null) ||
(typeof selectedNode.getText === 'function'); (typeof selectedNode.getText === 'function');
// 检查节点是否是路径节点(线条) // 检查节点是否是路径节点(线条)
const isPathNode = selectedNode.getType && selectedNode.getType() === 'Path' || const isPathNode = selectedNode.getType && selectedNode.getType() === 'Path' ||
(selectedNode.getProperties && selectedNode.getProperties().linestyle); (selectedNode.getProperties && selectedNode.getProperties().linestyle);
if (isTextNode && this.annotationTool) { if (isTextNode && this.annotationTool) {
// 文本节点:使用 annotationTool 编辑 // 文本节点:使用 annotationTool 编辑
if (this.annotationTool.getMode() !== PaintMode.Edit || this.annotationTool.getShape() !== selectedNode) { if (this.annotationTool.getMode() !== PaintMode.Edit || this.annotationTool.getShape() !== selectedNode) {
...@@ -6604,7 +6633,7 @@ export default { ...@@ -6604,7 +6633,7 @@ export default {
this.annotationTool.editNode(null); this.annotationTool.editNode(null);
} }
} }
eventArgs.stopPropagation(true, true); eventArgs.stopPropagation(true, true);
} }
}); });
...@@ -6786,7 +6815,7 @@ export default { ...@@ -6786,7 +6815,7 @@ export default {
console.warn('Widget or annotation tools not ready'); console.warn('Widget or annotation tools not ready');
return; return;
} }
// 如果是关闭文本工具,直接禁用并返回 // 如果是关闭文本工具,直接禁用并返回
if (this.isDrawingText) { if (this.isDrawingText) {
this.isDrawingText = false; this.isDrawingText = false;
...@@ -6800,7 +6829,7 @@ export default { ...@@ -6800,7 +6829,7 @@ export default {
} }
return; return;
} }
if (!this.annotationTool) { if (!this.annotationTool) {
console.warn('注释工具未初始化'); console.warn('注释工具未初始化');
return; return;
...@@ -7040,16 +7069,16 @@ export default { ...@@ -7040,16 +7069,16 @@ export default {
}); });
this.annotationTool.setEnabled(true); this.annotationTool.setEnabled(true);
// 关键修复:确保底部文本工具被正确插入到工具管理器 // 关键修复:确保底部文本工具被正确插入到工具管理器
// 先冻结 widget 更新,避免工具操作时的任何刷新 // 先冻结 widget 更新,避免工具操作时的任何刷新
if (this.annotationToolBottom && this._seismicWidgetBottom) { if (this.annotationToolBottom && this._seismicWidgetBottom) {
try { try {
// 先检查底部 pipeline 是否需要更新(在冻结前检查,避免不必要的冻结) // 先检查底部 pipeline 是否需要更新(在冻结前检查,避免不必要的冻结)
const info = this.getExpectedBottomInfo(); const info = this.getExpectedBottomInfo();
const needUpdatePipeline = info && info.path && const needUpdatePipeline = info && info.path &&
(String(this._bottomSegyPath) !== String(info.path) || String(this._bottomSegyKey) !== String(info.name)); (String(this._bottomSegyPath) !== String(info.path) || String(this._bottomSegyKey) !== String(info.name));
// 如果需要更新 pipeline,先冻结,然后更新 // 如果需要更新 pipeline,先冻结,然后更新
let wasFrozen = false; let wasFrozen = false;
if (needUpdatePipeline) { if (needUpdatePipeline) {
...@@ -7058,7 +7087,7 @@ export default { ...@@ -7058,7 +7087,7 @@ export default {
wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); wasFrozen = this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
// 只在真正需要时才更新 pipeline // 只在真正需要时才更新 pipeline
await this.assertBottomPipelineCurrent(); await this.assertBottomPipelineCurrent();
} else { } else {
...@@ -7069,7 +7098,7 @@ export default { ...@@ -7069,7 +7098,7 @@ export default {
} }
} catch (e) { } } catch (e) { }
} }
const tm = this._seismicWidgetBottom.getTool && this._seismicWidgetBottom.getTool(); const tm = this._seismicWidgetBottom.getTool && this._seismicWidgetBottom.getTool();
if (tm) { if (tm) {
// 先移除线条工具,避免冲突 // 先移除线条工具,避免冲突
...@@ -7088,7 +7117,7 @@ export default { ...@@ -7088,7 +7117,7 @@ export default {
// 设置属性并启用 // 设置属性并启用
this.annotationToolBottom.setProperties(textProperties); this.annotationToolBottom.setProperties(textProperties);
this.annotationToolBottom.setEnabled(true); this.annotationToolBottom.setEnabled(true);
// 恢复 widget 更新 // 恢复 widget 更新
try { try {
if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) { if (this._seismicWidgetBottom.setOptions && wasFrozen !== undefined) {
...@@ -7918,8 +7947,7 @@ export default { ...@@ -7918,8 +7947,7 @@ export default {
if (!this.checkWidgetStatus() || !this.isWidgetReady) return; if (!this.checkWidgetStatus() || !this.isWidgetReady) return;
// 修复:如果 plots 为 null,直接使用 _seismicWidget const widget = this.plots.getRoot();
const widget = (this.plots && this.plots.getRoot) ? this.plots.getRoot() : this._seismicWidget;
if (!widget) return; if (!widget) return;
// 确保注释层存在 // 确保注释层存在
...@@ -7986,42 +8014,9 @@ export default { ...@@ -7986,42 +8014,9 @@ export default {
if (node && this.annotations.indexOfChild(node) === -1) { if (node && this.annotations.indexOfChild(node) === -1) {
this.annotations.addChild(node); this.annotations.addChild(node);
} }
tool.setEditMode(EditMode.EditNode);
// 关键修复:绘制完成后,确保节点保持可编辑属性 tool.editNode(node);
try { this.selectedShape = node;
const props = typeof node.getProperties === 'function' ? node.getProperties() : {};
if (!props.selectable || !props.movable || !props.editable) {
// 如果属性丢失,重新设置
const currentLineStyle = props.linestyle || new LineStyle({
color: this.lineStyle?.color || '#0351ad',
width: this.lineStyle?.width || 2,
pattern: this.getProcessedLinePattern ? this.getProcessedLinePattern(this.lineStyle?.pattern) : []
});
node.setProperties({
...props,
linestyle: currentLineStyle,
selectable: true,
movable: true,
editable: true
});
}
} catch (e) {
console.warn('设置线条节点编辑属性失败:', e);
}
// 修复:绘制完成后,保持编辑模式,让用户可以立即编辑刚绘制的线条
// 用户可以通过点击空白区域或按 ESC 来取消编辑,然后继续绘制新线条
try {
if (this.pencilTool && this.pencilTool.isEnabled() && this.showLineStylePanel) {
// 设置编辑模式,让用户可以选择和编辑刚绘制的线条
this.pencilTool.setEditMode(EditMode.EditNode);
this.pencilTool.editNode(node);
this.selectedShape = node;
}
} catch (e) {
console.warn('设置线条编辑模式失败:', e);
}
this.requestRepaint(); this.requestRepaint();
}); });
} }
...@@ -8041,7 +8036,7 @@ export default { ...@@ -8041,7 +8036,7 @@ export default {
toolManager.insert(0, this.pencilTool); toolManager.insert(0, this.pencilTool);
this.pencilTool.setEnabled(true); this.pencilTool.setEnabled(true);
// 同步启用底部线条工具 // 同步启用底部线条工具
if (this.pencilToolBottom && this._seismicWidgetBottom) { if (this.pencilToolBottom && this._seismicWidgetBottom) {
try { try {
...@@ -8053,7 +8048,7 @@ export default { ...@@ -8053,7 +8048,7 @@ export default {
this._seismicWidgetBottom.setOptions({ 'freezeupdate': true }); this._seismicWidgetBottom.setOptions({ 'freezeupdate': true });
} }
} catch (e) { } } catch (e) { }
// 关键修复:先禁用并移除文本工具,避免工具冲突 // 关键修复:先禁用并移除文本工具,避免工具冲突
if (this.annotationToolBottom) { if (this.annotationToolBottom) {
try { try {
...@@ -8069,7 +8064,7 @@ export default { ...@@ -8069,7 +8064,7 @@ export default {
this.pencilToolBottom.setMode(PaintMode.Pencil); this.pencilToolBottom.setMode(PaintMode.Pencil);
this.pencilToolBottom.setEditMode(EditMode.Create); this.pencilToolBottom.setEditMode(EditMode.Create);
this.pencilToolBottom.setEnabled(true); this.pencilToolBottom.setEnabled(true);
// 恢复 widget 更新 // 恢复 widget 更新
try { try {
if (this._seismicWidgetBottom.setOptions) { if (this._seismicWidgetBottom.setOptions) {
...@@ -10167,4 +10162,4 @@ export default { ...@@ -10167,4 +10162,4 @@ export default {
.containerBlock { .containerBlock {
overflow: visible !important; overflow: visible !important;
} }
</style> </style>
\ No newline at end of file
...@@ -38,10 +38,7 @@ module.exports = { ...@@ -38,10 +38,7 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:8999`, target: `http://127.0.0.1:8999`, //井测试
// target: `http://192.168.31.108:8999`,
target: `http://192.168.31.12:8999`,
// target: `http://192.168.31.12:8999`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '', ['^' + process.env.VUE_APP_BASE_API]: '',
......
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