From a921c64f6b22e9c112a26b19f6edd4572195bc3b Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Thu, 21 Sep 2023 19:41:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=8F=8A=E5=8A=9F=E8=83=BD,=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0Gamma=E7=9A=84Save=20to=20DB=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E5=AE=8C=E6=88=90Gamma=20Calibration?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E4=B8=AD=E7=9A=84Call=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CustomChart/index.vue | 2 +- src/utils/number.js | 10 ++++ .../spectrumAnalysis/beta-gamma-analysis.vue | 20 ++++++-- .../components/Modals/ArrRrrModal.vue | 4 +- .../Modals/EfficiencyCalibrationModal.vue | 49 ++++++++++++++++++- .../Modals/EnergyCalibrationModal.vue | 49 ++++++++++++++++++- .../components/Modals/LoadFromDBModal.vue | 10 ++-- .../components/Modals/NuclideLibraryModal.vue | 37 +++++++++----- .../Modals/ResolutionCalibrationModal.vue | 49 ++++++++++++++++++- .../Modals/SampleInfomationModal.vue | 47 +++++++++--------- src/views/spectrumAnalysis/gamma-analysis.vue | 10 +++- src/views/spectrumAnalysis/index.vue | 49 +++++++++++-------- 12 files changed, 268 insertions(+), 68 deletions(-) create mode 100644 src/utils/number.js diff --git a/src/components/CustomChart/index.vue b/src/components/CustomChart/index.vue index d568449..bc36294 100644 --- a/src/components/CustomChart/index.vue +++ b/src/components/CustomChart/index.vue @@ -6,7 +6,7 @@ import * as echarts from 'echarts' import 'echarts-gl' const events = ['click', 'brushEnd'] -const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click'] +const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'] export default { props: { option: { diff --git a/src/utils/number.js b/src/utils/number.js new file mode 100644 index 0000000..19df3b6 --- /dev/null +++ b/src/utils/number.js @@ -0,0 +1,10 @@ +import { isNullOrUndefined } from './util' + +/** + * 保留小数 + * @param { string | number } num 数字 + * @param { number } digit 保留位数 + */ +export const toFixed = (num, digit) => { + return isNullOrUndefined(num) ? '' : Number(num).toFixed(digit) +} diff --git a/src/views/spectrumAnalysis/beta-gamma-analysis.vue b/src/views/spectrumAnalysis/beta-gamma-analysis.vue index 6932644..072e3dc 100644 --- a/src/views/spectrumAnalysis/beta-gamma-analysis.vue +++ b/src/views/spectrumAnalysis/beta-gamma-analysis.vue @@ -11,7 +11,13 @@ QC Flags - + @@ -353,12 +359,11 @@ export default { // 重新分析,设置右侧折线图的Energy reanalyse([type, data]) { const energy = data.map(item => [item.y]) - if(type == 'gamma') { + if (type == 'gamma') { this.gammaEnergyData = energy } else { this.betaEnergyData = energy } - } }, watch: { @@ -386,6 +391,15 @@ export default { } } + .sample-select { + ::v-deep { + .ant-select-selection { + background-color: transparent !important; + color: #ade6ee; + } + } + } + &-main { height: calc(100% - 51px); display: flex; diff --git a/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue b/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue index 46d0c17..cf4f1b5 100644 --- a/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue @@ -1,5 +1,5 @@ @@ -235,6 +223,7 @@ import BetaGammaEnergyCalibrationModal from './components/Modals/BetaGammaModals import StripModal from './components/Modals/StripModal.vue' import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue' import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue' +import { getAction } from '@/api/manage' // 分析类型 const ANALYZE_TYPE = { @@ -384,10 +373,10 @@ export default { }, handleLoadSampleFromFile(sampleList) { let arr = sampleList.filter(item => { - return Object.keys(item).length>4 + return Object.keys(item).length > 4 }) arr.forEach(item => { - item.sampleId = "" + item.sampleId = '' item.inputFileName = item.sampleFileName item.sampleType = item.sampleSystemType }) @@ -424,8 +413,28 @@ export default { * 保存结果到数据库 * @param { 'all' | 'current' } type */ - handleSaveResultsToDB(type) { + async handleSaveResultsToDB(type) { console.log('%c [ saveResultsToDB ]-157', 'font-size:13px; background:pink; color:#bf2c9f;', type) + if (this.isBetaGamma) { + } else if (this.isGamma) { + if (type == 'current') { + const hideLoading = this.$message.loading('Saving...', 0) + try { + const { success, message } = await getAction('/gamma/saveToDB', { + fileName: this.sampleData.inputFileName + }) + if (success) { + this.$message.success('Save Success') + } else { + this.$message.error(message) + } + } catch (error) { + console.error(error) + } finally { + hideLoading() + } + } + } }, /** @@ -906,7 +915,7 @@ export default { type: 'a-menu-item', title: 'Automatic Analysis Log', handler: () => { - this.autoAnalysisMogModalType = this.isGamma?1:this.isBetaGamma?2:1 + this.autoAnalysisMogModalType = this.isGamma ? 1 : this.isBetaGamma ? 2 : 1 this.autoAnalysisMogModalVisible = true } },