diff --git a/src/views/spectrumAnalysis/gamma-analysis.vue b/src/views/spectrumAnalysis/gamma-analysis.vue index 0d77c1d..0721e56 100644 --- a/src/views/spectrumAnalysis/gamma-analysis.vue +++ b/src/views/spectrumAnalysis/gamma-analysis.vue @@ -263,238 +263,7 @@ export default { }) console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result) if (success) { - this.isLoading = false - - const { - dead_time, - live_time, - real_time, - start_time, - - DetailedInformation, - QCFlag, - - allData, - - shadowChannelChart, - shadowEnergyChart, - - shapeChannelData, - shapeEnergyData - } = result - - this.detailedInfomation = DetailedInformation - this.qcFlags = QCFlag - - const channelPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'channel') - const energyPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'energy') - - const channelBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'channel') - const energyBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'energy') - - const channelLcLine = allData.find(item => item.name == 'Lc' && item.group == 'channel') - const energyLcLine = allData.find(item => item.name == 'Lc' && item.group == 'energy') - - const channelScacLine = allData.find(item => item.name == 'Scac' && item.group == 'channel') - const energyScacLine = allData.find(item => item.name == 'Scac' && item.group == 'energy') - - this.allEnergy = allData.find(item => item.name == 'Energy' && item.group == 'energy') - this.allChannel = allData.find(item => item.name == 'Count' && item.group == 'channel') - - // 保存Peak Line - this.channelPeakGroup = channelPeakGroup - this.energyPeakGroup = energyPeakGroup - - // 保存 Spectrum Line - this.shadowChannelChart = shadowChannelChart - this.shadowEnergyChart = shadowEnergyChart - - // 保存基线 - this.channelBaseLine = channelBaseLine - this.energyBaseLine = energyBaseLine - - // 保存Lc - this.channelLcLine = channelLcLine - this.energyLcLine = energyLcLine - - // 保存Scac - this.channelScacLine = channelScacLine - this.energyScacLine = energyScacLine - - // 保存 基线控制点 - this.shapeChannelData = shapeChannelData - this.shapeEnergyData = shapeEnergyData - - this.option.yAxis.max = Math.ceil(Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1) - this.thumbnailOption.yAxis.max = Math.ceil( - Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1 - ) - - const series = [] - - // 推入Spectrum Line - series.push({ - name: 'Spectrum', - type: 'line', - data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${shadowChannelChart.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - symbolSize: 1, - emphasis: { - disabled: true - }, - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - color: 'red', - width: 1 - }, - data: [{ xAxis: -1 }] - }, - animation: false - }) - - // 右上角缩略图推入Spectrum Line - this.thumbnailOption.series.push({ - name: 'Spectrum', - type: 'line', - data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${shadowChannelChart.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - symbolSize: 1, - emphasis: { - disabled: true - }, - silent: true, - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - type: 'solid', - color: '#1397a3', - width: 1 - }, - data: [] - } - }) - - // 推入BaseLine - series.push({ - name: 'BaseLine', - type: 'line', - data: channelBaseLine.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${channelBaseLine.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - emphasis: { - disabled: true - }, - animation: false, - zlevel: 2 - }) - - // 推入LcLine线 - series.push({ - name: 'LcLine', - type: 'line', - data: channelLcLine.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${channelLcLine.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - emphasis: { - disabled: true - }, - animation: false, - zlevel: 3 - }) - - // 推入Scac线 - series.push({ - name: 'ScacLine', - type: 'line', - data: channelScacLine.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${channelScacLine.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - emphasis: { - disabled: true - }, - animation: false, - zlevel: 4 - }) - - // 推入基线控制点 - series.push({ - name: 'BaseLine_Ctrl_Point', - type: 'scatter', - data: shapeChannelData.map(({ size, color, point: { x, y } }) => { - return { - value: [x, y], - itemStyle: { - color: 'transparent', - borderColor: color, - borderWidth: size / 2 - } - } - }), - emphasis: { - disabled: true - }, - animation: false, - zlevel: 5 - }) - - // 推入Peak Line - const peakLines = [] - channelPeakGroup.forEach((item, index) => { - peakLines.push({ - name: `Peak_${index}`, - type: 'line', - data: item.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${item.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - animation: false, - zlevel: 6 - }) - }) - series.push(...peakLines) - this.option.series = series - - this.option.tooltip.formatter = this.tooltipFormatter + this.dataProsess(result) } else { this.$message.error(message) } @@ -502,6 +271,7 @@ export default { console.error(error) } }, + async getSampleDetail_file() { const { inputFileName: fileName } = this.sample try { @@ -514,238 +284,7 @@ export default { }) console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result) if (success) { - this.isLoading = false - - const { - dead_time, - live_time, - real_time, - start_time, - - DetailedInformation, - QCFlag, - - allData, - - shadowChannelChart, - shadowEnergyChart, - - shapeChannelData, - shapeEnergyData - } = result - - this.detailedInfomation = DetailedInformation - this.qcFlags = QCFlag - - const channelPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'channel') - const energyPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'energy') - - const channelBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'channel') - const energyBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'energy') - - const channelLcLine = allData.find(item => item.name == 'Lc' && item.group == 'channel') - const energyLcLine = allData.find(item => item.name == 'Lc' && item.group == 'energy') - - const channelScacLine = allData.find(item => item.name == 'Scac' && item.group == 'channel') - const energyScacLine = allData.find(item => item.name == 'Scac' && item.group == 'energy') - - this.allEnergy = allData.find(item => item.name == 'Energy' && item.group == 'energy') - this.allChannel = allData.find(item => item.name == 'Count' && item.group == 'channel') - - // 保存Peak Line - this.channelPeakGroup = channelPeakGroup - this.energyPeakGroup = energyPeakGroup - - // 保存 Spectrum Line - this.shadowChannelChart = shadowChannelChart - this.shadowEnergyChart = shadowEnergyChart - - // 保存基线 - this.channelBaseLine = channelBaseLine - this.energyBaseLine = energyBaseLine - - // 保存Lc - this.channelLcLine = channelLcLine - this.energyLcLine = energyLcLine - - // 保存Scac - this.channelScacLine = channelScacLine - this.energyScacLine = energyScacLine - - // 保存 基线控制点 - this.shapeChannelData = shapeChannelData - this.shapeEnergyData = shapeEnergyData - - this.option.yAxis.max = Math.ceil(Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1) - this.thumbnailOption.yAxis.max = Math.ceil( - Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1 - ) - - const series = [] - - // 推入Spectrum Line - series.push({ - name: 'Spectrum', - type: 'line', - data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${shadowChannelChart.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - symbolSize: 1, - emphasis: { - disabled: true - }, - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - color: 'red', - width: 1 - }, - data: [{ xAxis: -1 }] - }, - animation: false - }) - - // 右上角缩略图推入Spectrum Line - this.thumbnailOption.series.push({ - name: 'Spectrum', - type: 'line', - data: shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${shadowChannelChart.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - symbolSize: 1, - emphasis: { - disabled: true - }, - silent: true, - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - type: 'solid', - color: '#1397a3', - width: 1 - }, - data: [] - } - }) - - // 推入BaseLine - series.push({ - name: 'BaseLine', - type: 'line', - data: channelBaseLine.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${channelBaseLine.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - emphasis: { - disabled: true - }, - animation: false, - zlevel: 2 - }) - - // 推入LcLine线 - series.push({ - name: 'LcLine', - type: 'line', - data: channelLcLine.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${channelLcLine.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - emphasis: { - disabled: true - }, - animation: false, - zlevel: 3 - }) - - // 推入Scac线 - series.push({ - name: 'ScacLine', - type: 'line', - data: channelScacLine.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${channelScacLine.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - emphasis: { - disabled: true - }, - animation: false, - zlevel: 4 - }) - - // 推入基线控制点 - series.push({ - name: 'BaseLine_Ctrl_Point', - type: 'scatter', - data: shapeChannelData.map(({ size, color, point: { x, y } }) => { - return { - value: [x, y], - itemStyle: { - color: 'transparent', - borderColor: color, - borderWidth: size / 2 - } - } - }), - emphasis: { - disabled: true - }, - animation: false, - zlevel: 5 - }) - - // 推入Peak Line - const peakLines = [] - channelPeakGroup.forEach((item, index) => { - peakLines.push({ - name: `Peak_${index}`, - type: 'line', - data: item.pointlist.map(({ x, y }) => [x, y]), - itemStyle: { - color: `rgb(${item.color})` - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - animation: false, - zlevel: 6 - }) - }) - series.push(...peakLines) - this.option.series = series - - this.option.tooltip.formatter = this.tooltipFormatter + this.dataProsess(result) } else { this.$message.error(message) } @@ -754,6 +293,240 @@ export default { } }, + dataProsess(result) { + this.isLoading = false + + const { + dead_time, + live_time, + real_time, + start_time, + + DetailedInformation, + QCFlag, + + allData, + + shadowChannelChart, + shadowEnergyChart, + + shapeChannelData, + shapeEnergyData + } = result + + this.detailedInfomation = DetailedInformation + this.qcFlags = QCFlag + + const channelPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'channel') + const energyPeakGroup = allData.filter(item => item.name == 'Peak' && item.group == 'energy') + + const channelBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'channel')||{} + const energyBaseLine = allData.find(item => item.name == 'BaseLine' && item.group == 'energy') + + const channelLcLine = allData.find(item => item.name == 'Lc' && item.group == 'channel')||{} + const energyLcLine = allData.find(item => item.name == 'Lc' && item.group == 'energy') + + const channelScacLine = allData.find(item => item.name == 'Scac' && item.group == 'channel')||{} + const energyScacLine = allData.find(item => item.name == 'Scac' && item.group == 'energy') + + this.allEnergy = allData.find(item => item.name == 'Energy' && item.group == 'energy')||{} + this.allChannel = allData.find(item => item.name == 'Count' && item.group == 'channel') + + // 保存Peak Line + this.channelPeakGroup = channelPeakGroup + this.energyPeakGroup = energyPeakGroup + + // 保存 Spectrum Line + this.shadowChannelChart = shadowChannelChart + this.shadowEnergyChart = shadowEnergyChart + + // 保存基线 + this.channelBaseLine = channelBaseLine + this.energyBaseLine = energyBaseLine + + // 保存Lc + this.channelLcLine = channelLcLine + this.energyLcLine = energyLcLine + + // 保存Scac + this.channelScacLine = channelScacLine + this.energyScacLine = energyScacLine + + // 保存 基线控制点 + this.shapeChannelData = shapeChannelData + this.shapeEnergyData = shapeEnergyData + + this.option.yAxis.max = shadowChannelChart.pointlist&&Math.ceil(Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1) + this.thumbnailOption.yAxis.max = shadowChannelChart.pointlist&&Math.ceil( + Math.max(...shadowChannelChart.pointlist.map(item => item.y)) * 1.1 + ) + + const series = [] + + // 推入Spectrum Line + series.push({ + name: 'Spectrum', + type: 'line', + data: shadowChannelChart.pointlist&&shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), + itemStyle: { + color: `rgb(${shadowChannelChart.color})` + }, + lineStyle: { + width: 1 + }, + symbol: 'none', + symbolSize: 1, + emphasis: { + disabled: true + }, + markLine: { + silent: true, + symbol: 'none', + label: { + show: false + }, + lineStyle: { + color: 'red', + width: 1 + }, + data: [{ xAxis: -1 }] + }, + animation: false + }) + + // 右上角缩略图推入Spectrum Line + this.thumbnailOption.series.push({ + name: 'Spectrum', + type: 'line', + data: shadowChannelChart.pointlist&&shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), + itemStyle: { + color: `rgb(${shadowChannelChart.color})` + }, + lineStyle: { + width: 1 + }, + symbol: 'none', + symbolSize: 1, + emphasis: { + disabled: true + }, + silent: true, + markLine: { + silent: true, + symbol: 'none', + label: { + show: false + }, + lineStyle: { + type: 'solid', + color: '#1397a3', + width: 1 + }, + data: [] + } + }) + // 推入BaseLine + series.push({ + name: 'BaseLine', + type: 'line', + data: channelBaseLine.pointlist&&channelBaseLine.pointlist.map(({ x, y }) => [x, y]), + itemStyle: { + color: `rgb(${channelBaseLine.color})` + }, + lineStyle: { + width: 1 + }, + symbol: 'none', + emphasis: { + disabled: true + }, + animation: false, + zlevel: 2 + }) + + // 推入LcLine线 + series.push({ + name: 'LcLine', + type: 'line', + data: channelLcLine.pointlist&&channelLcLine.pointlist.map(({ x, y }) => [x, y]), + itemStyle: { + color: `rgb(${channelLcLine.color})` + }, + lineStyle: { + width: 1 + }, + symbol: 'none', + emphasis: { + disabled: true + }, + animation: false, + zlevel: 3 + }) + + // 推入Scac线 + series.push({ + name: 'ScacLine', + type: 'line', + data: channelScacLine.pointlist&&channelScacLine.pointlist.map(({ x, y }) => [x, y]), + itemStyle: { + color: `rgb(${channelScacLine.color})` + }, + lineStyle: { + width: 1 + }, + symbol: 'none', + emphasis: { + disabled: true + }, + animation: false, + zlevel: 4 + }) + + // 推入基线控制点 + series.push({ + name: 'BaseLine_Ctrl_Point', + type: 'scatter', + data: shapeChannelData.map(({ size, color, point: { x, y } }) => { + return { + value: [x, y], + itemStyle: { + color: 'transparent', + borderColor: color, + borderWidth: size / 2 + } + } + }), + emphasis: { + disabled: true + }, + animation: false, + zlevel: 5 + }) + + // 推入Peak Line + const peakLines = [] + channelPeakGroup.forEach((item, index) => { + peakLines.push({ + name: `Peak_${index}`, + type: 'line', + data: item.pointlist.map(({ x, y }) => [x, y]), + itemStyle: { + color: `rgb(${item.color})` + }, + lineStyle: { + width: 1 + }, + symbol: 'none', + animation: false, + zlevel: 6 + }) + }) + series.push(...peakLines) + this.option.series = series + + this.option.tooltip.formatter = this.tooltipFormatter + }, + tooltipFormatter(params) { if (this.isEnergy()) { const energy = params[0].value[0] @@ -763,7 +536,7 @@ export default {