fix: 修复部分内存溢出问题,修改beta下的分析全部谱时的逻辑,修复切换谱后,即使已经分析过了,还是无法保存的问题
This commit is contained in:
parent
990ab9def5
commit
333a7fd1f4
|
@ -30,9 +30,10 @@ export default {
|
||||||
this._chart.setOption(this.option, this.opts)
|
this._chart.setOption(this.option, this.opts)
|
||||||
this.initEventListener()
|
this.initEventListener()
|
||||||
},
|
},
|
||||||
destroyed() {
|
beforeDestroy() {
|
||||||
if (this._chart) {
|
if (this._chart) {
|
||||||
this._chart.dispose()
|
this._chart.dispose()
|
||||||
|
this._chart = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -190,6 +190,10 @@ export default {
|
||||||
analyseCurrentSpectrum: {
|
analyseCurrentSpectrum: {
|
||||||
type: Object,
|
type: Object,
|
||||||
},
|
},
|
||||||
|
sampleList: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
this.SampleType = SampleType
|
this.SampleType = SampleType
|
||||||
|
@ -238,7 +242,7 @@ export default {
|
||||||
this.qcFlagsVisible = true
|
this.qcFlagsVisible = true
|
||||||
}, 100)
|
}, 100)
|
||||||
},
|
},
|
||||||
destroyed() {
|
beforeDestroy() {
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
this.$bus.$off('ReAnalyses', this.handleReAnalyse)
|
this.$bus.$off('ReAnalyses', this.handleReAnalyse)
|
||||||
|
|
||||||
|
@ -559,6 +563,16 @@ export default {
|
||||||
})
|
})
|
||||||
this.$emit('reAnalyCurr', res.result.savedAnalysisResult, res.result.XeData)
|
this.$emit('reAnalyCurr', res.result.savedAnalysisResult, res.result.XeData)
|
||||||
this.handleReAnalyse(res.result)
|
this.handleReAnalyse(res.result)
|
||||||
|
updateSampleData({
|
||||||
|
inputFileName: this.sample.inputFileName,
|
||||||
|
key: 'XeData',
|
||||||
|
data: res.result.XeData,
|
||||||
|
})
|
||||||
|
updateSampleData({
|
||||||
|
inputFileName: this.sample.inputFileName,
|
||||||
|
key: 'savedAnalysisResult',
|
||||||
|
data: res.result.savedAnalysisResult,
|
||||||
|
})
|
||||||
if (res.result.bProcessed) {
|
if (res.result.bProcessed) {
|
||||||
this.$message.success(res.result.message)
|
this.$message.success(res.result.message)
|
||||||
} else {
|
} else {
|
||||||
|
@ -571,47 +585,77 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 分析全部
|
// 分析全部
|
||||||
getAnalyzeAllSpectrum() {
|
async getAnalyzeAllSpectrum() {
|
||||||
let params = {
|
const regExp = /^([A-Z]{1,}\d{1,})_/
|
||||||
dbNames: [this.sample.dbName],
|
const regMatched = this.sample.inputFileName.match(regExp)
|
||||||
sampleIds: [this.sample.sampleId ? this.sample.sampleId : ''],
|
const currStationName = regMatched[1]
|
||||||
sampleFileNames: [this.sample.inputFileName],
|
const dbNames = [],
|
||||||
gasFileNames: [this.sample.gasFileName],
|
sampleIds = [],
|
||||||
detFileNames: [this.sample.detFileName],
|
sampleFileNames = [],
|
||||||
qcFileNames: [this.sample.qcFileName],
|
gasFileNames = [],
|
||||||
|
detFileNames = [],
|
||||||
|
qcFileNames = []
|
||||||
|
|
||||||
|
const matchedSampleList = this.sampleList.filter((item) => item.inputFileName.includes(currStationName))
|
||||||
|
matchedSampleList.forEach(
|
||||||
|
({ dbName, sampleId, inputFileName, sampleFileName, gasFileName, detFileName, qcFileName, qcFileStatus }) => {
|
||||||
|
dbNames.push(dbName || '')
|
||||||
|
sampleIds.push(sampleId || '')
|
||||||
|
sampleFileNames.push(sampleFileName || inputFileName || '')
|
||||||
|
gasFileNames.push(gasFileName || '')
|
||||||
|
detFileNames.push(detFileName || '')
|
||||||
|
qcFileNames.push(qcFileStatus ? qcFileName : '')
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
dbNames,
|
||||||
|
sampleIds,
|
||||||
|
sampleFileNames,
|
||||||
|
gasFileNames,
|
||||||
|
detFileNames,
|
||||||
|
qcFileNames,
|
||||||
currentFileName: this.sample.inputFileName,
|
currentFileName: this.sample.inputFileName,
|
||||||
}
|
}
|
||||||
postAction('/spectrumAnalysis/analyseAllSpectrum', params).then((res) => {
|
const { success, result, message } = await postAction('/spectrumAnalysis/analyseAllSpectrum', params)
|
||||||
if (res.success) {
|
if (success) {
|
||||||
// this.analyseCurrentSpectrum = res.result
|
// 对所有已加载的谱中和本谱相似的谱(指台站和探测器相同)
|
||||||
this.$emit('sendXeData', res.result.XeData)
|
Object.entries(result).forEach(([inputFileName, sampleInfo]) => {
|
||||||
res.result.XeData.forEach((item) => {
|
const { XeData, savedAnalysisResult, bProcessed, message } = sampleInfo
|
||||||
|
XeData.forEach((item) => {
|
||||||
item.conc = parseFloat(item.conc.toPrecision(6))
|
item.conc = parseFloat(item.conc.toPrecision(6))
|
||||||
item.concErr = parseFloat(item.concErr.toPrecision(6))
|
item.concErr = parseFloat(item.concErr.toPrecision(6))
|
||||||
item.lc = parseFloat(item.lc.toPrecision(6))
|
item.lc = parseFloat(item.lc.toPrecision(6))
|
||||||
item.mdc = parseFloat(item.mdc.toPrecision(6))
|
item.mdc = parseFloat(item.mdc.toPrecision(6))
|
||||||
})
|
})
|
||||||
this.$emit('reAnalyAll', res.result.savedAnalysisResult, res.result.XeData)
|
|
||||||
// 因为重新分析后的数据保存在服务端,故清理需要重新加载的本地缓存
|
|
||||||
|
|
||||||
this.removeOtherBetaSamples()
|
if (inputFileName == this.sample.inputFileName) {
|
||||||
|
this.$emit('sendXeData', XeData)
|
||||||
|
this.$emit('reAnalyAll', savedAnalysisResult, XeData)
|
||||||
|
this.handleReAnalyse(sampleInfo)
|
||||||
|
|
||||||
|
if (bProcessed) {
|
||||||
|
this.$message.success(message)
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning(res.message)
|
this.$message.warning(message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 移除其他的beta缓存
|
updateSampleData({
|
||||||
removeOtherBetaSamples() {
|
inputFileName,
|
||||||
const regExp = /([A-Z]+\d+_\d+)(-[\w\s_\.]+)/
|
key: 'XeData',
|
||||||
const stationAndDetectorName = this.sample.inputFileName.replace(regExp, '$1')
|
data: XeData,
|
||||||
// 清理掉不是自己,且台站号+探测器号跟自己一样的谱,让它重新加载
|
|
||||||
const filterList = sampleList.filter((item) => {
|
|
||||||
const inputFileName = item.inputFileName
|
|
||||||
return inputFileName == this.sample.inputFileName || !inputFileName.startsWith(stationAndDetectorName)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
setSampleList(filterList)
|
updateSampleData({
|
||||||
|
inputFileName,
|
||||||
|
key: 'savedAnalysisResult',
|
||||||
|
data: savedAnalysisResult,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.warning(message)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 右下角放大镜
|
// 右下角放大镜
|
||||||
|
@ -703,11 +747,6 @@ export default {
|
||||||
// this.currResultDisplay = newVal.XeData
|
// this.currResultDisplay = newVal.XeData
|
||||||
this.resultDisplay = cloneDeep(newVal.XeData) || []
|
this.resultDisplay = cloneDeep(newVal.XeData) || []
|
||||||
this.sortResultDisplay()
|
this.sortResultDisplay()
|
||||||
updateSampleData({
|
|
||||||
inputFileName: this.sample.inputFileName,
|
|
||||||
key: 'XeData',
|
|
||||||
data: newVal.XeData,
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// immediate: true,
|
// immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
|
|
|
@ -629,7 +629,7 @@ export default {
|
||||||
this.$bus.$on('betaRefresh', this.getData)
|
this.$bus.$on('betaRefresh', this.getData)
|
||||||
this.getData()
|
this.getData()
|
||||||
},
|
},
|
||||||
destroyed() {
|
beforeDestroy() {
|
||||||
this.$bus.$off('betaRefresh', this.handleReset)
|
this.$bus.$off('betaRefresh', this.handleReset)
|
||||||
this.$bus.$off('betaRefresh', this.getData)
|
this.$bus.$off('betaRefresh', this.getData)
|
||||||
},
|
},
|
||||||
|
|
|
@ -191,8 +191,8 @@ export default {
|
||||||
stripSumOrCutLine: null,
|
stripSumOrCutLine: null,
|
||||||
stripReferenceLine: null,
|
stripReferenceLine: null,
|
||||||
}
|
}
|
||||||
;(this.peakList = []), // Peak 列表(非点位)
|
this.peakList = [] // Peak 列表(非点位)
|
||||||
(this.baseCtrls = {}) // BaseCtrls
|
this.baseCtrls = {} // BaseCtrls
|
||||||
|
|
||||||
return {
|
return {
|
||||||
abc: false,
|
abc: false,
|
||||||
|
@ -254,7 +254,7 @@ export default {
|
||||||
window.addEventListener('keydown', this.handleKeyboardEvent)
|
window.addEventListener('keydown', this.handleKeyboardEvent)
|
||||||
window.addEventListener('click', this.closePeakInfomationTooltip)
|
window.addEventListener('click', this.closePeakInfomationTooltip)
|
||||||
},
|
},
|
||||||
destroyed() {
|
beforeDestroy() {
|
||||||
this.cancelLastRequest()
|
this.cancelLastRequest()
|
||||||
|
|
||||||
this.$bus.$off('gammaRefresh', this.handleRefresh)
|
this.$bus.$off('gammaRefresh', this.handleRefresh)
|
||||||
|
@ -264,8 +264,16 @@ export default {
|
||||||
window.removeEventListener('click', this.closePeakInfomationTooltip)
|
window.removeEventListener('click', this.closePeakInfomationTooltip)
|
||||||
|
|
||||||
if (this.qcFlagsTimer) {
|
if (this.qcFlagsTimer) {
|
||||||
clearTimeout(this.qcFlagsTimer)
|
window.clearTimeout(this.qcFlagsTimer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.closeWebSocket()
|
||||||
|
|
||||||
|
if (this.websocketTimer) {
|
||||||
|
window.clearTimeout(this.websocketTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.websock = null
|
||||||
},
|
},
|
||||||
deactivated() {
|
deactivated() {
|
||||||
// Object.keys(this.subOperatorsState).forEach(k => {
|
// Object.keys(this.subOperatorsState).forEach(k => {
|
||||||
|
@ -465,10 +473,10 @@ export default {
|
||||||
let token = Vue.ls.get(ACCESS_TOKEN)
|
let token = Vue.ls.get(ACCESS_TOKEN)
|
||||||
this.websock = new WebSocket(url, [token])
|
this.websock = new WebSocket(url, [token])
|
||||||
//update-end-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
//update-end-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
||||||
this.websock.onopen = this.websocketOnopen
|
this.websock.addEventListener('open', this.websocketOnopen)
|
||||||
this.websock.onerror = this.websocketOnerror
|
this.websock.addEventListener('error', this.websocketOnerror)
|
||||||
this.websock.onmessage = this.websocketOnmessage
|
this.websock.addEventListener('message', this.websocketOnmessage)
|
||||||
this.websock.onclose = this.websocketOnclose
|
this.websock.addEventListener('close', this.websocketOnclose)
|
||||||
},
|
},
|
||||||
websocketOnopen: function () {
|
websocketOnopen: function () {
|
||||||
// console.log('WebSocket连接成功1231')
|
// console.log('WebSocket连接成功1231')
|
||||||
|
@ -494,12 +502,25 @@ export default {
|
||||||
if (that.lockReconnect) return
|
if (that.lockReconnect) return
|
||||||
that.lockReconnect = true
|
that.lockReconnect = true
|
||||||
//没连接上会一直重连,设置延迟避免请求过多
|
//没连接上会一直重连,设置延迟避免请求过多
|
||||||
setTimeout(function () {
|
this.websocketTimer = setTimeout(function () {
|
||||||
console.info('尝试重连...')
|
console.info('尝试重连...')
|
||||||
that.initWebSocket()
|
that.initWebSocket()
|
||||||
that.lockReconnect = false
|
that.lockReconnect = false
|
||||||
}, 20000)
|
}, 20000)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 关闭websocket
|
||||||
|
closeWebSocket() {
|
||||||
|
if (this.websock) {
|
||||||
|
this.websock.removeEventListener('open', this.websocketOnopen)
|
||||||
|
this.websock.removeEventListener('error', this.websocketOnerror)
|
||||||
|
this.websock.removeEventListener('message', this.websocketOnmessage)
|
||||||
|
this.websock.removeEventListener('close', this.websocketOnclose)
|
||||||
|
this.websock.close()
|
||||||
|
this.websock = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 获取样品详情
|
// 获取样品详情
|
||||||
async getSampleDetail() {
|
async getSampleDetail() {
|
||||||
const { dbName, sampleId, analyst } = this.sample
|
const { dbName, sampleId, analyst } = this.sample
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
:sampleInfo="sampleInfo"
|
:sampleInfo="sampleInfo"
|
||||||
:sample="sampleData"
|
:sample="sampleData"
|
||||||
:analyseCurrentSpectrum="analyseCurrentSpectrumData"
|
:analyseCurrentSpectrum="analyseCurrentSpectrumData"
|
||||||
|
:sampleList="sampleList"
|
||||||
/>
|
/>
|
||||||
<!-- Beta-Gamma 分析 -->
|
<!-- Beta-Gamma 分析 -->
|
||||||
<div v-else class="empty">Please Select a Sample</div>
|
<div v-else class="empty">Please Select a Sample</div>
|
||||||
|
@ -281,7 +282,7 @@ import BGLogViewer from './components/Modals/BetaGammaModals/BGLogViewer.vue'
|
||||||
|
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import CompareFromDbModal from './components/Modals/CompareFromDBModal.vue'
|
import CompareFromDbModal from './components/Modals/CompareFromDBModal.vue'
|
||||||
import { clearSampleData, updateSampleDataAnaly } from '@/utils/SampleStore'
|
import { clearSampleData, getSampleData, updateSampleDataAnaly } from '@/utils/SampleStore'
|
||||||
|
|
||||||
// 分析类型
|
// 分析类型
|
||||||
const ANALYZE_TYPE = {
|
const ANALYZE_TYPE = {
|
||||||
|
@ -466,7 +467,7 @@ export default {
|
||||||
window.addEventListener('beforeunload', this.handleCleanAll)
|
window.addEventListener('beforeunload', this.handleCleanAll)
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
beforeDestroy() {
|
||||||
this.$bus.$off('reanalyse', this.handleReanalyse)
|
this.$bus.$off('reanalyse', this.handleReanalyse)
|
||||||
clearSampleData()
|
clearSampleData()
|
||||||
this.handleCleanAll()
|
this.handleCleanAll()
|
||||||
|
@ -504,6 +505,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.resultDisplayFlag = arg
|
this.resultDisplayFlag = arg
|
||||||
this.params_toDB.stationName = val
|
this.params_toDB.stationName = val
|
||||||
|
this.params_toDB.savedAnalysisResult = flag
|
||||||
this.isReAnalyed_beta = this.isReAnalyed_beta ? this.isReAnalyed_beta : flag
|
this.isReAnalyed_beta = this.isReAnalyed_beta ? this.isReAnalyed_beta : flag
|
||||||
},
|
},
|
||||||
getCheckFlag(val) {
|
getCheckFlag(val) {
|
||||||
|
@ -608,12 +610,13 @@ export default {
|
||||||
// B是beta-gamma P G是gamma
|
// B是beta-gamma P G是gamma
|
||||||
if (sample.sampleType == 'B') {
|
if (sample.sampleType == 'B') {
|
||||||
this.analysisType = ANALYZE_TYPE.BETA_GAMMA
|
this.analysisType = ANALYZE_TYPE.BETA_GAMMA
|
||||||
|
const sampleData = getSampleData(sample.inputFileName)
|
||||||
|
this.params_toDB.savedAnalysisResult = sampleData ? sampleData.data.savedAnalysisResult : false
|
||||||
} else {
|
} else {
|
||||||
this.analysisType = ANALYZE_TYPE.GAMMA
|
this.analysisType = ANALYZE_TYPE.GAMMA
|
||||||
}
|
}
|
||||||
this.sampleData = this.newSampleData = sample
|
this.sampleData = this.newSampleData = sample
|
||||||
this.currSampleDet = this.allSampleDet[sample.inputFileName]
|
this.currSampleDet = this.allSampleDet[sample.inputFileName]
|
||||||
this.params_toDB.savedAnalysisResult = sample.sampleId ? true : false
|
|
||||||
this.params_toDB.comment = ''
|
this.params_toDB.comment = ''
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user