From 0a021a3c53da160fcc18e7779b6623bc49727e14 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Tue, 10 Oct 2023 15:55:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Load=20From=20File=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=97=B6=E4=BF=9D=E7=95=99=E8=A1=A8=E6=A0=BC=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=96=9C=E7=8E=87=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=97=B6=E5=80=BC=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=9C=89=E6=96=9C=E7=8E=87=E7=9A=84?= =?UTF-8?q?=E5=9F=BA=E7=BA=BF=E6=8E=A7=E5=88=B6=E7=82=B9=E6=97=81=E8=BE=B9?= =?UTF-8?q?+=E5=8F=B7=E4=BD=8D=E7=BD=AE=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DPeak=20Infomation=E5=88=87=E6=8D=A2=E6=97=B6?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=9B=BE=E8=A1=A8=E6=A0=87=E9=A2=98=E6=9C=AA?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/EditSlopeModal.vue | 2 +- .../AnalyzeInteractiveToolModal/index.vue | 14 ++++--- .../components/Modals/LoadFromFileModal.vue | 8 ++-- src/views/spectrumAnalysis/gamma-analysis.vue | 42 ++++++++++++++----- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue index 5b5e4e1..4dc3de0 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue @@ -37,7 +37,7 @@ export default { }, handleOK() { if (this.allowNaN || this.value) { - this.$emit('change', this.value || 0, this.index, this.prevValue) + this.$emit('change', this.value, this.index, this.prevValue) this.visible = false } else { this.$message.warn('Input value invalid.') diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index 88d85dd..f65cb81 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -206,6 +206,7 @@ import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' import GeneralCommentModal from './components/GeneralCommentModal.vue' import EditSlopeModal from './components/EditSlopeModal.vue' import Response from './Response.json' +import { isNullOrUndefined } from '@/utils/util' // 初始配置 const initialOption = { @@ -414,7 +415,7 @@ const nuclideIdentifyModal = { } // 操作类型 -export const Operators = { +const Operators = { ADD: 1, // 新增 REMOVE: 2, // 移除 MODIFY: 3, // 改变 @@ -693,6 +694,7 @@ export default { if (!peaksBetweenChannel.length) { this.$message.warn(`There are 0 peak between channel ${left} and ${right}`) + this.isFitting = false return } @@ -1377,9 +1379,9 @@ export default { xctrlList.forEach((xctrl, index) => { const yctrl = yctrlList[index] const yslope = yslopeList[index] - if (yslope != 0) { - plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope)) + if (!isNullOrUndefined(yslope)) { plusGraphic.push(this.buildGraphicPlus(xctrl - 2, yctrl - 2 * yslope)) + plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope)) } }) this.option.graphic[1].children = plusGraphic @@ -1396,11 +1398,11 @@ export default { $action: 'replace', position: [xPix, yPix], style: { - x: -10, - y: -10, text: '+', fill: '#0f0', - font: 'bolder 20px "Microsoft YaHei", sans-serif' + font: 'bolder 20px "Microsoft YaHei", sans-serif', + textAlign: 'center', + textVerticalAlign: 'middle' }, zlevel: 101 } diff --git a/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue index d4a4e3f..9d50107 100644 --- a/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue @@ -319,6 +319,9 @@ export default { canUseFilePicker, } }, + created() { + this.handleReset() + }, methods: { // 初始化为10*4的表格 getInitialList() { @@ -386,6 +389,7 @@ export default { if (!isFileInDirectory) { this.$message.warn('File and Directory Not in Same') this.directoryHanlder = undefined + this.useFilePicker(column, record, rowIndex) return } @@ -679,10 +683,6 @@ export default { handleCancel() { this.visible = false }, - - beforeModalOpen() { - this.handleReset() - }, }, } diff --git a/src/views/spectrumAnalysis/gamma-analysis.vue b/src/views/spectrumAnalysis/gamma-analysis.vue index c6d48af..401acb4 100644 --- a/src/views/spectrumAnalysis/gamma-analysis.vue +++ b/src/views/spectrumAnalysis/gamma-analysis.vue @@ -194,7 +194,7 @@ export default { } }, created() { - this.option.title.text = '{a|Channel:0} {a|Energy:0} {a|Counts:0} {a|Detectability:0}' + this.setChartBottomTitle(0, 0, 0) this.option.tooltip.formatter = this.tooltipFormatter this.$bus.$on('colorChange', this.handleColorChange) @@ -458,7 +458,7 @@ export default { } return `
Channel: ${channel}
-
Energy: ${energy}
` +
${energy? `Energy: ${energy}`: ''}
` }, // Graph Assistance 操作 @@ -643,19 +643,37 @@ export default { const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum') spectrumLineSeries.markLine.data[0].xAxis = xAxis - const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed()) - const energy = this.isEnergy() - ? xAxis.toFixed(2) - : this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2) - const counts = this.isEnergy() - ? this.energyData.all.pointlist[channel - 1] - : this.channelData.all.pointlist[channel - 1] - this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts.y}} {a|Detectability:0}` + const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(xAxis) + this.setChartBottomTitle(channel, energy, counts) this.getSelPosNuclide(channel) } }, + // 设置图表底部的标题 + setChartBottomTitle(channel, energy, counts) { + this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts}} {a|Detectability:0}` + }, + + // 根据xAixs值找channel、energy和counts + getEnergyAndCountsByXAxis(xAxis) { + let channel, energy, counts + if (this.isEnergy()) { + channel = this.getChannelByEnergy(xAxis) + energy = xAxis.toFixed(2) + counts = this.energyData.all.pointlist[channel - 1] + } else { + channel = parseInt(xAxis.toFixed()) + energy = this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2) + counts = this.channelData.all.pointlist[channel - 1] + } + return { + channel, + energy, + counts: counts.y + } + }, + // 双击还原 handleChartDblClick() { this.handleResetChart() @@ -789,6 +807,8 @@ export default { if (find) { this.getSelPosNuclide(find) + const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(find) + this.setChartBottomTitle(channel, energy, counts) } }, @@ -1135,6 +1155,8 @@ export default { } } catch (error) { console.error(error) + } finally { + this.isLoading = false } // this.reprocessingModalVisible = true },