From 2b04b7d7baec0b9a088c5fa60c0a1a19a0e34923 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Sun, 18 Feb 2024 12:01:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Load=20From=20DB=20=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=97=B6=E6=89=A7=E8=A1=8C=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=EF=BC=8CBeta=20=E8=B0=B1=20->=20Energy=20Cal?= =?UTF-8?q?ibration=E5=BC=B9=E7=AA=97=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=BAman=E7=9A=84=E8=B0=B1=E6=97=B6?= =?UTF-8?q?=E5=AF=B9=E6=9F=90=E4=BA=9B=E6=95=B0=E6=8D=AE=E7=9A=84=E5=9B=9E?= =?UTF-8?q?=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BetaDetectorCalibration.vue | 115 ++++++++++++------ .../components/GammaDetectorCalibration.vue | 100 ++++++++++----- .../components/Modals/LoadFromDBModal.vue | 9 +- 3 files changed, 155 insertions(+), 69 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 e40ddc7..2876da0 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue @@ -128,9 +128,24 @@ C to E : E = - + - *C + - *C 2 + + + + + *C + + + *C 2

@@ -546,15 +561,15 @@ const newCalibrationFuncModel = { export default { mixins: [SampleDataMixin], components: { CustomChart, TitleOverBorder }, - props: { + props: { isFirstFitting: { type: Boolean, required: false, }, - isBetaReset:{ + isBetaReset: { type: Boolean, required: false, - } + }, }, data() { this.columns = columns @@ -619,7 +634,7 @@ export default { handler() { // this.getData() }, - immediate: true + immediate: true, }, }, methods: { @@ -636,11 +651,20 @@ export default { sampleId, qcFileName, sampleFileName: inputFileName, - fittingBtn: this.isFirstFitting + fittingBtn: this.isFirstFitting, }) if (res.success) { - const { CToE, EToC, betaEnergy, gammaEnergy, gammaGatedBetaSpectrum, histogramData, oldScatterSeries } = - res.result + const { + CToE, + EToC, + betaEnergy, + gammaEnergy, + gammaGatedBetaSpectrum, + histogramData, + oldScatterSeries, + newCToE, + newEToC, + } = res.result this.c2e = CToE this.e2c = EToC @@ -669,9 +693,27 @@ export default { // 如果点击过reanalyze则渲染之前fitting的数据,如果没点Reanalyze,数据会在窗口关闭时删掉 20231101:xiao // todo 现在能谱数据没有缓存,刷新页面时也会获取到fitting的数据 - if(this.getCache("CALIBRATION_BETA_"+this.newSampleData.inputFileName)) { - this.setFirringResult(this.getCache("CALIBRATION_BETA_"+this.newSampleData.inputFileName)) - return false; + if (this.getCache('CALIBRATION_BETA_' + this.newSampleData.inputFileName)) { + this.setFirringResult(this.getCache('CALIBRATION_BETA_' + this.newSampleData.inputFileName)) + return false + } + + /** + * 对人工交互的返回数据单独处理 + */ + if (this.sampleData.dbName == 'man') { + this.setFirringResult(res.result) + if (newCToE) { + const [paramA, paramB, paramC] = newCToE + this.newCalibrationFuncModel = { + paramA: Number(paramA).toPrecision(6), + paramB: Number(paramB).toPrecision(6), + paramC: Number(paramC).toPrecision(6), + } + } + if (newEToC) { + this.newE2C = newEToC + } } } else { this.$message.error(res.message) @@ -723,7 +765,7 @@ export default { chartHeight: this.gammaEnergy.length, channelWidth: this.gammaChannelWidth, qcFileName, - sampleFileName + sampleFileName, }, cancelToken ) @@ -797,7 +839,7 @@ export default { } this.tooltipVisible = true this.channelAndEnergyModel.channel = xAxis - if(!isNullOrUndefined(this.currEnergy)) { + if (!isNullOrUndefined(this.currEnergy)) { this.channelAndEnergyModel.energy = add(661.657, -this.currEnergy) } } @@ -816,12 +858,12 @@ export default { channel, energy, }) - + // add之后 需要清空chart黄色的线 20231028:Xiao - if(this.figureChartOption.series[1].data) { + if (this.figureChartOption.series[1].data) { this.figureChartOption.series[1].data = [] } - + this.figureChartOption.series[1].markPoint.data.push({ xAxis: channel, yAxis: energy }) const { min, max } = this.getFigureChartMaxAndMin() @@ -850,10 +892,10 @@ export default { // 输入内容的时候 需要清空table数据 20231028:Xiao this.list = [] // 需要清空chart黄色的线 20231028:Xiao - if(this.figureChartOption.series[1].data) { + if (this.figureChartOption.series[1].data) { this.figureChartOption.series[1].data = [] } - if(this.figureChartOption.series[1].markPoint.data) { + if (this.figureChartOption.series[1].markPoint.data) { this.figureChartOption.series[1].markPoint.data = [] } }, @@ -894,19 +936,22 @@ export default { // 点击Reset Button 重置 async handleReset() { this.$emit('isFitting', false) - this.removeCache("CALIBRATION_BETA_"+this.newSampleData.inputFileName) // 删除fitting之后缓存的数据 20231101:xiao + this.removeCache('CALIBRATION_BETA_' + this.newSampleData.inputFileName) // 删除fitting之后缓存的数据 20231101:xiao this.newCalibrationFuncModel = cloneDeep(newCalibrationFuncModel) this.list = [] this.newE2C = [] // 按乔的要求增加请求reset的接口 20231211:xiao - const res = await postAction('/spectrumAnalysis/resetButton?tabName=beta&sampleFileName='+this.newSampleData.inputFileName, {}) + const res = await postAction( + '/spectrumAnalysis/resetButton?tabName=beta&sampleFileName=' + this.newSampleData.inputFileName, + {} + ) this.figureChartOption = this.oldChartOption this.figureChartOption = cloneDeep(this.oldChartOption) // this.isFirstFitting = true - + this.isInverse = false }, @@ -918,13 +963,14 @@ export default { } try { const { success, result, message } = await postAction('/spectrumAnalysis/fitting', { - ...this.list.length <= 0 ? this.newCalibrationFuncModel : [], // 如果list有数据则不传 C to E 表单数据 20231101:xiao + ...(this.list.length <= 0 ? this.newCalibrationFuncModel : []), // 如果list有数据则不传 C to E 表单数据 20231101:xiao sampleFileName: this.newSampleData.inputFileName, - tabName: "beta", + tabName: 'beta', // 修改逻辑,如果列表中有数据 以列表的数据优先进行分析 20231028:Xiao - tempPoints: this.list.length > 0 - ? this.list.map((item) => ({ x: item.channel, y: item.energy })) - : this.oldScatterSeries, + tempPoints: + this.list.length > 0 + ? this.list.map((item) => ({ x: item.channel, y: item.energy })) + : this.oldScatterSeries, // tempPoints: this.isFirstFitting // ? this.oldScatterSeries // : this.list.map((item) => ({ x: item.channel, y: item.energy })), @@ -934,10 +980,9 @@ export default { this.betaIsFitting = true this.$emit('isFitting', true) // 点击reAnalyze按钮,将isFirstFitting改为true 20231101:xiao - this.setCache("CALIBRATION_BETA_"+this.newSampleData.inputFileName, result) // 缓存数据,如果点击ReAnalyze需要回显数据 20231101:xiao + this.setCache('CALIBRATION_BETA_' + this.newSampleData.inputFileName, result) // 缓存数据,如果点击ReAnalyze需要回显数据 20231101:xiao this.setFirringResult(result) - } else { this.$message.error(message) } @@ -947,7 +992,7 @@ export default { }, // 封装 fitting后数据填充方法,如果点击ReAnalyze需要回显数据 20231101:xiao - setFirringResult(result){ + setFirringResult(result) { const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result this.newE2C = EToC this.newLineSeries = newLineSeries @@ -1032,15 +1077,15 @@ export default { } return 0 }, - getCache(name){ + getCache(name) { return this.$ls.get(name) }, - setCache(name, data){ + setCache(name, data) { this.$ls.set(name, data) }, - removeCache(name){ + removeCache(name) { this.$ls.remove(name) // 删除fitting之后缓存的数据 20231101:xiao - } + }, }, computed: { rectHeight() { 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 f523e7c..3dae514 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue @@ -95,9 +95,24 @@ C to E : E = - + - *C + - *C 2 + + + + + *C + + + *C 2

@@ -494,11 +509,11 @@ export default { sampleId, qcFileName, sampleFileName: inputFileName, - fittingBtn: this.isFirstFitting + fittingBtn: this.isFirstFitting, }) if (res.success) { - const { CToE, EToC, gammaEnergy, gammaSpectrum, max, min, oldScatterSeries } = res.result + const { CToE, EToC, gammaEnergy, gammaSpectrum, max, min, oldScatterSeries, newCToE, newEToC } = res.result this.c2e = CToE this.e2c = EToC @@ -530,9 +545,27 @@ export default { // 如果点击过reanalyze则渲染之前fitting的数据,如果没点Reanalyze,数据会在窗口关闭时删掉 20231101:xiao // todo 现在能谱数据没有缓存,刷新页面时也会获取到fitting的数据 - if(this.getCache("CALIBRATION_GAMMA_"+this.newSampleData.inputFileName)) { - this.setFirringResult(this.getCache("CALIBRATION_GAMMA_"+this.newSampleData.inputFileName)) - return false; + if (this.getCache('CALIBRATION_GAMMA_' + this.newSampleData.inputFileName)) { + this.setFirringResult(this.getCache('CALIBRATION_GAMMA_' + this.newSampleData.inputFileName)) + return false + } + + /** + * 对人工交互的返回数据单独处理 + */ + if (this.sampleData.dbName == 'man') { + this.setFirringResult(res.result) + if (newCToE) { + const [paramA, paramB, paramC] = newCToE + this.newCalibrationFuncModel = { + paramA: Number(paramA).toPrecision(6), + paramB: Number(paramB).toPrecision(6), + paramC: Number(paramC).toPrecision(6), + } + } + if (newEToC) { + this.newE2C = newEToC + } } } else { this.$message.error(res.message) @@ -588,7 +621,7 @@ export default { }) // add之后 需要清空chart黄色的线 20231028:Xiao - if(this.figureChartOption.series[1].data) { + if (this.figureChartOption.series[1].data) { this.figureChartOption.series[1].data = [] } @@ -615,14 +648,14 @@ export default { this.isInverse = true }, // 输入框发生变化 - newCalibrationFuncModelChange(val,a) { + newCalibrationFuncModelChange(val, a) { // 输入内容的时候 需要清空table数据 20231028:Xiao this.list = [] // 需要清空chart黄色的线 20231028:Xiao - if(this.figureChartOption.series[1].data) { + if (this.figureChartOption.series[1].data) { this.figureChartOption.series[1].data = [] } - if(this.figureChartOption.series[1].markPoint.data) { + if (this.figureChartOption.series[1].markPoint.data) { this.figureChartOption.series[1].markPoint.data = [] } }, @@ -655,13 +688,16 @@ export default { // 点击Reset Button 重置 async handleReset() { - this.$ls.remove("CALIBRATION_GAMMA_"+this.newSampleData.inputFileName) // 删除fitting之后缓存的数据 20231101:xiao + this.$ls.remove('CALIBRATION_GAMMA_' + this.newSampleData.inputFileName) // 删除fitting之后缓存的数据 20231101:xiao this.newCalibrationFuncModel = cloneDeep(newCalibrationFuncModel) this.list = [] this.newE2C = [] // 按乔的要求增加请求reset的接口 20231211:xiao - const res = await postAction('/spectrumAnalysis/resetButton?tabName=gamma&sampleFileName='+ this.newSampleData.inputFileName, { }) + const res = await postAction( + '/spectrumAnalysis/resetButton?tabName=gamma&sampleFileName=' + this.newSampleData.inputFileName, + {} + ) this.$emit('isFitting', false) @@ -680,32 +716,32 @@ export default { } try { const { success, result, message } = await postAction('/spectrumAnalysis/fitting', { - ...this.list.length <= 0 ? this.newCalibrationFuncModel : [], // 如果list有数据则不传 C to E 表单数据 20231101:xiao + ...(this.list.length <= 0 ? this.newCalibrationFuncModel : []), // 如果list有数据则不传 C to E 表单数据 20231101:xiao sampleFileName: this.newSampleData.inputFileName, - tabName: "gamma", + tabName: 'gamma', // 如果列表中有数据 以列表的数据优先进行分析 20231028:Xiao - tempPoints: this.list.length > 0 - ? this.list.map((item) => ({ x: item.channel, y: item.energy })) - : this.oldScatterSeries, - - // tempPoints: this.isFirstFitting - // ? this.oldScatterSeries - // : this.list.map((item) => ({ x: item.channel, y: item.energy })), + tempPoints: + this.list.length > 0 + ? this.list.map((item) => ({ x: item.channel, y: item.energy })) + : this.oldScatterSeries, + + // tempPoints: this.isFirstFitting + // ? this.oldScatterSeries + // : this.list.map((item) => ({ x: item.channel, y: item.energy })), count: this.isFirstFitting || !this.isInverse ? undefined : this.count, - fittingBtn : this.isFirstFitting + fittingBtn: this.isFirstFitting, }) if (success) { this.gammaIsFitting = true this.$emit('isFitting', true) // 点击reAnalyze按钮,将isFirstFitting改为true 20231101:xiao - this.setCache("CALIBRATION_GAMMA_"+this.newSampleData.inputFileName, result) // 缓存数据,如果点击ReAnalyze需要回显数据 20231101:xiao + this.setCache('CALIBRATION_GAMMA_' + this.newSampleData.inputFileName, result) // 缓存数据,如果点击ReAnalyze需要回显数据 20231101:xiao this.setFirringResult(result) // 通知Beta页清空数据 this.$bus.$emit('betaRefresh', {}) - console.log("betaRefresh>>>"); - + console.log('betaRefresh>>>') } else { this.$message.error(message) } @@ -715,7 +751,7 @@ export default { }, // 封装 fitting后数据填充方法,如果点击ReAnalyze需要回显数据 20231101:xiao - setFirringResult(result){ + setFirringResult(result) { const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result this.newE2C = EToC this.newLineSeries = newLineSeries @@ -797,15 +833,15 @@ export default { } return 0 }, - getCache(name){ + getCache(name) { return this.$ls.get(name) }, - setCache(name, data){ + setCache(name, data) { this.$ls.set(name, data) }, - removeCache(name){ + removeCache(name) { this.$ls.remove(name) // 删除fitting之后缓存的数据 20231101:xiao - } + }, }, } diff --git a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue index b356b6b..8523ca9 100644 --- a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue @@ -23,7 +23,7 @@