fix:1 修改fitting逻辑解决计算错误问题;2 增加数据缓存,再次打开他弹窗回显上一次fitting结果
This commit is contained in:
parent
9e1377d5df
commit
fea099fe4f
|
@ -545,6 +545,12 @@ const newCalibrationFuncModel = {
|
|||
export default {
|
||||
mixins: [SampleDataMixin],
|
||||
components: { CustomChart, TitleOverBorder },
|
||||
props: {
|
||||
isFirstFitting: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
this.columns = columns
|
||||
|
||||
|
@ -594,7 +600,7 @@ export default {
|
|||
recalculateROICountsFor: [],
|
||||
|
||||
count: 0, //反算时需要传递的数值 非反算的情况下不需要传递 数值大小是 第一次调用接口时返回的tableWidgets 大小
|
||||
isFirstFitting: true,
|
||||
// isFirstFitting: true,
|
||||
isInverse: false, // 是否需要反算
|
||||
betaIsFitting: false,
|
||||
}
|
||||
|
@ -608,12 +614,14 @@ export default {
|
|||
},
|
||||
|
||||
async getData() {
|
||||
const { sampleId = '', qcFileName } = this.newSampleData
|
||||
// 增加sampleFileName参数 20231101:xiao
|
||||
const { sampleId = '', qcFileName, sampleFileName = inputFileName } = this.newSampleData
|
||||
try {
|
||||
this.isLoading = true
|
||||
const res = await getAction('/spectrumAnalysis/viewBetaDetectorCalibration', {
|
||||
sampleId,
|
||||
qcFileName,
|
||||
sampleFileName
|
||||
})
|
||||
if (res.success) {
|
||||
const { CToE, EToC, betaEnergy, gammaEnergy, gammaGatedBetaSpectrum, histogramData, oldScatterSeries } =
|
||||
|
@ -623,7 +631,7 @@ export default {
|
|||
|
||||
this.oldScatterSeries = oldScatterSeries
|
||||
this.count = oldScatterSeries.length
|
||||
this.isFirstFitting = true
|
||||
// this.isFirstFitting = true
|
||||
|
||||
this.betaGammaChartOption.series.data = histogramData.map(({ b, g, c }) => [b, g, c])
|
||||
this.gammaEnergy = gammaEnergy
|
||||
|
@ -644,6 +652,13 @@ export default {
|
|||
this.figureChartOption.series[0].markPoint.data = oldScatterSeries.map(({ x, y }) => ({ xAxis: x, yAxis: y }))
|
||||
|
||||
this.oldChartOption = cloneDeep(this.figureChartOption)
|
||||
|
||||
// 如果点击过reanalyze则渲染之前fitting的数据,如果没点Reanalyze,数据会在窗口关闭时删掉 20231101:xiao
|
||||
// todo 现在能谱数据没有缓存,刷新页面时也会获取到fitting的数据
|
||||
if(this.getCache("calibration-beta:"+this.newSampleData.inputFileName)) {
|
||||
this.setFirringResult(this.getCache("calibration-beta:"+this.newSampleData.inputFileName))
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
|
@ -861,6 +876,7 @@ export default {
|
|||
|
||||
// 点击Reset Button 重置
|
||||
handleReset() {
|
||||
this.removeCache("calibration-beta:"+this.newSampleData.inputFileName) // 删除fitting之后缓存的数据 20231101:xiao
|
||||
this.newCalibrationFuncModel = cloneDeep(newCalibrationFuncModel)
|
||||
this.list = []
|
||||
this.newE2C = []
|
||||
|
@ -880,7 +896,9 @@ export default {
|
|||
}
|
||||
try {
|
||||
const { success, result, message } = await postAction('/spectrumAnalysis/fitting', {
|
||||
...this.newCalibrationFuncModel,
|
||||
...this.list.length <= 0 ? this.newCalibrationFuncModel : [], // 如果list有数据则不传 C to E 表单数据 20231101:xiao
|
||||
sampleFileName: this.newSampleData.inputFileName,
|
||||
tabName: "beta",
|
||||
// 修改逻辑,如果列表中有数据 以列表的数据优先进行分析 20231028:Xiao
|
||||
tempPoints: this.list.length > 0
|
||||
? this.list.map((item) => ({ x: item.channel, y: item.energy }))
|
||||
|
@ -891,10 +909,25 @@ export default {
|
|||
count: this.isFirstFitting || !this.isInverse ? undefined : this.count,
|
||||
})
|
||||
if (success) {
|
||||
this.isFirstFitting = false
|
||||
// this.isFirstFitting = false
|
||||
this.betaIsFitting = true
|
||||
this.$emit('isFitting', this.betaIsFitting)
|
||||
this.$emit('isFitting', true) // 点击reAnalyze按钮,将isFirstFitting改为true 20231101:xiao
|
||||
|
||||
this.setCache("calibration-beta:"+this.newSampleData.inputFileName, result) // 缓存数据,如果点击ReAnalyze需要回显数据 20231101:xiao
|
||||
|
||||
this.setFirringResult(result)
|
||||
|
||||
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
// 封装 fitting后数据填充方法,如果点击ReAnalyze需要回显数据 20231101:xiao
|
||||
setFirringResult(result){
|
||||
const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result
|
||||
this.newE2C = EToC
|
||||
this.newLineSeries = newLineSeries
|
||||
|
@ -934,12 +967,6 @@ export default {
|
|||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
// 获取Figure Chart 最大值 和 最小值
|
||||
|
@ -985,6 +1012,15 @@ export default {
|
|||
}
|
||||
return 0
|
||||
},
|
||||
getCache(name){
|
||||
return this.$ls.get(name)
|
||||
},
|
||||
setCache(name, data){
|
||||
this.$ls.set(name, data)
|
||||
},
|
||||
removeCache(name){
|
||||
this.$ls.remove(name) // 删除fitting之后缓存的数据 20231101:xiao
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
rectHeight() {
|
||||
|
|
|
@ -435,6 +435,12 @@ const newCalibrationFuncModel = {
|
|||
export default {
|
||||
mixins: [SampleDataMixin],
|
||||
components: { CustomChart, TitleOverBorder },
|
||||
props: {
|
||||
isFirstFitting: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
this.columns = columns
|
||||
|
||||
|
@ -466,7 +472,7 @@ export default {
|
|||
recalculateROICountsFor: [],
|
||||
|
||||
count: 0, //反算时需要传递的数值 非反算的情况下不需要传递 数值大小是 第一次调用接口时返回的tableWidgets 大小
|
||||
isFirstFitting: true,
|
||||
// isFirstFitting: true,
|
||||
isInverse: false, // 是否需要反算
|
||||
gammaIsFitting: false,
|
||||
}
|
||||
|
@ -480,12 +486,16 @@ export default {
|
|||
},
|
||||
|
||||
async getData() {
|
||||
const { sampleId = '', qcFileName } = this.newSampleData
|
||||
console.log("isFirstFitting>>>"+this.isFirstFitting);
|
||||
// 增加sampleFileName参数 20231101:xiao
|
||||
const { sampleId = '', qcFileName, sampleFileName = inputFileName } = this.newSampleData
|
||||
|
||||
try {
|
||||
this.isLoading = true
|
||||
const res = await getAction('/spectrumAnalysis/viewGammaDetectorCalibration', {
|
||||
sampleId,
|
||||
qcFileName,
|
||||
sampleFileName
|
||||
})
|
||||
|
||||
if (res.success) {
|
||||
|
@ -495,7 +505,7 @@ export default {
|
|||
this.e2c = EToC
|
||||
this.oldScatterSeries = oldScatterSeries
|
||||
this.count = oldScatterSeries.length
|
||||
this.isFirstFitting = true
|
||||
// this.isFirstFitting = true
|
||||
|
||||
const { max: _max, min: _min, interval: _interval } = splitAxis(max, min, 4)
|
||||
|
||||
|
@ -519,6 +529,13 @@ export default {
|
|||
this.figureChartOption.series[0].markPoint.data = oldScatterSeries.map(({ x, y }) => ({ xAxis: x, yAxis: y }))
|
||||
|
||||
this.oldChartOption = cloneDeep(this.figureChartOption)
|
||||
|
||||
// 如果点击过reanalyze则渲染之前fitting的数据,如果没点Reanalyze,数据会在窗口关闭时删掉 20231101:xiao
|
||||
// todo 现在能谱数据没有缓存,刷新页面时也会获取到fitting的数据
|
||||
if(this.getCache("calibration-gamma:"+this.newSampleData.inputFileName)) {
|
||||
this.setFirringResult(this.getCache("calibration-gamma:"+this.newSampleData.inputFileName))
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
|
@ -640,12 +657,13 @@ export default {
|
|||
|
||||
// 点击Reset Button 重置
|
||||
handleReset() {
|
||||
this.$ls.remove("calibration-gamma:"+this.newSampleData.inputFileName) // 删除fitting之后缓存的数据 20231101:xiao
|
||||
this.newCalibrationFuncModel = cloneDeep(newCalibrationFuncModel)
|
||||
this.list = []
|
||||
this.newE2C = []
|
||||
|
||||
this.figureChartOption = cloneDeep(this.oldChartOption)
|
||||
this.isFirstFitting = true
|
||||
this.isFirstFitting = false
|
||||
this.isInverse = false
|
||||
},
|
||||
|
||||
|
@ -657,8 +675,10 @@ export default {
|
|||
}
|
||||
try {
|
||||
const { success, result, message } = await postAction('/spectrumAnalysis/fitting', {
|
||||
...this.newCalibrationFuncModel,
|
||||
// 修改逻辑,如果列表中有数据 以列表的数据优先进行分析 20231028:Xiao
|
||||
...this.list.length <= 0 ? this.newCalibrationFuncModel : [], // 如果list有数据则不传 C to E 表单数据 20231101:xiao
|
||||
sampleFileName: this.newSampleData.inputFileName,
|
||||
tabName: "gamma",
|
||||
// 如果列表中有数据 以列表的数据优先进行分析 20231028:Xiao
|
||||
tempPoints: this.list.length > 0
|
||||
? this.list.map((item) => ({ x: item.channel, y: item.energy }))
|
||||
: this.oldScatterSeries,
|
||||
|
@ -669,10 +689,24 @@ export default {
|
|||
count: this.isFirstFitting || !this.isInverse ? undefined : this.count,
|
||||
})
|
||||
if (success) {
|
||||
this.isFirstFitting = false
|
||||
// this.isFirstFitting = true
|
||||
this.gammaIsFitting = false
|
||||
this.$emit('isFitting', this.gammaIsFitting)
|
||||
this.$emit('isFitting', true) // 点击reAnalyze按钮,将isFirstFitting改为true 20231101:xiao
|
||||
|
||||
this.setCache("calibration-gamma:"+this.newSampleData.inputFileName, result) // 缓存数据,如果点击ReAnalyze需要回显数据 20231101:xiao
|
||||
|
||||
this.setFirringResult(result)
|
||||
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
// 封装 fitting后数据填充方法,如果点击ReAnalyze需要回显数据 20231101:xiao
|
||||
setFirringResult(result){
|
||||
const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result
|
||||
this.newE2C = EToC
|
||||
this.newLineSeries = newLineSeries
|
||||
|
@ -689,7 +723,6 @@ export default {
|
|||
paramC: Number(paramC).toPrecision(6),
|
||||
}
|
||||
}
|
||||
|
||||
const energyValues = newLineSeries.map((item) => item.y)
|
||||
|
||||
const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis
|
||||
|
@ -710,12 +743,6 @@ export default {
|
|||
yAxis: y,
|
||||
}))
|
||||
}
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
// 获取Figure Chart 最大值 和 最小值
|
||||
|
@ -761,6 +788,15 @@ export default {
|
|||
}
|
||||
return 0
|
||||
},
|
||||
getCache(name){
|
||||
return this.$ls.get(name)
|
||||
},
|
||||
setCache(name, data){
|
||||
this.$ls.set(name, data)
|
||||
},
|
||||
removeCache(name){
|
||||
this.$ls.remove(name) // 删除fitting之后缓存的数据 20231101:xiao
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
class="beta-gamma-tool-of-calibration"
|
||||
:footer="null"
|
||||
destroy-on-close
|
||||
@cancel="handleExit"
|
||||
>
|
||||
<a-tabs :animated="false" v-model="currTab">
|
||||
<a-tab-pane tab="Gamma Detector Calibration" key="gamma">
|
||||
<gamma-detector-calibration @isFitting="getFittingFlag_gamma" />
|
||||
<gamma-detector-calibration @isFitting="getFittingFlag_gamma" :isFirstFitting="gammaEnergyValid"/>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="Beta Detector Calibration" key="beta">
|
||||
<beta-detector-calibration @isFitting="getFittingFlag_beta" />
|
||||
|
@ -69,7 +70,8 @@ export default {
|
|||
checkDet: false,
|
||||
},
|
||||
betaEnergyValid: false,
|
||||
gammaEnergyValid: true,
|
||||
gammaEnergyValid: false,
|
||||
isReanlyze: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -88,9 +90,15 @@ export default {
|
|||
this.betaEnergyValid = val
|
||||
},
|
||||
getFittingFlag_gamma(val) {
|
||||
console.log("zhiqian>>>"+this.gammaEnergyValid);
|
||||
this.gammaEnergyValid = val
|
||||
console.log("zhihou>>>"+this.gammaEnergyValid);
|
||||
},
|
||||
handleReAnalyse() {
|
||||
// todo 1.fitting之后才能点击; 2.isReAnalyze需要缓存
|
||||
if(!this.gammaEnergyValid){
|
||||
return false;
|
||||
}
|
||||
const regExp = /^([A-Z]{1,}\d{1,})_/
|
||||
const regMatched = this.newSampleData.inputFileName.match(regExp)
|
||||
const currStationName = regMatched[1]
|
||||
|
@ -140,13 +148,19 @@ export default {
|
|||
})
|
||||
this.$emit('sendXeData', res.result.XeData)
|
||||
this.$message.success('Analyse Success!')
|
||||
this.visible = false
|
||||
this.isReanlyze = true
|
||||
this.handleExit()
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleExit() {
|
||||
this.gammaEnergyValid = this.isReanlyze
|
||||
console.log("exit>>>this.isReanlyze>>>"+this.isReanlyze);
|
||||
if(!this.isReanlyze && this.$ls.get("calibration-gamma:"+this.newSampleData.inputFileName)){
|
||||
this.$ls.remove("calibration-gamma:"+this.newSampleData.inputFileName) // 如果没有点击ReANalyze,删除fitting之后缓存的数据 20231101:xiao
|
||||
}
|
||||
this.visible = false
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user