完成gamma formFile 模块的功能

This commit is contained in:
renpy 2023-09-11 11:01:23 +08:00
parent 8cfb9d7262
commit 2761b0da21
2 changed files with 265 additions and 3 deletions

View File

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

View File

@ -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 => {