feat: 对接清理sample缓存功能

This commit is contained in:
Xu Zhimeng 2023-10-20 10:11:43 +08:00
parent e69f1b7c06
commit 961f9752f6
3 changed files with 29 additions and 3 deletions

View File

@ -0,0 +1,17 @@
import { deleteAction } from '@/api/manage'
/**
* 发起请求清理后端对sample的缓存
* @param {Array<any>} sampleList
*/
export const clearSampleCache = (sampleList) => {
sampleList.forEach(sample => {
const { inputFileName: fileName, sampleFileName, qcFileName } = sample
let url = '/gamma/delPHDCache',
params = { fileName }
if (sample.sampleType == 'B') {
url = '/spectrumAnalysis/deleteSpectrumCacheData'
params = { sampleFileName , qcFileName }
}
deleteAction(url, params)
})
}

View File

@ -16,6 +16,8 @@
</template>
<script>
import { clearSampleCache } from '../clearSampleCache'
export default {
props: {
list: {
@ -43,7 +45,8 @@ export default {
this.handleClick(this.list[index + 1])
}
}
this.list.splice(index, 1)
const deleted = this.list.splice(index, 1)
clearSampleCache(deleted)
this.$forceUpdate()
}
},

View File

@ -236,6 +236,7 @@ import BetaGammaEnergyCalibrationModal from './components/Modals/BetaGammaModals
import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue'
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
import { getAction } from '@/api/manage'
import { clearSampleCache } from './clearSampleCache'
//
const ANALYZE_TYPE = {
@ -479,6 +480,8 @@ export default {
//
handleCleanAll() {
clearSampleCache(this.sampleList)
this.sampleList = []
this.analysisType = undefined
this.sampleData = {}
@ -746,7 +749,9 @@ export default {
{
type: 'a-menu-item',
title: 'Clean All',
handler: this.handleCleanAll,
handler: () => {
this.handleCleanAll()
},
},
],
},
@ -770,7 +775,8 @@ export default {
if (spectra) {
this.loadSelectedSample(spectra)
} else {
this.handleCleanAll()
this.analysisType = undefined
this.sampleData = {}
}
},
},