From 006ae8fc22d8714c05e4bd63ac11cb4188533faf Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Wed, 15 Nov 2023 19:14:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=A7=A3=E5=86=B3beta=E8=B0=B1=E5=9C=A8cal?= =?UTF-8?q?ibration=E5=88=86=E6=9E=90=E5=90=8E=E5=BA=94=E7=94=A8all?= =?UTF-8?q?=EF=BC=8C=E5=85=B6=E4=BB=96=E8=B0=B1=E6=B2=A1=E6=9C=89=E7=BC=93?= =?UTF-8?q?=E5=AD=98calibration=E5=8F=82=E6=95=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spectrumAnalysis/clearSampleCache.js | 3 +- .../components/BetaDetectorCalibration.vue | 8 ++-- .../components/GammaDetectorCalibration.vue | 8 ++-- .../BetaGammaEnergyCalibrationModal/index.vue | 39 ++++++++++++++++--- 4 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/views/spectrumAnalysis/clearSampleCache.js b/src/views/spectrumAnalysis/clearSampleCache.js index d73971b..76f0e6b 100644 --- a/src/views/spectrumAnalysis/clearSampleCache.js +++ b/src/views/spectrumAnalysis/clearSampleCache.js @@ -17,6 +17,7 @@ export const clearSampleCache = sampleList => { } deleteAction(url, params) store.commit('REMOVE_SAMPLE_DATA', fileName) - Vue.ls.remove(`calibration-gamma:${fileName}`) + Vue.ls.remove(`CALIBRATION_GAMMA_${fileName}`) + Vue.ls.remove(`CALIBRATION_BETA_${fileName}`) }) } 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 a895bd4..c4db8f4 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue @@ -655,8 +655,8 @@ 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)) + if(this.getCache("CALIBRATION_BETA_"+this.newSampleData.inputFileName)) { + this.setFirringResult(this.getCache("CALIBRATION_BETA_"+this.newSampleData.inputFileName)) return false; } } else { @@ -877,7 +877,7 @@ export default { // 点击Reset Button 重置 handleReset() { - 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 = [] @@ -914,7 +914,7 @@ 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) 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 509a1d0..da65891 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue @@ -532,8 +532,8 @@ 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)) + if(this.getCache("CALIBRATION_GAMMA_"+this.newSampleData.inputFileName)) { + this.setFirringResult(this.getCache("CALIBRATION_GAMMA_"+this.newSampleData.inputFileName)) return false; } } else { @@ -657,7 +657,7 @@ export default { // 点击Reset Button 重置 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 = [] @@ -693,7 +693,7 @@ export default { this.gammaIsFitting = false 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) diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue index 4a24e3f..7796652 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue @@ -154,9 +154,11 @@ export default { this.$bus.$emit('ReAnalyses', res.result) if (this.newCalibrationIsAppliedTo == 'AllSpectrum') { - this.clearSameStationCache( - matchedSampleList.filter((item) => item.inputFileName !== this.newSampleData.inputFileName) + let sameStation = matchedSampleList.filter( + (item) => item.inputFileName !== this.newSampleData.inputFileName ) + this.clearSameStationCache(sameStation) + this.setSameStationCalibarationCache(sameStation) } } else { this.$message.warning(res.message) @@ -167,16 +169,41 @@ export default { // 清理相同台站的缓存 clearSameStationCache(sampleList) { sampleList.forEach(({ inputFileName }) => { + console.log('inputFileName>>' + inputFileName) this.$store.commit('REMOVE_SAMPLE_DATA', inputFileName) - this.$ls.remove('calibration-gamma:' + inputFileName) + }) + }, + // 相同台站能谱缓存一样的Calibration数据 20231115:xiao + setSameStationCalibarationCache(sampleList) { + sampleList.forEach(({ inputFileName }) => { + console.log('inputFileName:' + inputFileName) + // 根据tab页缓存对应数据 + if (this.currTab === 'gamma') { + this.$ls.set( + 'CALIBRATION_GAMMA_' + inputFileName, + this.$ls.get('CALIBRATION_GAMMA_' + this.newSampleData.inputFileName) + ) + } + if (this.currTab === 'beta') { + this.$ls.set( + 'CALIBRATION_BETA_' + inputFileName, + this.$ls.get('CALIBRATION_BETA_' + this.newSampleData.inputFileName) + ) + } }) }, handleExit() { + console.log('this.currTab>>>' + this.currTab) this.gammaEnergyValid = this.isReanlyze - console.log('exit>>>this.isReanlyze>>>' + this.isReanlyze) - if (!this.isReanlyze && this.$ls.get('calibration-gamma:' + this.newSampleData.inputFileName)) { - this.$ls.remove('calibration-gamma:' + this.newSampleData.inputFileName) // 如果没有点击ReANalyze,删除fitting之后缓存的数据 20231101:xiao + if (!this.isReanlyze) { + // 如果没有点击ReANalyze,删除fitting之后缓存的数据 20231101:xiao + if (this.currTab === 'gamma') { + this.$ls.remove('CALIBRATION_GAMMA_' + this.newSampleData.inputFileName) + } + if (this.currTab === 'beta') { + this.$ls.remove('CALIBRATION_BETA_' + this.newSampleData.inputFileName) + } } this.visible = false },