From e95fe5da812c99d08754b8dbf82270f4315972e4 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 30 Oct 2023 10:03:51 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DRLR=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=ADsampleData=E9=87=8D=E5=A4=8D=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modals/BetaGammaModals/BetaGammaRLRModal/index.vue | 5 ----- src/views/spectrumAnalysis/index.vue | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaRLRModal/index.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaRLRModal/index.vue index f87067e..eef4b9a 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaRLRModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaRLRModal/index.vue @@ -116,11 +116,6 @@ export default { AdditionalInfo, Notes, }, - props: { - sampleData: { - type: Object, - }, - }, data() { this.tabs = tabs return { diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 7dca51b..833f58b 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -190,7 +190,7 @@ - + From 0672e09dd18528b169e15a17c05970f02c1dbd29 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 30 Oct 2023 11:55:27 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DBeta=20=E4=B8=8B?= =?UTF-8?q?=20Energy=20Calibration=E5=BC=B9=E7=AA=97=E5=B7=A6=E4=B8=8B?= =?UTF-8?q?=E8=A7=92All=20Spectrum=20=E6=9C=AA=E7=94=9F=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BetaGammaEnergyCalibrationModal/index.vue | 41 ++++++++++++++++--- src/views/spectrumAnalysis/index.vue | 1 + 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue index eb43c15..9dc33f8 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue @@ -52,6 +52,12 @@ import TitleOverBorder from '@/views/spectrumAnalysis/components/TitleOverBorder export default { components: { BetaDetectorCalibration, GammaDetectorCalibration, TitleOverBorder }, mixins: [ModalMixin, SampleDataMixin], + props: { + sampleList: { + type: Array, + required: true, + }, + }, data() { return { currTab: 'gamma', @@ -85,6 +91,28 @@ export default { this.gammaEnergyValid = val }, handleReAnalyse() { + const regExp = /^([A-Z]{1,}\d{1,})_/ + const regMatched = this.newSampleData.inputFileName.match(regExp) + const currStationName = regMatched[1] + const dbNames = [], + sampleIds = [], + sampleFileNames = [], + gasFileNames = [], + detFileNames = [], + qcFileNames = [] + + const matchedSampleList = this.sampleList.filter((item) => item.inputFileName.includes(currStationName)) + matchedSampleList.forEach( + ({ dbName, sampleId, sampleFileName, gasFileName, detFileName, qcFileName, qcFileStatus }) => { + dbNames.push(dbName || '') + sampleIds.push(sampleId || '') + sampleFileNames.push(sampleFileName) + gasFileNames.push(gasFileName) + detFileNames.push(detFileName) + qcFileNames.push(qcFileStatus ? qcFileName : '') + } + ) + let params = { applyType: this.newCalibrationIsAppliedTo, sampleData: this.recalculateROICountsFor.includes('sample') ? true : false, @@ -93,13 +121,14 @@ export default { qcData: this.recalculateROICountsFor.includes('qc') ? true : false, betaEnergyValid: this.betaEnergyValid, gammaEnergyValid: this.gammaEnergyValid, - dbNames: [this.newSampleData.dbName], - sampleIds: [this.newSampleData.sampleId ? this.newSampleData.sampleId : ''], - sampleFileNames: [this.newSampleData.inputFileName], - gasFileNames: [this.newSampleData.gasFileName], - detFileNames: [this.newSampleData.detFileName], - qcFileNames: [this.newSampleData.qcFileName], + dbNames, + sampleIds, + sampleFileNames, + gasFileNames, + detFileNames, + qcFileNames, currentFileName: this.newSampleData.inputFileName, + currentQCFileName: this.newSampleData.qcFileName, } postAction('/spectrumAnalysis/ReAnalyse', params).then((res) => { if (res.success) { diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 833f58b..6391916 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -165,6 +165,7 @@ From d5d15ad5b43a5073cf54ee0f6bea456f683cc128 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 30 Oct 2023 14:02:30 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dbeta=E4=B8=8B?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=88=86=E6=9E=90=E5=90=8E=EF=BC=8CResult=20?= =?UTF-8?q?Display=E7=9A=84=E6=95=B0=E6=8D=AE=E6=B2=A1=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/sample.js | 9 ++++++++- src/views/spectrumAnalysis/beta-gamma-analysis.vue | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/store/modules/sample.js b/src/store/modules/sample.js index 273c4a0..f6b89a1 100644 --- a/src/store/modules/sample.js +++ b/src/store/modules/sample.js @@ -9,13 +9,20 @@ const sample = { ADD_SAMPLE_DATA: (state, sampleData) => { const find = state.sampleList.find(item => item.inputFileName == sampleData.inputFileName) - if(find) { + if (find) { find.data = sampleData.data } else { state.sampleList.push(sampleData) } }, + UPDATE_SAMPLE_DATA: (state, { inputFileName, key, data }) => { + const find = state.sampleList.find(item => item.inputFileName == inputFileName) + if (find) { + find.data[key] = data + } + }, + REMOVE_SAMPLE_DATA: (state, inputFileName) => { const findIndex = state.sampleList.findIndex(item => item.inputFileName == inputFileName) state.sampleList.splice(findIndex, 1) diff --git a/src/views/spectrumAnalysis/beta-gamma-analysis.vue b/src/views/spectrumAnalysis/beta-gamma-analysis.vue index d2e7284..836c3c7 100644 --- a/src/views/spectrumAnalysis/beta-gamma-analysis.vue +++ b/src/views/spectrumAnalysis/beta-gamma-analysis.vue @@ -478,6 +478,12 @@ export default { handler(newVal, oldVal) { // this.currResultDisplay = newVal.XeData this.resultDisplay = newVal.XeData || [] + + this.$store.commit('UPDATE_SAMPLE_DATA', { + inputFileName: this.sample.inputFileName, + key: 'XeData', + data: newVal.XeData + }) }, immediate: true, deep: true, From 3ae3dee3d29a031ce5f6623bc00594f1d0ded43e Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 30 Oct 2023 15:15:56 +0800 Subject: [PATCH 4/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dstore=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/sample.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/modules/sample.js b/src/store/modules/sample.js index f6b89a1..49cdf51 100644 --- a/src/store/modules/sample.js +++ b/src/store/modules/sample.js @@ -28,7 +28,7 @@ const sample = { state.sampleList.splice(findIndex, 1) }, - CLEAR_SAMPLE_DATA: () => { + CLEAR_SAMPLE_DATA: (state) => { state.sampleList = [] } }, From 9eeb9435b5b3e2f77150dc445c71ac7d16948438 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 30 Oct 2023 16:01:27 +0800 Subject: [PATCH 5/8] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0SAVE=E4=B8=8A?= =?UTF-8?q?=E7=9A=84loading=EF=BC=8C=E5=A2=9E=E5=8A=A0BG=20log=20viewer?= =?UTF-8?q?=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modals/BetaGammaModals/BGLogViewer.vue | 67 +++++++++++++++++++ src/views/spectrumAnalysis/index.vue | 34 ++++++++-- 2 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BGLogViewer.vue diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BGLogViewer.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BGLogViewer.vue new file mode 100644 index 0000000..5fa1710 --- /dev/null +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BGLogViewer.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 6391916..23a0180 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -10,7 +10,10 @@ :overlay-style="operation.style" :key="operation.title" > - {{ operation.title }} + + + {{ operation.title }} +
diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 23a0180..05014d0 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -512,7 +512,7 @@ export default { try { await fetchAndDownload(url, params, 'get') } catch (error) { - console.error(error) + console.error(error) } finally { this.isSaving = false } @@ -637,7 +637,7 @@ export default { }) // 处理当前的谱的reprocessing - if(inputFileName && sampleType !== 'B') { + if (inputFileName && sampleType !== 'B') { this.$refs.gammaAnalysisRef.reProcessing(false) } }, @@ -833,6 +833,23 @@ export default { children: [ { title: 'Save Results to File', + children: [ + { + title: 'Save Txt', + key: 'saveTxt', + show: this.isBetaGamma, + }, + { + title: 'Save Excel', + key: 'saveExcel', + show: this.isBetaGamma, + }, + { + title: 'Save Html', + key: 'saveHtml', + show: this.isBetaGamma, + }, + ], }, { title: 'Save Results to DB', @@ -844,6 +861,7 @@ export default { { title: 'Save All', key: 'all', + show: this.isGamma, }, ], key: 'resultsToDB', @@ -869,13 +887,23 @@ export default { on: { menuClick: () => { console.log(this.isBetaGamma, this.isGamma) - this.saveSettingModalVisible = true + if (this.isGamma) { + this.saveSettingModalVisible = true + } }, submenuClick: ({ item, child }) => { + console.log('item, child', item, child) + debugger if (item.key == 'resultsToDB') { this.handleSaveResultsToDB(child.key) } else if (item.key == 'phdToFile') { this.handleSavePHDToFile(child.key) + } else if (child.key == 'saveTxt') { + this.handleSaveResultsToFile('txt') + } else if (child.key == 'saveExcel') { + this.handleSaveResultsToFile('xls') + } else if (child.key == 'saveHtml') { + this.handleSaveResultsToFile('html') } }, }, From 1a849ec33694d5bbfe7447904026ee6247a88ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=8F=AE=E5=AE=87?= Date: Mon, 30 Oct 2023 19:53:55 +0800 Subject: [PATCH 7/8] =?UTF-8?q?gamma=20=E7=9A=84=20Save=20Results=20to=20F?= =?UTF-8?q?ile=20save=20All=20=20=E5=8A=9F=E8=83=BD=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Modals/SaveSettingModal.vue | 2 +- src/views/spectrumAnalysis/gamma-analysis.vue | 1 - src/views/spectrumAnalysis/index.vue | 47 ++++++++++++------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/SaveSettingModal.vue b/src/views/spectrumAnalysis/components/Modals/SaveSettingModal.vue index ea6ed2a..70cc35d 100644 --- a/src/views/spectrumAnalysis/components/Modals/SaveSettingModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/SaveSettingModal.vue @@ -39,7 +39,7 @@ export default { }, handleOk() { - this.$emit('save', this.saveFormat) + this.$emit('save', this.saveFormat, this.saveAll) }, }, computed: { diff --git a/src/views/spectrumAnalysis/gamma-analysis.vue b/src/views/spectrumAnalysis/gamma-analysis.vue index 91d6c94..8e5c698 100644 --- a/src/views/spectrumAnalysis/gamma-analysis.vue +++ b/src/views/spectrumAnalysis/gamma-analysis.vue @@ -413,7 +413,6 @@ export default { }, initWebSocket: function () { - console.log('qweqwerq') // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https var userId = store.getters.userInfo.id var url = diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 05014d0..e25da83 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -419,7 +419,6 @@ export default { this.isReAnalyed_gamma = val }, getUpdateFlag(val) { - console.log('qerq', val) this.updateFlag = val }, getcommentsInfo(val) { @@ -502,19 +501,38 @@ export default { }, // 保存结果到文件, 服务端生成文件,前端下载 - async handleSaveResultsToFile(saveFormat) { + async handleSaveResultsToFile(saveFormat, isSaveAll = false) { this.isSaving = true if (this.isGamma) { - const url = saveFormat == 'xls' ? '/gamma/saveToExcel' : saveFormat == 'txt' ? '/gamma/saveToTxt' : '' - let params = { - fileName: this.newSampleData.inputFileName, - } - try { - await fetchAndDownload(url, params, 'get') - } catch (error) { - console.error(error) - } finally { - this.isSaving = false + if (!isSaveAll) { + const url = saveFormat == 'xls' ? '/gamma/saveToExcel' : saveFormat == 'txt' ? '/gamma/saveToTxt' : '' + let params = { + fileName: this.newSampleData.inputFileName, + } + try { + await fetchAndDownload(url, params, 'get') + } catch (error) { + console.error(error) + } finally { + this.isSaving = false + } + } else { + let list = this.sampleList.filter((item) => item.sampleType !== 'B') + if (list.length > 0) { + list.forEach(async (item) => { + const url = saveFormat == 'xls' ? '/gamma/saveToExcel' : saveFormat == 'txt' ? '/gamma/saveToTxt' : '' + let params = { + fileName: item.inputFileName, + } + try { + await fetchAndDownload(url, params, 'get') + } catch (error) { + console.error(error) + } finally { + this.isSaving = false + } + }) + } } } if (this.isBetaGamma) { @@ -722,7 +740,6 @@ export default { } postAction('/spectrumAnalysis/analyseAllSpectrum', params).then((res) => { if (res.success) { - console.log(res) this.analyseCurrentSpectrumData = res.result this.resultDisplayFlag = res.result.XeData this.resultDisplayFlag.forEach((item) => { @@ -886,14 +903,11 @@ export default { }, on: { menuClick: () => { - console.log(this.isBetaGamma, this.isGamma) if (this.isGamma) { this.saveSettingModalVisible = true } }, submenuClick: ({ item, child }) => { - console.log('item, child', item, child) - debugger if (item.key == 'resultsToDB') { this.handleSaveResultsToDB(child.key) } else if (item.key == 'phdToFile') { @@ -1099,7 +1113,6 @@ export default { type: 'a-menu-item', title: 'ARR', handler: () => { - console.log(this.newSampleData) if (this.newSampleData.sampleId) { this.arrOrRRRModalVisible = true this.arrOrRRRModalExtraData = {} From a7b18c57c786017b8dc1708d424af9150cfa24d4 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 30 Oct 2023 19:56:56 +0800 Subject: [PATCH 8/8] =?UTF-8?q?WIP:=20=E4=BF=AE=E6=94=B9Interactive=20Tool?= =?UTF-8?q?s=20=E5=BC=B9=E7=AA=97=E6=95=B0=E6=8D=AE=E7=9A=84=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=BA=95=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E6=9C=80=E5=90=8E=E4=B8=80=E9=A1=B9=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=BA=A2=E5=87=BA=E9=9A=90=E8=97=8F=EF=BC=8C=E6=93=8D?= =?UTF-8?q?=E4=BD=9CmarkLine=E6=97=B6=E5=A6=82=E4=B8=8D=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E8=87=AA=E5=8A=A8=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/sampleHelper.js | 20 ++ .../AnalyzeInteractiveToolModal/index.vue | 325 +++++++++--------- 2 files changed, 182 insertions(+), 163 deletions(-) create mode 100644 src/utils/sampleHelper.js diff --git a/src/utils/sampleHelper.js b/src/utils/sampleHelper.js new file mode 100644 index 0000000..2520d19 --- /dev/null +++ b/src/utils/sampleHelper.js @@ -0,0 +1,20 @@ +/** + * 在返回的allData中查找指定的数据 + * @param {Array} allData + * @param {*} name + * @param {*} group + */ +export const getLineData = (allData, name, group, isList = false) => { + const arrFunc = isList ? Array.prototype.filter : Array.prototype.find + return arrFunc.call(allData, item => item.name == name && item.group == group) || {} +} + +/** + * 转换pointlist类型数据到series的data可用的数据 + */ +export const transformPointListData = pointlist => { + if (!pointlist) { + return [] + } + return pointlist.map(({ x, y }) => [x, y]) +} diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index 0c6f33b..a2643f7 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -36,6 +36,7 @@ >

{ return index + 1 }, - width: 60 + width: 60, }, { title: 'Energy (keV)', dataIndex: 'energy', width: 120, - customRender: text => { + customRender: (text) => { return text.toFixed(3) - } + }, }, { title: 'Centroid (C)', dataIndex: 'peakCentroid', width: 120, - customRender: text => { + customRender: (text) => { return text.toFixed(3) - } + }, }, { title: 'FWHM (keV)', dataIndex: 'fwhm', width: 120, - customRender: text => { + customRender: (text) => { return text.toFixed(3) - } + }, }, { title: 'Area', dataIndex: 'area', width: 120, - customRender: text => { + customRender: (text) => { return text.toFixed(3) - } + }, }, { title: 'Detectability', dataIndex: 'significance', width: 120, - customRender: text => { + customRender: (text) => { return text.toFixed(3) - } + }, }, { title: '#Cmnt', dataIndex: 'comments', - width: 120 + width: 120, }, { title: 'Nuclides', dataIndex: 'nuclides', width: 120, - customRender: text => { + ellipsis: true, + customRender: (text) => { return text && text.join(';') - } - } + }, + }, ] // 缩略图配置 @@ -371,43 +374,43 @@ const thumbnailOption = { top: 0, left: 5, right: 5, - bottom: 0 + bottom: 0, }, xAxis: { type: 'category', axisLine: { - show: false + show: false, }, splitLine: { - show: false + show: false, }, axisLabel: { - show: false + show: false, }, min: 1, - max: 'dataMax' + max: 'dataMax', }, yAxis: { type: 'value', axisLine: { - show: false + show: false, }, splitLine: { - show: false + show: false, }, axisLabel: { - show: false + show: false, }, min: 0.1, - max: 'dataMax' + max: 'dataMax', }, - series: null + series: null, } const nuclideIdentifyModal = { possibleNuclide: '', tolerance: 0.5, - identifiedNuclide: '' + identifiedNuclide: '', } // 操作类型 @@ -415,7 +418,7 @@ const Operators = { ADD: 1, // 新增 REMOVE: 2, // 移除 MODIFY: 3, // 改变 - SLOPE_CHANGE: 4 // 改变slope + SLOPE_CHANGE: 4, // 改变slope } export default { @@ -428,7 +431,7 @@ export default { NuclideReviewModal, GeneralCommentModal, EditSlopeModal, - RectList + RectList, }, data() { this.columns = columns @@ -477,66 +480,47 @@ export default { isReploting: false, operationStack: [], // 操作记录 - replotNeeded: false + replotNeeded: false, } }, created() { - this.option.tooltip.formatter = params => { + this.option.tooltip.formatter = (params) => { const channel = parseInt(params[0].value[0]) - const energy = this.energy[channel - 1] + const energy = this.energy.pointlist ? this.energy.pointlist[channel - 1].x : 0 return `
Channel: ${channel}
${isNullOrUndefined(energy) ? '' : `Energy: ${energy.toFixed(2)}`}
` } }, methods: { async getInfo() { - try { - this.isLoading = true - this.option.series = [] - this.thumbnailOption.series = [] - this.list = [] - this.model = cloneDeep(nuclideIdentifyModal) + this.option.series = [] + this.thumbnailOption.series = [] + this.list = [] + this.model = cloneDeep(nuclideIdentifyModal) - const { success, result, message } = await getAction('/gamma/InteractiveTool', { - sampleId: this.sampleId, - fileName: this.fileName - }) + const { inputFileName } = this.sampleData - // const { success, result, message } = cloneDeep(Response) + const currSampleDetailInfo = await this.$store.dispatch('GET_SAMPLE_DATA', inputFileName) + const { + data: { allData, shadowChannelChart, shapeChannelData, peak }, + } = currSampleDetailInfo - if (success) { - this.isLoading = false - const { - barChart, - channelBaseCPChart, - channelBaseLineChart, - channelCountChart, - channelPeakChart, - energy, - table, - BaseCtrls, - FitBaseLine - } = result + const channelBaseLine = getLineData(allData, 'BaseLine', 'channel') + const channelPeakGroup = getLineData(allData, 'Peak', 'channel', true) - console.log('%c [ ]-374', 'font-size:13px; background:pink; color:#bf2c9f;', result) + const allEnergy = getLineData(allData, 'Energy', 'energy') - this.channelBaseCPChart = channelBaseCPChart - this.channelBaseLineChart = channelBaseLineChart - this.channelCountChart = channelCountChart - this.channelPeakChart = channelPeakChart - this.energy = energy - this.BaseCtrls = BaseCtrls - this.FitBaseLine = FitBaseLine - this.barChart = barChart + this.channelBaseCPChart = shapeChannelData + this.channelBaseLineChart = channelBaseLine + this.channelCountChart = shadowChannelChart + this.channelPeakChart = channelPeakGroup + this.energy = allEnergy + // this.BaseCtrls = BaseCtrls + // this.FitBaseLine = FitBaseLine + this.barChart = shadowChannelChart - this.setChartOption(channelBaseLineChart, channelCountChart, channelPeakChart, channelBaseCPChart, barChart) - this.list = table - } else { - this.$message.error(message) - } - } catch (error) { - console.error(error) - } + this.setChartOption(channelBaseLine, shadowChannelChart, channelPeakGroup, shapeChannelData, shadowChannelChart) + this.list = peak }, setChartOption(baseLine, count, peaks, baseCP, bar) { @@ -554,7 +538,7 @@ export default { // 推入基线控制点 series.push(this.buildCtrlPoint(baseCP)) - this.thumbnailOption.series = this.buildBarChart(bar) + // this.thumbnailOption.series = this.buildBarChart(bar) this.option.series = series }, @@ -573,10 +557,6 @@ export default { }, beforeModalOpen() { - const { sampleId, inputFileName } = this.sampleData - this.sampleId = sampleId - this.fileName = inputFileName - this.getInfo() this.reset() }, @@ -640,7 +620,7 @@ export default { left = channel } - const peaksBetweenChannel = this.list.filter(peak => { + const peaksBetweenChannel = this.list.filter((peak) => { const centroidId = peak.peakCentroid return centroidId >= left && centroidId <= right }) @@ -672,7 +652,7 @@ export default { const maxXAxises = this.getPeakMaxValues() if (direction == 'next') { // 找到第一个比prevAxis大的xAxis - const find = maxXAxises.find(xAxis => xAxis > prevAxis) + const find = maxXAxises.find((xAxis) => xAxis > prevAxis) if (find) { markLineOption.xAxis = find } @@ -680,7 +660,7 @@ export default { // 找到第一个比prevAxis小的xAxis const find = cloneDeep(maxXAxises) .reverse() - .find(xAxis => xAxis < prevAxis) + .find((xAxis) => xAxis < prevAxis) if (find) { markLineOption.xAxis = find } @@ -688,11 +668,24 @@ export default { const xAxis = markLineOption.xAxis if (xAxis >= 0) { - const index = maxXAxises.findIndex(item => item == xAxis) + const index = maxXAxises.findIndex((item) => item == xAxis) if (index !== -1) { this.selectedKeys = [this.list[index].index] } } + + const { xAxis: chartXAxisOption } = this.option + const { max, min } = chartXAxisOption + + // 如果不在范围内 + if (xAxis >= max || xAxis <= min) { + const halfDiff = (max - min) / 2 + const lastChannel = this.channelCountChart.pointlist[this.channelCountChart.pointlist.length - 1].x + let nextMax = xAxis + halfDiff + let nextMin = xAxis - halfDiff + chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax + chartXAxisOption.min = nextMin < 1 ? 1 : nextMin + } }, // 获取右下角possible nuclide 和 identified nuclide @@ -703,10 +696,11 @@ export default { if (!row._possible) { this.$set(row, '_loading', true) try { + const { sampleId, inputFileName: fileName } = this.sampleData const { success, result, message } = await getAction('/gamma/getSelPosNuclide', { - sampleId: this.sampleId, + sampleId, channel: parseInt(row.peakCentroid), - fileName: this.fileName + fileName, }) if (success) { const { possible } = result @@ -724,9 +718,9 @@ export default { // 获取每一段 Channel 中的最大值 getPeakMaxValues() { - const maxXAxises = this.channelPeakChart.map(item => { - const allY = item.pointlist.map(point => point.y) - const max = item.pointlist.find(point => point.y == Math.max(...allY)) + const maxXAxises = this.channelPeakChart.map((item) => { + const allY = item.pointlist.map((point) => point.y) + const max = item.pointlist.find((point) => point.y == Math.max(...allY)) return max.x }) return maxXAxises @@ -772,7 +766,7 @@ export default { shadowEnergyChart, shapeChannelData, shapeEnergyData, - table + table, } = result this.$bus.$emit('gammaRefresh', { @@ -781,7 +775,7 @@ export default { shadowChannelChart, shadowEnergyChart, shapeChannelData, - shapeEnergyData + shapeEnergyData, }) this.channelPeakChart = channelPeakChart @@ -828,8 +822,8 @@ export default { content: 'Are you sure to delete this peak?', cancelButtonProps: { props: { - type: 'warn' - } + type: 'warn', + }, }, onOk: async () => { // this.list.splice(findIndex, 1) @@ -850,7 +844,7 @@ export default { const { inputFileName: fileName } = this.sampleData const { success, result, message } = await getAction('/gamma/deletePeak', { fileName, - curRow: this.curRow + curRow: this.curRow, }) if (success) { const { @@ -860,7 +854,7 @@ export default { shadowEnergyChart, shapeChannelData, shapeEnergyData, - table + table, } = result this.$bus.$emit('gammaRefresh', { @@ -869,7 +863,7 @@ export default { shadowChannelChart, shadowEnergyChart, shapeChannelData, - shapeEnergyData + shapeEnergyData, }) this.channelPeakChart = channelPeakChart @@ -896,7 +890,7 @@ export default { } catch (error) { console.error(error) } - } + }, }) }, @@ -928,6 +922,19 @@ export default { this.option.series[0].markLine.data[0].xAxis = channel + const { xAxis: chartXAxisOption } = this.option + const { max, min } = chartXAxisOption + + // 如果不在范围内 + if (channel >= max || channel <= min) { + const halfDiff = (max - min) / 2 + const lastChannel = this.channelCountChart.pointlist[this.channelCountChart.pointlist.length - 1].x + let nextMax = channel + halfDiff + let nextMin = channel - halfDiff + chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax + chartXAxisOption.min = nextMin < 1 ? 1 : nextMin + } + this.getSelPosNuclide(row) this.selectedTableItem = row @@ -946,8 +953,8 @@ export default { key: 'brush', brushOption: { // 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。 - brushType: 'rect' - } + brushType: 'rect', + }, }) }, @@ -962,12 +969,12 @@ export default { // 清理刷选的范围 chart.dispatchAction({ type: 'brush', - areas: [] + areas: [], }) // 改为不可刷选状态 chart.dispatchAction({ - type: 'takeGlobalCursor' + type: 'takeGlobalCursor', }) }, @@ -978,8 +985,8 @@ export default { if (areas) { const range = areas.range const [[minX, maxX], [minY, maxY]] = range - const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map(num => parseInt(num.toFixed())) - const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map(num => parseInt(num.toFixed())) + const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map((num) => parseInt(num.toFixed())) + const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map((num) => parseInt(num.toFixed())) const xAxisMax = chart.getModel().getComponent('xAxis').axis.scale._extent[1] const yAxisMax = this.option.yAxis.max let [x1, y2, x2, y1] = [...point1, ...point2] // 根据解析出的数据确定真实的范围 @@ -1036,7 +1043,7 @@ export default { this.baseCtrls_Copy.baseline.map((val, index) => [index + 1, val]), this.FitBaseLine, { - zlevel: 21 + zlevel: 21, } ) this.option.series.push(baseLineEditSeries) @@ -1050,13 +1057,13 @@ export default { this.btnGroupType = 1 this.opts.notMerge = true const baseLineEditSeries = findSeriesByName(this.option.series, 'BaseLine_Edit') - const index = this.option.series.findIndex(item => item == baseLineEditSeries) + const index = this.option.series.findIndex((item) => item == baseLineEditSeries) this.option.series.splice(index, 1) this.clearRect() const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine') - baseLineSeries.data = this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]) // 恢复基线 + baseLineSeries.data = transformPointListData(this.channelBaseLineChart.pointlist) // 恢复基线 const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point') baseLineCP.data = this.buildCPPointData(this.channelBaseCPChart) @@ -1096,7 +1103,7 @@ export default { this.isModifying = false this.pushOperationStack(Operators.MODIFY, { index, - prevYAxis + prevYAxis, }) }, @@ -1120,7 +1127,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)) @@ -1196,7 +1203,7 @@ export default { index: i, removeXAxis, removeYAxis, - removeYSlope + removeYSlope, }) }, @@ -1232,7 +1239,7 @@ export default { this.$refs.editSlopeModal.open({ index: i, value: yslope[i], - allowNaN: !(i == 0 || i == n - 1) + allowNaN: !(i == 0 || i == n - 1), }) }, @@ -1246,7 +1253,7 @@ export default { yslope[index] = slope this.pushOperationStack(Operators.SLOPE_CHANGE, { index, - slope: prevSlope + slope: prevSlope, }) this.redrawBaseLine() this.buildRect() @@ -1269,7 +1276,7 @@ export default { const { success, result, message } = await postAction('/gamma/replotBaseLine', { ...this.baseCtrls_Copy, fileName, - replotNeeded: this.replotNeeded + replotNeeded: this.replotNeeded, }) if (success) { const { chartData, peakSet, shapeData } = result @@ -1288,8 +1295,8 @@ export default { color, point: { x: xAxis, - y: yctrl[index] - } + y: yctrl[index], + }, } }) baseLineCP.data = this.buildCPPointData(baseCPPoints) @@ -1323,8 +1330,8 @@ export default { itemStyle: { color: 'transparent', borderColor: color, - borderWidth: size / 2 - } + borderWidth: size / 2, + }, } }) }, @@ -1358,7 +1365,7 @@ export default { this.isAccepting = true const { success, result, message } = await postAction('/gamma/acceptBaseLine', { ...this.baseCtrls_Copy, - fileName + fileName, }) if (success) { this.BaseCtrls = cloneDeep(this.baseCtrls_Copy) @@ -1372,7 +1379,7 @@ export default { shadowEnergyChart, shapeChannelData, shapeData, - shapeEnergyData + shapeEnergyData, } = result this.channelBaseLineChart = channelBaseLineChart @@ -1416,7 +1423,7 @@ export default { curRow: this.curRow, nuclideName: possibleNuclide, fileName, - list_identify: nuclides + list_identify: nuclides, }) if (success) { nuclides.push(possibleNuclide) @@ -1439,7 +1446,7 @@ export default { if (this.selectedTableItem._deleting) { return } - const findIndex = nuclides.findIndex(nuclide => nuclide == this.model.identifiedNuclide) + const findIndex = nuclides.findIndex((nuclide) => nuclide == this.model.identifiedNuclide) if (-1 !== findIndex) { try { this.$set(this.selectedTableItem, '_deleting', true) @@ -1448,7 +1455,7 @@ export default { curRow: this.curRow, nuclideName: this.model.identifiedNuclide, fileName, - list_identify: nuclides + list_identify: nuclides, }) if (success) { nuclides.splice(findIndex, 1) @@ -1467,43 +1474,35 @@ export default { buildBaseLine(channelBaseLineChart) { return buildLineSeries( 'BaseLine', - channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]), + transformPointListData(channelBaseLineChart.pointlist), channelBaseLineChart.color, { markLine: { silent: true, symbol: 'none', label: { - show: false + show: false, }, lineStyle: { color: 'red', - width: 1 + width: 1, }, - data: [{ xAxis: -1 }] + data: [{ xAxis: -1 }], }, - zlevel: 10 + zlevel: 10, } ) }, // 构建count buildCountLine(channelCountChart) { - return buildLineSeries( - 'CountChart', - channelCountChart.pointlist.map(({ x, y }) => [x, y]), - channelCountChart.color - ) + return buildLineSeries('CountChart', transformPointListData(channelCountChart.pointlist), channelCountChart.color) }, // 构建Peaks buildPeaks(channelPeakChart) { return channelPeakChart.map((item, index) => { - return buildLineSeries( - 'Peak_' + (index + 1), - item.pointlist.map(({ x, y }) => [x, y]), - item.color - ) + return buildLineSeries('Peak_' + (index + 1), transformPointListData(item.pointlist), item.color) }) }, @@ -1515,7 +1514,7 @@ export default { data: this.buildCPPointData(channelBaseCPChart), silent: true, animation: false, - zlevel: 20 + zlevel: 20, } }, @@ -1526,7 +1525,7 @@ export default { barChart.map(({ x, y }) => [x, y]), '#fff', { - silent: true + silent: true, } ) }, @@ -1539,7 +1538,7 @@ export default { pushOperationStack(operator, operand) { this.operationStack.push({ operator, - operand + operand, }) }, @@ -1584,19 +1583,19 @@ export default { */ clearOperationStack() { this.operationStack = [] - } + }, }, computed: { curRow() { const [selectedKey] = this.selectedKeys - const findIndex = this.list.findIndex(item => item.index == selectedKey) + const findIndex = this.list.findIndex((item) => item.index == selectedKey) return findIndex }, isOperationStackEmpty() { return this.operationStack.length == 0 - } - } + }, + }, }