From 7cc143bbd45867e4cdd6980425b7930f93bf9be3 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Fri, 13 Oct 2023 19:07:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?WIP:=20=E4=BF=AE=E6=94=B9Insert=E5=92=8CFit?= =?UTF-8?q?=20Peak=E6=8E=A5=E5=8F=A3=E5=92=8C=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0BaseLine=E7=9A=84Accept=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/FitPeaksAndBaselineModal.vue | 95 ++++++++++++------- .../AnalyzeInteractiveToolModal/index.vue | 69 ++++++++++---- 2 files changed, 110 insertions(+), 54 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/FitPeaksAndBaselineModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/FitPeaksAndBaselineModal.vue index 73502a1..ca12c50 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/FitPeaksAndBaselineModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/FitPeaksAndBaselineModal.vue @@ -6,16 +6,29 @@ Fixed - +
- + Peaks - Cancel + Cancel
@@ -25,6 +38,7 @@ import { getAction, postAction } from '@/api/manage' import ModalMixin from '@/mixins/ModalMixin' import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' +import { cloneDeep } from 'lodash' const columns = [ { @@ -116,8 +130,14 @@ const columns = [ export default { mixins: [ModalMixin, SampleDataMixin], props: { - curChan: { + channel_1: { type: Number + }, + channel_2: { + type: Number + }, + isInsertPeak: { + type: Boolean } }, data() { @@ -129,18 +149,20 @@ export default { } }, methods: { - // 接收 - async handlePeaks() { + async handlePeaks(accept) { try { this.isAcceptting = true const { inputFileName: fileName } = this.sampleData const { success, result, message } = await postAction('/gamma/acceptResults', { fileName, - accept: true + accept, + oldPeaks: this.oldPeaks, + newPeak: this.newPeaks, + flag: this.isInsertPeak ? 'insert' : 'fit' }) if (success) { this.visible = false - this.$emit('result', result) + this.$emit(accept ? 'result' : 'cancel', result) } else { this.$message.error(message) } @@ -151,46 +173,51 @@ export default { } }, - // 取消 - async handleCancel() { - try { - this.isCanceling = true - const { inputFileName: fileName } = this.sampleData - const { success, result, message } = await postAction('/gamma/acceptResults', { - fileName, - accept: false, - oldPeak: this.oldPeaks - }) - if (success) { - this.visible = false - this.$emit('cancel', result) - } else { - this.$message.error(message) + // 值变化 + handleInput(record, index) { + const find = this.newPeaks.find(item => item.index == record.lab) + if (find) { + const table2NewPeakMap = { + energy: 'energy', + netArea: 'area', + fwhm: 'fwhm' } - } catch (error) { - console.error(error) - } finally { - this.isCanceling = false + + find[table2NewPeakMap[index]] = record[index] } }, async getData() { + const { sampleId, inputFileName: fileName } = this.sampleData try { + let url = '/gamma/fitPeak' + let params = { + left: this.channel_1, + right: this.channel_2, + fileName + } + + // 如果是Insert Peak + if (this.isInsertPeak) { + url = '/gamma/insertPeak' + params = { + sampleId, + fileName, + curChan: Math.ceil(this.channel_1) + } + } + this.isLoading = true - const { sampleId, inputFileName } = this.sampleData - const { success, result, message } = await getAction('/gamma/insertPeak', { - sampleId, - fileName: inputFileName, - curChan: Math.ceil(this.curChan) - }) + const { success, result, message } = await getAction(url, params) if (success) { - const { oldPeaks, tablePeaksList } = result + const { newPeaks, oldPeaks, tablePeaksList } = result tablePeaksList.forEach(item => { item.energy = Number(item.energy).toPrecision(6) item.netArea = Number(item.netArea).toPrecision(6) item.fwhm = Number(item.fwhm).toPrecision(6) }) this.list = tablePeaksList + this.newPeaks = newPeaks this.oldPeaks = oldPeaks } else { this.$message.error(message) diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index 3b1e0ac..944a233 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -181,7 +181,9 @@ @@ -461,6 +463,11 @@ export default { model: cloneDeep(nuclideIdentifyModal), currChannel: undefined, // 当currChannel前选中的channel + + channel_1: undefined, // 用于Fit Peaks And Baseline Modal的道值 + channel_2: undefined, + isInsertPeak: false, // 是否是插入Peak + selectedTableItem: undefined, // 当前选中的表格项 isModifying: false, // 正在修改控制点 @@ -636,6 +643,9 @@ export default { return } + this.channel_1 = left + this.channel_2 = right + this.isInsertPeak = false this.fitPeaksAndBaselineModalVisible = true this.isFitting = false @@ -737,7 +747,10 @@ export default { return } + this.channel_1 = this.currChannel + this.fitPeaksAndBaselineModalVisible = true + this.isInsertPeak = true }, // 点击 Fit Peak XXX 弹窗中的 Peaks 按钮 @@ -772,13 +785,13 @@ export default { series.push(this.buildBaseLine(channelBaseLineChart)) // 推入旧的Count - series.push(this.buildCountLine(channelCountChart)) + series.push(this.buildCountLine(this.channelCountChart)) // 推入Peak series.push(...this.buildPeaks(channelPeakChart)) // 推入旧的基线控制点 - series.push(this.buildCtrlPoint(channelBaseCPChart)) + series.push(this.buildCtrlPoint(this.channelBaseCPChart)) this.thumbnailOption.series = this.buildBarChart(barChart) @@ -1278,27 +1291,43 @@ export default { }, // 确定对Baseline Control Points 的操作 - handleAccept() { + async handleAccept() { this.BaseCtrls = cloneDeep(this.baseCtrls_Copy) const { baseline, xctrl, yctrl } = this.BaseCtrls - this.channelBaseLineChart.pointlist = baseline.map((val, index) => { - return { - x: index + 1, - y: val - } - }) + // this.channelBaseLineChart.pointlist = baseline.map((val, index) => { + // return { + // x: index + 1, + // y: val + // } + // }) - this.channelBaseCPChart = xctrl.map((val, index) => { - return { - color: this.channelBaseCPChart[0].color, - name: index.toString(), - point: { - x: val, - y: yctrl[index] - }, - size: 4 + // this.channelBaseCPChart = xctrl.map((val, index) => { + // return { + // color: this.channelBaseCPChart[0].color, + // name: index.toString(), + // point: { + // x: val, + // y: yctrl[index] + // }, + // size: 4 + // } + // }) + + const { inputFileName: fileName } = this.sampleData + + try { + const { success, result, message } = await postAction('/gamma/acceptBaseLine', { + ...this.BaseCtrls, + fileName + }) + if(success) { + console.log('%c [ ]-1312', 'font-size:13px; background:pink; color:#bf2c9f;', result) + } else { + this.$message.error(message) } - }) + } catch (error) { + console.error(error) + } this.handleSwitchOperation() From 90cfebf23e67001dd932ca474e96660b4bbeedbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=8F=AE=E5=AE=87?= Date: Fri, 13 Oct 2023 19:49:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?beta=20=E9=87=8D=E6=96=B0=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=EF=BC=8C=E5=8F=8Asave=20to?= =?UTF-8?q?=20DB=20=E5=8A=9F=E8=83=BD=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BetaDetectorCalibration.vue | 3 ++ .../components/GammaDetectorCalibration.vue | 3 ++ .../BetaGammaEnergyCalibrationModal/index.vue | 52 ++++++++++++++++--- src/views/spectrumAnalysis/index.vue | 49 +++++++++++++++-- 4 files changed, 97 insertions(+), 10 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue index 9d16ab4..c098dba 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue @@ -596,6 +596,7 @@ export default { count: 0, //反算时需要传递的数值 非反算的情况下不需要传递 数值大小是 第一次调用接口时返回的tableWidgets 大小 isFirstFitting: true, isInverse: false, // 是否需要反算 + betaIsFitting: false, } }, created() { @@ -869,6 +870,8 @@ export default { }) if (success) { this.isFirstFitting = false + this.betaIsFitting = true + this.$emit('isFitting', this.betaIsFitting) const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result this.newE2C = EToC diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue index 2fc9bb9..aa1ec94 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue @@ -467,6 +467,7 @@ export default { count: 0, //反算时需要传递的数值 非反算的情况下不需要传递 数值大小是 第一次调用接口时返回的tableWidgets 大小 isFirstFitting: true, isInverse: false, // 是否需要反算 + gammaIsFitting: false, } }, created() { @@ -646,6 +647,8 @@ export default { }) if (success) { this.isFirstFitting = false + this.gammaIsFitting = false + this.$emit('isFitting', this.gammaIsFitting) const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result this.newE2C = EToC diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue index df6f889..2ac1900 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue @@ -9,19 +9,19 @@ > - + - +