自建台站ROI功能修改

This commit is contained in:
Xu Zhimeng 2024-08-02 09:40:10 +08:00
parent 91b1fd3b81
commit 12cdef2ae1
3 changed files with 35 additions and 15 deletions

View File

@ -27,6 +27,7 @@ const addSampleData = sampleData => {
* @param {{ inputFileName: string; key: string; data: any; }} param0
*/
const updateSampleData = ({ inputFileName, key, data }) => {
console.log('updateSampleData:', key)
const find = sampleList.find(item => item.inputFileName == inputFileName)
if (find) {
if (key.includes('.')) {
@ -35,10 +36,13 @@ const updateSampleData = ({ inputFileName, key, data }) => {
if (index == keys.length - 1) {
return acc
}
return acc[k]
return acc? acc[k]: null
}, find.data)
target[keys[keys.length - 1]] = data
if(target) {
target[keys[keys.length - 1]] = data
} else {
console.log(`${key}不存在`)
}
} else {
find.data[key] = data
}

View File

@ -364,8 +364,6 @@ export default {
try {
this.isLoading = true
const { inputFileName } = this.sample
const params = this.roiParamList.map(([startChannel, endChannel], index) => ({
startChannel,
endChannel,
@ -373,8 +371,10 @@ export default {
}))
const formData = new FormData()
const { inputFileName } = this.sample
formData.append('sampleFileName', inputFileName)
formData.append('roiParams', JSON.stringify(params))
formData.append('dataType', this.spectrumData.dataType)
const { success, result, message } = await putAction('/selfStation/updateROI', formData)
if (success) {
@ -395,12 +395,27 @@ export default {
this.ROILists = [ROIOneList, ROITwoList, ROIThreeList, ROIFourList]
this.$refs.betaChartRef.setBoundaryList([
const boundaryList = [
[ROIOneStart, ROIOneStop],
[ROITwoStart, ROITwoStop],
[ROIThreeStart, ROIThreeStop],
[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 {
this.isLoading = false
this.$message.error(message)
@ -603,16 +618,16 @@ export default {
fileName,
})
if (success) {
const { DetailedInformation } = result
this.spectrumData = DetailedInformation
// DetailedInfomation
updateSampleData({
inputFileName: fileName,
key: `${this.spectraType}.spectrumData`,
data: DetailedInformation,
Object.entries(result).forEach(([k, v]) => {
// DetailedInfomation
updateSampleData({
inputFileName: fileName,
key: `${k}.spectrumData`,
data: v,
})
})
console.log('%c [ ]-617', 'font-size:13px; background:pink; color:#bf2c9f;', getSampleData(fileName))
this.spectrumData = result[this.spectraType]
} else {
throw new Error(message)
}

View File

@ -256,6 +256,7 @@ export default {
setBoundaryList(boundary) {
this.boundary = boundary
this.reDrawRect()
},
setOption(option, opts) {