From f072b2d40b4980bfc0316993d799d34d0496dcac Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 6 Nov 2023 15:36:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0initValue=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E7=94=A8=EF=BC=8C=E5=A2=9E=E5=8A=A0gamma=E4=B8=8B?= =?UTF-8?q?=E7=9A=84save=20phd=20to=20file=E7=9A=84save=20all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/spectrumAnalysis/index.vue | 39 +++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index c0f9100..5aa9e07 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -477,6 +477,7 @@ export default { handleLoadSampleFromDB(sampleList) { const ids = this.sampleList.map((item) => item.sampleId) // 当前Sample列表中的所有id const willAddList = sampleList.filter((item) => !ids.includes(item.sampleId)) + this.callInitValue(willAddList) this.sampleList = this.sampleList.concat(willAddList) }, handleLoadSampleFromFile(sampleList) { @@ -497,9 +498,29 @@ export default { }) const names = this.sampleList.map((item) => item.inputFileName) // 当前Sample列表中的所有id const willAddList = arr.filter((item) => !names.includes(item.inputFileName)) + this.callInitValue(willAddList) this.sampleList = this.sampleList.concat(willAddList) }, + /** + * gamma谱调用initValue先初始化数据 + * @param {Array} willAddList + */ + callInitValue(willAddList) { + willAddList + .filter( + ({ sampleType, inputFileName }) => sampleType !== 'B' && inputFileName !== this.sampleData.inputFileName + ) + .forEach(({ inputFileName: fileName, dbName, sampleId }) => { + const params = { + sampleId, + dbName, + fileName, + } + getAction('/gamma/initValue', params) + }) + }, + // 加载选中的样本 async loadSelectedSample(sample) { console.log('%c [ sample ]-381', 'font-size:13px; background:pink; color:#bf2c9f;', sample) @@ -665,11 +686,21 @@ export default { handleSavePHDToFile(type) { console.log('%c [ savePHDToFile ]-162', 'font-size:13px; background:pink; color:#bf2c9f;', type) if (this.isGamma) { - const url = '/gamma/saveToPHD' - let params = { - fileName: this.newSampleData.inputFileName, + if (type == 'current') { + let params = { + fileName: this.newSampleData.inputFileName, + } + fetchAndDownload('/gamma/saveToPHD', params, 'get') + } else { + this.sampleList + .filter(({ sampleType }) => sampleType !== 'B') + .forEach(({ inputFileName: fileName }) => { + const params = { + fileName, + } + fetchAndDownload('/gamma/saveToPHD', params, 'get') + }) } - fetchAndDownload(url, params, 'get') } }, From 1777d174e2c033bc5e3865c0aa626c224fb40b78 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 6 Nov 2023 17:53:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0beta=E4=B8=8B?= =?UTF-8?q?=E5=8F=B3=E4=B8=8B=E8=A7=92=E7=9A=84=E6=94=BE=E5=A4=A7=E9=95=9C?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E4=B8=8A=E5=B1=82=E5=8F=A0=E6=96=B9=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spectrumAnalysis/beta-gamma-analysis.vue | 50 ++++++++++++++++++- .../components/BetaGammaSpectrumChart.vue | 7 +-- .../components/ResultDisplay.vue | 12 +++-- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/views/spectrumAnalysis/beta-gamma-analysis.vue b/src/views/spectrumAnalysis/beta-gamma-analysis.vue index b33e2c4..e1fada0 100644 --- a/src/views/spectrumAnalysis/beta-gamma-analysis.vue +++ b/src/views/spectrumAnalysis/beta-gamma-analysis.vue @@ -102,7 +102,7 @@
- +
@@ -506,6 +506,53 @@ export default { } }) }, + + // 右下角放大镜 + handleZoom(nuclideName) { + let ROI_nums = [] + switch (nuclideName) { + case 'Xe131m': + ROI_nums = [5] + break + case 'Xe133m': + ROI_nums = [6] + break + case 'Xe133': + ROI_nums = [3, 4] + break + case 'Xe135': + ROI_nums = [2] + break + } + + if (this.boundaryList.length) { + let left = 0, + right = 0, + top = 0, + bottom = 0 + for (let i = 0; i < ROI_nums.length; ++i) { + const ROI_line = this.boundaryList[ROI_nums[i]] + left = Math.min(left, ROI_line.minX) + right = Math.max(right, ROI_line.maxX) + top = Math.max(top, ROI_line.maxY) + bottom = Math.min(bottom, ROI_line.minY) + } + + const minX = left - 10, + maxX = right + 10, + minY = bottom - 10, + maxY = top + 10 + + this.$refs.betaGammaChartRef.setRange(minX, maxX, 'x') + this.$refs.betaGammaChartRef.setRange(minY, maxY, 'y') + + this.$refs.lineChart1Ref.setRange(minY, maxY) + this.$refs.lineChart2Ref.setRange(minY, maxY) + + this.$refs.lineChart3Ref.setRange(minX, maxX) + this.$refs.lineChart4Ref.setRange(minX, maxX) + } + }, }, watch: { sample: { @@ -527,6 +574,7 @@ export default { this.getSampleDetail_file() } } + this.$refs.betaGammaChartRef.handleUnzoom() }, immediate: true, deep: true, diff --git a/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue b/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue index 5b3bd3f..36d40f7 100644 --- a/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue +++ b/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue @@ -48,6 +48,7 @@ import ColorPalette from './ColorPalette.vue' import { getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper.js' const buttons = ['2D', '3D Surface', '3D Scatter'] +const rectColorList = ['#99CA53', '#F6A625', '#6D5FD5', '#BF593E', '#1F9DDB'] // 2D 配置 const twoDOption = { @@ -133,7 +134,7 @@ const twoDOption = { }, series: { type: 'scatterGL', - symbolSize: 5, + symbolSize: 4, data: [], itemStyle: { color: '#fff' @@ -757,8 +758,8 @@ export default { // 2D 图表 上的 矩形 boundary: { handler(newVal) { - newVal.forEach(item => { - item.color = this.getRandomColor() + newVal.forEach((item, index) => { + item.color = rectColorList[index%5] }) this.boundaryData = newVal this.reDrawRect() diff --git a/src/views/spectrumAnalysis/components/ResultDisplay.vue b/src/views/spectrumAnalysis/components/ResultDisplay.vue index e221590..2d00eb7 100644 --- a/src/views/spectrumAnalysis/components/ResultDisplay.vue +++ b/src/views/spectrumAnalysis/components/ResultDisplay.vue @@ -17,8 +17,8 @@ {{ text }} - -