diff --git a/src/views/spectrumAnalysis/beta-gamma-analysis.vue b/src/views/spectrumAnalysis/beta-gamma-analysis.vue index 8fb72a7..2915521 100644 --- a/src/views/spectrumAnalysis/beta-gamma-analysis.vue +++ b/src/views/spectrumAnalysis/beta-gamma-analysis.vue @@ -461,7 +461,6 @@ export default { qcFileNames: [this.sample.qcFileName], } postAction('/spectrumAnalysis/analyseCurrentSpectrum', params).then((res) => { - console.log('分析分析', res) if (res.success) { // this.isReAnalyed_beta = true this.analyseCurrentSpectrum = res.result diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index c4c2281..028cc33 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -378,18 +378,19 @@ export default { resultDisplayFlag: [], params_toDB: { comment: '', + savedAnalysisResult: false, stationName: '', dbName: '', sampleFileName: '', gasFileName: '', detFileName: '', qcFileName: '', - bGammaEnergyValidSample: false, - bBetaEnergyValidSample: false, - bGammaEnergyValidGas: false, - bBetaEnergyValidGas: false, - bGammaEnergyValidDet: false, - bBetaEnergyValidDet: false, + // bGammaEnergyValidSample: false, + // bBetaEnergyValidSample: false, + // bGammaEnergyValidGas: false, + // bBetaEnergyValidGas: false, + // bGammaEnergyValidDet: false, + // bBetaEnergyValidDet: false, checkSample: false, checkGas: false, checkDet: false, @@ -426,6 +427,7 @@ export default { methods: { getReAnalyCurr(flag, val) { this.isReAnalyed_beta = flag + this.params_toDB.savedAnalysisResult = true this.resultDisplayFlag = val }, getReAnalyAll(val) { @@ -504,6 +506,7 @@ export default { this.analysisType = ANALYZE_TYPE.GAMMA } this.sampleData = this.newSampleData = sample + this.params_toDB.savedAnalysisResult = sample.sampleId ? true : false this.params_toDB.comment = '' }, @@ -589,11 +592,8 @@ export default { * @param { 'all' | 'current' } type */ async handleSaveResultsToDB(type) { - if (this.isBetaGamma) { - if (type === 'current') { - this.handleSaveResultsToDB_Cuurrent() - } - } else if (this.isGamma) { + if (this.isReAnalyed_gamma) { + this.isSaving = true if (type == 'current') { const hideLoading = this.$message.loading('Saving...', 0) try { @@ -609,36 +609,42 @@ export default { console.error(error) } finally { hideLoading() + this.isSaving = true } } } }, handleSaveResultsToDB_Cuurrent() { // xeflag params_toDB - if (this.resultDisplayFlag.length > 0) { - this.resultDisplayFlag.forEach((item) => { - if (item.nuclideName === 'Xe131m') { - this.params_toDB.xe131mFlag = item.nidFlag - } else if (item.nuclideName === 'Xe133') { - this.params_toDB.xe133Flag = item.nidFlag - } else if (item.nuclideName === 'Xe133m') { - this.params_toDB.xe133mFlag = item.nidFlag - } else if (item.nuclideName === 'Xe135') { - this.params_toDB.xe135Flag = item.nidFlag - } - }) - this.params_toDB.sampleFileName = this.newSampleData.inputFileName - this.params_toDB.gasFileName = this.newSampleData.gasFileName - this.params_toDB.detFileName = this.newSampleData.detFileName - this.params_toDB.qcFileName = this.newSampleData.qcFileName - this.params_toDB.dbName = this.newSampleData.dbName - postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => { - if (res.success) { - this.$message.success('Save Successfully!') - } else { - this.$message.warning('Fail To Save') - } - }) + if (this.params_toDB.savedAnalysisResult) { + if (this.resultDisplayFlag.length > 0) { + this.resultDisplayFlag.forEach((item) => { + if (item.nuclideName === 'Xe131m') { + this.params_toDB.xe131mFlag = item.nidFlag + } else if (item.nuclideName === 'Xe133') { + this.params_toDB.xe133Flag = item.nidFlag + } else if (item.nuclideName === 'Xe133m') { + this.params_toDB.xe133mFlag = item.nidFlag + } else if (item.nuclideName === 'Xe135') { + this.params_toDB.xe135Flag = item.nidFlag + } + }) + this.params_toDB.sampleFileName = this.newSampleData.inputFileName + this.params_toDB.gasFileName = this.newSampleData.gasFileName + this.params_toDB.detFileName = this.newSampleData.detFileName + this.params_toDB.qcFileName = this.newSampleData.qcFileName + this.params_toDB.dbName = this.newSampleData.dbName + this.isSaving = true + postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => { + if (res.success) { + this.$message.success('Save Successfully!') + this.isSaving = true + } else { + this.isSaving = true + this.$message.warning(`${res.message}`) + } + }) + } } }, @@ -852,6 +858,7 @@ export default { show: this.isBetaGamma, }, ], + key: 'resultsToFile', }, { title: 'Save Results to DB', @@ -859,6 +866,7 @@ export default { { title: 'Save Current', key: 'current', + show: this.isGamma, }, { title: 'Save All', @@ -887,10 +895,14 @@ export default { width: '170px', }, on: { - menuClick: () => { - if (this.isGamma) { + menuClick: (item) => { + if (this.isGamma && item.key == 'resultsToFile') { this.saveSettingModalVisible = true } + if (this.isBetaGamma && item.key == 'resultsToDB') { + // beta save to db + this.handleSaveResultsToDB_Cuurrent() + } }, submenuClick: ({ item, child }) => { if (item.key == 'resultsToDB') {