diff --git a/src/views/spectrumAnalysis/SampleDataMixin.js b/src/views/spectrumAnalysis/SampleDataMixin.js index 0c5f18a..44c5d57 100644 --- a/src/views/spectrumAnalysis/SampleDataMixin.js +++ b/src/views/spectrumAnalysis/SampleDataMixin.js @@ -1,8 +1,11 @@ export default { - inject: ['sample'], + inject: ['sample', 'newSample'], computed: { sampleData() { return this.sample() + }, + newSampleData() { + return this.newSample() } } } diff --git a/src/views/spectrumAnalysis/beta-gamma-analysis.vue b/src/views/spectrumAnalysis/beta-gamma-analysis.vue index fe9a126..7631850 100644 --- a/src/views/spectrumAnalysis/beta-gamma-analysis.vue +++ b/src/views/spectrumAnalysis/beta-gamma-analysis.vue @@ -222,13 +222,6 @@ export default { currSample: {}, } }, - mounted() { - if (this.currSample.sampleId) { - this.getSampleDetail() - } else { - this.getSampleDetail_file() - } - }, methods: { async getSampleDetail() { this.spectraType = this.SampleType[0].value @@ -244,7 +237,11 @@ export default { this.sampleDetail = result this.changeChartByType('sample') this.isLoading = false - this.$emit('getFiles', { detFileName: result.detBg.fileName, gasFileName: result.gasBg.fileName }) + this.$emit('getFiles', { + detFileName: result.detBg.fileName, + gasFileName: result.gasBg.fileName, + qcFileName: result.qc.fileName || '', + }) } else { this.$message.error(message) } @@ -400,7 +397,9 @@ export default { sample: { handler(newVal, oldVal) { if (newVal.sampleId) { - this.currSample = newVal + this.getSampleDetail() + } else { + this.getSampleDetail_file() } }, immediate: true, 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 3fbf76a..22ab33c 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/BetaDetectorCalibration.vue @@ -53,7 +53,7 @@ class="custom-tool-tip" :style="{ top: tooltipPosition.top + 'px', - left: tooltipPosition.left + 'px' + left: tooltipPosition.left + 'px', }" >
Channel: {{ tooltipChannel }}
@@ -82,7 +82,7 @@ :scroll="{ y: 99 }" > @@ -179,103 +179,104 @@ import { cloneDeep } from 'lodash' import { exportEchartImg, getXAxisAndYAxisByPosition, splitAxis } from '@/utils/chartHelper' import { graphic } from 'echarts' import { isNullOrUndefined } from '@/utils/util' +import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' const initialBetaGammaChartOption = { grid: { top: 15, left: 55, right: 10, - bottom: 45 + bottom: 45, }, xAxis: { name: 'Beta Channel', nameTextStyle: { color: '#5b9cba', - fontSize: 16 + fontSize: 16, }, nameLocation: 'center', nameGap: 30, axisLine: { lineStyle: { - color: 'rgba(119, 181, 213, .3)' - } + color: 'rgba(119, 181, 213, .3)', + }, }, axisLabel: { color: '#ade6ee', - fontSize: 12 + fontSize: 12, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .3)' - } + color: 'rgba(119, 181, 213, .3)', + }, }, axisTick: { - show: false + show: false, }, min: 0, max: 256, - interval: 64 + interval: 64, }, yAxis: { name: 'Gamma Channel', nameTextStyle: { color: '#5b9cba', - fontSize: 16 + fontSize: 16, }, nameLocation: 'center', nameGap: 35, axisLine: { lineStyle: { - color: 'rgba(119, 181, 213, .3)' - } + color: 'rgba(119, 181, 213, .3)', + }, }, axisLabel: { color: '#ade6ee', - fontSize: 12 + fontSize: 12, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .3)' - } + color: 'rgba(119, 181, 213, .3)', + }, }, axisTick: { - show: false + show: false, }, min: 0, max: 256, - interval: 64 + interval: 64, }, series: { type: 'scatterGL', symbolSize: 2, data: [], itemStyle: { - color: '#fff' + color: '#fff', }, - cursor: 'default' - } + cursor: 'default', + }, } const initialGammaGatedChartOption = { grid: { top: 10, right: 15, - bottom: 50 + bottom: 50, }, tooltip: { trigger: 'axis', axisPointer: { lineStyle: { - color: '#099D24' - } + color: '#099D24', + }, }, - formatter: params => { + formatter: (params) => { const [channel] = params[0].value return `
Channel: ${channel}
` }, - className: 'figure-chart-option-tooltip' + className: 'figure-chart-option-tooltip', }, xAxis: { min: 0, @@ -283,28 +284,28 @@ const initialGammaGatedChartOption = { interval: 64, axisLine: { lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Channel', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 35 + nameGap: 35, }, yAxis: { min: 0, @@ -313,79 +314,79 @@ const initialGammaGatedChartOption = { axisLine: { show: true, lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Count', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 25 + nameGap: 25, }, series: { type: 'line', itemStyle: { - color: '#04ADD9' + color: '#04ADD9', }, areaStyle: { color: new graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, - color: 'rgba(4, 173, 217, 0.87)' + color: 'rgba(4, 173, 217, 0.87)', }, { offset: 1, - color: 'rgba(4, 173, 217, 0.05)' - } - ]) + color: 'rgba(4, 173, 217, 0.05)', + }, + ]), }, symbol: 'none', data: [], markLine: { symbol: 'none', label: { - show: false + show: false, }, animation: false, emphasis: { - disabled: true + disabled: true, }, lineStyle: { - color: '#f00' + color: '#f00', }, - data: [] - } - } + data: [], + }, + }, } const initialFigureChartOption = { grid: { top: 10, right: 15, - bottom: 50 + bottom: 50, }, tooltip: { trigger: 'axis', axisPointer: { lineStyle: { - color: '#099D24' - } + color: '#099D24', + }, }, - formatter: params => { + formatter: (params) => { const [series1, series2] = params const [channel, energy1] = series1.value @@ -399,7 +400,7 @@ const initialFigureChartOption = { return html }, - className: 'figure-chart-option-tooltip' + className: 'figure-chart-option-tooltip', }, xAxis: { min: 0, @@ -407,28 +408,28 @@ const initialFigureChartOption = { interval: 64, axisLine: { lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Channel', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 35 + nameGap: 35, }, yAxis: { min: 0, @@ -437,109 +438,110 @@ const initialFigureChartOption = { axisLine: { show: true, lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Energy[E/kev]', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 80 + nameGap: 80, }, series: [ { type: 'line', itemStyle: { - color: '#04ADD9' + color: '#04ADD9', }, symbol: 'none', data: [], markPoint: { symbol: 'circle', symbolSize: 8, - data: [] - } + data: [], + }, }, { type: 'line', itemStyle: { - color: 'yellow' + color: 'yellow', }, symbol: 'none', data: [], markPoint: { symbol: 'circle', symbolSize: 8, - data: [] - } - } - ] + data: [], + }, + }, + ], } const columns = [ { title: 'Index', dataIndex: 'rowCount', - align: 'center' + align: 'center', }, { title: 'Channel', dataIndex: 'channel', - align: 'center' + align: 'center', }, { title: 'Energy/keV', dataIndex: 'energy', align: 'center', - customRender: text => { + customRender: (text) => { return text.toPrecision(6) - } + }, }, { title: 'FWHM/C', dataIndex: 'c', - align: 'center' + align: 'center', }, { title: 'FWHM/keV', dataIndex: 'keV', - align: 'center' + align: 'center', }, { title: 'S', align: 'center', scopedSlots: { - customRender: 'operation' - } - } + customRender: 'operation', + }, + }, ] const newCalibrationFuncModel = { paramA: undefined, paramB: undefined, - paramC: undefined + paramC: undefined, } export default { + mixins: [SampleDataMixin], components: { CustomChart, TitleOverBorder }, props: { sampleId: { - type: Number - } + type: Number, + }, }, data() { this.columns = columns @@ -559,23 +561,23 @@ export default { markLineVisible: false, markLinePosition: { - top: 0 + top: 0, }, rectVisible: false, rectPosition: { - top: 0 + top: 0, }, tooltipVisible: false, tooltipPosition: { top: 0, - left: 0 + left: 0, }, channelAndEnergyModel: { channel: undefined, - energy: undefined + energy: undefined, }, c2e: {}, @@ -590,7 +592,7 @@ export default { count: 0, //反算时需要传递的数值 非反算的情况下不需要传递 数值大小是 第一次调用接口时返回的tableWidgets 大小 isFirstFitting: true, - isInverse: false // 是否需要反算 + isInverse: false, // 是否需要反算 } }, created() { @@ -604,21 +606,16 @@ export default { }, async getData() { + const { sampleId, qcFileName } = this.newSampleData try { this.isLoading = true const res = await getAction('/spectrumAnalysis/viewBetaDetectorCalibration', { - sampleId: this.sampleId + sampleId, + qcFileName, }) if (res.success) { - const { - CToE, - EToC, - betaEnergy, - gammaEnergy, - gammaGatedBetaSpectrum, - histogramData, - oldScatterSeries - } = res.result + const { CToE, EToC, betaEnergy, gammaEnergy, gammaGatedBetaSpectrum, histogramData, oldScatterSeries } = + res.result this.c2e = CToE this.e2c = EToC @@ -631,7 +628,7 @@ export default { this.gammaGatedBetaSpectrum = gammaGatedBetaSpectrum this.oldScatterSeries = oldScatterSeries - const gammaEnergyValue = betaEnergy.map(item => item[0]) + const gammaEnergyValue = betaEnergy.map((item) => item[0]) const gammaEnergyMax = Math.max(...gammaEnergyValue) const gammaEnergyMin = Math.min(...gammaEnergyValue) @@ -669,7 +666,7 @@ export default { this.currEnergy = parseFloat(this.gammaEnergy[yAxis][0].toFixed(2)) // 设置当前选中位置的Energy this.channelAndEnergyModel = { channel: undefined, - energy: undefined + energy: undefined, } this.getGammaGated(yAxis) @@ -682,12 +679,12 @@ export default { const { success, result: { data }, - message + message, } = await getAction('/spectrumAnalysis/getGammaGated', { gammaChannel, sampleId: this.sampleId, chartHeight: this.gammaEnergy.length, - channelWidth: this.gammaChannelWidth + channelWidth: this.gammaChannelWidth, }) if (success) { const max = Math.max(...data.map(({ y }) => y)) @@ -721,7 +718,7 @@ export default { const energy = gammaEnergy[0].toPrecision(6) this.betaGammaInfo = { channel: yAxis, - energy + energy, } } } @@ -760,7 +757,7 @@ export default { this.list.push({ rowCount: this.list.length + 1, channel, - energy + energy, }) this.figureChartOption.series[1].markPoint.data.push({ xAxis: channel, yAxis: energy }) @@ -780,7 +777,7 @@ export default { this.channelAndEnergyModel = { channel: undefined, - energy: undefined + energy: undefined, } this.isInverse = true @@ -791,7 +788,7 @@ export default { const willDelItem = this.list.splice(index, 1)[0] const findIndex = this.figureChartOption.series[1].markPoint.data.findIndex( - item => item.xAxis == willDelItem.channel && item.yAxis == willDelItem.energy + (item) => item.xAxis == willDelItem.channel && item.yAxis == willDelItem.energy ) if (-1 !== findIndex) { @@ -843,8 +840,8 @@ export default { ...this.newCalibrationFuncModel, tempPoints: this.isFirstFitting ? this.oldScatterSeries - : this.list.map(item => ({ x: item.channel, y: item.energy })), - count: this.isFirstFitting || !this.isInverse ? undefined : this.count + : this.list.map((item) => ({ x: item.channel, y: item.energy })), + count: this.isFirstFitting || !this.isInverse ? undefined : this.count, }) if (success) { this.isFirstFitting = false @@ -862,11 +859,11 @@ export default { this.newCalibrationFuncModel = { paramA: Number(paramA).toPrecision(6), paramB: Number(paramB).toPrecision(6), - paramC: Number(paramC).toPrecision(6) + paramC: Number(paramC).toPrecision(6), } } - const energyValues = newLineSeries.map(item => item.y) + const energyValues = newLineSeries.map((item) => item.y) const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis @@ -884,7 +881,7 @@ export default { this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => { return { xAxis: x, - yAxis: y + yAxis: y, } }) } @@ -901,22 +898,22 @@ export default { const [series0, series1] = this.figureChartOption.series const { data: data0, - markPoint: { data: markPointData0 } + markPoint: { data: markPointData0 }, } = series0 const { data: data1, - markPoint: { data: markPointData1 } + markPoint: { data: markPointData1 }, } = series1 const newArr = [ - ...data0.map(item => item[1]), - ...markPointData0.map(item => item.yAxis), - ...data1.map(item => item[1]), - ...markPointData1.map(item => item.yAxis) + ...data0.map((item) => item[1]), + ...markPointData0.map((item) => item.yAxis), + ...data1.map((item) => item[1]), + ...markPointData1.map((item) => item.yAxis), ] return { max: Math.max(...newArr), - min: Math.min(...newArr) + min: Math.min(...newArr), } }, @@ -938,15 +935,15 @@ export default { return `${Number(start).toPrecision(6)}${end ? 'e' + end : ''}` } return 0 - } + }, }, computed: { rectHeight() { const { top, bottom } = initialBetaGammaChartOption.grid const totalHeight = 427 - top - bottom return (totalHeight / 256) * this.gammaChannelWidth - } - } + }, + }, } 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 be1e2be..5e2d662 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/components/GammaDetectorCalibration.vue @@ -20,7 +20,7 @@ class="custom-tool-tip" :style="{ top: tooltipPosition.top + 'px', - left: tooltipPosition.left + 'px' + left: tooltipPosition.left + 'px', }" >
Channel: {{ tooltipChannel }}
@@ -53,7 +53,7 @@ :scroll="{ y: 99 }" > @@ -153,25 +153,26 @@ import { exportEchartImg, getXAxisAndYAxisByPosition, splitAxis } from '@/utils/ import { cloneDeep } from 'lodash' import { isNullOrUndefined } from '@/utils/util' +import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' const initialGammaSpectrumChartOption = { grid: { top: 10, right: 15, - bottom: 50 + bottom: 50, }, tooltip: { trigger: 'axis', axisPointer: { lineStyle: { - color: '#099D24' - } + color: '#099D24', + }, }, - formatter: params => { + formatter: (params) => { const [channel] = params[0].value return `
Channel: ${channel}
` }, - className: 'figure-chart-option-tooltip' + className: 'figure-chart-option-tooltip', }, xAxis: { min: 0, @@ -179,28 +180,28 @@ const initialGammaSpectrumChartOption = { interval: 64, axisLine: { lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Channel', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 35 + nameGap: 35, }, yAxis: { min: 0, @@ -209,79 +210,79 @@ const initialGammaSpectrumChartOption = { axisLine: { show: true, lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Count', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 60 + nameGap: 60, }, series: { type: 'line', itemStyle: { - color: '#04ADD9' + color: '#04ADD9', }, areaStyle: { color: new graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, - color: 'rgba(4, 173, 217, 0.87)' + color: 'rgba(4, 173, 217, 0.87)', }, { offset: 1, - color: 'rgba(4, 173, 217, 0.05)' - } - ]) + color: 'rgba(4, 173, 217, 0.05)', + }, + ]), }, symbol: 'none', data: [], markLine: { symbol: 'none', label: { - show: false + show: false, }, animation: false, emphasis: { - disabled: true + disabled: true, }, lineStyle: { - color: '#f00' + color: '#f00', }, - data: [] - } - } + data: [], + }, + }, } const initialFigureChartOption = { grid: { top: 10, right: 15, - bottom: 50 + bottom: 50, }, tooltip: { trigger: 'axis', axisPointer: { lineStyle: { - color: '#099D24' - } + color: '#099D24', + }, }, - formatter: params => { + formatter: (params) => { const [series1, series2] = params const [channel, energy1] = series1.value @@ -295,7 +296,7 @@ const initialFigureChartOption = { return html }, - className: 'figure-chart-option-tooltip' + className: 'figure-chart-option-tooltip', }, xAxis: { min: 0, @@ -303,28 +304,28 @@ const initialFigureChartOption = { interval: 64, axisLine: { lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Channel', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 35 + nameGap: 35, }, yAxis: { min: 0, @@ -333,109 +334,110 @@ const initialFigureChartOption = { axisLine: { show: true, lineStyle: { - color: 'rgb(119, 181, 213, 0.5)' - } + color: 'rgb(119, 181, 213, 0.5)', + }, }, splitLine: { show: true, lineStyle: { - color: 'rgba(119, 181, 213, .2)' - } + color: 'rgba(119, 181, 213, .2)', + }, }, axisTick: { - show: false + show: false, }, axisLabel: { - color: '#ade6ee' + color: '#ade6ee', }, name: 'Energy[E/kev]', nameLocation: 'center', nameTextStyle: { fontSize: 14, - color: '#5b9cba' + color: '#5b9cba', }, - nameGap: 80 + nameGap: 80, }, series: [ { type: 'line', itemStyle: { - color: '#04ADD9' + color: '#04ADD9', }, symbol: 'none', data: [], markPoint: { symbol: 'circle', symbolSize: 8, - data: [] - } + data: [], + }, }, { type: 'line', itemStyle: { - color: 'yellow' + color: 'yellow', }, symbol: 'none', data: [], markPoint: { symbol: 'circle', symbolSize: 8, - data: [] - } - } - ] + data: [], + }, + }, + ], } const columns = [ { title: 'Index', dataIndex: 'rowCount', - align: 'center' + align: 'center', }, { title: 'Channel', dataIndex: 'channel', - align: 'center' + align: 'center', }, { title: 'Energy/keV', dataIndex: 'energy', align: 'center', - customRender: text => { + customRender: (text) => { return text.toPrecision(6) - } + }, }, { title: 'FWHM/C', dataIndex: 'c', - align: 'center' + align: 'center', }, { title: 'FWHM/keV', dataIndex: 'keV', - align: 'center' + align: 'center', }, { title: 'S', align: 'center', scopedSlots: { - customRender: 'operation' - } - } + customRender: 'operation', + }, + }, ] const newCalibrationFuncModel = { paramA: undefined, paramB: undefined, - paramC: undefined + paramC: undefined, } export default { + mixins: [SampleDataMixin], components: { CustomChart, TitleOverBorder }, props: { sampleId: { - type: Number - } + type: Number, + }, }, data() { this.columns = columns @@ -453,13 +455,13 @@ export default { tooltipVisible: false, tooltipPosition: { top: 0, - left: 0 + left: 0, }, tooltipChannel: '', channelAndEnergyModel: { channel: undefined, - energy: undefined + energy: undefined, }, newCalibrationFuncModel: cloneDeep(newCalibrationFuncModel), @@ -469,7 +471,7 @@ export default { count: 0, //反算时需要传递的数值 非反算的情况下不需要传递 数值大小是 第一次调用接口时返回的tableWidgets 大小 isFirstFitting: true, - isInverse: false // 是否需要反算 + isInverse: false, // 是否需要反算 } }, created() { @@ -483,10 +485,12 @@ export default { }, async getData() { + const { sampleId, qcFileName } = this.newSampleData try { this.isLoading = true const res = await getAction('/spectrumAnalysis/viewGammaDetectorCalibration', { - sampleId: this.sampleId + sampleId, + qcFileName, }) if (res.success) { @@ -505,13 +509,13 @@ export default { this.gammaSpectrumChartOption.yAxis.interval = _interval this.gammaSpectrumChartOption.series.data = gammaSpectrum.map(({ x, y }) => [x, y]) - const gammaEnergyValue = gammaEnergy.map(item => item[0]) + const gammaEnergyValue = gammaEnergy.map((item) => item[0]) - const { max: __max, min: __min, interval: __interval } = splitAxis( - Math.max(...gammaEnergyValue), - Math.min(...gammaEnergyValue), - 4 - ) + const { + max: __max, + min: __min, + interval: __interval, + } = splitAxis(Math.max(...gammaEnergyValue), Math.min(...gammaEnergyValue), 4) this.figureChartOption.yAxis.max = __max this.figureChartOption.yAxis.min = __min @@ -570,7 +574,7 @@ export default { this.list.push({ rowCount: this.list.length + 1, channel, - energy + energy, }) this.figureChartOption.series[1].markPoint.data.push({ xAxis: channel, yAxis: energy }) @@ -590,7 +594,7 @@ export default { this.channelAndEnergyModel = { channel: undefined, - energy: undefined + energy: undefined, } this.isInverse = true @@ -601,7 +605,7 @@ export default { const willDelItem = this.list.splice(index, 1)[0] const findIndex = this.figureChartOption.series[1].markPoint.data.findIndex( - item => item.xAxis == willDelItem.channel && item.yAxis == willDelItem.energy + (item) => item.xAxis == willDelItem.channel && item.yAxis == willDelItem.energy ) if (-1 !== findIndex) { const markPointData = this.figureChartOption.series[1].markPoint.data @@ -644,8 +648,8 @@ export default { ...this.newCalibrationFuncModel, tempPoints: this.isFirstFitting ? this.oldScatterSeries - : this.list.map(item => ({ x: item.channel, y: item.energy })), - count: this.isFirstFitting || !this.isInverse ? undefined : this.count + : this.list.map((item) => ({ x: item.channel, y: item.energy })), + count: this.isFirstFitting || !this.isInverse ? undefined : this.count, }) if (success) { this.isFirstFitting = false @@ -663,11 +667,11 @@ export default { this.newCalibrationFuncModel = { paramA: Number(paramA).toPrecision(6), paramB: Number(paramB).toPrecision(6), - paramC: Number(paramC).toPrecision(6) + paramC: Number(paramC).toPrecision(6), } } - const energyValues = newLineSeries.map(item => item.y) + const energyValues = newLineSeries.map((item) => item.y) const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis @@ -684,7 +688,7 @@ export default { if (newScatterSeriesData) { this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => ({ xAxis: x, - yAxis: y + yAxis: y, })) } } else { @@ -700,22 +704,22 @@ export default { const [series0, series1] = this.figureChartOption.series const { data: data0, - markPoint: { data: markPointData0 } + markPoint: { data: markPointData0 }, } = series0 const { data: data1, - markPoint: { data: markPointData1 } + markPoint: { data: markPointData1 }, } = series1 const newArr = [ - ...data0.map(item => item[1]), - ...markPointData0.map(item => item.yAxis), - ...data1.map(item => item[1]), - ...markPointData1.map(item => item.yAxis) + ...data0.map((item) => item[1]), + ...markPointData0.map((item) => item.yAxis), + ...data1.map((item) => item[1]), + ...markPointData1.map((item) => item.yAxis), ] return { max: Math.max(...newArr), - min: Math.min(...newArr) + min: Math.min(...newArr), } }, @@ -737,8 +741,8 @@ export default { return `${Number(start).toPrecision(6)}${end ? 'e' + end : ''}` } return 0 - } - } + }, + }, } diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 8564210..2dd9692 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -285,6 +285,9 @@ export default { sample: () => { return this.sampleData }, + newSample: () => { + return this.newSampleData + }, } }, @@ -302,6 +305,7 @@ export default { ftransltModalVisible: false, // Ftransit 弹窗 sampleData: {}, // 要分析的谱数据 + newSampleData: {}, // 要分析的谱数据 saveSettingModalVisible: false, // 保存设置弹窗 @@ -372,7 +376,7 @@ export default { methods: { getFiles(val) { - this.sampleData = { ...this.sampleData, ...val } + this.newSampleData = { ...this.sampleData, ...val } }, /** * 从数据库加载-选择完成 @@ -519,6 +523,11 @@ export default { saveToDb() { console.log('savetodb') }, + handleEnergyCalib() { + if (this.newSampleData.qcFileName) { + this.betaGammaEnergyCalibrationModalVisible = true + } + }, }, computed: { // 顶部菜单栏配置 @@ -729,7 +738,7 @@ export default { type: 'a-menu-item', title: 'Energy Calibration', show: this.isBetaGamma, - handler: () => (this.betaGammaEnergyCalibrationModalVisible = true), + handler: () => this.handleEnergyCalib(), }, { type: 'a-menu-item',