自建台站ROI功能修改
This commit is contained in:
parent
91b1fd3b81
commit
12cdef2ae1
|
@ -27,6 +27,7 @@ const addSampleData = sampleData => {
|
||||||
* @param {{ inputFileName: string; key: string; data: any; }} param0
|
* @param {{ inputFileName: string; key: string; data: any; }} param0
|
||||||
*/
|
*/
|
||||||
const updateSampleData = ({ inputFileName, key, data }) => {
|
const updateSampleData = ({ inputFileName, key, data }) => {
|
||||||
|
console.log('updateSampleData:', key)
|
||||||
const find = sampleList.find(item => item.inputFileName == inputFileName)
|
const find = sampleList.find(item => item.inputFileName == inputFileName)
|
||||||
if (find) {
|
if (find) {
|
||||||
if (key.includes('.')) {
|
if (key.includes('.')) {
|
||||||
|
@ -35,10 +36,13 @@ const updateSampleData = ({ inputFileName, key, data }) => {
|
||||||
if (index == keys.length - 1) {
|
if (index == keys.length - 1) {
|
||||||
return acc
|
return acc
|
||||||
}
|
}
|
||||||
return acc[k]
|
return acc? acc[k]: null
|
||||||
}, find.data)
|
}, find.data)
|
||||||
|
if(target) {
|
||||||
target[keys[keys.length - 1]] = data
|
target[keys[keys.length - 1]] = data
|
||||||
|
} else {
|
||||||
|
console.log(`${key}不存在`)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
find.data[key] = data
|
find.data[key] = data
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,8 +364,6 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const { inputFileName } = this.sample
|
|
||||||
|
|
||||||
const params = this.roiParamList.map(([startChannel, endChannel], index) => ({
|
const params = this.roiParamList.map(([startChannel, endChannel], index) => ({
|
||||||
startChannel,
|
startChannel,
|
||||||
endChannel,
|
endChannel,
|
||||||
|
@ -373,8 +371,10 @@ export default {
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
|
const { inputFileName } = this.sample
|
||||||
formData.append('sampleFileName', inputFileName)
|
formData.append('sampleFileName', inputFileName)
|
||||||
formData.append('roiParams', JSON.stringify(params))
|
formData.append('roiParams', JSON.stringify(params))
|
||||||
|
formData.append('dataType', this.spectrumData.dataType)
|
||||||
|
|
||||||
const { success, result, message } = await putAction('/selfStation/updateROI', formData)
|
const { success, result, message } = await putAction('/selfStation/updateROI', formData)
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@ -395,12 +395,27 @@ export default {
|
||||||
|
|
||||||
this.ROILists = [ROIOneList, ROITwoList, ROIThreeList, ROIFourList]
|
this.ROILists = [ROIOneList, ROITwoList, ROIThreeList, ROIFourList]
|
||||||
|
|
||||||
this.$refs.betaChartRef.setBoundaryList([
|
const boundaryList = [
|
||||||
[ROIOneStart, ROIOneStop],
|
[ROIOneStart, ROIOneStop],
|
||||||
[ROITwoStart, ROITwoStop],
|
[ROITwoStart, ROITwoStop],
|
||||||
[ROIThreeStart, ROIThreeStop],
|
[ROIThreeStart, ROIThreeStop],
|
||||||
[ROIFourStart, ROIFourStop],
|
[ROIFourStart, ROIFourStop],
|
||||||
])
|
]
|
||||||
|
|
||||||
|
this.$refs.betaChartRef.setBoundaryList(boundaryList)
|
||||||
|
|
||||||
|
const updateKeys = ['One', 'Two', 'Three', 'Four']
|
||||||
|
updateKeys.forEach((updateKey) => {
|
||||||
|
const innerKeys = ['Start', 'Stop', 'List']
|
||||||
|
innerKeys.forEach((innerKey) => {
|
||||||
|
const realKey = `ROI${updateKey}${innerKey}`
|
||||||
|
updateSampleData({
|
||||||
|
inputFileName,
|
||||||
|
key: `${this.spectraType}.${realKey}`,
|
||||||
|
data: result[realKey],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
this.$message.error(message)
|
this.$message.error(message)
|
||||||
|
@ -603,16 +618,16 @@ export default {
|
||||||
fileName,
|
fileName,
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
const { DetailedInformation } = result
|
Object.entries(result).forEach(([k, v]) => {
|
||||||
this.spectrumData = DetailedInformation
|
|
||||||
// 更新缓存中的DetailedInfomation数据
|
// 更新缓存中的DetailedInfomation数据
|
||||||
updateSampleData({
|
updateSampleData({
|
||||||
inputFileName: fileName,
|
inputFileName: fileName,
|
||||||
key: `${this.spectraType}.spectrumData`,
|
key: `${k}.spectrumData`,
|
||||||
data: DetailedInformation,
|
data: v,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('%c [ ]-617', 'font-size:13px; background:pink; color:#bf2c9f;', getSampleData(fileName))
|
this.spectrumData = result[this.spectraType]
|
||||||
} else {
|
} else {
|
||||||
throw new Error(message)
|
throw new Error(message)
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,7 @@ export default {
|
||||||
|
|
||||||
setBoundaryList(boundary) {
|
setBoundaryList(boundary) {
|
||||||
this.boundary = boundary
|
this.boundary = boundary
|
||||||
|
this.reDrawRect()
|
||||||
},
|
},
|
||||||
|
|
||||||
setOption(option, opts) {
|
setOption(option, opts) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user