From 481fcf99c3adc876a8ab3d5aa03232a05824d863 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Thu, 2 Nov 2023 16:49:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2?= =?UTF-8?q?Peak=E5=88=87=E9=A1=B5=E6=97=B6barChart=E6=9C=AA=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalyzeInteractiveToolModal/index.vue | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index a458076..c631035 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -550,9 +550,7 @@ export default { this.option.series = series this.thumbnailOption.series = this.buildBarChart(bar) - const thumbnailYMax = this.getThumbnailYMax(0, bar.length) - this.thumbnailOption.yAxis.max = thumbnailYMax - this.thumbnailOption.yAxis.min = -thumbnailYMax + this.setThumbnailRange(1, bar.length) }, reset() { @@ -712,6 +710,8 @@ export default { let nextMin = xAxis - halfDiff chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax chartXAxisOption.min = nextMin < 1 ? 1 : nextMin + + this.setThumbnailRange(chartXAxisOption.min, chartXAxisOption.max) } }, @@ -960,6 +960,8 @@ export default { let nextMin = channel - halfDiff chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax chartXAxisOption.min = nextMin < 1 ? 1 : nextMin + + this.setThumbnailRange(chartXAxisOption.min, chartXAxisOption.max) } this.getSelPosNuclide(row) @@ -1030,12 +1032,7 @@ export default { this.option.yAxis.min = y1 this.option.yAxis.max = y2 - const thumbnailYMax = this.getThumbnailYMax(x1 - 1, x2) - this.thumbnailOption.xAxis.min = x1 - this.thumbnailOption.xAxis.max = x2 - this.thumbnailOption.yAxis.max = thumbnailYMax - this.thumbnailOption.yAxis.min = -thumbnailYMax - + this.setThumbnailRange(x1, x2) if (this.btnGroupType == 2) { this.buildRect() } @@ -1044,12 +1041,17 @@ export default { }, // 查找barChart范围内的最大值 - getThumbnailYMax(minIndex, maxIndex) { - const slicedArr = this.barChart.slice(minIndex, maxIndex) + setThumbnailRange(x1, x2) { + const slicedArr = this.barChart.slice(x1 - 1, x2) const yData = slicedArr.map(({ y }) => y) const max = Math.max(...yData) const min = Math.min(...yData) - return Math.max(Math.abs(max), Math.abs(min)) + const thumbnailYMax = Math.max(Math.abs(max), Math.abs(min)) + + this.thumbnailOption.xAxis.min = x1 + this.thumbnailOption.xAxis.max = x2 + this.thumbnailOption.yAxis.max = thumbnailYMax + this.thumbnailOption.yAxis.min = -thumbnailYMax }, handleResetChart() { @@ -1058,11 +1060,7 @@ export default { this.option.yAxis.min = 0.1 this.option.yAxis.max = 'dataMax' - const thumbnailYMax = this.getThumbnailYMax(0, this.barChart.length) - this.thumbnailOption.xAxis.min = 1 - this.thumbnailOption.xAxis.max = 'dataMax' - this.thumbnailOption.yAxis.max = thumbnailYMax - this.thumbnailOption.yAxis.min = -thumbnailYMax + this.setThumbnailRange(1, this.barChart.length) if (this.btnGroupType == 2) { this.buildRect() From 36c42be01fb6699df69146899e082b579de23943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=8F=AE=E5=AE=87?= Date: Thu, 2 Nov 2023 17:55:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E5=88=86?= =?UTF-8?q?=E6=9E=90=E8=BF=87=EF=BC=8Csave=20to=20db=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD=EF=BC=8C=E4=B8=8D=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E8=AF=B7=E6=B1=82=E6=8E=A5=E5=8F=A3=20=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5=EF=BC=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=8A=8A=E6=8E=A5=E5=8F=A3=E9=94=99=E8=AF=AF=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=8F=90=E7=A4=BA=E5=A4=84=E7=90=86=20Beta=E4=B8=8D?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E6=98=BE=E7=A4=BA=20save=20current=20save=20?= =?UTF-8?q?to=20db=20=E6=B2=A1=E6=9C=89=E8=A7=A6=E5=8F=91=E2=80=9C?= =?UTF-8?q?=E8=BD=AC=E5=9C=88=E2=80=9D=E7=89=B9=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spectrumAnalysis/beta-gamma-analysis.vue | 1 - src/views/spectrumAnalysis/index.vue | 86 +++++++++++-------- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/src/views/spectrumAnalysis/beta-gamma-analysis.vue b/src/views/spectrumAnalysis/beta-gamma-analysis.vue index 8fb72a7..2915521 100644 --- a/src/views/spectrumAnalysis/beta-gamma-analysis.vue +++ b/src/views/spectrumAnalysis/beta-gamma-analysis.vue @@ -461,7 +461,6 @@ export default { qcFileNames: [this.sample.qcFileName], } postAction('/spectrumAnalysis/analyseCurrentSpectrum', params).then((res) => { - console.log('分析分析', res) if (res.success) { // this.isReAnalyed_beta = true this.analyseCurrentSpectrum = res.result diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index c4c2281..028cc33 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -378,18 +378,19 @@ export default { resultDisplayFlag: [], params_toDB: { comment: '', + savedAnalysisResult: false, stationName: '', dbName: '', sampleFileName: '', gasFileName: '', detFileName: '', qcFileName: '', - bGammaEnergyValidSample: false, - bBetaEnergyValidSample: false, - bGammaEnergyValidGas: false, - bBetaEnergyValidGas: false, - bGammaEnergyValidDet: false, - bBetaEnergyValidDet: false, + // bGammaEnergyValidSample: false, + // bBetaEnergyValidSample: false, + // bGammaEnergyValidGas: false, + // bBetaEnergyValidGas: false, + // bGammaEnergyValidDet: false, + // bBetaEnergyValidDet: false, checkSample: false, checkGas: false, checkDet: false, @@ -426,6 +427,7 @@ export default { methods: { getReAnalyCurr(flag, val) { this.isReAnalyed_beta = flag + this.params_toDB.savedAnalysisResult = true this.resultDisplayFlag = val }, getReAnalyAll(val) { @@ -504,6 +506,7 @@ export default { this.analysisType = ANALYZE_TYPE.GAMMA } this.sampleData = this.newSampleData = sample + this.params_toDB.savedAnalysisResult = sample.sampleId ? true : false this.params_toDB.comment = '' }, @@ -589,11 +592,8 @@ export default { * @param { 'all' | 'current' } type */ async handleSaveResultsToDB(type) { - if (this.isBetaGamma) { - if (type === 'current') { - this.handleSaveResultsToDB_Cuurrent() - } - } else if (this.isGamma) { + if (this.isReAnalyed_gamma) { + this.isSaving = true if (type == 'current') { const hideLoading = this.$message.loading('Saving...', 0) try { @@ -609,36 +609,42 @@ export default { console.error(error) } finally { hideLoading() + this.isSaving = true } } } }, handleSaveResultsToDB_Cuurrent() { // xeflag params_toDB - if (this.resultDisplayFlag.length > 0) { - this.resultDisplayFlag.forEach((item) => { - if (item.nuclideName === 'Xe131m') { - this.params_toDB.xe131mFlag = item.nidFlag - } else if (item.nuclideName === 'Xe133') { - this.params_toDB.xe133Flag = item.nidFlag - } else if (item.nuclideName === 'Xe133m') { - this.params_toDB.xe133mFlag = item.nidFlag - } else if (item.nuclideName === 'Xe135') { - this.params_toDB.xe135Flag = item.nidFlag - } - }) - this.params_toDB.sampleFileName = this.newSampleData.inputFileName - this.params_toDB.gasFileName = this.newSampleData.gasFileName - this.params_toDB.detFileName = this.newSampleData.detFileName - this.params_toDB.qcFileName = this.newSampleData.qcFileName - this.params_toDB.dbName = this.newSampleData.dbName - postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => { - if (res.success) { - this.$message.success('Save Successfully!') - } else { - this.$message.warning('Fail To Save') - } - }) + if (this.params_toDB.savedAnalysisResult) { + if (this.resultDisplayFlag.length > 0) { + this.resultDisplayFlag.forEach((item) => { + if (item.nuclideName === 'Xe131m') { + this.params_toDB.xe131mFlag = item.nidFlag + } else if (item.nuclideName === 'Xe133') { + this.params_toDB.xe133Flag = item.nidFlag + } else if (item.nuclideName === 'Xe133m') { + this.params_toDB.xe133mFlag = item.nidFlag + } else if (item.nuclideName === 'Xe135') { + this.params_toDB.xe135Flag = item.nidFlag + } + }) + this.params_toDB.sampleFileName = this.newSampleData.inputFileName + this.params_toDB.gasFileName = this.newSampleData.gasFileName + this.params_toDB.detFileName = this.newSampleData.detFileName + this.params_toDB.qcFileName = this.newSampleData.qcFileName + this.params_toDB.dbName = this.newSampleData.dbName + this.isSaving = true + postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => { + if (res.success) { + this.$message.success('Save Successfully!') + this.isSaving = true + } else { + this.isSaving = true + this.$message.warning(`${res.message}`) + } + }) + } } }, @@ -852,6 +858,7 @@ export default { show: this.isBetaGamma, }, ], + key: 'resultsToFile', }, { title: 'Save Results to DB', @@ -859,6 +866,7 @@ export default { { title: 'Save Current', key: 'current', + show: this.isGamma, }, { title: 'Save All', @@ -887,10 +895,14 @@ export default { width: '170px', }, on: { - menuClick: () => { - if (this.isGamma) { + menuClick: (item) => { + if (this.isGamma && item.key == 'resultsToFile') { this.saveSettingModalVisible = true } + if (this.isBetaGamma && item.key == 'resultsToDB') { + // beta save to db + this.handleSaveResultsToDB_Cuurrent() + } }, submenuClick: ({ item, child }) => { if (item.key == 'resultsToDB') {