diff --git a/src/views/spectrumAnalysis/beta-analysis.vue b/src/views/spectrumAnalysis/beta-analysis.vue
index 4dbcedc..55d1ba3 100644
--- a/src/views/spectrumAnalysis/beta-analysis.vue
+++ b/src/views/spectrumAnalysis/beta-analysis.vue
@@ -34,7 +34,7 @@
/>
-
Update
+ Update
@@ -51,7 +51,6 @@
:histogramDataList="histogramDataList"
:boundary="boundaryList"
:isLoading.sync="isLoading"
- @refreshRoi="refreshRoi"
@boundaryChange="handleBoundaryChange"
/>
@@ -98,7 +97,7 @@ import RoiLimits from './components/RoiLimits/RoiLimits.vue'
import RoiParam from './components/RoiParam.vue'
import axios from 'axios'
import store from '@/store/'
-import { getAction, postAction, deleteAction } from '../../api/manage'
+import { getAction, postAction, putAction } from '../../api/manage'
import { addSampleData, getSampleData, updateSampleData } from '@/utils/SampleStore'
import { cloneDeep } from 'lodash'
@@ -109,7 +108,11 @@ const SampleType = [
},
{
label: 'DetBg Data',
- value: 'detBg',
+ value: 'det',
+ },
+ {
+ label: 'QC Data',
+ value: 'qc',
},
]
@@ -204,6 +207,12 @@ export default {
key: 'ROIAnalyzeLists',
data: _result,
})
+ } else {
+ const arr = message.split('\n')
+ this.$warning({
+ title: 'Warning',
+ content: () => arr.map((text) => {text}
),
+ })
}
let XeData = [
{
@@ -317,11 +326,71 @@ export default {
this.resultDisplay = XeData
// this.$emit('reAnalyCurr', true, XeData)
},
- refreshRoi(data) {
- console.log('%c [ 刷新 ]-303', 'font-size:13px; background:pink; color:#bf2c9f;', data)
- },
- reDrawRectOri() {
- // 更新
+ // 点击Update
+ async handleUpdate() {
+ const hasEmpty = this.roiParamList.some(
+ ([startChannel, endChannel]) => (!startChannel && startChannel !== '0') || (!endChannel && endChannel !== '0')
+ )
+ if (hasEmpty) {
+ this.$message.warning('Channel cannot be null')
+ return
+ }
+
+ const hasNegative = this.roiParamList.some(([startChannel, endChannel]) => startChannel < 0 || endChannel < 0)
+ if (hasNegative) {
+ this.$message.warning('Channel cannot be negative')
+ return
+ }
+
+ try {
+ this.isLoading = true
+ const { inputFileName } = this.sample
+
+ const params = this.roiParamList.map(([startChannel, endChannel], index) => ({
+ startChannel,
+ endChannel,
+ roiNum: index + 1,
+ }))
+
+ const formData = new FormData()
+ formData.append('sampleFileName', inputFileName)
+ formData.append('roiParams', JSON.stringify(params))
+
+ const { success, result, message } = await putAction('/selfStation/updateROI', formData)
+ if (success) {
+ console.log('%c [ ]-353', 'font-size:13px; background:pink; color:#bf2c9f;', result)
+ const {
+ ROIOneList,
+ ROITwoList,
+ ROIThreeList,
+ ROIFourList,
+ ROIOneStart,
+ ROIOneStop,
+ ROITwoStart,
+ ROITwoStop,
+ ROIThreeStart,
+ ROIThreeStop,
+ ROIFourStart,
+ ROIFourStop,
+ } = result
+
+ this.ROILists = [ROIOneList, ROITwoList, ROIThreeList, ROIFourList]
+
+ this.boundaryList = [
+ [ROIOneStart, ROIOneStop],
+ [ROITwoStart, ROITwoStop],
+ [ROIThreeStart, ROIThreeStop],
+ [ROIFourStart, ROIFourStop],
+ ]
+ } else {
+ this.isLoading = false
+ this.$message.error(message)
+ }
+ } catch (error) {
+ console.error(error)
+ } finally {
+ this.isLoading = false
+ }
},
// async handleDetalSelfStationCache() {
// const { inputFileName } = this.sample
@@ -366,6 +435,12 @@ export default {
}
},
changeChartByType(val) {
+ const currSampleDetail = this.sampleDetail[this.spectraType]
+ if (!currSampleDetail) {
+ this.$message.warning(`No ${this.spectraType} spectrum file!`)
+ return
+ }
+
if (val == 'sample') this.currSpectrum = 'Sample'
if (val == 'detBg') this.currSpectrum = 'Det'
this.roiParamList = cloneDeep(InitialRoiParamList)
@@ -388,7 +463,8 @@ export default {
ROIThreeStop,
ROIFourStart,
ROIFourStop,
- } = this.sampleDetail[this.spectraType]
+ } = currSampleDetail
+
this.spectrumData = spectrumData
this.histogramDataList = histogramDataList
this.gammaEnergyData = gammaEnergyData
diff --git a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue
index 276fd62..31bf7c1 100644
--- a/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue
+++ b/src/views/spectrumAnalysis/components/BetaGammaSpectrum.vue
@@ -64,7 +64,6 @@