fix: 修改Save to Txt调的接口
This commit is contained in:
parent
8459081c5c
commit
88348f4f78
|
@ -255,6 +255,8 @@ import { clearSampleCache } from './clearSampleCache'
|
|||
import { fetchAndDownload } from '@/utils/file'
|
||||
import BGLogViewer from './components/Modals/BetaGammaModals/BGLogViewer.vue'
|
||||
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
// 分析类型
|
||||
const ANALYZE_TYPE = {
|
||||
GAMMA: 'gammaAnalysis',
|
||||
|
@ -586,11 +588,57 @@ export default {
|
|||
}
|
||||
}
|
||||
if (this.isBetaGamma) {
|
||||
if(!this.isReAnalyed_beta) {
|
||||
this.$message.warning('Please analyze the spectrum first!')
|
||||
this.isSaving = false
|
||||
return
|
||||
}
|
||||
if (saveFormat == 'txt') {
|
||||
try {
|
||||
const {
|
||||
sampleId,
|
||||
inputFileName: fileName,
|
||||
dbName,
|
||||
detFileName,
|
||||
gasFileName,
|
||||
qcFileName,
|
||||
} = this.newSampleData
|
||||
|
||||
const params = {
|
||||
dbName,
|
||||
sampleId,
|
||||
sampleData: false,
|
||||
gasBgData: false,
|
||||
detBgData: false,
|
||||
qcData: false,
|
||||
sampleFileName: fileName,
|
||||
gasFileName,
|
||||
detFileName,
|
||||
qcFileName,
|
||||
}
|
||||
const txtFileName = `${fileName.split('.')[0]}.txt`
|
||||
const res = await postAction('/spectrumAnalysis/viewRRR', params)
|
||||
if (typeof res == 'string') {
|
||||
const data = new Blob([res], { type: 'text/plain;charset=utf-8' })
|
||||
saveAs(data, txtFileName)
|
||||
} else {
|
||||
const { success, result, message } = res
|
||||
if (success) {
|
||||
const data = new Blob([result], { type: 'text/plain;charset=utf-8' })
|
||||
saveAs(data, txtFileName)
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.isSaving = false
|
||||
}
|
||||
} else {
|
||||
const url =
|
||||
saveFormat == 'xls'
|
||||
? '/spectrumAnalysis/saveToExcel'
|
||||
: saveFormat == 'txt'
|
||||
? '/spectrumAnalysis/saveToTxt'
|
||||
: saveFormat == 'html'
|
||||
? '/spectrumAnalysis/saveToHTML'
|
||||
: ''
|
||||
|
@ -616,6 +664,7 @@ export default {
|
|||
this.isSaving = false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user