Compare commits

..

No commits in common. "bb983557f08f35680d4a105f80a5222b771258e6" and "9c755377a441c84b753fb5c9723fa88e554047c6" have entirely different histories.

13 changed files with 135 additions and 246 deletions

View File

@ -30,10 +30,9 @@ export default {
this._chart.setOption(this.option, this.opts)
this.initEventListener()
},
beforeDestroy() {
destroyed() {
if (this._chart) {
this._chart.dispose()
this._chart = null
}
},
methods: {

View File

@ -6,6 +6,7 @@ import user from './modules/user'
import permission from './modules/permission'
import enhance from './modules/enhance'
import online from './modules/online'
import sample from './modules/sample'
import getters from './getters'
Vue.use(Vuex)
@ -17,6 +18,7 @@ export default new Vuex.Store({
permission,
enhance,
online,
sample
},
state: {

View File

@ -0,0 +1,52 @@
const sample = {
state: Object.freeze({
sampleList: [] // [{ inputFileName: String; data: Object; }]
}),
mutations: {
SET_SAMPLE_LIST: (state, sampleList) => {
state.sampleList = sampleList
},
ADD_SAMPLE_DATA: (state, sampleData) => {
const find = state.sampleList.find(item => item.inputFileName == sampleData.inputFileName)
if (find) {
find.data = sampleData.data
} else {
state.sampleList.push(sampleData)
}
},
UPDATE_SAMPLE_DATA: (state, { inputFileName, key, data }) => {
const find = state.sampleList.find(item => item.inputFileName == inputFileName)
if (find) {
find.data[key] = data
}
},
UPDATE_SAMPLE_DATA_ANALY: (state, { inputFileName, data }) => {
const find = state.sampleList.find(item => item.inputFileName == inputFileName)
if (find) {
data.DetailedInformation = find.data.DetailedInformation
find.data = data
}
},
REMOVE_SAMPLE_DATA: (state, inputFileName) => {
const findIndex = state.sampleList.findIndex(item => item.inputFileName == inputFileName)
if(-1 !== findIndex) {
state.sampleList.splice(findIndex, 1)
}
},
CLEAR_SAMPLE_DATA: (state) => {
state.sampleList = []
}
},
actions: {
GET_SAMPLE_DATA: ({ state }, inputFileName) => {
const find = state.sampleList.find(item => item.inputFileName == inputFileName)
return find ? find : null
}
}
}
export default sample

View File

@ -1,84 +0,0 @@
// 所有缓存的谱
let sampleList = []
/**
* 重新设置缓存的谱
* @param {Array} list
*/
const setSampleList = list => {
sampleList = list
}
/**
* 缓存一条谱数据
* @param {*} sampleData
*/
const addSampleData = sampleData => {
const find = sampleList.find(item => item.inputFileName == sampleData.inputFileName)
if (find) {
find.data = sampleData.data
} else {
sampleList.push(sampleData)
}
}
/**
* 更新谱数据
* @param {{ inputFileName: string; key: string; data: any; }} param0
*/
const updateSampleData = ({ inputFileName, key, data }) => {
const find = sampleList.find(item => item.inputFileName == inputFileName)
if (find) {
find.data[key] = data
}
}
/**
* 移除谱数据
* @param {string} inputFileName
*/
const removeSampleData = inputFileName => {
const findIndex = sampleList.findIndex(item => item.inputFileName == inputFileName)
if (-1 !== findIndex) {
sampleList.splice(findIndex, 1)
}
}
/**
* 更新分析数据
* @param {{ inputFileName: string; data: any; }} param0
*/
const updateSampleDataAnaly = ({ inputFileName, data }) => {
const find = sampleList.find(item => item.inputFileName == inputFileName)
if (find) {
data.DetailedInformation = find.data.DetailedInformation
find.data = data
}
}
/**
* 清理缓存列表
*/
const clearSampleData = () => {
sampleList = []
}
/**
* 根据文件名获取谱
* @param {string} inputFileName
*/
const getSampleData = inputFileName => {
const find = sampleList.find(item => item.inputFileName == inputFileName)
return find ? find : null
}
export {
sampleList,
setSampleList,
addSampleData,
updateSampleData,
removeSampleData,
updateSampleDataAnaly,
clearSampleData,
getSampleData
}

View File

@ -121,7 +121,6 @@
</template>
<script>
import { addSampleData, getSampleData, sampleList, setSampleList, updateSampleData } from '@/utils/SampleStore'
import { getAction, postAction } from '../../api/manage'
import BetaGammaChartContainer from './components/BetaGammaChartContainer.vue'
import BetaGammaSpectrumChart from './components/BetaGammaSpectrumChart.vue'
@ -190,10 +189,6 @@ export default {
analyseCurrentSpectrum: {
type: Object,
},
sampleList: {
type: Array,
required: true,
},
},
data() {
this.SampleType = SampleType
@ -232,7 +227,6 @@ export default {
statisticsType: StatisticsType['Collection Time'],
currSample: {},
qcFlagsVisible: false,
defaultSavedAnalysisResult: null,
}
},
created() {
@ -243,7 +237,7 @@ export default {
this.qcFlagsVisible = true
}, 100)
},
beforeDestroy() {
destroyed() {
this.cancelLastRequest()
this.$bus.$off('ReAnalyses', this.handleReAnalyse)
@ -304,7 +298,7 @@ export default {
item.nidFlag = val ? 1 : 0
}
})
this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode, this.defaultSavedAnalysisResult)
this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode)
},
async getSampleDetail() {
this.spectraType = this.SampleType[0].value
@ -329,7 +323,7 @@ export default {
this.changeChartByType('sample')
this.emitGetFiles(result)
addSampleData({
this.$store.commit('ADD_SAMPLE_DATA', {
inputFileName,
data: result,
from: 'db',
@ -375,12 +369,11 @@ export default {
this.sampleDetail = result
this.changeChartByType('sample')
addSampleData({
this.$store.commit('ADD_SAMPLE_DATA', {
inputFileName: this.sample.sampleFileName,
data: result,
from: 'file',
})
this.isLoading = false
} else {
this.$message.error(message)
@ -443,7 +436,6 @@ export default {
XeData, // Result Display
savedAnalysisResult,
} = this.sampleDetail
this.defaultSavedAnalysisResult = this.sampleDetail.savedAnalysisResult
this.spectrumData = spectrumData
this.histogramDataList = histogramDataList
@ -564,17 +556,6 @@ export default {
item.mdc = parseFloat(item.mdc.toPrecision(6))
})
this.$emit('reAnalyCurr', res.result.savedAnalysisResult, res.result.XeData)
// 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,
})
this.handleReAnalyse(res.result)
if (res.result.bProcessed) {
this.$message.success(res.result.message)
@ -587,77 +568,31 @@ export default {
}
})
},
//
async getAnalyzeAllSpectrum() {
const regExp = /^([A-Z]{1,}\d{1,})_/
const regMatched = this.sample.inputFileName.match(regExp)
const currStationName = regMatched[1]
const dbNames = [],
sampleIds = [],
sampleFileNames = [],
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,
getAnalyzeAllSpectrum() {
let params = {
dbNames: [this.sample.dbName],
sampleIds: [this.sample.sampleId ? this.sample.sampleId : ''],
sampleFileNames: [this.sample.inputFileName],
gasFileNames: [this.sample.gasFileName],
detFileNames: [this.sample.detFileName],
qcFileNames: [this.sample.qcFileName],
currentFileName: this.sample.inputFileName,
}
const { success, result, message } = await postAction('/spectrumAnalysis/analyseAllSpectrum', params)
if (success) {
//
Object.entries(result).forEach(([inputFileName, sampleInfo]) => {
const { XeData, savedAnalysisResult, bProcessed, message } = sampleInfo
XeData.forEach((item) => {
postAction('/spectrumAnalysis/analyseAllSpectrum', params).then((res) => {
if (res.success) {
// this.analyseCurrentSpectrum = res.result
this.$emit('sendXeData', res.result.XeData)
res.result.XeData.forEach((item) => {
item.conc = parseFloat(item.conc.toPrecision(6))
item.concErr = parseFloat(item.concErr.toPrecision(6))
item.lc = parseFloat(item.lc.toPrecision(6))
item.mdc = parseFloat(item.mdc.toPrecision(6))
})
updateSampleData({
inputFileName,
key: 'XeData',
data: XeData,
})
updateSampleData({
inputFileName,
key: 'savedAnalysisResult',
data: savedAnalysisResult,
})
if (inputFileName == this.sample.inputFileName) {
this.$emit('sendXeData', XeData)
this.$emit('reAnalyAll', savedAnalysisResult, XeData)
this.handleReAnalyse(sampleInfo)
if (bProcessed) {
this.$message.success(message)
} else {
this.$message.warning(message)
}
}
})
} else {
this.$message.warning(message)
}
this.$emit('reAnalyAll', true, res.result.XeData)
} else {
this.$message.warning(res.message)
}
})
},
//
@ -720,7 +655,7 @@ export default {
sample: {
async handler(newVal, oldVal) {
this.resultDisplay = []
const sampleData = getSampleData(newVal.inputFileName)
const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName)
if (sampleData) {
this.cancelLastRequest()
this.isLoading = false
@ -738,7 +673,6 @@ export default {
this.getSampleDetail_file()
}
}
await this.$nextTick()
this.$refs.betaGammaChartRef.handleUnzoom()
},
immediate: true,
@ -749,6 +683,11 @@ export default {
// this.currResultDisplay = newVal.XeData
this.resultDisplay = cloneDeep(newVal.XeData) || []
this.sortResultDisplay()
this.$store.commit('UPDATE_SAMPLE_DATA', {
inputFileName: this.sample.inputFileName,
key: 'XeData',
data: newVal.XeData,
})
},
// immediate: true,
deep: true,

View File

@ -1,5 +1,5 @@
import { deleteAction } from '@/api/manage'
import { removeSampleData } from '@/utils/SampleStore'
import store from '@/store'
import Vue from 'vue'
/**
@ -20,7 +20,7 @@ export const clearSampleCache = sampleList => {
params = { sampleFileName: fileName }
}
deleteAction(url, params)
removeSampleData(fileName)
store.commit('REMOVE_SAMPLE_DATA', fileName)
Vue.ls.remove(`CALIBRATION_GAMMA_${fileName}`)
Vue.ls.remove(`CALIBRATION_BETA_${fileName}`)
})

View File

@ -327,6 +327,7 @@ export default {
},
}
},
mounted() {
this.opts.notMerge = true
this.$nextTick(() => {
@ -564,20 +565,13 @@ export default {
// 3D
histogramDataDList: {
handler(newVal) {
let maxCount = 0
const data = []
for (const item of newVal) {
const { b, g, c } = item //
if (c > maxCount) maxCount = c
data.push([b, g, c])
}
const maxCount = Math.max(...newVal.map((item) => item.c))
this.threeDSurfaceOption.zAxis3D.max = Math.ceil(maxCount * 1.2)
this.threeDSurfaceOption.series.data = data // 设置3D surface数据 // 第一次设置耗时较多
this.threeDSurfaceOption.series.data = newVal.map((item) => [item.b, item.g, item.c]) // 3D surface
this.threeDSurfaceOption.visualMap.max = maxCount
this.threeDScatterOption.zAxis3D.max = Math.ceil(maxCount * 1.2)
this.threeDScatterOption.series.data = data // 3D scatter
this.threeDScatterOption.series.data = newVal.map((item) => [item.b, item.g, item.c]) // 3D scatter
this.threeDScatterOption.visualMap.max = maxCount
},
immediate: true,

View File

@ -228,7 +228,6 @@ import { updateBaseLine } from '@/utils/WasmHelper'
import RectList from './components/RectList.vue'
import { isNullOrUndefined } from '@/utils/util'
import { findNearPeak, getLineData, transformPointListData } from '@/utils/sampleHelper'
import { getSampleData } from '@/utils/SampleStore'
//
const initialOption = {
@ -515,7 +514,7 @@ export default {
}
},
methods: {
getInfo() {
async getInfo() {
this.option.series = []
this.thumbnailOption.series = []
this.list = []
@ -523,7 +522,7 @@ export default {
const { inputFileName } = this.sampleData
const currSampleDetailInfo = getSampleData(inputFileName)
const currSampleDetailInfo = await this.$store.dispatch('GET_SAMPLE_DATA', inputFileName)
const {
data: { allData, shadowChannelChart, shapeChannelData, peak, BaseCtrls, barChart },
} = currSampleDetailInfo
@ -584,8 +583,8 @@ export default {
this.handleResetChart()
},
beforeModalOpen() {
this.getInfo()
async beforeModalOpen() {
await this.getInfo()
this.reset()
},

View File

@ -629,7 +629,7 @@ export default {
this.$bus.$on('betaRefresh', this.getData)
this.getData()
},
beforeDestroy() {
destroyed() {
this.$bus.$off('betaRefresh', this.handleReset)
this.$bus.$off('betaRefresh', this.getData)
},

View File

@ -50,7 +50,6 @@ import { postAction } from '@/api/manage'
import BetaDetectorCalibration from './components/BetaDetectorCalibration.vue'
import GammaDetectorCalibration from './components/GammaDetectorCalibration.vue'
import TitleOverBorder from '@/views/spectrumAnalysis/components/TitleOverBorder.vue'
import { removeSampleData } from '@/utils/SampleStore'
export default {
components: { BetaDetectorCalibration, GammaDetectorCalibration, TitleOverBorder },
mixins: [ModalMixin, SampleDataMixin],
@ -180,7 +179,8 @@ export default {
//
clearSameStationCache(sampleList) {
sampleList.forEach(({ inputFileName }) => {
removeSampleData(inputFileName)
console.log('inputFileName>>' + inputFileName)
this.$store.commit('REMOVE_SAMPLE_DATA', inputFileName)
})
},
// Calibration 20231115xiao

View File

@ -1,5 +1,5 @@
<template>
<custom-modal v-model="visible" :width="1000" title="View Spectrum" destroyOnClose @cancel="handleCancel">
<custom-modal v-model="visible" :width="1000" title="View Spectrum" destroyOnClose>
<a-spin :spinning="isLoading">
<a-tabs :animated="false" @change="handleTabChange">
<a-tab-pane tab="Sample Spectrum" :key="1">
@ -19,7 +19,7 @@
<div slot="custom-footer">
<a-space :size="20">
<a-button type="primary" @click="handleOk">Save Text</a-button>
<a-button @click="handleCancel">Cancel</a-button>
<a-button @click="visible = false">Cancel</a-button>
</a-space>
</div>
</custom-modal>
@ -89,6 +89,7 @@ export default {
this.currTab = key
},
handleOk() {
console.log(this.sampleData)
this.fileName = ''
let text = ''
if (this.currTab == 1) {
@ -103,6 +104,7 @@ export default {
if (text) {
let name = this.newSampleData.inputFileName.split('.')[0]
let strData = new Blob([text], { type: 'text/plain;charset=utf-8' })
// saveAs(strData, `GammaViewer Log.txt`)
if (this.currTab == 1) {
saveAs(strData, `${name}_Sample Spectrum.txt`)
} else if (this.currTab == 2) {
@ -112,14 +114,27 @@ export default {
} else if (this.currTab == 4) {
saveAs(strData, `${name}_QC Spectrum.txt`)
}
// let _this = this
// this.$confirm({
// title: 'Please enter file name',
// content: (h) => <a-input v-model={_this.fileName} />,
// okText: 'Cancle',
// cancelText: 'Save',
// okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
// cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
// onOk() {
// console.log('Cancel')
// },
// onCancel() {
// if (_this.fileName) {
// saveAs(strData, `${_this.fileName}.txt`)
// }
// },
// })
} else {
this.$message.warning('No data can be saved!')
}
},
handleCancel() {
this.currTab = 1
this.visible = false
},
},
}
</script>

View File

@ -136,7 +136,6 @@ import { readFile, zipFile } from '@/utils/file'
import { findNearPeak } from '@/utils/sampleHelper'
import { add, subtract } from 'xe-utils/methods'
import { PHDParser, isSample, getSampleTypeIdentify } from '@/utils/phdHelper'
import { addSampleData, getSampleData } from '@/utils/SampleStore'
export default {
props: {
@ -191,8 +190,8 @@ export default {
stripSumOrCutLine: null,
stripReferenceLine: null,
}
this.peakList = [] // Peak
this.baseCtrls = {} // BaseCtrls
;(this.peakList = []), // Peak
(this.baseCtrls = {}) // BaseCtrls
return {
abc: false,
@ -254,7 +253,7 @@ export default {
window.addEventListener('keydown', this.handleKeyboardEvent)
window.addEventListener('click', this.closePeakInfomationTooltip)
},
beforeDestroy() {
destroyed() {
this.cancelLastRequest()
this.$bus.$off('gammaRefresh', this.handleRefresh)
@ -264,16 +263,8 @@ export default {
window.removeEventListener('click', this.closePeakInfomationTooltip)
if (this.qcFlagsTimer) {
window.clearTimeout(this.qcFlagsTimer)
clearTimeout(this.qcFlagsTimer)
}
this.closeWebSocket()
if (this.websocketTimer) {
window.clearTimeout(this.websocketTimer)
}
this.websock = null
},
deactivated() {
// Object.keys(this.subOperatorsState).forEach(k => {
@ -473,10 +464,10 @@ export default {
let token = Vue.ls.get(ACCESS_TOKEN)
this.websock = new WebSocket(url, [token])
//update-end-author:taoyan date:2022-4-22 for: v2.4.6 websocket #3278
this.websock.addEventListener('open', this.websocketOnopen)
this.websock.addEventListener('error', this.websocketOnerror)
this.websock.addEventListener('message', this.websocketOnmessage)
this.websock.addEventListener('close', this.websocketOnclose)
this.websock.onopen = this.websocketOnopen
this.websock.onerror = this.websocketOnerror
this.websock.onmessage = this.websocketOnmessage
this.websock.onclose = this.websocketOnclose
},
websocketOnopen: function () {
// console.log('WebSocket1231')
@ -502,25 +493,12 @@ export default {
if (that.lockReconnect) return
that.lockReconnect = true
//
this.websocketTimer = setTimeout(function () {
setTimeout(function () {
console.info('尝试重连...')
that.initWebSocket()
that.lockReconnect = false
}, 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() {
const { dbName, sampleId, analyst } = this.sample
@ -601,7 +579,7 @@ export default {
dataProcess(result, flag) {
const { inputFileName } = this.sample
addSampleData({
this.$store.commit('ADD_SAMPLE_DATA', {
inputFileName,
data: result,
from: flag,
@ -2079,11 +2057,11 @@ export default {
immediate: true,
},
sample: {
handler(newVal, oldVal) {
async handler(newVal, oldVal) {
console.log('newValnewVal', newVal)
this.graphAssistance.axisType = 'Channel'
this.handleResetState()
const sampleData = getSampleData(newVal.inputFileName)
const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName)
if (sampleData) {
this.cancelLastRequest()
this.isLoading = false

View File

@ -65,7 +65,6 @@
:sampleInfo="sampleInfo"
:sample="sampleData"
:analyseCurrentSpectrum="analyseCurrentSpectrumData"
:sampleList="sampleList"
/>
<!-- Beta-Gamma 分析 -->
<div v-else class="empty">Please Select a Sample</div>
@ -296,7 +295,6 @@ 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'
//
const ANALYZE_TYPE = {
@ -491,9 +489,9 @@ export default {
window.addEventListener('beforeunload', this.handleCleanAll)
},
beforeDestroy() {
destroyed() {
this.$bus.$off('reanalyse', this.handleReanalyse)
clearSampleData()
this.$store.commit('CLEAR_SAMPLE_DATA')
this.handleCleanAll()
window.removeEventListener('beforeunload', this.handleCleanAll)
},
@ -504,10 +502,8 @@ export default {
this.params_toDB.savedAnalysisResult = flag
this.resultDisplayFlag = val
},
getReAnalyAll(flag, val) {
this.isReAnalyed_beta = flag
getReAnalyAll(val) {
this.resultDisplayFlag = val
this.params_toDB.savedAnalysisResult = flag
},
handleReAnalyed(val) {
this.isReAnalyed_gamma = val
@ -529,7 +525,6 @@ export default {
}
this.resultDisplayFlag = arg
this.params_toDB.stationName = val
this.params_toDB.savedAnalysisResult = flag
this.isReAnalyed_beta = this.isReAnalyed_beta ? this.isReAnalyed_beta : flag
},
getCheckFlag(val) {
@ -650,8 +645,6 @@ export default {
// Bbeta-gamma P Ggamma
if (sample.sampleType == 'B') {
this.analysisType = ANALYZE_TYPE.BETA_GAMMA
const sampleData = getSampleData(sample.inputFileName)
this.params_toDB.savedAnalysisResult = sampleData ? sampleData.data.savedAnalysisResult : false
} else if (sample.sampleType == 'C') {
this.analysisType = ANALYZE_TYPE.BETA
} else {
@ -659,6 +652,7 @@ export default {
}
this.sampleData = this.newSampleData = sample
this.currSampleDet = this.allSampleDet[sample.inputFileName]
this.params_toDB.savedAnalysisResult = sample.sampleId ? true : false
this.params_toDB.comment = ''
},
@ -889,6 +883,7 @@ export default {
* @param { 'all' | 'current' } type
*/
handleSavePHDToFile(type) {
console.log('%c [ savePHDToFile ]-162', 'font-size:13px; background:pink; color:#bf2c9f;', type)
if (this.isGamma) {
if (type == 'current') {
let params = {
@ -948,7 +943,7 @@ export default {
try {
const { success, result, message } = await postAction(`/gamma/Reprocessing?fileName=${fileNames[0]}`)
if (success) {
updateSampleDataAnaly({
this.$store.commit('UPDATE_SAMPLE_DATA_ANALY', {
inputFileName: fileNames[0],
data: result,
})