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

View File

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

View File

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