diff --git a/src/views/spectrumAnalysis/gamma-analysis.vue b/src/views/spectrumAnalysis/gamma-analysis.vue index fb11920..0d77c1d 100644 --- a/src/views/spectrumAnalysis/gamma-analysis.vue +++ b/src/views/spectrumAnalysis/gamma-analysis.vue @@ -502,6 +502,257 @@ export default { console.error(error) } }, + async getSampleDetail_file() { + const { inputFileName: fileName } = this.sample + try { + this.isLoading = true + this.option.series = [] + this.thumbnailOption.series = [] + // const { success, result, message } = Response + const { success, result, message } = await getAction('/gamma/gammaByFile', { + fileName, + }) + 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 + } else { + this.$message.error(message) + } + } catch (error) { + console.error(error) + } + }, tooltipFormatter(params) { if (this.isEnergy()) { @@ -987,8 +1238,13 @@ export default { }, watch: { sample: { - handler() { - this.getSampleDetail() + handler(newVal, oldVal) { + console.log("newValnewVal", newVal); + if (newVal.sampleId) { + this.getSampleDetail() + } else { + this.getSampleDetail_file() + } }, immediate: true } diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 0930ead..610173b 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -386,7 +386,13 @@ export default { handleLoadSampleFromFile(sampleList) { console.log("sampleListsampleListsampleListsampleListsampleList",sampleList); let arr = sampleList.filter(item => { - return Object.keys(item).length>4&&item.gasFileStatus&&item.detFileStatus + if (Object.keys(item).length>4) { + if (item.gasFileName&&item.detFileName&&item.qcFileName&&item.gasFileStatus&&item.detFileStatus) { + return item + } else if (!item.gasFileName && !item.detFileName && !item.qcFileName) { + return item + } + } }) console.log("sampleListsampleList",arr); arr.forEach(item => {