diff --git a/src/views/spectrumAnalysis/beta-analysis.vue b/src/views/spectrumAnalysis/beta-analysis.vue index 93efa7c..37d47b6 100644 --- a/src/views/spectrumAnalysis/beta-analysis.vue +++ b/src/views/spectrumAnalysis/beta-analysis.vue @@ -18,7 +18,6 @@ style="width: 246px" class="sample-select" > -
删除
@@ -35,13 +34,14 @@ :gammaEnergyData="gammaEnergyData" :histogramDataList="histogramDataList" :boundary="boundaryList" + :currIdx="currIdx" />
- +
@@ -110,6 +110,11 @@ export default { RoiLimits, RoiParam, }, + props: { + sample: { + type: Object, + }, + }, data() { this.SampleType = SampleType return { @@ -134,12 +139,42 @@ export default { sampleDetail: {}, qcFlags: {}, resultDisplay: [], + currIdx: 0, } }, + watch: { + sample: { + async handler(newVal, oldVal) { + this.resultDisplay = [] + const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName) + if (sampleData) { + const { data, from } = sampleData + this.sampleDetail = data + // this.changeChartByType('sample') + if (from == 'db') { + this.sampleDetail = data + this.emitGetFiles(data) + } + } else { + if (newVal.sampleId) { + this.getSampleDetail() + } else { + this.getSelfStationSampleDetail() + } + } + this.$refs.betaChartRef.handleUnzoom() + }, + immediate: true, + deep: true, + }, + }, mounted() { - this.getSelfStationSampleDetail() + // this.getSelfStationSampleDetail() }, methods: { + getIndex(val) { + this.currIdx = val + }, async handleDetalSelfStationCache() { let params = { sampleFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD', @@ -151,9 +186,10 @@ export default { } }, async getSelfStationSampleDetail() { + const { inputFileName, detFileName } = this.sample let params = { - sampleFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD', - detFileName: 'ABC01_001-20240108_1327_D_FULL_381505.PHD', + sampleFileName: inputFileName, + detFileName: detFileName, } try { this.isLoading = true @@ -161,6 +197,11 @@ export default { const cancelToken = this.createCancelToken() const { success, result, message } = await getAction('/selfStation/loadFromFile', params, cancelToken) if (success) { + this.$store.commit('ADD_SAMPLE_DATA', { + inputFileName, + data: result, + from: 'file', + }) this.sampleDetail = result const { spectrumData, @@ -193,7 +234,7 @@ export default { this.roiParam.ROIThreeStop = ROIThreeStop this.roiParam.ROIFourStart = ROIFourStart this.roiParam.ROIFourStop = ROIFourStop - let boundary1 = { minX: 500, maxX: ROIOneStop, minY: 0, maxY: 4096 } + let boundary1 = { minX: ROIOneStart, maxX: ROIOneStop, minY: 0, maxY: 4096 } let boundary2 = { minX: ROITwoStart, maxX: ROITwoStop, minY: 0, maxY: 4096 } let boundary3 = { minX: ROIThreeStart, maxX: ROIThreeStop, minY: 0, maxY: 4096 } let boundary4 = { minX: ROIFourStart, maxX: ROIFourStop, minY: 0, maxY: 4096 } @@ -232,6 +273,7 @@ export default { handleGetFlag(val, obj) { console.log(val, obj) }, + resize() {}, }, destroyed() { this.cancelLastRequest() diff --git a/src/views/spectrumAnalysis/clearSampleCache.js b/src/views/spectrumAnalysis/clearSampleCache.js index 76f0e6b..072b58f 100644 --- a/src/views/spectrumAnalysis/clearSampleCache.js +++ b/src/views/spectrumAnalysis/clearSampleCache.js @@ -15,6 +15,10 @@ export const clearSampleCache = sampleList => { url = '/spectrumAnalysis/deleteSpectrumCacheData' params = { sampleFileName: fileName } } + if (sample.sampleType == 'C') { + url = '/selfStation/deleteSelfStationCache' + params = { sampleFileName: fileName } + } deleteAction(url, params) store.commit('REMOVE_SAMPLE_DATA', fileName) Vue.ls.remove(`CALIBRATION_GAMMA_${fileName}`) diff --git a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue index 92f12fc..f8c3981 100644 --- a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue +++ b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue @@ -21,6 +21,7 @@ :option="twoDOption" @zr:mousedown="handleMouseDown" @zr:mouseup="handleMouseUp" + @brushEnd="handleBrushEnd" /> @@ -133,7 +134,7 @@ const twoDOption = { color: '#fff', }, markLine: { - silent: true, + silent: false, symbol: 'none', data: [], animation: false, @@ -312,6 +313,9 @@ export default { type: Array, default: () => [], }, + currIdx: { + type: Number, + }, }, watch: { // 2D 图表 @@ -343,7 +347,7 @@ export default { this.boundaryData = newVal[0] this.reDrawRect() }, - immediate: true, + // immediate: true, }, currCount: { handler() { @@ -351,6 +355,13 @@ export default { }, immediate: true, }, + currIdx: { + handler(newVal) { + this.boundaryData = this.boundary[newVal] + this.reDrawRect() + }, + // immediate: true, + }, }, data() { this.buttons = buttons @@ -606,25 +617,25 @@ export default { }, ] }, - // 点击改变Beta-Gamma Spectrum: Sample图表类型 + // 点击改变 ROI LIMITS handleChange(index) { this.active = index }, // 点击unzoom handleUnzoom() { this.twoDOption.xAxis.min = 0 - this.twoDOption.xAxis.max = 256 + this.twoDOption.xAxis.max = 1024 this.twoDOption.yAxis.min = 0 - this.twoDOption.yAxis.max = 256 + this.twoDOption.yAxis.max = 4096 // this.emitRangeChange([0, 256, 0, 256]) - // this.reDrawRect() + this.reDrawRect() this.buildScatterList() }, // 鼠标按下时开启可刷选状态 handleMouseDown() { - const chart = this.$refs.chartRef.getChartInstance() + const chart = this.$refs.chartTwoDRef.getChartInstance() chart.dispatchAction({ type: 'takeGlobalCursor', // 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。 @@ -638,13 +649,13 @@ export default { handleMouseUp() { setTimeout(() => { - const chart = this.$refs.chartRef.getChartInstance() + const chart = this.$refs.chartTwoDRef.getChartInstance() this.clearBrush(chart) }, 0) }, // 刷选完毕时 handleBrushEnd(param) { - const chart = this.$refs.chartRef.getChartInstance() + const chart = this.$refs.chartTwoDRef.getChartInstance() const areas = param.areas[0] if (areas) { const range = areas.range @@ -655,14 +666,15 @@ export default { const [x1, y2, x2, y1] = [...point1, ...point2] // 根据解析出的数据确定真实的范围 - const rangeNumberFunc = rangeNumber(0, 256) + const rangeNumberFuncX = rangeNumber(0, 1024) + const rangeNumberFuncY = rangeNumber(0, 4096) - this.twoDOption.xAxis.min = rangeNumberFunc(x1) - this.twoDOption.xAxis.max = rangeNumberFunc(x2) - this.twoDOption.yAxis.min = rangeNumberFunc(y1) - this.twoDOption.yAxis.max = rangeNumberFunc(y2) + this.twoDOption.xAxis.min = rangeNumberFuncX(x1) + this.twoDOption.xAxis.max = rangeNumberFuncX(x2) + this.twoDOption.yAxis.min = rangeNumberFuncY(y1) + this.twoDOption.yAxis.max = rangeNumberFuncY(y2) - this.emitRangeChange([x1, x2, y1, y2]) + // this.emitRangeChange([x1, x2, y1, y2]) this.reDrawRect() @@ -671,6 +683,18 @@ export default { this.clearBrush(chart) }, + clearBrush(chart) { + // 清理刷选的范围 + chart.dispatchAction({ + type: 'brush', + areas: [], + }) + + // 改为不可刷选状态 + chart.dispatchAction({ + type: 'takeGlobalCursor', + }) + }, // 点击ROI handleROI() { diff --git a/src/views/spectrumAnalysis/components/RoiLimits.vue b/src/views/spectrumAnalysis/components/RoiLimits.vue index eb34296..b954558 100644 --- a/src/views/spectrumAnalysis/components/RoiLimits.vue +++ b/src/views/spectrumAnalysis/components/RoiLimits.vue @@ -106,7 +106,7 @@ export default { const [ROIOneList, ...lists] = newVal this.buildOneLineList(ROIOneList) }, - immediate: true, + // immediate: true, }, }, data() { @@ -123,8 +123,11 @@ export default { }, // 点击改变Beta-Gamma Spectrum: Sample图表类型 handleChange(index) { + console.log(index) this.active = index this.buildOneLineList(this.ROILists[index]) + // this.$bus.$emit('sendIndex', index) + this.$emit('sendIndex', index) }, }, } diff --git a/src/views/spectrumAnalysis/components/SpectraListInMenu.vue b/src/views/spectrumAnalysis/components/SpectraListInMenu.vue index 59228c2..9a1647d 100644 --- a/src/views/spectrumAnalysis/components/SpectraListInMenu.vue +++ b/src/views/spectrumAnalysis/components/SpectraListInMenu.vue @@ -22,12 +22,12 @@ export default { props: { list: { type: Array, - default: () => [] - } + default: () => [], + }, }, methods: { handleClick(spectraItem) { - this.list.forEach(item => (item.checked = false)) + this.list.forEach((item) => (item.checked = false)) spectraItem && (spectraItem.checked = true) this.$emit('change', spectraItem) this.$forceUpdate() @@ -46,17 +46,18 @@ export default { } } const deleted = this.list.splice(index, 1) + console.log('deleted', deleted) clearSampleCache(deleted) this.$forceUpdate() - } + }, }, watch: { list(newVal) { - if (newVal.length && !newVal.find(item => item.checked)) { + if (newVal.length && !newVal.find((item) => item.checked)) { this.handleClick(newVal[0]) } - } - } + }, + }, } diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index f10f93e..b60a62f 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -50,7 +50,7 @@ /> - + @@ -287,6 +287,7 @@ import CompareFromDbModal from './components/Modals/CompareFromDBModal.vue' // 分析类型 const ANALYZE_TYPE = { + BETA: 'betaAnalysis', GAMMA: 'gammaAnalysis', BETA_GAMMA: 'betaGammaAnalysis', } @@ -564,6 +565,22 @@ export default { }) const names = this.sampleList.map((item) => item.inputFileName) // 当前Sample列表中的所有id const willAddList = arr.filter((item) => !names.includes(item.inputFileName)) + console.log('willAddList', willAddList) + willAddList.push({ + checked: true, + dbName: '', + detFileName: 'ABC01_001-20240108_1327_D_FULL_381505.PHD', + detFileStatus: null, + gasFileName: '', + gasFileStatus: null, + inputFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD', + qcFileName: '', + qcFileStatus: null, + sampleFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD', + sampleId: null, + sampleSystemType: 'C', + sampleType: 'C', + }) this.callInitValue(willAddList) this.sampleList = this.sampleList.concat(willAddList) }, @@ -610,6 +627,8 @@ export default { // B是beta-gamma P G是gamma if (sample.sampleType == 'B') { this.analysisType = ANALYZE_TYPE.BETA_GAMMA + } else if (sample.sampleType == 'C') { + this.analysisType = ANALYZE_TYPE.BETA } else { this.analysisType = ANALYZE_TYPE.GAMMA } @@ -966,6 +985,7 @@ export default { handleResize() { this.$refs.gammaAnalysisRef && this.$refs.gammaAnalysisRef.resize() this.$refs.betaGammaAnalysisRef && this.$refs.betaGammaAnalysisRef.resize() + this.$refs.betaAnalysisRef && this.$refs.betaAnalysisRef.resize() }, // Beta-Gamma Energy Calibration 的重新分析 @@ -1653,7 +1673,7 @@ export default { }, // 当前类型是否是Beta isBeta() { - return this.analysisType == ANALYZE_TYPE.BETA_GAMMA ? false : true + return this.analysisType == ANALYZE_TYPE.BETA }, // 当前类型是否是Beta-Gamma