feat: Replot功能对接
This commit is contained in:
parent
6a1fe4a7a0
commit
4edd3d250b
|
@ -104,7 +104,7 @@
|
||||||
<a-button type="primary" :disabled="isOperationStackEmpty" @click="handleUndo">Undo</a-button>
|
<a-button type="primary" :disabled="isOperationStackEmpty" @click="handleUndo">Undo</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="peak-box-item">
|
<div class="peak-box-item">
|
||||||
<a-button type="primary" @click="handleReplot">Replot</a-button>
|
<a-button type="primary" :loading="isReploting" @click="handleReplot">Replot</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="peak-box-item">
|
<div class="peak-box-item">
|
||||||
<a-button type="primary" :loading="isAccepting" @click="handleAccept">Accept</a-button>
|
<a-button type="primary" :loading="isAccepting" @click="handleAccept">Accept</a-button>
|
||||||
|
@ -474,6 +474,7 @@ export default {
|
||||||
isFitting: false, // 正在进行Fit操作
|
isFitting: false, // 正在进行Fit操作
|
||||||
firstFittingChannel: null, // Fit操作时点击的第一个channel
|
firstFittingChannel: null, // Fit操作时点击的第一个channel
|
||||||
isAccepting: false,
|
isAccepting: false,
|
||||||
|
isReploting: false,
|
||||||
|
|
||||||
operationStack: [] // 操作记录
|
operationStack: [] // 操作记录
|
||||||
}
|
}
|
||||||
|
@ -529,7 +530,6 @@ export default {
|
||||||
|
|
||||||
this.setChartOption(channelBaseLineChart, channelCountChart, channelPeakChart, channelBaseCPChart, barChart)
|
this.setChartOption(channelBaseLineChart, channelCountChart, channelPeakChart, channelBaseCPChart, barChart)
|
||||||
this.list = table
|
this.list = table
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(message)
|
this.$message.error(message)
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,13 @@ export default {
|
||||||
this.channelBaseLineChart = channelBaseLineChart
|
this.channelBaseLineChart = channelBaseLineChart
|
||||||
this.barChart = barChart
|
this.barChart = barChart
|
||||||
|
|
||||||
this.setChartOption(channelBaseLineChart, this.channelCountChart, channelPeakChart, this.channelBaseCPChart, barChart)
|
this.setChartOption(
|
||||||
|
channelBaseLineChart,
|
||||||
|
this.channelCountChart,
|
||||||
|
channelPeakChart,
|
||||||
|
this.channelBaseCPChart,
|
||||||
|
barChart
|
||||||
|
)
|
||||||
this.list = table
|
this.list = table
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -796,7 +802,13 @@ export default {
|
||||||
const { channelPeakChart, table } = result
|
const { channelPeakChart, table } = result
|
||||||
this.channelPeakChart = channelPeakChart
|
this.channelPeakChart = channelPeakChart
|
||||||
|
|
||||||
this.setChartOption(this.channelBaseLineChart, this.channelCountChart, channelPeakChart, this.channelBaseCPChart, this.barChart)
|
this.setChartOption(
|
||||||
|
this.channelBaseLineChart,
|
||||||
|
this.channelCountChart,
|
||||||
|
channelPeakChart,
|
||||||
|
this.channelBaseCPChart,
|
||||||
|
this.barChart
|
||||||
|
)
|
||||||
|
|
||||||
this.list = table
|
this.list = table
|
||||||
},
|
},
|
||||||
|
@ -1035,7 +1047,10 @@ export default {
|
||||||
else {
|
else {
|
||||||
this.btnGroupType = 1
|
this.btnGroupType = 1
|
||||||
this.opts.notMerge = true
|
this.opts.notMerge = true
|
||||||
this.option.series.splice(this.option.series.length - 1, 1) // 去掉白色的基线副本
|
const baseLineEditSeries = findSeriesByName(this.option.series, 'BaseLine_Edit')
|
||||||
|
const index = this.option.series.findIndex(item => item == baseLineEditSeries)
|
||||||
|
this.option.series.splice(index, 1)
|
||||||
|
|
||||||
this.clearRect()
|
this.clearRect()
|
||||||
|
|
||||||
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
|
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
|
||||||
|
@ -1044,6 +1059,8 @@ export default {
|
||||||
const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
|
const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
|
||||||
baseLineCP.data = this.buildCPPointData(this.channelBaseCPChart)
|
baseLineCP.data = this.buildCPPointData(this.channelBaseCPChart)
|
||||||
|
|
||||||
|
this.redrawPeaks(this.channelPeakChart)
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.resetChartOpts()
|
this.resetChartOpts()
|
||||||
})
|
})
|
||||||
|
@ -1098,6 +1115,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 重绘Peaks
|
||||||
|
redrawPeaks(peakList) {
|
||||||
|
this.option.series = this.option.series.filter((item) => {
|
||||||
|
return !item.name.includes('Peak_')
|
||||||
|
})
|
||||||
|
this.option.series.push(...this.buildPeaks(peakList))
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置小方块可拖拽
|
* 设置小方块可拖拽
|
||||||
*/
|
*/
|
||||||
|
@ -1231,26 +1256,53 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 将原先的基线和控制点移动到新位置
|
// 将原先的基线和控制点移动到新位置
|
||||||
handleReplot() {
|
async handleReplot() {
|
||||||
const { xctrl, yctrl, yslope, baseline } = this.baseCtrls_Copy
|
try {
|
||||||
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
|
const { inputFileName: fileName } = this.sampleData
|
||||||
baseLineSeries.data = baseline.map((val, index) => [index + 1, val])
|
this.isReploting = true
|
||||||
|
const { success, result, message } = await postAction('/gamma/replotBaseLine', {
|
||||||
|
...this.baseCtrls_Copy,
|
||||||
|
fileName,
|
||||||
|
replotNeeded: true
|
||||||
|
})
|
||||||
|
if (success) {
|
||||||
|
const { chartData, peakSet, shapeData } = result
|
||||||
|
|
||||||
const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
|
const { xctrl, yctrl, yslope, baseline } = this.baseCtrls_Copy
|
||||||
// 第一个控制点(因为第一个和最后一个不会被删除)
|
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
|
||||||
const firstCP = this.channelBaseCPChart[0]
|
baseLineSeries.data = baseline.map((val, index) => [index + 1, val])
|
||||||
const { color, size } = firstCP
|
|
||||||
const baseCPPoints = xctrl.map((xAxis, index) => {
|
const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
|
||||||
return {
|
// 第一个控制点(因为第一个和最后一个不会被删除)
|
||||||
size,
|
const firstCP = this.channelBaseCPChart[0]
|
||||||
color,
|
const { color, size } = firstCP
|
||||||
point: {
|
const baseCPPoints = xctrl.map((xAxis, index) => {
|
||||||
x: xAxis,
|
return {
|
||||||
y: yctrl[index]
|
size,
|
||||||
}
|
color,
|
||||||
|
point: {
|
||||||
|
x: xAxis,
|
||||||
|
y: yctrl[index]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
baseLineCP.data = this.buildCPPointData(baseCPPoints)
|
||||||
|
|
||||||
|
this.opts.notMerge = true
|
||||||
|
this.redrawPeaks(peakSet)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetChartOpts()
|
||||||
|
})
|
||||||
|
|
||||||
|
this.BaseCtrls = cloneDeep(this.baseCtrls_Copy)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
}
|
}
|
||||||
})
|
} catch (error) {
|
||||||
baseLineCP.data = this.buildCPPointData(baseCPPoints)
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.isReploting = false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1272,8 +1324,8 @@ export default {
|
||||||
|
|
||||||
// 确定对Baseline Control Points 的操作
|
// 确定对Baseline Control Points 的操作
|
||||||
async handleAccept() {
|
async handleAccept() {
|
||||||
this.BaseCtrls = cloneDeep(this.baseCtrls_Copy)
|
// this.BaseCtrls = cloneDeep(this.baseCtrls_Copy)
|
||||||
const { baseline, xctrl, yctrl } = this.BaseCtrls
|
// const { baseline, xctrl, yctrl } = this.BaseCtrls
|
||||||
// this.channelBaseLineChart.pointlist = baseline.map((val, index) => {
|
// this.channelBaseLineChart.pointlist = baseline.map((val, index) => {
|
||||||
// return {
|
// return {
|
||||||
// x: index + 1,
|
// x: index + 1,
|
||||||
|
@ -1298,10 +1350,12 @@ export default {
|
||||||
try {
|
try {
|
||||||
this.isAccepting = true
|
this.isAccepting = true
|
||||||
const { success, result, message } = await postAction('/gamma/acceptBaseLine', {
|
const { success, result, message } = await postAction('/gamma/acceptBaseLine', {
|
||||||
...this.BaseCtrls,
|
...this.baseCtrls_Copy,
|
||||||
fileName
|
fileName
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
|
this.BaseCtrls = cloneDeep(this.baseCtrls_Copy)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
allData,
|
allData,
|
||||||
barChart,
|
barChart,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user