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 },