diff --git a/src/views/spectrumAnalysis/beta-analysis.vue b/src/views/spectrumAnalysis/beta-analysis.vue
index 8ca042f..9d07754 100644
--- a/src/views/spectrumAnalysis/beta-analysis.vue
+++ b/src/views/spectrumAnalysis/beta-analysis.vue
@@ -230,6 +230,8 @@ export default {
this.getDetailFromFile()
}
}
+
+ this.$bus.$emit('resetROIRectState')
},
immediate: true,
deep: true,
@@ -626,7 +628,7 @@ export default {
const { success, message, result } = await getAction('/selfStation/saveToDB', {
fileName,
- comment: sampleData.data.comment
+ comment: sampleData.data.comment,
})
if (success) {
Object.entries(result).forEach(([k, v]) => {
diff --git a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue
index ab09439..7062485 100644
--- a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue
+++ b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue
@@ -54,25 +54,33 @@
height: boundaryContainerPosition.height + 'px',
}"
>
-
+ v-if="showState[index]"
+ class="boundary-item"
+ :key="index"
+ :style="{
+ left: boundaryItem.left + 'px',
+ top: boundaryItem.top + 'px',
+ width: boundaryItem.width + 'px',
+ height: boundaryItem.height + 'px',
+ backgroundColor: boundaryItem.backgroundColor,
+ borderColor: boundaryItem.borderColor,
+ }"
+ >
+
+
+
+
+
+
+
@@ -392,7 +400,6 @@ export default {
this.buttons = buttons
return {
- showROI: true,
startChannel: null,
endChannel: null,
boundaryList: [], // 最终生成的框
@@ -417,15 +424,22 @@ export default {
},
btnActive: 2,
+
+ showState: [],
}
},
created() {
this.scatterList = []
this.boundary = []
+ this.setAllShowState(true)
this.$bus.$on('roiLimitItemChange', this.handleLimitItemChange)
+ this.$bus.$on('toggleROIRect', this.handleToggleROIRect)
+ this.$bus.$on('resetROIRectState', this.resetROIRectState)
},
beforeDestroy() {
this.$bus.$off('roiLimitItemChange', this.handleLimitItemChange)
+ this.$bus.$off('toggleROIRect', this.handleToggleROIRect)
+ this.$bus.$off('resetROIRectState', this.resetROIRectState)
},
mounted() {
const newOption = cloneDeep(TwoDOption)
@@ -608,27 +622,23 @@ export default {
height: containerBottom - containerTop,
}
- if (this.showROI) {
- this.boundaryList = this.boundary.map((item, index) => {
- const color = ColorList[index]
- const [start, end] = item
+ this.boundaryList = this.boundary.map((item, index) => {
+ const color = ColorList[index]
+ const [start, end] = item
- const [left, top] = chart.convertToPixel({ seriesIndex: 0 }, [start, 4096]) // 拿到矩形左上角坐标
- const [right, bottom] = chart.convertToPixel({ seriesIndex: 0 }, [end, 0]) // 拿到矩形右下角坐标
+ const [left, top] = chart.convertToPixel({ seriesIndex: 0 }, [start, 4096]) // 拿到矩形左上角坐标
+ const [right, bottom] = chart.convertToPixel({ seriesIndex: 0 }, [end, 0]) // 拿到矩形右下角坐标
- // 因为外层容器已经提供了 上/左 边距的定位,把这部分减去
- return {
- borderColor: color.borderColor,
- backgroundColor: color.bgColor,
- top: top - containerTop,
- height: bottom - top,
- left: left - containerLeft,
- width: right - left,
- }
- })
- } else {
- this.boundaryList = []
- }
+ // 因为外层容器已经提供了 上/左 边距的定位,把这部分减去
+ return {
+ borderColor: color.borderColor,
+ backgroundColor: color.bgColor,
+ top: top - containerTop,
+ height: bottom - top,
+ left: left - containerLeft,
+ width: right - left,
+ }
+ })
},
handleChartResize() {
@@ -781,8 +791,12 @@ export default {
// 点击ROI
handleROI() {
- this.showROI = !this.showROI
- this.reDrawRect()
+ // 如果有某些Rect处于显示状态,则都隐藏
+ if (this.showState.some((state) => state)) {
+ this.setAllShowState(false)
+ } else {
+ this.setAllShowState(true)
+ }
},
// 矩形周边点击
@@ -876,6 +890,22 @@ export default {
this.currBoundaryItem = null
}
},
+
+ setAllShowState(state) {
+ this.showState = new Array(4).fill(state)
+ },
+
+ // 切换显示隐藏状态
+ handleToggleROIRect(index) {
+ this.$set(this.showState, index, !this.showState[index])
+ },
+
+ // 重置显示隐藏状态
+ resetROIRectState() {
+ this.setAllShowState(true)
+ this.boundary = []
+ this.boundaryList = []
+ },
},
}
diff --git a/src/views/spectrumAnalysis/components/RoiLimits/RoiLimits.vue b/src/views/spectrumAnalysis/components/RoiLimits/RoiLimits.vue
index 5102e57..e2bc6c0 100644
--- a/src/views/spectrumAnalysis/components/RoiLimits/RoiLimits.vue
+++ b/src/views/spectrumAnalysis/components/RoiLimits/RoiLimits.vue
@@ -1,14 +1,15 @@
@@ -16,7 +17,6 @@
diff --git a/src/views/spectrumAnalysis/components/RoiLimits/components/RoiLimitItem.vue b/src/views/spectrumAnalysis/components/RoiLimits/components/RoiLimitItem.vue
index 2780ab6..0a048e7 100644
--- a/src/views/spectrumAnalysis/components/RoiLimits/components/RoiLimitItem.vue
+++ b/src/views/spectrumAnalysis/components/RoiLimits/components/RoiLimitItem.vue
@@ -1,7 +1,9 @@