AnalysisSystemForRadionucli.../src/views/spectrumAnalysis/index.vue

1726 lines
56 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="spectrum-analysis">
<!-- 顶部操作栏 -->
<div class="spectrum-analysis-operators">
<template v-for="operation in operations">
<a-dropdown
v-if="operation.show !== false"
class="spectrum-analysis-operators-item"
overlayClassName="spectrum-analysis-operators-dropdown-overlay"
:overlay-style="operation.style"
:key="operation.title"
>
<a-button type="primary">
<a-icon type="loading" v-if="operation.loading"></a-icon>
{{ operation.title }}
</a-button>
<div slot="overlay">
<template v-for="(child, index) in operation.children">
<component v-if="child.show !== false" :is="child.type" :key="index" v-bind="child.attrs" v-on="child.on">
<template v-for="item in child.children">
<component v-if="item.show !== false" :is="item.type" :key="item.title" @click="item.handler">
{{ item.title }}
</component>
</template>
</component>
</template>
</div>
</a-dropdown>
</template>
</div>
<!-- 顶部操作栏结束 -->
<!-- 频谱分析部分 -->
<div class="spectrum-analysis-main">
<!-- Gamma 分析 -->
<gamma-analysis
v-if="isGamma"
ref="gammaAnalysisRef"
:sample="sampleData"
:updateFlag="updateFlag"
@reAnalyed="handleReAnalyed"
/>
<!-- Gamma 分析 -->
<!-- Beta-Gamma 分析 -->
<!-- <beta-gamma-analysis v-else-if="isBetaGamma" ref="betaGammaAnalysisRef" :sample="sampleData" /> -->
<beta-gamma-analysis
v-else-if="isBetaGamma"
ref="betaGammaAnalysisRef"
@getFiles="getFiles"
@sendInfo="getStationName"
@sendXeData="getXeData"
@reAnalyCurr="getReAnalyCurr"
@reAnalyAll="getReAnalyAll"
:sampleInfo="sampleInfo"
:sample="sampleData"
:analyseCurrentSpectrum="analyseCurrentSpectrumData"
/>
<!-- Beta-Gamma 分析 -->
<div v-else class="empty">Please Select a Sample</div>
<resize-observer @notify="handleResize" />
</div>
<!-- 频谱分析部分结束 -->
<!-- 从数据库加载开始 -->
<load-from-db-modal v-model="loadFromDbModalVisible" @loadSample="handleLoadSampleFromDB" />
<!-- 从数据库加载结束 -->
<!-- 从文件加载开始 -->
<load-from-file-modal v-model="loadFromFileModalVisible" @loadFormFile="handleLoadSampleFromFile" />
<!-- 从文件加载结束 -->
<!-- Ftransit 弹窗开始 -->
<ftranslt-modal v-model="ftransltModalVisible" />
<!-- Ftransit 弹窗结束 -->
<!-- Peak Infomation 弹窗开始 -->
<peak-infomation v-model="peakInfomationModalVisible" />
<!-- Peak Infomation 弹窗结束 -->
<!-- Nuclide Activity and MDC 弹窗开始 -->
<nuclide-activity-and-mdc-modal v-model="nuclideActivityAndMDCModalVisible" />
<!-- Nuclide Activity and MDC 弹窗结束 -->
<!-- Save Setting 弹窗开始 -->
<save-setting-modal v-model="saveSettingModalVisible" @save="handleSaveResultsToFile" />
<!-- Save Setting 弹窗结束 -->
<!-- 分析-设置弹窗开始 -->
<analyze-setting-modal
v-model="analyzeConfigureModalVisible"
:sampleId="sampleData.sampleId"
@senInfo="getUpdateFlag"
/>
<!-- 分析-设置弹窗结束 -->
<!-- 全部分析-进度弹窗开始 -->
<processing-monitor-modal
v-model="analyzeAllModalVisible"
:percent="percentBar"
:analysedFileName="analysedFileName"
/>
<!-- 全部分析-进度弹窗结束 -->
<!-- 分析工具弹窗开始 -->
<analyze-interactive-tool-modal
v-model="analyzeInteractiveToolModalVisible"
:sampleId="sampleData.sampleId"
:colorConfig="colorConfig"
/>
<!-- 分析工具弹窗结束 -->
<!-- Korsum 弹窗开始 -->
<korsum-modal v-model="korsumModalShow" />
<!-- Korsum 弹窗结束 -->
<!-- Zero Time 弹窗开始 -->
<zero-time-modal v-model="zeroTimeModalVisible" :sampleId="sampleData.sampleId" />
<!-- Zero Time 弹窗结束 -->
<!-- Efficiency Calibration 弹窗开始 -->
<efficiency-calibration-modal v-model="efficiencyCalibrationModalShow" />
<!-- Efficiency Calibration 弹窗结束 -->
<!-- Energy Calibration 弹窗开始 -->
<energy-calibration-modal v-model="energyCalibrationModalShow" />
<!-- Energy Calibration 弹窗结束 -->
<!-- Resolution Calibration 弹窗开始 -->
<resolution-calibration-modal v-model="resolutionCalibrationModalShow" />
<!-- Resolution Calibration 弹窗结束 -->
<!-- SpectrumComments 弹窗开始 -->
<spectrum-comments-modal v-model="gammaCommentsModalVisible" :isAdd="isGammaCommentsAdd" />
<!-- SpectrumComments 弹窗结束 -->
<!-- Color Config 弹窗开始 -->
<color-config-modal v-model="colorConfigModalVisible" :colorConfig="colorConfig" @colorChange="handleColorChange" />
<!-- Color Config 弹窗结束 -->
<!-- Data Processing Log 弹窗开始 -->
<data-processing-log-modal v-model="dataProcessingLogModalVisible" :sampleId="sampleData.sampleId" />
<!-- Data Processing Log 弹窗结束 -->
<!-- Config User Library 弹窗开始 -->
<config-user-library-modal v-model="configUserLibModalVisible" />
<!-- Config User Library 弹窗结束 -->
<!-- Nuclide Library 弹窗开始 -->
<nuclide-library-modal v-model="nuclideLibraryModalVisible" />
<!-- Nuclide Library 弹窗结束 -->
<!-- Arr 和 RRR 弹窗开始 -->
<arr-rrr-modal v-model="arrOrRRRModalVisible" :type="arrOrRRRModalType" :extraData="this.arrOrRRRModalExtraData" />
<!-- Arr 弹窗结束 -->
<!-- Spectrum 弹窗开始 -->
<spectrum-modal v-model="spectrumModalVisible" />
<!-- Spectrum 弹窗结束 -->
<!-- SampleInfo 弹窗开始 -->
<sample-infomation-modal v-model="sampleInfomationModalVisible" />
<!-- SampleInfo 弹窗结束 -->
<!-- Qc Results 弹窗开始 -->
<qc-results-modal v-model="qcResultsModalVisible" />
<!-- Qc Results 弹窗结束 -->
<!-- RLR 弹窗开始 -->
<rlr-modal v-model="rlrModalVisible" />
<!-- RLR 弹窗结束 -->
<automatic-analysis-log-modal v-model="autoAnalysisMogModalVisible" :type="autoAnalysisMogModalType" />
<!-- Beta-Gamma 的Comments 弹窗 -->
<beta-gamma-comments-modal
v-model="betaGammaCommentsModalVisible"
:isAdd="isBetaGammaCommentsAdd"
:comment="params_toDB.comment"
@sendInfo="getcommentsInfo"
/>
<!-- Beta-Gamma 的Comments 结束 -->
<!-- Beta-Gamma 的Energy Calibration开始 -->
<beta-gamma-energy-calibration-modal
v-model="betaGammaEnergyCalibrationModalVisible"
:sampleList="sampleList"
@sendInfo="getCheckFlag"
@sendXeData="getXeData"
@reAnalyCurr="getReAnalyCurr"
/>
<!-- Beta-Gamma 的Energy Calibration结束 -->
<!-- Beta-Gamma 的 Extrapolation 弹窗开始 -->
<beta-gamma-extrapolation-modal v-model="betaGammaExtrapolationModalVisible" />
<!-- Beta-Gamma 的 Extrapolation 弹窗结束 -->
<!-- Beta-Gamma 的 Spectrum 弹窗 -->
<beta-gamma-spectrum-modal v-model="betaGammaSpectrumModalVisible" />
<!-- Beta-Gamma 的 Spectrum 弹窗 结束 -->
<!-- Beta-Gamma 的 Sample Infomation 弹窗 -->
<beta-gamma-sample-infomation-modal
v-model="betaGammaSampleInfomationModalVisible"
:sampleId="this.sampleData.sampleId"
/>
<!-- Beta-Gamma 的 Sample Infomation 弹窗 结束 -->
<!-- Beta-Gamma 的 QC Result 弹窗 -->
<beta-gamma-qc-results-modal v-model="betaGammaQCResultsModalVisible" :sampleId="this.sampleData.sampleId" />
<!-- Beta-Gamma 的 QC Result 弹窗 结束 -->
<!-- Beta-Gamma 的 RLR 弹窗 -->
<beta-gamma-rlr-modal v-model="betaGammaRlrModalVisible" />
<!-- Beta-Gamma 的 RLR 弹窗 结束 -->
<!-- Beta-Gamma 的 Statistics Paramer History 弹窗 -->
<statistics-paramer-history-modal v-model="statisticsParamerHistoryModalVisible" />
<!-- Beta-Gamma 的 Statistics Paramer History 弹窗 结束 -->
<bg-log-viewer v-model="bgLogViewerVisible" />
</div>
</template>
<script>
import { postAction } from '@/api/manage'
import GammaAnalysis from './gamma-analysis.vue'
import BetaGammaAnalysis from './beta-gamma-analysis.vue'
import SpectraListInMenu from './components/SpectraListInMenu.vue'
import LoadFromDbModal from './components/Modals/LoadFromDBModal.vue'
import LoadFromFileModal from './components/Modals/LoadFromFileModal.vue'
import PeakInfomation from './components/PeakInfomation.vue'
import NuclideActivityAndMdcModal from './components/Modals/NuclideActivityAndMDCModal.vue'
import MultiLevelMenu from './components/MultiLevelMenu.vue'
import SaveSettingModal from './components/Modals/SaveSettingModal.vue'
import AnalyzeSettingModal from './components/Modals/AnalyzeSettingModal.vue'
import ProcessingMonitorModal from './components/Modals/ProcessingMonitorModal.vue'
import AnalyzeInteractiveToolModal from './components/Modals/AnalyzeInteractiveToolModal/index.vue'
import KorsumModal from './components/Modals/KorsumModal.vue'
import ZeroTimeModal from './components/Modals/ZeroTimeModal.vue'
import EfficiencyCalibrationModal from './components/Modals/EfficiencyCalibrationModal.vue'
import EnergyCalibrationModal from './components/Modals/EnergyCalibrationModal.vue'
import ResolutionCalibrationModal from './components/Modals/ResolutionCalibrationModal.vue'
import SpectrumCommentsModal from './components/Modals/SpectrumCommentsModal.vue'
import ColorConfigModal from './components/Modals/ColorConfigModal.vue'
import DataProcessingLogModal from './components/Modals/DataProcessingLogModal.vue'
import ConfigUserLibraryModal from './components/Modals/ConfigUserLibraryModal.vue'
import NuclideLibraryModal from './components/Modals/NuclideLibraryModal.vue'
import ArrRrrModal from './components/Modals/ArrRrrModal.vue'
import SpectrumModal from './components/Modals/SpectrumModal.vue'
import SampleInfomationModal from './components/Modals/SampleInfomationModal.vue'
import QcResultsModal from './components/Modals/QcResultsModal.vue'
import RlrModal from './components/Modals/RLRModal/index.vue'
import BetaGammaCommentsModal from './components/Modals/BetaGammaModals/BetaGammaCommentsModal.vue'
import BetaGammaSpectrumModal from './components/Modals/BetaGammaModals/BetaGammaSpectrumModal.vue'
import BetaGammaSampleInfomationModal from './components/Modals/BetaGammaModals/BetaGammaSampleInfomationModal.vue'
import BetaGammaQcResultsModal from './components/Modals/BetaGammaModals/BetaGammaQCResultsModal.vue'
import BetaGammaRlrModal from './components/Modals/BetaGammaModals/BetaGammaRLRModal/index.vue'
import StatisticsParamerHistoryModal from './components/Modals/BetaGammaModals/StatisticsParamerHistoryModal.vue'
import FtransltModal from './components/Modals/FtransltModal/index.vue'
import BetaGammaEnergyCalibrationModal from './components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue'
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'
import { fetchAndDownload } from '@/utils/file'
import BGLogViewer from './components/Modals/BetaGammaModals/BGLogViewer.vue'
import { saveAs } from 'file-saver'
// 分析类型
const ANALYZE_TYPE = {
GAMMA: 'gammaAnalysis',
BETA_GAMMA: 'betaGammaAnalysis',
}
export default {
name: 'SpectrumAnalysis',
components: {
BetaGammaAnalysis,
GammaAnalysis,
SpectraListInMenu,
LoadFromDbModal,
LoadFromFileModal,
PeakInfomation,
NuclideActivityAndMdcModal,
MultiLevelMenu,
SaveSettingModal,
AnalyzeSettingModal,
ProcessingMonitorModal,
AnalyzeInteractiveToolModal,
KorsumModal,
ZeroTimeModal,
EfficiencyCalibrationModal,
EnergyCalibrationModal,
ResolutionCalibrationModal,
SpectrumCommentsModal,
ColorConfigModal,
DataProcessingLogModal,
ConfigUserLibraryModal,
NuclideLibraryModal,
ArrRrrModal,
SpectrumModal,
SampleInfomationModal,
QcResultsModal,
RlrModal,
BetaGammaCommentsModal,
BetaGammaSpectrumModal,
BetaGammaSampleInfomationModal,
BetaGammaQcResultsModal,
BetaGammaRlrModal,
StatisticsParamerHistoryModal,
FtransltModal,
BetaGammaEnergyCalibrationModal,
AutomaticAnalysisLogModal,
BetaGammaExtrapolationModal,
BgLogViewer: BGLogViewer,
},
provide() {
return {
sample: () => {
return this.sampleData
},
newSample: () => {
return this.newSampleData
},
}
},
data() {
this.ANALYZE_TYPE = ANALYZE_TYPE
return {
analysisType: null, // 分析类型
sampleList: [],
loadFromDbModalVisible: false, // 从数据库加载弹窗
loadFromFileModalVisible: false, // 从文件加载弹窗
ftransltModalVisible: false, // Ftransit 弹窗
sampleData: {}, // 要分析的谱数据
newSampleData: {}, // 要分析的谱数据
saveSettingModalVisible: false, // 保存设置弹窗
analyzeConfigureModalVisible: false, // 分析设置弹窗
analyzeAllModalVisible: false, // 全部分析设置弹窗
analyzeInteractiveToolModalVisible: false, // 分析工具弹窗
zeroTimeModalVisible: false, // Zero Time 弹窗
korsumModalShow: false, // Korsum 弹窗
efficiencyCalibrationModalShow: false, // Calibration -> Efficiency 弹窗
energyCalibrationModalShow: false, // Calibration -> Energy 弹窗
resolutionCalibrationModalShow: false, // Calibration -> Resolution 弹窗
gammaCommentsModalVisible: false, // Comments -> Spectrum Comments 弹窗
isGammaCommentsAdd: true, // Spectrum Comments 是否是新增
colorConfigModalVisible: false, // Help -> Color Config 弹窗
dataProcessingLogModalVisible: false, // Log -> Data Processing Log 弹窗
configUserLibModalVisible: false, // NuclideLibrary -> Config User Library 弹窗
nuclideLibraryModalVisible: false, // NuclideLibrary -> Nuclide Library 弹窗
peakInfomationModalVisible: false, // Reports -> PeakInfo 弹窗
arrOrRRRModalVisible: false, // Reports -> ARR 或RRR 弹窗
arrOrRRRModalType: 1, // Reports -> ARR 或RRR 弹窗类型
arrOrRRRModalExtraData: {},
nuclideActivityAndMDCModalVisible: false, // Reports -> Radionuclide Activity 弹窗
spectrumModalVisible: false, // Reports -> Spectrum 弹窗
sampleInfomationModalVisible: false, // Reports -> Sample Infomation 弹窗
qcResultsModalVisible: false, // Reports -> Qc Results 弹窗
rlrModalVisible: false, // Reports -> RLR 弹窗
autoAnalysisMogModalVisible: false, // Log -> Automatic Analysis Log 弹窗
autoAnalysisMogModalType: 1, // Log -> Automatic Analysis Log 弹窗类型 1为gamma 2为 betagamma
/**
* 以下是beta-gamma跟前面不同的弹窗
**/
betaGammaCommentsModalVisible: false, // beta-gamma Comments
isBetaGammaCommentsAdd: false, // beta-gamma comments 是否新增
betaGammaEnergyCalibrationModalVisible: false, // beta-gamma 的 Energy Calibration 弹窗
betaGammaExtrapolationModalVisible: false, // beta-gamma 的 Extrapolation 弹窗
betaGammaSpectrumModalVisible: false, // beta-gamma spectrum 弹窗
betaGammaSampleInfomationModalVisible: false, // beta-gamma sample infomation 弹窗
betaGammaQCResultsModalVisible: false, // beta-gamma QC Result 弹窗
betaGammaRlrModalVisible: false, // beta-gamma RLR 弹窗
statisticsParamerHistoryModalVisible: false, // beta-gamma Statistics Paramer History 弹窗
bgLogViewerVisible: false, // beta-gamma Log 下的BG log viewer 弹窗
analyseCurrentSpectrumData: {},
resultDisplayFlag: [],
params_toDB: {
comment: '',
savedAnalysisResult: false,
stationName: '',
dbName: '',
sampleFileName: '',
gasFileName: '',
detFileName: '',
qcFileName: '',
// bGammaEnergyValidSample: false,
// bBetaEnergyValidSample: false,
// bGammaEnergyValidGas: false,
// bBetaEnergyValidGas: false,
// bGammaEnergyValidDet: false,
// bBetaEnergyValidDet: false,
checkSample: false,
checkGas: false,
checkDet: false,
xe131mFlag: null,
xe133Flag: null,
xe133mFlag: null,
xe135Flag: null,
},
updateFlag: '2',
isReAnalyed_gamma: false,
isReAnalyed_beta: false,
isSaving: false,
colorConfig: {}, // 颜色配置
sampleInfo: {},
gammaSampleNum: 0,
finishCont: 0,
percentBar: 0,
analysedFileName: '', //分析完成的文件名称
}
},
created() {
this.$bus.$on('reanalyse', this.handleReanalyse)
// this.loadSelectedSample({
// sampleId: 426530,
// sampleType: 'G',
// dbName: 'auto',
// inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
// })
this.getColorConfig()
window.addEventListener('beforeunload', this.handleCleanAll)
},
destroyed() {
this.$bus.$off('reanalyse', this.handleReanalyse)
this.$store.commit('CLEAR_SAMPLE_DATA')
this.handleCleanAll()
window.removeEventListener('beforeunload', this.handleCleanAll)
},
methods: {
getReAnalyCurr(flag, val) {
this.isReAnalyed_beta = flag
this.params_toDB.savedAnalysisResult = true
this.resultDisplayFlag = val
},
getReAnalyAll(val) {
this.resultDisplayFlag = val
},
handleReAnalyed(val) {
this.isReAnalyed_gamma = val
},
getUpdateFlag(val) {
this.updateFlag = val
},
getcommentsInfo(val) {
this.params_toDB.comment = val.spectrumAnalysisCommentInfo
},
getStationName(arg, val, flag) {
if (arg.length > 0) {
arg.forEach((item) => {
item.conc = parseFloat(Number(item.conc).toPrecision(6))
item.concErr = parseFloat(Number(item.concErr).toPrecision(6))
item.lc = parseFloat(Number(item.lc).toPrecision(6))
item.mdc = parseFloat(Number(item.mdc).toPrecision(6))
})
}
this.resultDisplayFlag = arg
this.params_toDB.stationName = val
this.isReAnalyed_beta = this.isReAnalyed_beta ? this.isReAnalyed_beta : flag
},
getCheckFlag(val) {
this.params_toDB.checkSample = val.checkSample
this.params_toDB.checkGas = val.checkGas
this.params_toDB.checkDet = val.checkDet
},
getXeData(val) {
if (val && val.length) {
this.$set(this.analyseCurrentSpectrumData, 'XeData', val)
this.resultDisplayFlag = val
}
},
// formDB 来源 吧接口返回的文件名称添加到sampleData
getFiles(val) {
this.newSampleData = { ...this.sampleData, ...val }
},
/**
* 从数据库加载-选择完成
* @param {any[]} sampleList
*/
handleLoadSampleFromDB(sampleList) {
const ids = this.sampleList.map((item) => item.sampleId) // 当前Sample列表中的所有id
const willAddList = sampleList.filter((item) => !ids.includes(item.sampleId))
this.callInitValue(willAddList)
this.sampleList = this.sampleList.concat(willAddList)
},
handleLoadSampleFromFile(sampleList) {
let arr = sampleList.filter((item) => {
if (Object.keys(item).length > 4) {
if (item.gasFileName && item.detFileName && item.gasFileStatus && item.detFileStatus) {
return item
} else if (!item.gasFileName && !item.detFileName && !item.qcFileName) {
return item
}
}
})
arr.forEach((item) => {
item.dbName = ''
item.sampleId = null
item.inputFileName = item.sampleFileName
item.sampleType = item.sampleSystemType
})
const names = this.sampleList.map((item) => item.inputFileName) // 当前Sample列表中的所有id
const willAddList = arr.filter((item) => !names.includes(item.inputFileName))
this.callInitValue(willAddList)
this.sampleList = this.sampleList.concat(willAddList)
},
/**
* gamma谱调用initValue先初始化数据
* @param {Array<any>} willAddList
*/
callInitValue(willAddList) {
console.log('willAddListwillAddList', willAddList)
willAddList
.filter(
({ sampleType, inputFileName }) => sampleType !== 'B' && inputFileName !== this.sampleData.inputFileName
)
.forEach(({ inputFileName: fileName, dbName, sampleId, analyst }) => {
const params = {
sampleId,
dbName,
fileName,
analyst,
}
getAction('/gamma/initValue', params)
})
willAddList
.filter(({ sampleType, inputFileName }) => sampleType == 'B' && inputFileName !== this.sampleData.inputFileName)
.forEach(
({ inputFileName: sampleFileName, gasFileName, detFileName, qcFileName, dbName, sampleId, analyst }) => {
const params = {
sampleId,
dbName,
analyst: analyst ? analyst : null,
sampleFileName,
gasFileName,
detFileName,
qcFileName,
}
getAction('/spectrumAnalysis/initValue', params)
}
)
},
// 加载选中的样本
async loadSelectedSample(sample) {
console.log('%c [ sample ]-381', 'font-size:13px; background:pink; color:#bf2c9f;', sample)
// B是beta-gamma P G是gamma
if (sample.sampleType == 'B') {
this.analysisType = ANALYZE_TYPE.BETA_GAMMA
} else {
this.analysisType = ANALYZE_TYPE.GAMMA
}
this.sampleData = this.newSampleData = sample
this.params_toDB.savedAnalysisResult = sample.sampleId ? true : false
this.params_toDB.comment = ''
},
// 清理全部
handleCleanAll() {
clearSampleCache(this.sampleList)
this.sampleList = []
this.analysisType = undefined
this.sampleData = {}
},
// 保存结果到文件, 服务端生成文件,前端下载
async handleSaveResultsToFile(saveFormat, isSaveAll = false) {
this.isSaving = true
if (this.isGamma) {
if (!isSaveAll) {
const url = saveFormat == 'xls' ? '/gamma/saveToExcel' : saveFormat == 'txt' ? '/gamma/saveToTxt' : ''
let params = {
fileName: this.newSampleData.inputFileName,
}
try {
await fetchAndDownload(url, params, 'get')
} catch (error) {
console.error(error)
} finally {
this.isSaving = false
}
} else {
let list = this.sampleList.filter((item) => item.sampleType !== 'B')
if (list.length > 0) {
list.forEach(async (item) => {
const url = saveFormat == 'xls' ? '/gamma/saveToExcel' : saveFormat == 'txt' ? '/gamma/saveToTxt' : ''
let params = {
fileName: item.inputFileName,
}
try {
await fetchAndDownload(url, params, 'get')
} catch (error) {
console.error(error)
} finally {
this.isSaving = false
}
})
}
}
}
if (this.isBetaGamma) {
if (!this.isReAnalyed_beta) {
this.$message.warning('Please analyze the spectrum first!')
this.isSaving = false
return
}
if (saveFormat == 'txt') {
try {
const {
sampleId,
inputFileName: fileName,
dbName,
detFileName,
gasFileName,
qcFileName,
} = this.newSampleData
const params = {
dbName,
sampleId,
sampleData: false,
gasBgData: false,
detBgData: false,
qcData: false,
sampleFileName: fileName,
gasFileName,
detFileName,
qcFileName,
}
const txtFileName = `${fileName.split('.')[0]}.txt`
const res = await postAction('/spectrumAnalysis/viewRRR', params)
if (typeof res == 'string') {
const data = new Blob([res], { type: 'text/plain;charset=utf-8' })
saveAs(data, txtFileName)
} else {
const { success, result, message } = res
if (success) {
const data = new Blob([result], { type: 'text/plain;charset=utf-8' })
saveAs(data, txtFileName)
} else {
this.$message.error(message)
}
}
} catch (error) {
console.error(error)
} finally {
this.isSaving = false
}
} else {
const url =
saveFormat == 'xls'
? '/spectrumAnalysis/saveToExcel'
: saveFormat == 'html'
? '/spectrumAnalysis/saveToHTML'
: ''
if (!this.resultDisplayFlag) {
this.$message.warn('Please Analyse Spectrum First')
return
}
this.resultDisplayFlag.forEach((item) => {
this.params_toDB[`${item.nuclideName.toLowerCase()}Flag`] = 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
try {
await fetchAndDownload(url, this.params_toDB)
} catch (error) {
console.error(error)
} finally {
this.isSaving = false
}
}
}
},
/**
* 保存结果到数据库
* @param { 'all' | 'current' } type
*/
async handleSaveResultsToDB(type) {
if (this.isReAnalyed_gamma) {
this.isSaving = true
if (type == 'current') {
const hideLoading = this.$message.loading('Saving...', 0)
try {
const { success, message } = await getAction('/gamma/saveToDB', {
fileName: this.sampleData.inputFileName,
})
if (success) {
this.$message.success('Save Success')
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
hideLoading()
this.isSaving = false
}
}
} else {
this.$message.warn('Please Analyse Spectrum First')
}
},
handleSaveResultsToDB_Cuurrent() {
// xeflag params_toDB
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 = false
this.sampleInfo = res.result.sample
} else {
this.isSaving = false
this.$message.warning(`${res.message}`)
}
})
}
} else {
this.$message.warn('Please Analyse Spectrum First')
}
},
/**
* 将谱列表中所有谱数据均以IMS2.0格式保存为PHD文件
* 服务端生成文件,前端下载
* @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 = {
fileName: this.newSampleData.inputFileName,
}
fetchAndDownload('/gamma/saveToPHD', params, 'get')
} else {
this.sampleList
.filter(({ sampleType }) => sampleType !== 'B')
.forEach(({ inputFileName: fileName }) => {
const params = {
fileName,
}
fetchAndDownload('/gamma/saveToPHD', params, 'get')
})
}
}
},
handleReprocessAll() {
this.percentBar = 0
this.finishCont = 0
this.analyzeAllModalVisible = true
const { inputFileName, sampleType } = this.sampleData
// 获取所有的gamma list
const gammaSampleList = this.sampleList.filter((sample) => sample.sampleType !== 'B')
this.gammaSampleNum = gammaSampleList.length
const gammaInputFileNames = gammaSampleList.map((item) => item.inputFileName)
if (gammaInputFileNames.length > 0) {
this.fetchReprocessing(gammaInputFileNames, inputFileName, sampleType)
}
// // 先排除当前的谱
// const otherSampleList = this.sampleList.filter((sample) => sample.inputFileName !== inputFileName)
// const betaSamples = otherSampleList.filter((sample) => sample.sampleType == 'B')
// const gammaSamples = otherSampleList.filter((sample) => sample.sampleType !== 'B')
// gammaSamples.forEach((gammaSample) => {
// postAction(`/gamma/Reprocessing?fileName=${gammaSample.inputFileName}`)
// })
// // 处理当前的谱的reprocessing
// if (inputFileName && sampleType !== 'B') {
// this.$refs.gammaAnalysisRef.reProcessing(false)
// }
},
async fetchReprocessing(fileNames, currFileName, sampleType) {
if (fileNames[0] == currFileName && sampleType !== 'B') {
this.$refs.gammaAnalysisRef.reProcessing(false).then((res) => {
if (res) {
this.finishCont++
this.percentBar = this.finishCont / this.gammaSampleNum
this.analysedFileName = fileNames.splice(0, 1)
if (fileNames.length > 0) {
this.fetchReprocessing(fileNames, currFileName, sampleType)
}
} else {
this.analyzeAllModalVisible = false
const arr = res.split('\n')
this.$warning({
title: 'Warning',
content: () => arr.map((text) => <div>{text}</div>),
})
return
}
})
} else {
try {
const { success, result, message } = await postAction(`/gamma/Reprocessing?fileName=${fileNames[0]}`)
if (success) {
this.finishCont++
this.percentBar = this.finishCont / this.gammaSampleNum
this.analysedFileName = fileNames.splice(0, 1)
if (fileNames.length > 0) {
this.fetchReprocessing(fileNames, currFileName, sampleType)
}
} else {
this.analyzeAllModalVisible = false
const arr = message.split('\n')
this.$warning({
title: 'Warning',
content: () => arr.map((text) => <div>{text}</div>),
})
return
}
} catch (error) {
console.error(error)
}
}
},
// 查看Comments
handleViewComments() {
// 如果是gamma
if (this.isGamma) {
this.gammaCommentsModalVisible = true
this.isGammaCommentsAdd = false
}
// 如果是beta-gamma
else {
this.betaGammaCommentsModalVisible = true
this.isBetaGammaCommentsAdd = false
}
},
// 添加Comments
handleAddComments() {
// 如果是gamma
if (this.isGamma) {
this.gammaCommentsModalVisible = true
this.isGammaCommentsAdd = true
}
// 如果是beta-gamma
else {
this.betaGammaCommentsModalVisible = true
this.isBetaGammaCommentsAdd = true
}
},
// 查看软件操作帮助文档
handleHelp() {
console.log('%c [ handleHelp ]-221', 'font-size:13px; background:pink; color:#bf2c9f;')
},
handleResize() {
this.$refs.gammaAnalysisRef && this.$refs.gammaAnalysisRef.resize()
this.$refs.betaGammaAnalysisRef && this.$refs.betaGammaAnalysisRef.resize()
},
// Beta-Gamma Energy Calibration 的重新分析
handleReanalyse(...data) {
this.$refs.betaGammaAnalysisRef.reanalyse(data)
},
handleEnergyCalib() {
if (this.newSampleData.sampleId) {
if (this.newSampleData.qcFileName) {
this.betaGammaEnergyCalibrationModalVisible = true
}
} else {
if (this.newSampleData.qcFileStatus && this.newSampleData.qcFileName) {
this.betaGammaEnergyCalibrationModalVisible = true
}
}
},
// 获取颜色配置
async getColorConfig() {
try {
const { success, result, message } = await getAction('/gamma/viewColorConfig')
if (success) {
this.colorConfig = result
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
}
},
// 颜色修改
handleColorChange(colorConfig) {
this.colorConfig = colorConfig
this.$refs.gammaAnalysisRef.handleColorChange(colorConfig)
},
},
computed: {
// 顶部菜单栏配置
operations() {
return [
{
title: 'SAMPLE',
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'Load From DB',
handler: () => (this.loadFromDbModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Load From File',
handler: () => (this.loadFromFileModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Compare',
show: this.isGamma,
handler: () => this.$refs.gammaAnalysisRef.showCompareModal(false),
},
{
type: 'a-menu-item',
title: 'Strip',
show: this.isGamma,
handler: () => this.$refs.gammaAnalysisRef.showCompareModal(true),
},
{
type: 'a-menu-item',
title: 'Ftransit',
handler: () => (this.ftransltModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Clean All',
handler: () => {
this.handleCleanAll()
},
},
],
},
{
type: 'a-divider',
attrs: {
style: {
marginTop: '5px',
marginBottom: '5px',
display: this.sampleList.length ? '' : 'none',
},
},
},
{
type: 'SpectraListInMenu',
attrs: {
list: this.sampleList,
},
on: {
change: (spectra) => {
if (spectra) {
this.loadSelectedSample(spectra)
} else {
this.analysisType = undefined
this.sampleData = {}
}
},
},
},
],
},
{
title: 'SAVE',
loading: this.isSaving,
children: [
{
type: 'MultiLevelMenu',
show: this.isBetaGamma || this.isGamma,
attrs: {
children: [
{
title: 'Save Results to File',
children: [
{
title: 'Save Txt',
key: 'saveTxt',
show: this.isBetaGamma,
},
{
title: 'Save Excel',
key: 'saveExcel',
show: this.isBetaGamma,
},
{
title: 'Save Html',
key: 'saveHtml',
show: this.isBetaGamma,
},
],
key: 'resultsToFile',
},
{
title: 'Save Results to DB',
children: [
{
title: 'Save Current',
key: 'current',
show: this.isGamma,
},
{
title: 'Save All',
key: 'all',
show: this.isGamma,
},
],
key: 'resultsToDB',
},
{
title: 'Save PHD to File',
children: [
{
title: 'Save Current',
key: 'current',
},
{
title: 'Save All',
key: 'all',
},
],
key: 'phdToFile',
show: this.isGamma,
},
],
width: '170px',
},
on: {
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') {
this.handleSaveResultsToDB(child.key)
} else if (item.key == 'phdToFile') {
this.handleSavePHDToFile(child.key)
} else if (child.key == 'saveTxt') {
this.handleSaveResultsToFile('txt')
} else if (child.key == 'saveExcel') {
this.handleSaveResultsToFile('xls')
} else if (child.key == 'saveHtml') {
this.handleSaveResultsToFile('html')
}
},
},
},
],
},
{
title: 'ANALYZE',
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'Configure',
show: this.isGamma,
handler: () => (this.analyzeConfigureModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Reprocessing',
show: this.isGamma,
handler: () => this.$refs.gammaAnalysisRef.reProcessing(),
},
{
type: 'a-menu-item',
title: 'Reprocess All',
show: this.isGamma,
handler: this.handleReprocessAll,
},
{
type: 'a-menu-item',
title: 'Interactive Tool',
show: this.isGamma,
handler: () => (this.analyzeInteractiveToolModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Zero Time',
show: this.isGamma,
handler: () => (this.zeroTimeModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Korsum',
show: this.isGamma,
handler: () => (this.korsumModalShow = true),
},
{
type: 'a-menu-item',
title: 'Analyze current spectrum',
show: this.isBetaGamma,
handler: () => {
// this.getAnalyzeCurrentSpectrum()
this.$refs.betaGammaAnalysisRef.getAnalyzeCurrentSpectrum()
},
},
{
type: 'a-menu-item',
title: 'Analyze all spectra',
show: this.isBetaGamma,
handler: () => {
// this.getAnalyzeAllSpectrum()
this.$refs.betaGammaAnalysisRef.getAnalyzeAllSpectrum()
},
},
],
},
],
},
{
title: 'CALIBRATION',
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'Energy',
show: this.isGamma,
handler: () => (this.energyCalibrationModalShow = true),
},
{
type: 'a-menu-item',
title: 'Resolution',
show: this.isGamma,
handler: () => (this.resolutionCalibrationModalShow = true),
},
{
type: 'a-menu-item',
title: 'Efficiency',
show: this.isGamma,
handler: () => (this.efficiencyCalibrationModalShow = true),
},
{
type: 'a-menu-item',
title: 'Energy Calibration',
show: this.isBetaGamma,
handler: () => this.handleEnergyCalib(),
},
{
type: 'a-menu-item',
title: 'Extrapolation',
show: this.isBetaGamma,
handler: () => (this.betaGammaExtrapolationModalVisible = true),
},
],
},
],
},
{
title: 'NUCLIDELIBRARY',
show: !this.isBetaGamma,
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'Nuclide Library',
handler: () => (this.nuclideLibraryModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Config User Library',
handler: () => (this.configUserLibModalVisible = true),
},
],
},
],
},
{
title: 'STATISTIC',
show: this.isBetaGamma,
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'MDC & Activity Concentration',
handler: () => (this.statisticsParamerHistoryModalVisible = true),
},
],
},
],
},
{
title: 'COMMENTS',
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'View Comments',
show: this.isBetaGamma,
handler: this.handleViewComments,
},
{
type: 'a-menu-item',
title: 'Add Comments',
show: this.isBetaGamma,
handler: this.handleAddComments,
},
{
type: 'a-menu-item',
title: 'View',
show: this.isGamma,
handler: this.handleViewComments,
},
{
type: 'a-menu-item',
title: 'Add',
show: this.isGamma,
handler: this.handleAddComments,
},
],
},
],
},
{
title: 'REPORTS',
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'Peak Infomation',
handler: () => (this.peakInfomationModalVisible = true),
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'ARR',
handler: () => {
if (this.newSampleData.sampleId) {
this.arrOrRRRModalVisible = true
this.arrOrRRRModalExtraData = {}
this.arrOrRRRModalType = 1
} else {
this.$message.warning("The file isn't existed.")
}
},
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'RRR',
handler: () => {
if (this.isReAnalyed_gamma) {
this.arrOrRRRModalVisible = true
this.arrOrRRRModalExtraData = {}
this.arrOrRRRModalType = 2
} else {
this.$message.warning('Please analyze the spectrum first!')
}
},
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'Radionuclide Activity',
handler: () => (this.nuclideActivityAndMDCModalVisible = true),
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'Spectrum',
handler: () => (this.spectrumModalVisible = true),
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'Sample Infomation',
handler: () => (this.sampleInfomationModalVisible = true),
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'QC Results',
handler: () => (this.qcResultsModalVisible = true),
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'RLR',
handler: () => (this.rlrModalVisible = true),
show: this.isGamma,
},
// 以下是beta-gamma的下拉
{
type: 'a-menu-item',
title: 'View ARR',
show: this.isBetaGamma,
handler: () => {
if (this.newSampleData.sampleId) {
this.arrOrRRRModalVisible = true
this.arrOrRRRModalExtraData = {}
this.arrOrRRRModalType = 3
} else {
this.$message.warning("The file isn't existed.")
}
},
},
{
type: 'a-menu-item',
title: 'View RRR',
handler: () => {
if (this.isReAnalyed_beta) {
this.arrOrRRRModalVisible = true
this.arrOrRRRModalExtraData = {
dbName: this.sampleData.dbName,
sampleData: false,
GasBgData: false,
DetBgData: false,
QCData: false,
bGammaEnergyValid: false,
bBetaEnergyValid: false,
}
this.arrOrRRRModalType = 4
} else {
this.$message.warning('Please analyze the spectrum first!')
}
},
show: this.isBetaGamma,
},
{
type: 'a-menu-item',
title: 'View spectrum',
handler: () => (this.betaGammaSpectrumModalVisible = true),
show: this.isBetaGamma,
},
{
type: 'a-menu-item',
title: 'View Sample Infomation',
handler: () => (this.betaGammaSampleInfomationModalVisible = true),
show: this.isBetaGamma,
},
{
type: 'a-menu-item',
title: 'QC results',
handler: () => (this.betaGammaQCResultsModalVisible = true),
show: this.isBetaGamma,
},
{
type: 'a-menu-item',
title: 'RLR',
handler: () => (this.betaGammaRlrModalVisible = true),
show: this.isBetaGamma,
},
],
},
],
},
{
title: 'LOG',
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'Automatic Analysis Log',
show: this.isBetaGamma || this.isGamma,
handler: () => {
if (this.isBetaGamma || this.isGamma) {
if (this.newSampleData.sampleId) {
this.autoAnalysisMogModalType = this.isGamma ? 1 : this.isBetaGamma ? 2 : 1
this.autoAnalysisMogModalVisible = true
} else {
this.$message.warning("The file isn't existed.")
}
}
},
},
{
type: 'a-menu-item',
title: 'BG log viewer',
show: this.isBetaGamma,
handler: () => {
if (this.params_toDB.savedAnalysisResult) {
this.bgLogViewerVisible = true
}
},
},
{
type: 'a-menu-item',
title: 'GammaViewer Log',
show: this.isGamma,
handler: () => (this.dataProcessingLogModalVisible = true),
},
],
},
],
},
{
title: 'HELP',
children: [
{
type: 'a-menu',
children: [
{
type: 'a-menu-item',
title: 'Help',
handler: this.handleHelp,
},
{
type: 'a-menu-item',
title: 'Color Config',
show: this.isGamma,
handler: () => (this.colorConfigModalVisible = true),
},
],
},
],
},
]
},
// 当前类型是否是Gamma
isGamma() {
return this.analysisType == ANALYZE_TYPE.GAMMA
},
// 当前类型是否是Beta-Gamma
isBetaGamma() {
return this.analysisType == ANALYZE_TYPE.BETA_GAMMA
},
},
}
</script>
<style lang="less" scoped>
.spectrum-analysis {
padding-top: 17px;
height: 100%;
display: flex;
flex-direction: column;
// 顶部操作栏开始
&-operators {
flex-shrink: 0;
display: flex;
justify-content: space-between;
flex-wrap: nowrap;
overflow: auto;
&-item {
width: 158px;
border: 1px solid rgba(12, 235, 201, 0.6);
border-top-width: 3px;
height: 30px;
background-color: rgba(51, 202, 217, 0.2);
color: #ccede8;
&:not(:last-child) {
margin-right: 15px;
}
::v-deep {
span {
text-shadow: none;
line-height: 26px;
letter-spacing: 2px;
}
}
&:nth-child(4) {
width: 224px;
}
&:nth-child(5) {
width: 268px;
}
&:nth-child(6) {
width: 257px;
}
&:nth-child(7) {
width: 234px;
}
&:nth-child(8) {
width: 125px;
}
}
}
// 顶部操作栏结束
::v-deep {
// 二级操作栏开始
.spectrum-analysis-sub-operators {
flex-shrink: 0;
margin-bottom: 19px;
display: flex;
flex-wrap: nowrap;
overflow: auto;
.pop-over-with-icon {
height: 32px;
&:not(:last-child) {
margin-right: 11px;
}
&:nth-child(1) {
width: 256px;
}
&:nth-child(2) {
width: 186px;
}
&:nth-child(3) {
width: 246px;
}
&:nth-child(4) {
width: 246px;
}
}
.peak-info {
width: 306px;
height: 32px;
display: inline-block;
}
}
// 二级操作栏结束
}
// 主体部分开始
&-main {
margin-top: 15px;
height: calc(100% - 45px);
overflow: hidden;
}
// 主体部分结束
}
</style>
<style lang="less" scoped>
::v-deep {
.pop-over-with-icon {
height: 100%;
display: flex;
justify-content: space-between;
align-items: center;
border: 1px solid #0a544e;
height: 100%;
padding: 0 11px;
cursor: pointer;
.text {
font-family: MicrosoftYaHei;
color: #ade6ee;
letter-spacing: 1px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
user-select: none;
}
img {
margin-left: 5px;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
flex-shrink: 0;
user-select: none;
}
&.ant-popover-open {
img {
transform: rotate(180deg);
}
}
}
}
</style>
<style lang="less">
.spectrum-analysis-operators-dropdown-overlay {
background-color: #03353f;
.ant-menu {
background: transparent;
padding: 0;
position: relative;
border-right: 0;
&-submenu {
&-active {
background-color: #055565 !important;
}
&-title {
height: 30px !important;
line-height: 30px !important;
color: #fff;
margin: 0;
&:active {
background-color: #055565 !important;
}
.ant-menu-submenu-arrow {
&::before,
&::after {
background: #fff !important;
}
}
}
}
&-item {
color: #fff;
font-family: Arial;
border: 0;
background-color: transparent !important;
padding: 4px 14px;
height: 30px;
line-height: 22px;
margin: 0 !important;
&:hover {
background-color: #055565 !important;
}
&-selected {
font-weight: normal;
}
&-disabled {
color: #476d74 !important;
&:hover {
background-color: transparent !important;
}
}
}
}
}
.empty {
padding-top: 100px;
font-size: 20px;
font-weight: bold;
text-align: center;
}
.figure-chart-option-tooltip {
background-color: #00aa7f !important;
border-color: #00aa7f !important;
.channel {
color: #fff;
}
.energy {
color: #00d1f0;
}
.warning {
color: yellow;
}
}
.popover-with-icon {
z-index: 999;
.ant-popover-inner-content {
padding: 8px;
}
}
</style>