From 3aedc2445d6ea5306e84469935be96ed730617b2 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 25 Sep 2023 14:55:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Compare=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=92=8CConfigure=E7=9A=84Save=E5=AF=B9=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E5=8F=8A=E9=83=A8=E5=88=86=E4=B8=BB=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalyzeInteractiveToolModal/index.vue | 34 +++-- .../components/Modals/AnalyzeSettingModal.vue | 116 +++++++++++---- .../Modals/CompareFileListModal.vue | 138 ++++++++++++++++++ src/views/spectrumAnalysis/gamma-analysis.vue | 93 ++++++++++-- src/views/spectrumAnalysis/index.vue | 10 +- 5 files changed, 339 insertions(+), 52 deletions(-) create mode 100644 src/views/spectrumAnalysis/components/Modals/CompareFileListModal.vue diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index 40e8b85..88d85dd 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -407,6 +407,12 @@ const thumbnailOption = { series: null } +const nuclideIdentifyModal = { + possibleNuclide: '', + tolerance: 0.5, + identifiedNuclide: '' +} + // 操作类型 export const Operators = { ADD: 1, // 新增 @@ -442,6 +448,7 @@ export default { energy: [], list: [], BaseCtrls: {}, + FitBaseLine: '#fff', sampleId: -1, peakCommentModalVisible: false, // Comment 弹窗是否显示 @@ -454,11 +461,7 @@ export default { fitPeaksAndBaselineModalVisible: false, // Fit Peaks And Base Line 弹窗 nuclideReviewModalVisible: false, // Nuclide Review 弹窗 - model: { - possibleNuclide: '', - tolerance: 0.5, - identifiedNuclide: '' - }, + model: cloneDeep(nuclideIdentifyModal), currChannel: undefined, // 当currChannel前选中的channel selectedTableItem: undefined, // 当前选中的表格项 @@ -483,6 +486,9 @@ export default { try { this.isLoading = true this.option.series = [] + this.thumbnailOption.series = [] + this.list = [] + this.model = cloneDeep(nuclideIdentifyModal) const { success, result, message } = await getAction('/gamma/InteractiveTool', { sampleId: this.sampleId, @@ -501,7 +507,8 @@ export default { channelPeakChart, energy, table, - BaseCtrls + BaseCtrls, + FitBaseLine } = result console.log('%c [ ]-374', 'font-size:13px; background:pink; color:#bf2c9f;', result) @@ -512,6 +519,7 @@ export default { this.channelPeakChart = channelPeakChart this.energy = energy this.BaseCtrls = BaseCtrls + this.FitBaseLine = FitBaseLine const series = [] @@ -1246,7 +1254,7 @@ export default { const baseLineEditSeries = buildLineSeries( 'BaseLine_Edit', this._channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]), - '#fff', + this.FitBaseLine, { zlevel: 21 } @@ -1296,6 +1304,8 @@ export default { buildGraphicRect(xAxis, yAxis) { const chart = this.$refs.chartRef.getChartInstance() const [xPix, yPix] = chart.convertToPixel('grid', [xAxis, yAxis]) + const that = this + return { type: 'rect', id: Math.random().toString(), @@ -1312,12 +1322,12 @@ export default { fill: 'transparent', lineWidth: 2 }, - draggable: false, + draggable: this.isModifying, ondrag: function() { const [xPixel] = chart.convertToPixel('grid', [xAxis, yAxis]) // 保持x轴不变 this.position[0] = xPixel - this.redrawBaseLine() + that.redrawBaseLine() }, ondragend: ({ offsetY }) => { this.setGraphicDraggable(false) @@ -1351,7 +1361,7 @@ export default { // 重新生成基线 redrawBaseLine() { - console.log('%c [ 重新生成基线 ]-1355', 'font-size:13px; background:pink; color:#bf2c9f;', ) + console.log('%c [ 重新生成基线 ]-1355', 'font-size:13px; background:pink; color:#bf2c9f;') }, // 根据数据绘制 + 号 @@ -1472,7 +1482,7 @@ export default { // 修改控制点 handleModifyCP() { - this.setGraphicDraggable(true) + this.setGraphicDraggable(!this.isModifying) }, // 编辑斜率 @@ -1560,7 +1570,7 @@ export default { this.channelBaseCPChart = this._channelBaseCPChart this.handleSwitchOperation() - + this.$bus.$emit('accept') }, diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue index dca474c..a855d14 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue @@ -13,44 +13,40 @@
- + KeV
- + KeV
- + KeV
- +
- + - + - - Update Calibration - + Update Calibration - - Keep Calibration Peak Search Peaks - + Keep Calibration Peak Search Peaks @@ -61,13 +57,13 @@ - + - + - + @@ -75,12 +71,12 @@ - + - + @@ -90,10 +86,20 @@
- + - +
@@ -106,10 +112,11 @@ @@ -198,7 +256,7 @@ export default { display: flex; align-items: center; - .ant-input-number { + .ant-input { margin-right: 10px; } } diff --git a/src/views/spectrumAnalysis/components/Modals/CompareFileListModal.vue b/src/views/spectrumAnalysis/components/Modals/CompareFileListModal.vue new file mode 100644 index 0000000..b49e6ec --- /dev/null +++ b/src/views/spectrumAnalysis/components/Modals/CompareFileListModal.vue @@ -0,0 +1,138 @@ + + + + + diff --git a/src/views/spectrumAnalysis/gamma-analysis.vue b/src/views/spectrumAnalysis/gamma-analysis.vue index d302b1e..bce2a30 100644 --- a/src/views/spectrumAnalysis/gamma-analysis.vue +++ b/src/views/spectrumAnalysis/gamma-analysis.vue @@ -88,6 +88,8 @@ :channel="currChannel" :nuclide="nuclideReview.nuclide" /> + + @@ -105,6 +107,7 @@ import { buildLineSeries, findSeriesByName, getXAxisAndYAxisByPosition, rangeNum import { cloneDeep } from 'lodash' import axios from 'axios' import NuclideReviewModal from './components/Modals/AnalyzeInteractiveToolModal/components/NuclideReviewModal.vue' +import CompareFileListModal from './components/Modals/CompareFileListModal.vue' // 初始配置 const initialOption = { @@ -269,6 +272,7 @@ export default { NuclideLibrary, ButtonWithSwitchIcon, NuclideReviewModal, + CompareFileListModal, }, data() { return { @@ -302,6 +306,8 @@ export default { nuclide: '', }, currChannel: -1, + + compareFileListModalVisible: false, // Compare 弹窗 } }, created() { @@ -359,8 +365,7 @@ export default { const { inputFileName: fileName } = this.sample try { this.isLoading = true - this.option.series = [] - this.thumbnailOption.series = [] + this.reset() // const { success, result, message } = Response const { success, result, message } = await getAction('/gamma/gammaByFile', { fileName, @@ -439,11 +444,8 @@ export default { this.shapeChannelData = shapeChannelData this.shapeEnergyData = shapeEnergyData - this.option.yAxis.max = - shadowChannelChart.pointlist && Math.ceil(Math.max(...shadowChannelChart.pointlist.map((item) => item.y)) * 1.1) - this.thumbnailOption.yAxis.max = - shadowChannelChart.pointlist && Math.ceil(Math.max(...shadowChannelChart.pointlist.map((item) => item.y)) * 1.1) - + this.option.yAxis.max = 'dataMax' + this.resetThumbnailChartDataMax() const series = [] // 推入Spectrum Line @@ -566,6 +568,13 @@ export default { ) }) series.push(...peakLines) + + series.push( + buildLineSeries('Compare', [], '#fff', { + symbolSize: 2, + }) + ) + this.option.series = series this.option.tooltip.formatter = this.tooltipFormatter @@ -590,6 +599,8 @@ export default { // Graph Assistance 操作 handleGraphAssistanceChange({ type, label, value }) { + const compareLineSeries = findSeriesByName(this.option.series, 'Compare') + // 类型变化 if (type == 'labelChange') { switch (label) { @@ -629,6 +640,8 @@ export default { this.redrawPeakLine() this.redrawThumbnailChart() + + this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine) break case 'Lines': this.option.series[0].type = 'line' @@ -636,6 +649,9 @@ export default { this.thumbnailOption.series[0].type = 'line' this.thumbnailOption.series[0].symbol = 'none' + + compareLineSeries.type = 'line' + compareLineSeries.symbol = 'none' break case 'Scatter': this.option.series[0].type = 'scatterGL' @@ -643,6 +659,9 @@ export default { this.thumbnailOption.series[0].type = 'scatterGL' this.thumbnailOption.series[0].symbol = 'circle' + + compareLineSeries.type = 'scatterGL' + compareLineSeries.symbol = 'circle' break } } @@ -677,7 +696,7 @@ export default { }, // 根据seriesName重绘线 - redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true) { + redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true, color) { const series = findSeriesByName(this.option.series, seriesName) if (isShow) { const data = this.isEnergy() ? energyData : channelData @@ -685,6 +704,9 @@ export default { } else { series.data = [] } + if (color) { + series.itemStyle.color = color + } }, // 重绘控制点 @@ -1055,7 +1077,7 @@ export default { this.option.xAxis.min = 1 this.option.xAxis.max = 'dataMax' this.option.yAxis.min = 1 - this.option.yAxis.max = Math.ceil(Math.max(...this.shadowChannelChart.pointlist.map((item) => item.y)) * 1.1) + this.option.yAxis.max = 'dataMax' this.thumbnailOption.series[0].markLine.data = [] this.thumbnailChartRect = [] @@ -1115,6 +1137,9 @@ export default { this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart) this.redrawThumbnailChart() + + this.clearCompareLine() + this.$nextTick(() => { this.resetChartOpts() }) @@ -1123,6 +1148,50 @@ export default { // 分析工具Accept时刷新部分数据 handleAccept() { console.log('%c [ 分析工具Accept时刷新部分数据 ]-1046', 'font-size:13px; background:pink; color:#bf2c9f;') + this.clearCompareLine() + }, + + // 显示比较弹窗 + showCompareModal() { + if (this.isLoading) { + this.$message.warn('Sample is Loading') + return + } + this.clearCompareLine() + this.compareFileListModalVisible = true + }, + + // 文件之间对比 + handleCompareWithFile([channelData, energyData]) { + this.channelCompareLine = channelData + this.energyCompareLine = energyData + this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color) + + if (this.option.series[0].type == 'scatterGL') { + lineSeries.type = 'scatterGL' + } + + this.$nextTick(() => { + const chart = this.$refs.chartRef.getChartInstance() + const yAxisMax = chart.getModel().getComponent('yAxis').axis.scale._extent[1] + this.thumbnailOption.yAxis.max = yAxisMax + }) + }, + + // 移除 Compare 线 + clearCompareLine() { + const compareLine = findSeriesByName(this.option.series, 'Compare') + if (compareLine) { + compareLine.data = [] + this.resetThumbnailChartDataMax() + } + this.channelCompareLine = [] + this.energyCompareLine = [] + }, + + // 重置缩略图表y轴最大值 + resetThumbnailChartDataMax() { + this.thumbnailOption.yAxis.max = 'dataMax' }, // 重置图表配置 @@ -1220,11 +1289,17 @@ export default { this.channelScacLine.color = Color_Scac this.energyScacLine.color = Color_Scac + if (this.channelCompareLine) { + this.channelCompareLine.color = Color_Compare + this.energyCompareLine.color = Color_Compare + } + this.changeColorBySeriesName('Spectrum', Color_Spec) this.changePeakLineColor(Color_Peak) this.changeColorBySeriesName('LcLine', Color_Lc) this.changeColorBySeriesName('BaseLine', Color_Base) this.changeColorBySeriesName('ScacLine', Color_Scac) + this.changeColorBySeriesName('Compare', Color_Compare) const thumbnailChartSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum') thumbnailChartSeries.itemStyle.color = Color_Spec diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 1c521df..9490742 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -643,8 +643,9 @@ export default { }, { type: 'a-menu-item', - title: 'Clean All', - handler: this.handleCleanAll, + title: 'Compare', + show: this.isGamma, + handler: () => this.$refs.gammaAnalysisRef.showCompareModal(), }, { type: 'a-menu-item', @@ -658,6 +659,11 @@ export default { show: this.isGamma, handler: () => (this.ftransltModalVisible = true), }, + { + type: 'a-menu-item', + title: 'Clean All', + handler: this.handleCleanAll, + }, ], }, {