From 5feb566d46761fa28c0d85f2a0f15274406e22a7 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Wed, 7 Aug 2024 19:10:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Update=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/spectrumAnalysis/beta-analysis.vue | 75 +++++++++----------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/src/views/spectrumAnalysis/beta-analysis.vue b/src/views/spectrumAnalysis/beta-analysis.vue index 4842748..9d9c7f6 100644 --- a/src/views/spectrumAnalysis/beta-analysis.vue +++ b/src/views/spectrumAnalysis/beta-analysis.vue @@ -221,10 +221,11 @@ export default { const { inputFileName, detFileName } = this.sample const userId = store.getters.userInfo.id this.isLoading = true - const { success, result, message } = await postAction( - `/selfStation/Reprocessing?fileName=${inputFileName}&processKey=${userId}_${this.timerStamp}` - ) - console.log(userId, success, result, message) + + const formData = new FormData() + formData.append('fileName', inputFileName) + formData.append('processKey', `${userId}_${this.timerStamp}`) + const { success, result, message } = await postAction('/selfStation/Reprocessing', formData) if (success) { const _result = [] _result.push(result.ROI1) @@ -380,55 +381,49 @@ export default { roiNum: index + 1, })) - const formData = new FormData() const { inputFileName } = this.sample - formData.append('sampleFileName', inputFileName) + const userId = store.getters.userInfo.id + + const formData = new FormData() formData.append('roiParams', JSON.stringify(params)) - formData.append('dataType', this.spectrumData.dataType) + formData.append('fileName', inputFileName) + formData.append('processKey', `${userId}_${this.timerStamp}`) + const { success, result, message } = await postAction('/selfStation/Reprocessing', formData) - const { success, result, message } = await putAction('/selfStation/updateROI', formData) if (success) { - const { - ROIOneList, - ROITwoList, - ROIThreeList, - ROIFourList, - ROIOneStart, - ROIOneStop, - ROITwoStart, - ROITwoStop, - ROIThreeStart, - ROIThreeStop, - ROIFourStart, - ROIFourStop, - } = result - - this.ROILists = [ROIOneList, ROITwoList, ROIThreeList, ROIFourList] - - const boundaryList = [ - [ROIOneStart, ROIOneStop], - [ROITwoStart, ROITwoStop], - [ROIThreeStart, ROIThreeStop], - [ROIFourStart, ROIFourStop], - ] - - this.$refs.betaChartRef.setBoundaryList(boundaryList) + for (let index = 0; index < 4; index++) { + const key = `ROI${index + 1}` + const value = result[key] + if(value) { + this.$set(this.ROIAnalyzeLists, index, value) + } + } + updateSampleData({ + inputFileName, + key: 'ROIAnalyzeLists', + data: cloneDeep(this.ROIAnalyzeLists), + }) + this.$refs.betaChartRef.setBoundaryList(cloneDeep(this.roiParamList)) const updateKeys = ['One', 'Two', 'Three', 'Four'] - updateKeys.forEach((updateKey) => { - const innerKeys = ['Start', 'Stop', 'List'] - innerKeys.forEach((innerKey) => { + updateKeys.forEach((updateKey, index) => { + const innerKeys = ['Start', 'Stop'] + innerKeys.forEach((innerKey, ind) => { const realKey = `ROI${updateKey}${innerKey}` updateSampleData({ inputFileName, - key: `${this.spectraType}.${realKey}`, - data: result[realKey], + key: `sample.${realKey}`, + data: this.roiParamList[index][ind], }) }) }) } else { this.isLoading = false - this.$message.error(message) + const arr = message.split('\n') + this.$warning({ + title: 'Warning', + content: () => arr.map((text) =>
{text}
), + }) } } catch (error) { console.error(error) @@ -492,7 +487,7 @@ export default { if (val == 'sample') { this.currSpectrum = 'Sample' - this.ROIAnalyzeLists = this.sampleDetail.ROIAnalyzeLists + this.ROIAnalyzeLists = this.sampleDetail.ROIAnalyzeLists || [] } else { this.ROIAnalyzeLists = [] }