对接UpdateROI功能
This commit is contained in:
parent
93a2f3ed16
commit
b214308e23
|
@ -34,7 +34,7 @@
|
||||||
/>
|
/>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
</div>
|
</div>
|
||||||
<div class="spectrum-analysis-sub-operators-button" @click="reDrawRectOri">Update</div>
|
<div class="spectrum-analysis-sub-operators-button" @click="handleUpdate">Update</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 二级交互栏结束 -->
|
<!-- 二级交互栏结束 -->
|
||||||
|
|
||||||
|
@ -51,7 +51,6 @@
|
||||||
:histogramDataList="histogramDataList"
|
:histogramDataList="histogramDataList"
|
||||||
:boundary="boundaryList"
|
:boundary="boundaryList"
|
||||||
:isLoading.sync="isLoading"
|
:isLoading.sync="isLoading"
|
||||||
@refreshRoi="refreshRoi"
|
|
||||||
@boundaryChange="handleBoundaryChange"
|
@boundaryChange="handleBoundaryChange"
|
||||||
/>
|
/>
|
||||||
</beta-gamma-chart-container>
|
</beta-gamma-chart-container>
|
||||||
|
@ -98,7 +97,7 @@ import RoiLimits from './components/RoiLimits/RoiLimits.vue'
|
||||||
import RoiParam from './components/RoiParam.vue'
|
import RoiParam from './components/RoiParam.vue'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import store from '@/store/'
|
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 { addSampleData, getSampleData, updateSampleData } from '@/utils/SampleStore'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
|
@ -109,7 +108,11 @@ const SampleType = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'DetBg Data',
|
label: 'DetBg Data',
|
||||||
value: 'detBg',
|
value: 'det',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'QC Data',
|
||||||
|
value: 'qc',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -204,6 +207,12 @@ export default {
|
||||||
key: 'ROIAnalyzeLists',
|
key: 'ROIAnalyzeLists',
|
||||||
data: _result,
|
data: _result,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
const arr = message.split('\n')
|
||||||
|
this.$warning({
|
||||||
|
title: 'Warning',
|
||||||
|
content: () => arr.map((text) => <div>{text}</div>),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
let XeData = [
|
let XeData = [
|
||||||
{
|
{
|
||||||
|
@ -317,11 +326,71 @@ export default {
|
||||||
this.resultDisplay = XeData
|
this.resultDisplay = XeData
|
||||||
// this.$emit('reAnalyCurr', true, XeData)
|
// this.$emit('reAnalyCurr', true, XeData)
|
||||||
},
|
},
|
||||||
refreshRoi(data) {
|
// 点击Update
|
||||||
console.log('%c [ 刷新 ]-303', 'font-size:13px; background:pink; color:#bf2c9f;', data)
|
async handleUpdate() {
|
||||||
},
|
const hasEmpty = this.roiParamList.some(
|
||||||
reDrawRectOri() {
|
([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() {
|
// async handleDetalSelfStationCache() {
|
||||||
// const { inputFileName } = this.sample
|
// const { inputFileName } = this.sample
|
||||||
|
@ -366,6 +435,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeChartByType(val) {
|
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 == 'sample') this.currSpectrum = 'Sample'
|
||||||
if (val == 'detBg') this.currSpectrum = 'Det'
|
if (val == 'detBg') this.currSpectrum = 'Det'
|
||||||
this.roiParamList = cloneDeep(InitialRoiParamList)
|
this.roiParamList = cloneDeep(InitialRoiParamList)
|
||||||
|
@ -388,7 +463,8 @@ export default {
|
||||||
ROIThreeStop,
|
ROIThreeStop,
|
||||||
ROIFourStart,
|
ROIFourStart,
|
||||||
ROIFourStop,
|
ROIFourStop,
|
||||||
} = this.sampleDetail[this.spectraType]
|
} = currSampleDetail
|
||||||
|
|
||||||
this.spectrumData = spectrumData
|
this.spectrumData = spectrumData
|
||||||
this.histogramDataList = histogramDataList
|
this.histogramDataList = histogramDataList
|
||||||
this.gammaEnergyData = gammaEnergyData
|
this.gammaEnergyData = gammaEnergyData
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
<script>
|
<script>
|
||||||
import CustomChart from '@/components/CustomChart/index.vue'
|
import CustomChart from '@/components/CustomChart/index.vue'
|
||||||
import { getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper.js'
|
import { getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper.js'
|
||||||
import { putAction } from '../../../api/manage'
|
|
||||||
import SampleDataMixin from '../SampleDataMixin'
|
import SampleDataMixin from '../SampleDataMixin'
|
||||||
const buttons = ['Gamma', 'Beta']
|
const buttons = ['Gamma', 'Beta']
|
||||||
// Beta-Gamma 的配置
|
// Beta-Gamma 的配置
|
||||||
|
@ -439,37 +438,6 @@ export default {
|
||||||
this.showROI = !this.showROI
|
this.showROI = !this.showROI
|
||||||
this.reDrawRect()
|
this.reDrawRect()
|
||||||
},
|
},
|
||||||
// 点击Update
|
|
||||||
async handleUpdate() {
|
|
||||||
this.$emit('update:isLoading', true)
|
|
||||||
const { inputFileName } = this.sampleData
|
|
||||||
try {
|
|
||||||
const { success, result, message } = await putAction(
|
|
||||||
`/selfStation/updateROI?sampleFileName=${inputFileName}&startChannel=${this.startChannel}&endChannel=${this.endChannel}&ROINum=1`
|
|
||||||
)
|
|
||||||
if (success) {
|
|
||||||
this.$emit('update:isLoading', false)
|
|
||||||
let obj = {}
|
|
||||||
for (const key in result) {
|
|
||||||
if (Object.hasOwnProperty.call(result, key)) {
|
|
||||||
const element = result[key]
|
|
||||||
if (key.includes('List')) {
|
|
||||||
obj.list = element
|
|
||||||
} else if (key.includes('Start')) {
|
|
||||||
obj.start = element
|
|
||||||
} else {
|
|
||||||
obj.stop = element
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.$emit('refreshRoi', obj)
|
|
||||||
} else {
|
|
||||||
this.$emit('update:isLoading', false)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 矩形周边点击
|
// 矩形周边点击
|
||||||
handleBorderMouseDown(boundaryItem, direction, index) {
|
handleBorderMouseDown(boundaryItem, direction, index) {
|
||||||
|
|
|
@ -159,6 +159,7 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.option.tooltip.formatter = this.handleTooltipFormat
|
this.option.tooltip.formatter = this.handleTooltipFormat
|
||||||
|
this.option.series[0].itemStyle.color = 'yellow'
|
||||||
this.$bus.$on('changeROILimitsYAxisType', this.changeYAxisType)
|
this.$bus.$on('changeROILimitsYAxisType', this.changeYAxisType)
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user