diff --git a/src/views/spectrumAnalysis/beta-analysis.vue b/src/views/spectrumAnalysis/beta-analysis.vue index f053d8b..cfa4504 100644 --- a/src/views/spectrumAnalysis/beta-analysis.vue +++ b/src/views/spectrumAnalysis/beta-analysis.vue @@ -216,14 +216,13 @@ export default { this.changeChartByType('sample') if (from == 'db') { this.sampleDetail = data - this.emitGetFiles(data) } this.ROIAnalyzeLists = data.ROIAnalyzeLists || [] } else { if (newVal.sampleId) { - this.getSampleDetail() + this.getDetailFromDB() } else { - this.getSelfStationSampleDetail() + this.getDetailFromFile() } this.ROIAnalyzeLists = [] } @@ -242,6 +241,16 @@ export default { this.$bus.$off('selfAccept', this.handleAccept) }, methods: { + // 从分析或来自db的谱信息拿到分析结果列表 + getROIAnalyzeListsFromResult(sampleData) { + const arr = [] + for (let index = 1; index <= 4; index++) { + const k = `ROI${index}` + arr.push(sampleData[k]) + } + return arr + }, + async getAnalyzeCurrentSpectrum() { if (this.isLoading) { return @@ -257,16 +266,12 @@ export default { formData.append('processKey', `${userId}_${this.timerStamp}`) const { success, result, message } = await postAction('/selfStation/Reprocessing', formData) if (success) { - const _result = [] - _result.push(result.ROI1) - _result.push(result.ROI2) - _result.push(result.ROI3) - _result.push(result.ROI4) - this.ROIAnalyzeLists = _result + const analyseList = this.getROIAnalyzeListsFromResult(result) + this.ROIAnalyzeLists = analyseList updateSampleData({ inputFileName, key: 'ROIAnalyzeLists', - data: _result, + data: analyseList, }) } else { const arr = message.split('\n') @@ -464,15 +469,13 @@ export default { } }, - async getSelfStationSampleDetail() { + async getDetailFromFile() { this.spectraType = this.SampleType[0].value const { inputFileName, detFileName, qcFileName } = this.sample let params = { sampleFileName: inputFileName, detFileName: detFileName, qcFileName: qcFileName, - // sampleFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD', - // detFileName: detFileName || 'ABC01_001-20240108_1327_D_FULL_381505.PHD', } try { this.isLoading = true @@ -502,7 +505,7 @@ export default { }, // 获取样品详情 - async getSampleDetail() { + async getDetailFromDB() { const { dbName, sampleId, analyst, inputFileName } = this.sample try { this.cancelLastRequest() @@ -524,6 +527,15 @@ export default { data: result, from: 'db', }) + + const analyseList = this.getROIAnalyzeListsFromResult(result.sample) + this.ROIAnalyzeLists = analyseList + updateSampleData({ + inputFileName, + key: 'ROIAnalyzeLists', + data: analyseList, + }) + this.sampleDetail = result this.changeChartByType('sample') this.isLoading = false