修改Update接口

This commit is contained in:
Xu Zhimeng 2024-08-07 19:10:18 +08:00
parent abe080c0e3
commit 5feb566d46

View File

@ -221,10 +221,11 @@ export default {
const { inputFileName, detFileName } = this.sample
const userId = store.getters.userInfo.id
this.isLoading = true
const { success, result, message } = await postAction(
`/selfStation/Reprocessing?fileName=${inputFileName}&processKey=${userId}_${this.timerStamp}`
)
console.log(userId, success, result, message)
const formData = new FormData()
formData.append('fileName', inputFileName)
formData.append('processKey', `${userId}_${this.timerStamp}`)
const { success, result, message } = await postAction('/selfStation/Reprocessing', formData)
if (success) {
const _result = []
_result.push(result.ROI1)
@ -380,55 +381,49 @@ export default {
roiNum: index + 1,
}))
const formData = new FormData()
const { inputFileName } = this.sample
formData.append('sampleFileName', inputFileName)
const userId = store.getters.userInfo.id
const formData = new FormData()
formData.append('roiParams', JSON.stringify(params))
formData.append('dataType', this.spectrumData.dataType)
formData.append('fileName', inputFileName)
formData.append('processKey', `${userId}_${this.timerStamp}`)
const { success, result, message } = await postAction('/selfStation/Reprocessing', formData)
const { success, result, message } = await putAction('/selfStation/updateROI', formData)
if (success) {
const {
ROIOneList,
ROITwoList,
ROIThreeList,
ROIFourList,
ROIOneStart,
ROIOneStop,
ROITwoStart,
ROITwoStop,
ROIThreeStart,
ROIThreeStop,
ROIFourStart,
ROIFourStop,
} = result
this.ROILists = [ROIOneList, ROITwoList, ROIThreeList, ROIFourList]
const boundaryList = [
[ROIOneStart, ROIOneStop],
[ROITwoStart, ROITwoStop],
[ROIThreeStart, ROIThreeStop],
[ROIFourStart, ROIFourStop],
]
this.$refs.betaChartRef.setBoundaryList(boundaryList)
for (let index = 0; index < 4; index++) {
const key = `ROI${index + 1}`
const value = result[key]
if(value) {
this.$set(this.ROIAnalyzeLists, index, value)
}
}
updateSampleData({
inputFileName,
key: 'ROIAnalyzeLists',
data: cloneDeep(this.ROIAnalyzeLists),
})
this.$refs.betaChartRef.setBoundaryList(cloneDeep(this.roiParamList))
const updateKeys = ['One', 'Two', 'Three', 'Four']
updateKeys.forEach((updateKey) => {
const innerKeys = ['Start', 'Stop', 'List']
innerKeys.forEach((innerKey) => {
updateKeys.forEach((updateKey, index) => {
const innerKeys = ['Start', 'Stop']
innerKeys.forEach((innerKey, ind) => {
const realKey = `ROI${updateKey}${innerKey}`
updateSampleData({
inputFileName,
key: `${this.spectraType}.${realKey}`,
data: result[realKey],
key: `sample.${realKey}`,
data: this.roiParamList[index][ind],
})
})
})
} else {
this.isLoading = false
this.$message.error(message)
const arr = message.split('\n')
this.$warning({
title: 'Warning',
content: () => arr.map((text) => <div>{text}</div>),
})
}
} catch (error) {
console.error(error)
@ -492,7 +487,7 @@ export default {
if (val == 'sample') {
this.currSpectrum = 'Sample'
this.ROIAnalyzeLists = this.sampleDetail.ROIAnalyzeLists
this.ROIAnalyzeLists = this.sampleDetail.ROIAnalyzeLists || []
} else {
this.ROIAnalyzeLists = []
}