增加保存自定义台站到数据库功能
This commit is contained in:
parent
d0a75dabc5
commit
2e4a58c95a
|
@ -594,6 +594,28 @@ export default {
|
|||
this.$refs.betaModalRef.open(currSampleDetail.bSpectrum, currSampleDetail.betaEnergyData)
|
||||
}
|
||||
},
|
||||
|
||||
// 保存当前谱到db
|
||||
async saveCurrentToDB() {
|
||||
if (!this.ROIAnalyzeLists || !this.ROIAnalyzeLists.length) {
|
||||
throw new Error('Please Analyse Spectrum First')
|
||||
}
|
||||
const { inputFileName: fileName } = this.sample
|
||||
const { success, message, result } = await getAction('/selfStation/saveToDB', {
|
||||
fileName,
|
||||
})
|
||||
if (success) {
|
||||
this.$message.success('Save Success')
|
||||
// 更新缓存中的DetailedInfomation数据
|
||||
updateSampleData({
|
||||
inputFileName: fileName,
|
||||
key: 'DetailedInformation',
|
||||
data: [...result.DetailedInformation],
|
||||
})
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -600,6 +600,7 @@ export default {
|
|||
position: absolute;
|
||||
border: 1px solid transparent;
|
||||
overflow: visible;
|
||||
will-change: left, width;
|
||||
|
||||
&-left,
|
||||
&-right {
|
||||
|
|
|
@ -825,49 +825,76 @@ export default {
|
|||
* @param { 'all' | 'current' } type
|
||||
*/
|
||||
async handleSaveResultsToDB(type) {
|
||||
if (this.isReAnalyed_gamma) {
|
||||
this.isSaving = true
|
||||
if (type == 'current') {
|
||||
const hideLoading = this.$message.loading('Saving...', 0)
|
||||
try {
|
||||
const { success, message, result } = await getAction('/gamma/saveToDB', {
|
||||
fileName: this.sampleData.inputFileName,
|
||||
})
|
||||
if (success) {
|
||||
this.$message.success('Save Success')
|
||||
this.currSampleDet = [...result.DetailedInformation]
|
||||
|
||||
// 更新缓存中的DetailedInfomation数据
|
||||
updateSampleData({
|
||||
inputFileName: this.sampleData.inputFileName,
|
||||
key: 'DetailedInformation',
|
||||
data: [...result.DetailedInformation],
|
||||
// 如果是gamma
|
||||
if (this.isGamma) {
|
||||
if (this.isReAnalyed_gamma) {
|
||||
this.isSaving = true
|
||||
if (type == 'current') {
|
||||
const hideLoading = this.$message.loading('Saving...', 0)
|
||||
try {
|
||||
const { success, message, result } = await getAction('/gamma/saveToDB', {
|
||||
fileName: this.sampleData.inputFileName,
|
||||
})
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
if (success) {
|
||||
this.$message.success('Save Success')
|
||||
this.currSampleDet = [...result.DetailedInformation]
|
||||
|
||||
// 更新缓存中的DetailedInfomation数据
|
||||
updateSampleData({
|
||||
inputFileName: this.sampleData.inputFileName,
|
||||
key: 'DetailedInformation',
|
||||
data: [...result.DetailedInformation],
|
||||
})
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
hideLoading()
|
||||
this.isSaving = false
|
||||
}
|
||||
} else {
|
||||
const gammaList = this.sampleList.filter(({ sampleType }) => sampleType !== 'B' && sampleType !== 'C')
|
||||
const gammaInputFileNames = gammaList.map((item) => item.inputFileName)
|
||||
try {
|
||||
this.isSaving = true
|
||||
for (const fileName of gammaInputFileNames) {
|
||||
await this.gammaSaveToDBRequest(fileName)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
} finally {
|
||||
this.isSaving = false
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
hideLoading()
|
||||
this.isSaving = false
|
||||
}
|
||||
} else {
|
||||
const gammaList = this.sampleList.filter(({ sampleType }) => sampleType !== 'B' && sampleType !== 'C')
|
||||
const gammaInputFileNames = gammaList.map((item) => item.inputFileName)
|
||||
try {
|
||||
this.isSaving = true
|
||||
for (const fileName of gammaInputFileNames) {
|
||||
await this.gammaSaveToDBRequest(fileName)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
} finally {
|
||||
this.isSaving = false
|
||||
}
|
||||
this.$message.warn('Please Analyse Spectrum First')
|
||||
}
|
||||
}
|
||||
// 如果是beta,也就是自建台站
|
||||
else if (this.isBeta) {
|
||||
this.isSaving = true
|
||||
const hideLoading = this.$message.loading('Saving...', 0)
|
||||
|
||||
try {
|
||||
// 保存当前
|
||||
await this.$refs.betaAnalysisRef.saveCurrentToDB()
|
||||
if (type == 'all') {
|
||||
const selfSampleLists = this.sampleList.filter(
|
||||
({ sampleType, inputFileName }) => sampleType == 'C' && inputFileName !== this.sampleData.inputFileName
|
||||
)
|
||||
const selfSampleInputFileNames = selfSampleLists.map((item) => item.inputFileName)
|
||||
for (const fileName of selfSampleInputFileNames) {
|
||||
await this.saveSelfStationToDBRequest(fileName)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error(error && (error.message || error))
|
||||
} finally {
|
||||
hideLoading()
|
||||
this.isSaving = false
|
||||
}
|
||||
} else {
|
||||
this.$message.warn('Please Analyse Spectrum First')
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -893,6 +920,25 @@ export default {
|
|||
console.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
// 保存自建台站谱到数据库
|
||||
async saveSelfStationToDBRequest(fileName) {
|
||||
try {
|
||||
const { result, success, message } = await getAction('/selfStation/saveToDB', { fileName })
|
||||
if (success) {
|
||||
// 更新缓存中的DetailedInfomation数据
|
||||
// updateSampleData({
|
||||
// inputFileName: fileName,
|
||||
// key: 'DetailedInformation',
|
||||
// data: [...result.DetailedInformation],
|
||||
// })
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
handleSaveResultsToDB_Cuurrent() {
|
||||
// xeflag params_toDB
|
||||
if (this.params_toDB.savedAnalysisResult) {
|
||||
|
@ -1055,7 +1101,6 @@ export default {
|
|||
handleResize() {
|
||||
this.$refs.gammaAnalysisRef && this.$refs.gammaAnalysisRef.resize()
|
||||
this.$refs.betaGammaAnalysisRef && this.$refs.betaGammaAnalysisRef.resize()
|
||||
this.$refs.betaAnalysisRef && this.$refs.betaAnalysisRef.resize()
|
||||
},
|
||||
|
||||
// Beta-Gamma Energy Calibration 的重新分析
|
||||
|
@ -1273,7 +1318,7 @@ export default {
|
|||
children: [
|
||||
{
|
||||
type: 'MultiLevelMenu',
|
||||
show: this.isBetaGamma || this.isGamma,
|
||||
show: this.isBetaGamma || this.isGamma || this.isBeta,
|
||||
attrs: {
|
||||
children: [
|
||||
{
|
||||
|
@ -1282,20 +1327,18 @@ export default {
|
|||
{
|
||||
title: 'Save Txt',
|
||||
key: 'saveTxt',
|
||||
show: this.isBetaGamma,
|
||||
},
|
||||
{
|
||||
title: 'Save Excel',
|
||||
key: 'saveExcel',
|
||||
show: this.isBetaGamma,
|
||||
},
|
||||
{
|
||||
title: 'Save Html',
|
||||
key: 'saveHtml',
|
||||
show: this.isBetaGamma,
|
||||
},
|
||||
],
|
||||
key: 'resultsToFile',
|
||||
show: this.isBetaGamma,
|
||||
},
|
||||
{
|
||||
title: 'Save Results to DB',
|
||||
|
@ -1303,12 +1346,12 @@ export default {
|
|||
{
|
||||
title: 'Save Current',
|
||||
key: 'current',
|
||||
show: this.isGamma,
|
||||
show: this.isGamma || this.isBeta,
|
||||
},
|
||||
{
|
||||
title: 'Save All',
|
||||
key: 'all',
|
||||
show: this.isGamma,
|
||||
show: this.isGamma || this.isBeta,
|
||||
},
|
||||
],
|
||||
key: 'resultsToDB',
|
||||
|
|
Loading…
Reference in New Issue
Block a user