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