gamma保存后未更新Sample Status的问题

This commit is contained in:
Xu Zhimeng 2024-07-26 18:37:44 +08:00
parent 684ccf165a
commit 64729f91df

View File

@ -315,7 +315,7 @@ import BGLogViewer from './components/Modals/BetaGammaModals/BGLogViewer.vue'
import { saveAs } from 'file-saver'
import CompareFromDbModal from './components/Modals/CompareFromDBModal.vue'
import { clearSampleData, getSampleData, updateSampleDataAnaly } from '@/utils/SampleStore'
import { clearSampleData, getSampleData, updateSampleData, updateSampleDataAnaly } from '@/utils/SampleStore'
import BetaAnalyzeInteractiveToolModal from './components/Modals/SelfStation/BetaAnalyzeInteractiveToolModal/index.vue'
import SelfStationAnalyzeSettingModal from './components/Modals/SelfStation/SelfStationAnalyzeSettingModal.vue'
@ -497,8 +497,6 @@ export default {
percentBar: 0,
analysedFileName: '', //
currSampleDet: [], // DetailedInformation
allSampleDet: {}, // DetailedInformation all
isComparing: false,
isStriping: false,
}
@ -694,7 +692,6 @@ export default {
this.analysisType = ANALYZE_TYPE.GAMMA
}
this.sampleData = this.newSampleData = sample
this.currSampleDet = this.allSampleDet[sample.inputFileName]
this.params_toDB.comment = ''
},
@ -725,7 +722,7 @@ export default {
this.isSaving = false
}
} else {
let list = this.sampleList.filter((item) => item.sampleType !== 'B')
let list = this.sampleList.filter((item) => item.sampleType !== 'B' && item.sampleType !== 'C')
if (list.length > 0) {
list.forEach(async (item) => {
const url = saveFormat == 'xls' ? '/gamma/saveToExcel' : saveFormat == 'txt' ? '/gamma/saveToTxt' : ''
@ -839,6 +836,13 @@ export default {
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)
}
@ -849,37 +853,47 @@ export default {
this.isSaving = false
}
} else {
this.allSampleDet = []
const { inputFileName } = this.sampleData
let gammaList = this.sampleList.filter(({ sampleType }) => sampleType !== 'B')
const gammaList = this.sampleList.filter(({ sampleType }) => sampleType !== 'B' && sampleType !== 'C')
const gammaInputFileNames = gammaList.map((item) => item.inputFileName)
if (gammaInputFileNames.length > 0) {
this.fatchSaveDbAll(gammaInputFileNames, inputFileName)
const saveToDbPromises = gammaInputFileNames.map((fileName) => this.gammaSaveToDBRequest(fileName))
try {
this.isSaving = true
await Promise.all(saveToDbPromises)
} catch (error) {
console.log(error)
} finally {
this.isSaving = false
}
}
} else {
this.$message.warn('Please Analyse Spectrum First')
}
},
async fatchSaveDbAll(fileNames, currFileName) {
// gamma
async gammaSaveToDBRequest(fileName) {
try {
const { result, success, message } = await getAction('/gamma/saveToDB', { fileName: fileNames[0] })
const { result, success, message } = await getAction('/gamma/saveToDB', { fileName })
if (success) {
this.$set(this.allSampleDet, fileNames[0], [...result.DetailedInformation])
fileNames.splice(0, 1)
if (fileNames.length > 0) {
this.fatchSaveDbAll(fileNames, currFileName)
} else {
this.isSaving = false
this.currSampleDet = this.allSampleDet[this.sampleData.inputFileName]
// DetailedInfomation
updateSampleData({
inputFileName: fileName,
key: 'DetailedInformation',
data: [...result.DetailedInformation],
})
console.log('%c [ 更更新缓存 ]-891', 'font-size:13px; background:pink; color:#bf2c9f;')
if (this.sampleData.inputFileName == fileName) {
this.currSampleDet = [...result.DetailedInformation]
console.log('%c [ 更新当前 ]-894', 'font-size:13px; background:pink; color:#bf2c9f;')
}
} else {
this.isSaving = false
this.$message.error(message)
}
} catch (error) {
this.isSaving = false
console.error(error)
}
},
handleSaveResultsToDB_Cuurrent() {
@ -933,7 +947,7 @@ export default {
fetchAndDownload('/gamma/saveToPHD', params, 'get')
} else {
this.sampleList
.filter(({ sampleType }) => sampleType !== 'B')
.filter(({ sampleType }) => sampleType !== 'B' && sampleType !== 'C')
.forEach(({ inputFileName: fileName }) => {
const params = {
fileName,
@ -951,7 +965,7 @@ export default {
this.analyzeAllModalVisible = true
const { inputFileName, sampleType } = this.sampleData
// gamma list
const gammaSampleList = this.sampleList.filter((sample) => sample.sampleType !== 'B')
const gammaSampleList = this.sampleList.filter((sample) => sample.sampleType !== 'B' && sample.sampleType !== 'C')
this.gammaSampleNum = gammaSampleList.length
const gammaInputFileNames = gammaSampleList.map((item) => item.inputFileName)
@ -960,7 +974,7 @@ export default {
}
},
async fetchReprocessing(fileNames, currFileName, sampleType) {
if (fileNames[0] == currFileName && sampleType !== 'B') {
if (fileNames[0] == currFileName && sampleType !== 'B' && sampleType !== 'C') {
this.$refs.gammaAnalysisRef.reProcessing(false).then((res) => {
if (res) {
this.finishCont++