fix: 优化部分逻辑和代码

This commit is contained in:
Xu Zhimeng 2023-10-17 10:00:48 +08:00
parent 4edd3d250b
commit 0f8d019a56
3 changed files with 23 additions and 13 deletions

View File

@ -251,7 +251,6 @@ export default {
if (success) {
this.sampleDetail = result
this.changeChartByType('sample')
this.isLoading = false
this.$emit('getFiles', {
detFileName: result.detBg.fileName,
gasFileName: result.gasBg.fileName,
@ -262,6 +261,8 @@ export default {
}
} catch (error) {
console.error(error)
} finally {
this.isLoading = false
}
},
async getSampleDetail_file() {

View File

@ -476,7 +476,8 @@ export default {
isAccepting: false,
isReploting: false,
operationStack: [] //
operationStack: [], //
replotNeeded: false
}
},
created() {
@ -563,6 +564,7 @@ export default {
this.btnGroupType = 1
this.opts.notMerge = false
this.isFitting = false
this.replotNeeded = false
this.$nextTick(() => {
this.option.brush = { toolbox: [] }
this.selectedKeys = []
@ -611,13 +613,12 @@ export default {
}
}
const selectedRow = this.list[index]
this.selectedKeys = [selectedRow.index]
this.getSelPosNuclide(selectedRow)
this.selectedTableItem = selectedRow
if (this.list.length) {
const selectedRow = this.list[index]
this.selectedKeys = [selectedRow.index]
this.getSelPosNuclide(selectedRow)
this.selectedTableItem = selectedRow
}
// Fit
if (this.isFitting) {
@ -1027,6 +1028,7 @@ export default {
if (this.btnGroupType == 1) {
this.btnGroupType = 2
this.baseCtrls_Copy = cloneDeep(this.BaseCtrls)
this.replotNeeded = false
// 线
const baseLineEditSeries = buildLineSeries(
@ -1100,6 +1102,7 @@ export default {
// 线
redrawBaseLine() {
this.replotNeeded = true
try {
console.time('updateBaseLine')
const res = updateBaseLine(JSON.stringify(this.baseCtrls_Copy))
@ -1117,7 +1120,7 @@ export default {
// Peaks
redrawPeaks(peakList) {
this.option.series = this.option.series.filter((item) => {
this.option.series = this.option.series.filter(item => {
return !item.name.includes('Peak_')
})
this.option.series.push(...this.buildPeaks(peakList))
@ -1257,13 +1260,16 @@ export default {
// 线
async handleReplot() {
if (!this.replotNeeded) {
return
}
try {
const { inputFileName: fileName } = this.sampleData
this.isReploting = true
const { success, result, message } = await postAction('/gamma/replotBaseLine', {
...this.baseCtrls_Copy,
fileName,
replotNeeded: true
replotNeeded: this.replotNeeded
})
if (success) {
const { chartData, peakSet, shapeData } = result
@ -1295,6 +1301,7 @@ export default {
})
this.BaseCtrls = cloneDeep(this.baseCtrls_Copy)
this.replotNeeded = false
} else {
this.$message.error(message)
}

View File

@ -794,6 +794,7 @@ export default {
key: 'all',
},
],
key: 'resultsToDB'
},
{
title: 'Save PHD to File',
@ -807,6 +808,7 @@ export default {
key: 'all',
},
],
key: 'phdToFile'
},
],
width: '170px',
@ -817,9 +819,9 @@ export default {
this.saveSettingModalVisible = true
},
submenuClick: ({ item, child }) => {
if (item.title == 'Save Results to DB') {
if (item.key == 'resultsToDB') {
this.handleSaveResultsToDB(child.key)
} else if (item.title == 'Save PHD to File') {
} else if (item.key == 'phdToFile') {
this.handleSavePHDToFile(child.key)
}
},