diff --git a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue index 6715ba5..22dd9c2 100644 --- a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue +++ b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue @@ -2,7 +2,12 @@
count: {{ axisInfo.c }} - + {{ item }} Unzoom @@ -16,7 +21,7 @@ @mouseleave="handleBorderMouseLeave" @mouseup="handleBorderMouseLeave" > -
+
0
-
- - -
+ +
-
-
+
+
+
+
+
- + + + + + + + +
@@ -78,7 +94,7 @@ import { getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper.js' import SampleDataMixin from '../SampleDataMixin' import { cloneDeep } from 'lodash' -const buttons = ['Gamma', 'Beta'] +const buttons = ['Gamma', 'Beta', '2D', '3D Surface', '3D Scatter'] // Beta-Gamma 的配置 const TwoDOption = { grid: { @@ -102,7 +118,6 @@ const TwoDOption = { }, }, xAxis: { - id: '2', name: 'Beta Channel', nameTextStyle: { color: '#5b9cba', @@ -133,7 +148,6 @@ const TwoDOption = { interval: 128, }, yAxis: { - id: '3', name: 'Gamma Channel', nameTextStyle: { color: '#5b9cba', @@ -205,6 +219,149 @@ const ChartAxis = { }, } +//3D Surface 配置 + +const ThreeDSurfaceOption = { + tooltip: { + trigger: 'item', + formatter: ({ value: [x, y, z] }) => { + // 自定义 tooltip 的内容 + return `Beta Channel:${x} Count:${z} Gamma Channel: ${y}` + }, + }, + visualMap: { + show: false, + min: 0, + max: 0, + inRange: { + color: ['#0DCF38', '#B5475E'], + }, + }, + grid3D: { + axisLabel: { + color: '#ade6ee', + }, + axisPointer: { + show: false, + }, + axisLine: { + lineStyle: { + color: 'rgba(119, 181, 213, .3)', + }, + }, + splitLine: { + lineStyle: { + color: 'rgba(119, 181, 213, .3)', + }, + }, + }, + xAxis3D: { + name: 'Beta Channel', + nameTextStyle: { + color: '#5b9cba', + fontSize: 14, + }, + min: 0, + max: 512, + interval: 128, + }, + yAxis3D: { + name: 'Gamma Channel', + nameTextStyle: { + color: '#5b9cba', + fontSize: 14, + }, + min: 0, + max: 4096, + interval: 512, + }, + zAxis3D: { + name: 'Count', + nameTextStyle: { + color: '#5b9cba', + fontSize: 14, + }, + }, + series: { + type: 'surface', + data: [], + }, +} + +// 3D Scatter 配置 +const ThreeDScatterOption = { + tooltip: { + trigger: 'item', + formatter: ({ value: [x, y, z] }) => { + // 自定义 tooltip 的内容 + return `Beta Channel:${x} Count:${z} Gamma Channel: ${y}` + }, + }, + visualMap: { + show: false, + min: 0, + max: 0, + inRange: { + color: ['#0DCF38', '#B5475E'], + }, + }, + grid3D: { + axisLabel: { + color: '#ade6ee', + }, + axisPointer: { + show: false, + }, + axisLine: { + lineStyle: { + color: 'rgba(119, 181, 213, .3)', + }, + }, + splitLine: { + lineStyle: { + color: 'rgba(119, 181, 213, .3)', + }, + }, + }, + xAxis3D: { + name: 'Beta Channel', + nameTextStyle: { + color: '#5b9cba', + fontSize: 14, + }, + max: 512, + interval: 128, + interval: 64, + }, + yAxis3D: { + name: 'Gamma Channel', + nameTextStyle: { + color: '#5b9cba', + fontSize: 14, + }, + min: 0, + max: 4096, + interval: 512, + }, + zAxis3D: { + name: 'Count', + nameTextStyle: { + color: '#5b9cba', + fontSize: 14, + }, + }, + series: { + type: 'scatter3D', + symbolSize: 5, + emphasis: { + label: { + show: false, + }, + }, + data: [], + }, +} + export default { mixins: [SampleDataMixin], components: { @@ -254,6 +411,10 @@ export default { value: [0, 0], max: 0, }, + + btnActive: 2, + threeDSurfaceOption: cloneDeep(ThreeDSurfaceOption), + threeDScatterOption: cloneDeep(ThreeDScatterOption), } }, created() { @@ -303,6 +464,7 @@ export default { this.setVisialMapParams() this.buildScatterList() this.initChart() + this.btnActive = 2 }, /** @@ -330,6 +492,11 @@ export default { }) this.reDrawRect() + + // 设置3D图表值 + const threedData = this.histogramDataList.map(({ b, g, c }) => [b, g, c]) + this.threeDSurfaceOption.series.data = threedData + this.threeDScatterOption.series.data = threedData }, // 构造scatter列表 @@ -401,6 +568,9 @@ export default { // 要求在最大值基础上加100 this.visualMap.max = max this.visualMap.value = [0, max] + + this.threeDSurfaceOption.visualMap.max = max + this.threeDScatterOption.visualMap.max = max }, // 右侧滑块改变 @@ -472,7 +642,11 @@ export default { // 弹出gamma或beta弹窗 handleChange(index) { - this.$emit('open-modal', index) + if ([0, 1].includes(index)) { + this.$emit('open-modal', index) + } else { + this.btnActive = index + } }, // 点击unzoom handleUnzoom() { @@ -717,10 +891,15 @@ export default { text-align: center; height: 100%; line-height: 26px; - width: 100px; + padding: 0 13px; background-color: #406979; cursor: pointer; user-select: none; + white-space: nowrap; + + &.active { + background-color: #1397a3; + } } } &-main { diff --git a/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/BetaDetectorCalibration.vue b/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/BetaDetectorCalibration.vue index 8a7381a..8d16667 100644 --- a/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/BetaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/BetaDetectorCalibration.vue @@ -23,19 +23,36 @@
- - -
-
+
+ + + +
+
+
+
+
{{ visualMap.max }}
+
+ +
+
0
+
@@ -166,30 +183,6 @@ - @@ -624,6 +617,12 @@ export default { count: 0, //反算时需要传递的数值 非反算的情况下不需要传递 数值大小是 第一次调用接口时返回的tableWidgets 大小 isInverse: false, // 是否需要反算 betaIsFitting: false, + + // 右侧范围选择 + visualMap: { + value: [0, 0], + max: 0, + }, } }, created() { @@ -679,7 +678,10 @@ export default { this.oldScatterSeries = oldScatterSeries this.count = oldScatterSeries.length - this.betaGammaChartOption.series.data = histogramData.map(({ b, g, c }) => [b, g, c]) + this.histogramDataList = histogramData + this.setVisialMapParams() + this.buildScatterList() + this.gammaEnergy = gammaEnergy this.gammaGatedBetaSpectrum = gammaGatedBetaSpectrum this.oldScatterSeries = oldScatterSeries @@ -742,6 +744,68 @@ export default { } }, + // 构造scatter列表 + buildScatterList() { + this.betaGammaChartOption.series.data = this.histogramDataList + .filter(({ c }) => c) + .map(({ b, g, c }) => this.buildScatterItem(b, g, c)) + }, + + // 构造一个scatter 的点 + buildScatterItem(xAxis, yAxis, count) { + return { + value: [xAxis, yAxis, count], + itemStyle: { + color: this.getScatterItemColor(count), + }, + } + }, + + // 获取一个点的颜色 + getScatterItemColor(count) { + const [min, max] = this.visualMap.value + let color = '' + if (count >= max) { + color = '#f00' + } else if (count <= min) { + color = '#fff' + } else { + const { r, g, b } = this.interpolateColor(1 - (count - min) / (max - min)) + color = `rgb(${r}, ${g}, ${b})` + } + return color + }, + + // 颜色插值算法 + interpolateColor(percentage) { + const color1 = { r: 255, g: 0, b: 0 }, + color2 = { r: 255, g: 255, b: 255 } + + const r = color1.r + (color2.r - color1.r) * percentage + const g = color1.g + (color2.g - color1.g) * percentage + const b = color1.b + (color2.b - color1.b) * percentage + return { r, g, b } + }, + + // 设置右侧滑块参数 + setVisialMapParams() { + const counts = this.histogramDataList + .filter(({ c }) => c) + .map(({ c }) => c) + .sort((a, b) => b - a) + const max = (counts[0] || 0) + 100 + // 要求在最大值基础上加100 + this.visualMap.max = max + this.visualMap.value = [0, max] + }, + + // 右侧滑块改变 + handleSliderChange() { + this.betaGammaChartOption.series.data.forEach((item) => { + item.itemStyle.color = this.getScatterItemColor(item.value[2]) + }) + }, + // 点击左上角散点图,设置红线 handleBetaGammaChartClick(param) { const { offsetX, offsetY } = param @@ -1159,12 +1223,22 @@ p { .beta-gamma-chart { height: 608px; - position: relative; + display: flex; + + &-container { + position: relative; + height: 100%; + flex: 1; + + .custom-chart { + height: 100%; + } + } .markline { position: absolute; left: 55px; - width: 442px; + width: 406px; height: 1px; background-color: red; pointer-events: none; @@ -1173,7 +1247,7 @@ p { .rect { position: absolute; left: 55px; - width: 446px; + width: 406px; border: 1px solid #0f0; background-color: rgba(0, 255, 0, 0.4); transform: translateY(-50%); @@ -1348,4 +1422,50 @@ p { color: #fff; } } + +.bar { + width: 30px; + margin-left: 10px; + color: #ade6ee; + padding-top: 5px; + padding-bottom: 20px; + display: flex; + flex-direction: column; + align-items: center; + gap: 5px; + + &-main { + width: 14px; + flex: 1; + + .ant-slider { + margin: 0; + padding: 0; + + ::v-deep { + .ant-slider-handle { + left: -2px; + right: -2px; + border-radius: 0; + margin-left: 0; + box-shadow: none; + border: 0; + background: #0cebc9; + height: 6px; + width: auto; + } + + .ant-slider-rail { + width: 100%; + background: #084248 !important; + } + + .ant-slider-track { + width: 100%; + background: linear-gradient(to bottom, #f00 0, #fff 100%); + } + } + } + } +} \ No newline at end of file diff --git a/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/GammaDetectorCalibration.vue b/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/GammaDetectorCalibration.vue index 2cabcd6..60623a5 100644 --- a/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/GammaDetectorCalibration.vue +++ b/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/components/GammaDetectorCalibration.vue @@ -131,30 +131,6 @@ - @@ -192,8 +168,8 @@ const initialGammaSpectrumChartOption = { }, xAxis: { min: 0, - max: 256, - interval: 64, + max: 4096, + interval: 512, axisLine: { lineStyle: { color: 'rgb(119, 181, 213, 0.5)', @@ -316,8 +292,8 @@ const initialFigureChartOption = { }, xAxis: { min: 0, - max: 256, - interval: 64, + max: 4096, + interval: 512, axisLine: { lineStyle: { color: 'rgb(119, 181, 213, 0.5)', diff --git a/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/index.vue b/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/index.vue index 86b92ec..c504c3d 100644 --- a/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/SelfStation/CalibrationModal/index.vue @@ -19,22 +19,10 @@ - @@ -114,15 +108,6 @@ export default { data: { handler(val) { if (val && Array.isArray(val)) { - val.forEach((item) => { - if (item.conc < 0) { - item.className = 'error' - } else if (item.conc > 0 && item.conc < item.mdc) { - item.className = 'warning' - } else { - item.className = 'success' - } - }) this.source1 = val.slice(0, 2) this.source2 = val.slice(2, 4) } diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 315860c..5f91b90 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -1126,6 +1126,11 @@ export default { // 新的beta的 handleNewBetaEnergyCalib() { + const sampleDetail = getSampleData(this.sampleData.inputFileName) + if (!sampleDetail || !sampleDetail.data.qc) { + this.$message.warning('No QC data available!') + return + } this.$refs.newCalibrationModalRef.show() },