fix: 处理接口未返回newEToC、newCToE、newLineSeries时存在的问题,处理未销毁betaRefresh事件的问题

This commit is contained in:
Xu Zhimeng 2024-02-21 14:38:22 +08:00
parent 05c64441a7
commit f0cff34940
2 changed files with 35 additions and 41 deletions

View File

@ -629,6 +629,10 @@ export default {
this.$bus.$on('betaRefresh', this.getData)
this.getData()
},
destroyed() {
this.$bus.$off('betaRefresh', this.handleReset)
this.$bus.$off('betaRefresh', this.getData)
},
watch: {
isFirstFitting: {
handler() {
@ -702,18 +706,10 @@ export default {
* 对人工交互的返回数据单独处理
*/
if (this.sampleData.dbName == 'man') {
const result = res.result
result.EToC = newEToC || []
result.CToE = newCToE
this.setFirringResult(res.result)
if (newCToE) {
const [paramA, paramB, paramC] = newCToE
this.newCalibrationFuncModel = {
paramA: Number(paramA).toPrecision(6),
paramB: Number(paramB).toPrecision(6),
paramC: Number(paramC).toPrecision(6),
}
}
if (newEToC) {
this.newE2C = newEToC
}
}
} else {
this.$message.error(res.message)
@ -1009,21 +1005,23 @@ export default {
paramC: Number(paramC).toPrecision(6),
}
}
if (newLineSeries) {
const energyValues = newLineSeries.map((item) => item.y)
const energyValues = newLineSeries.map((item) => item.y)
const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis
const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis
const energyMax = Math.max(Math.max(...energyValues), prevMax)
const energyMin = Math.min(Math.min(...energyValues), prevMin)
const energyMax = Math.max(Math.max(...energyValues), prevMax)
const energyMin = Math.min(Math.min(...energyValues), prevMin)
const { min, max, interval } = splitAxis(energyMax, energyMin, 4)
const { min, max, interval } = splitAxis(energyMax, energyMin, 4)
this.figureChartOption.yAxis.max = max
this.figureChartOption.yAxis.min = min
this.figureChartOption.yAxis.interval = interval
this.figureChartOption.yAxis.max = max
this.figureChartOption.yAxis.min = min
this.figureChartOption.yAxis.interval = interval
this.figureChartOption.series[1].data = newLineSeries.map(({ x, y }) => [x, y])
}
this.figureChartOption.series[1].data = newLineSeries.map(({ x, y }) => [x, y])
if (newScatterSeriesData) {
this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => {
return {

View File

@ -554,18 +554,10 @@ export default {
* 对人工交互的返回数据单独处理
*/
if (this.sampleData.dbName == 'man') {
this.setFirringResult(res.result)
if (newCToE) {
const [paramA, paramB, paramC] = newCToE
this.newCalibrationFuncModel = {
paramA: Number(paramA).toPrecision(6),
paramB: Number(paramB).toPrecision(6),
paramC: Number(paramC).toPrecision(6),
}
}
if (newEToC) {
this.newE2C = newEToC
}
const result = res.result
result.EToC = newEToC || []
result.CToE = newCToE
this.setFirringResult(result)
}
} else {
this.$message.error(res.message)
@ -768,20 +760,24 @@ export default {
paramC: Number(paramC).toPrecision(6),
}
}
const energyValues = newLineSeries.map((item) => item.y)
const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis
if (newLineSeries) {
const energyValues = newLineSeries.map((item) => item.y)
const energyMax = Math.max(Math.max(...energyValues), prevMax)
const energyMin = Math.min(Math.min(...energyValues), prevMin)
const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis
const { min, max, interval } = splitAxis(energyMax, energyMin, 4)
const energyMax = Math.max(Math.max(...energyValues), prevMax)
const energyMin = Math.min(Math.min(...energyValues), prevMin)
this.figureChartOption.yAxis.max = max
this.figureChartOption.yAxis.min = min
this.figureChartOption.yAxis.interval = interval
const { min, max, interval } = splitAxis(energyMax, energyMin, 4)
this.figureChartOption.yAxis.max = max
this.figureChartOption.yAxis.min = min
this.figureChartOption.yAxis.interval = interval
this.figureChartOption.series[1].data = newLineSeries.map(({ x, y }) => [x, y])
}
this.figureChartOption.series[1].data = newLineSeries.map(({ x, y }) => [x, y])
if (newScatterSeriesData) {
this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => ({
xAxis: x,