From 544f44066a51cb3188f9b548c40121818865ae5a Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Thu, 15 Aug 2024 11:10:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=BB=BA=E5=8F=B0=E7=AB=99=E7=9A=84lo?= =?UTF-8?q?ad=20from=20db=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/spectrumAnalysis/beta-analysis.vue | 40 +++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) 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