调整本地文件如果没有分析过,save to db需要进行判断,不允许请求接口

如果保存失败,需要把接口错误结果提示处理
Beta不需要显示 save current
save to db 没有触发“转圈”特效
This commit is contained in:
任珮宇 2023-11-02 17:55:15 +08:00
parent 481fcf99c3
commit 36c42be01f
2 changed files with 49 additions and 38 deletions

View File

@ -461,7 +461,6 @@ export default {
qcFileNames: [this.sample.qcFileName], qcFileNames: [this.sample.qcFileName],
} }
postAction('/spectrumAnalysis/analyseCurrentSpectrum', params).then((res) => { postAction('/spectrumAnalysis/analyseCurrentSpectrum', params).then((res) => {
console.log('分析分析', res)
if (res.success) { if (res.success) {
// this.isReAnalyed_beta = true // this.isReAnalyed_beta = true
this.analyseCurrentSpectrum = res.result this.analyseCurrentSpectrum = res.result

View File

@ -378,18 +378,19 @@ export default {
resultDisplayFlag: [], resultDisplayFlag: [],
params_toDB: { params_toDB: {
comment: '', comment: '',
savedAnalysisResult: false,
stationName: '', stationName: '',
dbName: '', dbName: '',
sampleFileName: '', sampleFileName: '',
gasFileName: '', gasFileName: '',
detFileName: '', detFileName: '',
qcFileName: '', qcFileName: '',
bGammaEnergyValidSample: false, // bGammaEnergyValidSample: false,
bBetaEnergyValidSample: false, // bBetaEnergyValidSample: false,
bGammaEnergyValidGas: false, // bGammaEnergyValidGas: false,
bBetaEnergyValidGas: false, // bBetaEnergyValidGas: false,
bGammaEnergyValidDet: false, // bGammaEnergyValidDet: false,
bBetaEnergyValidDet: false, // bBetaEnergyValidDet: false,
checkSample: false, checkSample: false,
checkGas: false, checkGas: false,
checkDet: false, checkDet: false,
@ -426,6 +427,7 @@ export default {
methods: { methods: {
getReAnalyCurr(flag, val) { getReAnalyCurr(flag, val) {
this.isReAnalyed_beta = flag this.isReAnalyed_beta = flag
this.params_toDB.savedAnalysisResult = true
this.resultDisplayFlag = val this.resultDisplayFlag = val
}, },
getReAnalyAll(val) { getReAnalyAll(val) {
@ -504,6 +506,7 @@ export default {
this.analysisType = ANALYZE_TYPE.GAMMA this.analysisType = ANALYZE_TYPE.GAMMA
} }
this.sampleData = this.newSampleData = sample this.sampleData = this.newSampleData = sample
this.params_toDB.savedAnalysisResult = sample.sampleId ? true : false
this.params_toDB.comment = '' this.params_toDB.comment = ''
}, },
@ -589,11 +592,8 @@ export default {
* @param { 'all' | 'current' } type * @param { 'all' | 'current' } type
*/ */
async handleSaveResultsToDB(type) { async handleSaveResultsToDB(type) {
if (this.isBetaGamma) { if (this.isReAnalyed_gamma) {
if (type === 'current') { this.isSaving = true
this.handleSaveResultsToDB_Cuurrent()
}
} else if (this.isGamma) {
if (type == 'current') { if (type == 'current') {
const hideLoading = this.$message.loading('Saving...', 0) const hideLoading = this.$message.loading('Saving...', 0)
try { try {
@ -609,12 +609,14 @@ export default {
console.error(error) console.error(error)
} finally { } finally {
hideLoading() hideLoading()
this.isSaving = true
} }
} }
} }
}, },
handleSaveResultsToDB_Cuurrent() { handleSaveResultsToDB_Cuurrent() {
// xeflag params_toDB // xeflag params_toDB
if (this.params_toDB.savedAnalysisResult) {
if (this.resultDisplayFlag.length > 0) { if (this.resultDisplayFlag.length > 0) {
this.resultDisplayFlag.forEach((item) => { this.resultDisplayFlag.forEach((item) => {
if (item.nuclideName === 'Xe131m') { if (item.nuclideName === 'Xe131m') {
@ -632,14 +634,18 @@ export default {
this.params_toDB.detFileName = this.newSampleData.detFileName this.params_toDB.detFileName = this.newSampleData.detFileName
this.params_toDB.qcFileName = this.newSampleData.qcFileName this.params_toDB.qcFileName = this.newSampleData.qcFileName
this.params_toDB.dbName = this.newSampleData.dbName this.params_toDB.dbName = this.newSampleData.dbName
this.isSaving = true
postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => { postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => {
if (res.success) { if (res.success) {
this.$message.success('Save Successfully!') this.$message.success('Save Successfully!')
this.isSaving = true
} else { } else {
this.$message.warning('Fail To Save') this.isSaving = true
this.$message.warning(`${res.message}`)
} }
}) })
} }
}
}, },
/** /**
@ -852,6 +858,7 @@ export default {
show: this.isBetaGamma, show: this.isBetaGamma,
}, },
], ],
key: 'resultsToFile',
}, },
{ {
title: 'Save Results to DB', title: 'Save Results to DB',
@ -859,6 +866,7 @@ export default {
{ {
title: 'Save Current', title: 'Save Current',
key: 'current', key: 'current',
show: this.isGamma,
}, },
{ {
title: 'Save All', title: 'Save All',
@ -887,10 +895,14 @@ export default {
width: '170px', width: '170px',
}, },
on: { on: {
menuClick: () => { menuClick: (item) => {
if (this.isGamma) { if (this.isGamma && item.key == 'resultsToFile') {
this.saveSettingModalVisible = true this.saveSettingModalVisible = true
} }
if (this.isBetaGamma && item.key == 'resultsToDB') {
// beta save to db
this.handleSaveResultsToDB_Cuurrent()
}
}, },
submenuClick: ({ item, child }) => { submenuClick: ({ item, child }) => {
if (item.key == 'resultsToDB') { if (item.key == 'resultsToDB') {