Merge branch 'feature-analysis-RLR-renpy' of http://git.hivekion.com:3000/xiaoguangbin/AnalysisSystemForRadionuclide_vue into master-dev

This commit is contained in:
orgin 2023-11-03 13:49:42 +08:00
commit 118814f667
9 changed files with 238 additions and 160 deletions

View File

@ -80,9 +80,13 @@ export class PHDParser {
// 如果解析的是sample 文件,则解析相关联的文件 // 如果解析的是sample 文件,则解析相关联的文件
if (this.isSample) { if (this.isSample) {
const filePrefixes = this.getFilePrefixes(headerInfo[2]) if (this.fileType == 'B') {
this.sampleFilePrefix = filePrefixes.splice(0, 1)[0] const filePrefixes = this.getFilePrefixes(headerInfo[2])
this.otherFilePrefixes = filePrefixes this.sampleFilePrefix = filePrefixes.splice(0, 1)[0]
this.otherFilePrefixes = filePrefixes
} else {
this.sampleFilePrefix = this.getGammaFilePrefix(headerInfo[2])
}
} }
} }
@ -166,7 +170,7 @@ export class PHDParser {
} }
/** /**
* 获取全部文件名 * 获取全部文件名前缀
* @param {string} text * @param {string} text
*/ */
getFilePrefixes(text) { getFilePrefixes(text) {
@ -179,4 +183,15 @@ export class PHDParser {
}) })
return filePrefixes return filePrefixes
} }
/**
* 获取gamma的文件名前缀
* @param {string} text
*/
getGammaFilePrefix(text) {
const regExp = /[A-Z]{1,}\d{1,}_\d{1,}-\d{4}\/\d{2}\/\d{2}[-\s]\d{2}:\d{2}/
const result = text.match(regExp)
const regExpDate = /(\d{4})\/(\d{2})\/(\d{2})[ -](\d{2}):(\d{2})/
return result[0].replace(regExpDate, '$1$2$3_$4$5') + '_'
}
} }

View File

@ -121,7 +121,7 @@
</template> </template>
<script> <script>
import { getAction } from '../../api/manage' import { getAction, postAction } from '../../api/manage'
import BetaGammaChartContainer from './components/BetaGammaChartContainer.vue' import BetaGammaChartContainer from './components/BetaGammaChartContainer.vue'
import BetaGammaSpectrumChart from './components/BetaGammaSpectrumChart.vue' import BetaGammaSpectrumChart from './components/BetaGammaSpectrumChart.vue'
import StatisticsParamerHistoryModalForQcFlags from './components/Modals/BetaGammaModals/StatisticsParamerHistoryModalForQCFlags.vue' import StatisticsParamerHistoryModalForQcFlags from './components/Modals/BetaGammaModals/StatisticsParamerHistoryModalForQCFlags.vue'
@ -180,14 +180,15 @@ export default {
sample: { sample: {
type: Object, type: Object,
}, },
analyseCurrentSpectrum: { // analyseCurrentSpectrum: {
type: Object, // type: Object,
}, // },
}, },
data() { data() {
this.SampleType = SampleType this.SampleType = SampleType
return { return {
analyseCurrentSpectrum: {},
qcFlags: {}, qcFlags: {},
spectraVisible: false, spectraVisible: false,
@ -449,6 +450,59 @@ export default {
this.betaEnergyData = energy this.betaEnergyData = energy
} }
}, },
// beta Analyze current spectrum
getAnalyzeCurrentSpectrum() {
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],
}
postAction('/spectrumAnalysis/analyseCurrentSpectrum', params).then((res) => {
if (res.success) {
// this.isReAnalyed_beta = true
this.analyseCurrentSpectrum = res.result
if (res.result.XeData && res.result.XeData.length > 0) {
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))
})
this.$emit('reAnalyCurr', true, res.result.XeData)
}
} else {
this.$message.warning(res.message)
}
})
},
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,
}
postAction('/spectrumAnalysis/analyseAllSpectrum', params).then((res) => {
if (res.success) {
this.analyseCurrentSpectrum = res.result
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))
})
this.$emit('reAnalyAll', true, res.result.XeData)
} else {
this.$message.warning(res.message)
}
})
},
}, },
watch: { watch: {
sample: { sample: {
@ -482,7 +536,7 @@ export default {
this.$store.commit('UPDATE_SAMPLE_DATA', { this.$store.commit('UPDATE_SAMPLE_DATA', {
inputFileName: this.sample.inputFileName, inputFileName: this.sample.inputFileName,
key: 'XeData', key: 'XeData',
data: newVal.XeData data: newVal.XeData,
}) })
}, },
immediate: true, immediate: true,

View File

@ -19,7 +19,7 @@
<a-button type="primary" :disabled="isLoading" :loading="isAcceptting" @click="handlePeaks(true)"> <a-button type="primary" :disabled="isLoading" :loading="isAcceptting" @click="handlePeaks(true)">
Peaks Peaks
</a-button> </a-button>
<a-button>Cancel</a-button> <a-button @click="visible = false">Cancel</a-button>
</a-space> </a-space>
</div> </div>
</custom-modal> </custom-modal>

View File

@ -59,6 +59,7 @@
</a-form-model> </a-form-model>
</div> </div>
<a-table <a-table
ref="tableRef"
:class="list.length ? 'has-data' : ''" :class="list.length ? 'has-data' : ''"
:columns="columns" :columns="columns"
:dataSource="list" :dataSource="list"
@ -77,9 +78,7 @@
<!-- 以下是图表部分 --> <!-- 以下是图表部分 -->
<div class="nuclide-review-chart"> <div class="nuclide-review-chart">
<div class="nuclide-review-chart-prev"> <div class="nuclide-review-chart-prev">
<span @click="handleChangeChart('prev')"> <span @click="handleChangeChart('prev')"> &lt; </span>
&lt;
</span>
</div> </div>
<a-row class="nuclide-review-chart-list"> <a-row class="nuclide-review-chart-list">
<a-col class="nuclide-review-chart-item" :span="8" v-for="(chartItem, index) in currChartList" :key="index"> <a-col class="nuclide-review-chart-item" :span="8" v-for="(chartItem, index) in currChartList" :key="index">
@ -94,9 +93,7 @@
</a-col> </a-col>
</a-row> </a-row>
<div class="nuclide-review-chart-next"> <div class="nuclide-review-chart-next">
<span @click="handleChangeChart('next')"> <span @click="handleChangeChart('next')"> &gt; </span>
&gt;
</span>
</div> </div>
</div> </div>
<!-- 图表部分结束 --> <!-- 图表部分结束 -->
@ -116,32 +113,32 @@ const columns = [
width: '5%', width: '5%',
customRender: (_, __, index) => { customRender: (_, __, index) => {
return index + 1 return index + 1
} },
}, },
{ {
title: 'Full Name', title: 'Full Name',
dataIndex: 'fullName', dataIndex: 'fullName',
width: '15%' width: '15%',
}, },
{ {
title: 'Energy', title: 'Energy',
dataIndex: 'energy', dataIndex: 'energy',
width: '15%' width: '15%',
}, },
{ {
title: 'Energy Err', title: 'Energy Err',
dataIndex: 'energyUncert', dataIndex: 'energyUncert',
width: '15%' width: '15%',
}, },
{ {
title: 'Abundance(%)', title: 'Abundance(%)',
dataIndex: 'yield', dataIndex: 'yield',
width: '15%' width: '15%',
}, },
{ {
title: 'Abundance Err(%)', title: 'Abundance Err(%)',
dataIndex: 'yieldUncert', dataIndex: 'yieldUncert',
width: '15%' width: '15%',
}, },
{ {
title: 'KeyLine', title: 'KeyLine',
@ -149,20 +146,20 @@ const columns = [
width: '15%', width: '15%',
align: 'center', align: 'center',
scopedSlots: { scopedSlots: {
customRender: 'keyLine' customRender: 'keyLine',
} },
} },
] ]
export default { export default {
components: { NuclideReviewChart }, components: { NuclideReviewChart },
mixins: [ModalMixin, SampleDataMixin], mixins: [ModalMixin, SampleDataMixin],
props: { props: {
channel: { channel: {
type: Number type: Number,
}, },
nuclide: { nuclide: {
type: String type: String,
} },
}, },
data() { data() {
this.columns = columns this.columns = columns
@ -177,13 +174,13 @@ export default {
currChartList: [], // ,3 currChartList: [], // ,3
model: {}, model: {},
info: {} info: {},
} }
}, },
methods: { methods: {
// / // /
handleNuclideChange(direction) { handleNuclideChange(direction) {
const currIndex = this.nuclideList.findIndex(item => item == this.currNuclide) const currIndex = this.nuclideList.findIndex((item) => item == this.currNuclide)
if (direction == 'prev' && currIndex > 0) { if (direction == 'prev' && currIndex > 0) {
this.handleNuclideClick(currIndex - 1) this.handleNuclideClick(currIndex - 1)
} else if (direction == 'next' && currIndex !== this.nuclideList.length - 1) { } else if (direction == 'next' && currIndex !== this.nuclideList.length - 1) {
@ -191,6 +188,13 @@ export default {
} }
}, },
scrollIntoView(index) {
const tableEle = this.$refs.tableRef.$el
const tableBodyEle = tableEle.querySelector('.ant-table-body')
const prevEle = tableBodyEle.querySelector(`.ant-table-row:nth-child(${index + 1})`)
tableBodyEle.scrollTop = prevEle.offsetTop
},
// //
handleNuclideClick(index) { handleNuclideClick(index) {
this.currNuclide = this.nuclideList[index] this.currNuclide = this.nuclideList[index]
@ -226,15 +230,19 @@ export default {
const willJumpIndex = currIndex - 3 const willJumpIndex = currIndex - 3
if (willJumpIndex >= 0) { if (willJumpIndex >= 0) {
this.selectTableRow(willJumpIndex) this.selectTableRow(willJumpIndex)
this.scrollIntoView(willJumpIndex)
} else { } else {
this.selectTableRow(0) this.selectTableRow(0)
this.scrollIntoView(0)
} }
} else if (direction == 'next') { } else if (direction == 'next') {
const willJumpIndex = currIndex + 3 const willJumpIndex = currIndex + 3
if (willJumpIndex <= this.list.length - 2) { if (willJumpIndex <= this.list.length - 2) {
this.selectTableRow(willJumpIndex) this.selectTableRow(willJumpIndex)
this.scrollIntoView(willJumpIndex)
} else { } else {
this.selectTableRow(this.list.length - 1) this.selectTableRow(this.list.length - 1)
this.scrollIntoView(this.list.length - 1)
} }
} }
}, },
@ -246,8 +254,8 @@ export default {
on: { on: {
click: () => { click: () => {
this.selectTableRow(index) this.selectTableRow(index)
} },
} },
} }
}, },
@ -259,17 +267,15 @@ export default {
const { success, result, message } = await getAction('/gamma/nuclideReview', { const { success, result, message } = await getAction('/gamma/nuclideReview', {
sampleId: sampleId, sampleId: sampleId,
channel: this.channel, channel: this.channel,
fileName fileName,
}) })
if (success) { if (success) {
this.model = { this.model = {
energy: result.energy, energy: result ? result.energy : undefined,
tolerance: 0.5 tolerance: 0.5,
} }
this.handleResData(result) this.handleResData(result)
this.isLoading = false
if (this.nuclide && this.nuclideList.length) { if (this.nuclide && this.nuclideList.length) {
this.currNuclide = this.nuclide this.currNuclide = this.nuclide
this.getInfoByNuclide() this.getInfoByNuclide()
@ -279,18 +285,32 @@ export default {
} }
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} finally {
this.isLoading = false
} }
}, },
// //
handleResData(result) { handleResData(result) {
if (!result) {
result = {
chart: [],
halfLife: null,
halfLifeErr: null,
lines: null,
list: [],
name: '',
table: [],
}
}
const { chart, halfLife, halfLifeErr, lines, list, name, table } = result const { chart, halfLife, halfLifeErr, lines, list, name, table } = result
this.info = { this.info = {
halfLife, halfLife,
halfLifeErr, halfLifeErr,
lines, lines,
name name,
} }
this.list = table this.list = table
@ -311,7 +331,7 @@ export default {
const { success, result, message } = await getAction('/gamma/changeNuclide', { const { success, result, message } = await getAction('/gamma/changeNuclide', {
sampleId, sampleId,
nuclideName: this.currNuclide, nuclideName: this.currNuclide,
fileName: inputFileName fileName: inputFileName,
}) })
if (success) { if (success) {
const { chart, halfLife, halfLifeErr, lines, name, table } = result const { chart, halfLife, halfLifeErr, lines, name, table } = result
@ -320,7 +340,7 @@ export default {
halfLife, halfLife,
halfLifeErr, halfLifeErr,
lines, lines,
name name,
} }
this.list = table this.list = table
@ -350,7 +370,7 @@ export default {
const { success, result, message } = await getAction('/gamma/searchNuclide', { const { success, result, message } = await getAction('/gamma/searchNuclide', {
sampleId, sampleId,
fileName, fileName,
...this.model ...this.model,
}) })
if (success) { if (success) {
this.handleResData(result) this.handleResData(result)
@ -362,8 +382,8 @@ export default {
} finally { } finally {
this.isLoading = false this.isLoading = false
} }
} },
} },
} }
</script> </script>

View File

@ -550,9 +550,7 @@ export default {
this.option.series = series this.option.series = series
this.thumbnailOption.series = this.buildBarChart(bar) this.thumbnailOption.series = this.buildBarChart(bar)
const thumbnailYMax = this.getThumbnailYMax(0, bar.length) this.setThumbnailRange(1, bar.length)
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
}, },
reset() { reset() {
@ -712,6 +710,8 @@ export default {
let nextMin = xAxis - halfDiff let nextMin = xAxis - halfDiff
chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax
chartXAxisOption.min = nextMin < 1 ? 1 : nextMin chartXAxisOption.min = nextMin < 1 ? 1 : nextMin
this.setThumbnailRange(chartXAxisOption.min, chartXAxisOption.max)
} }
}, },
@ -799,6 +799,7 @@ export default {
shapeChannelData, shapeChannelData,
shapeEnergyData, shapeEnergyData,
peak: table, peak: table,
barChart: this.barChart
}) })
this.channelPeakChart = channelPeakChart this.channelPeakChart = channelPeakChart
@ -888,6 +889,7 @@ export default {
shapeChannelData, shapeChannelData,
shapeEnergyData, shapeEnergyData,
peak: table, peak: table,
barChart: this.barChart,
}) })
this.channelPeakChart = channelPeakChart this.channelPeakChart = channelPeakChart
@ -911,6 +913,8 @@ export default {
this.resetChartOpts() this.resetChartOpts()
this.selectedKeys = [] this.selectedKeys = []
this.selectedTableItem = null
} else { } else {
this.$message.error(message) this.$message.error(message)
} }
@ -960,6 +964,8 @@ export default {
let nextMin = channel - halfDiff let nextMin = channel - halfDiff
chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax chartXAxisOption.max = nextMax > lastChannel ? lastChannel : nextMax
chartXAxisOption.min = nextMin < 1 ? 1 : nextMin chartXAxisOption.min = nextMin < 1 ? 1 : nextMin
this.setThumbnailRange(chartXAxisOption.min, chartXAxisOption.max)
} }
this.getSelPosNuclide(row) this.getSelPosNuclide(row)
@ -1030,12 +1036,7 @@ export default {
this.option.yAxis.min = y1 this.option.yAxis.min = y1
this.option.yAxis.max = y2 this.option.yAxis.max = y2
const thumbnailYMax = this.getThumbnailYMax(x1 - 1, x2) this.setThumbnailRange(x1, x2)
this.thumbnailOption.xAxis.min = x1
this.thumbnailOption.xAxis.max = x2
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
if (this.btnGroupType == 2) { if (this.btnGroupType == 2) {
this.buildRect() this.buildRect()
} }
@ -1044,12 +1045,17 @@ export default {
}, },
// barChart // barChart
getThumbnailYMax(minIndex, maxIndex) { setThumbnailRange(x1, x2) {
const slicedArr = this.barChart.slice(minIndex, maxIndex) const slicedArr = this.barChart.slice(x1 - 1, x2)
const yData = slicedArr.map(({ y }) => y) const yData = slicedArr.map(({ y }) => y)
const max = Math.max(...yData) const max = Math.max(...yData)
const min = Math.min(...yData) const min = Math.min(...yData)
return Math.max(Math.abs(max), Math.abs(min)) const thumbnailYMax = Math.max(Math.abs(max), Math.abs(min))
this.thumbnailOption.xAxis.min = x1
this.thumbnailOption.xAxis.max = x2
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
}, },
handleResetChart() { handleResetChart() {
@ -1058,11 +1064,7 @@ export default {
this.option.yAxis.min = 0.1 this.option.yAxis.min = 0.1
this.option.yAxis.max = 'dataMax' this.option.yAxis.max = 'dataMax'
const thumbnailYMax = this.getThumbnailYMax(0, this.barChart.length) this.setThumbnailRange(1, this.barChart.length)
this.thumbnailOption.xAxis.min = 1
this.thumbnailOption.xAxis.max = 'dataMax'
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
if (this.btnGroupType == 2) { if (this.btnGroupType == 2) {
this.buildRect() this.buildRect()

View File

@ -114,7 +114,7 @@ export default {
return { return {
queryParam: { queryParam: {
menuTypes: 'G,B', menuTypes: 'G,B',
sampleType: 'P', sampleType: '',
startDate: moment().add(-7, 'd').format('YYYY-MM-DD'), startDate: moment().add(-7, 'd').format('YYYY-MM-DD'),
endDate: moment().format('YYYY-MM-DD'), endDate: moment().format('YYYY-MM-DD'),
dbName: 'auto', dbName: 'auto',
@ -326,13 +326,19 @@ export default {
] ]
if (event == 'B') { if (event == 'B') {
this.sampleTypeOption = arr_B this.sampleTypeOption = arr_B
this.queryParam.sampleType = 'B' this.$nextTick(() => {
this.queryParam.sampleType = 'B'
})
} else if (event == 'G') { } else if (event == 'G') {
this.sampleTypeOption = arr_G this.sampleTypeOption = arr_G
this.queryParam.sampleType = 'P' this.$nextTick(() => {
this.queryParam.sampleType = 'P'
})
} else { } else {
this.sampleTypeOption = arr_A this.sampleTypeOption = arr_A
this.queryParam.sampleType = 'P' this.$nextTick(() => {
this.queryParam.sampleType = ''
})
} }
this.getStationAndDetectorList(event) this.getStationAndDetectorList(event)
}, },

View File

@ -133,7 +133,7 @@
</a-upload> </a-upload>
<a-button type="primary" @click="handleReset">Reset</a-button> <a-button type="primary" @click="handleReset">Reset</a-button>
<a-button :loading="isUploadingZip" type="primary" @click="handleLoad">Load</a-button> <a-button :loading="isUploadingZip" type="primary" @click="handleLoad">Load</a-button>
<a-button type="primary" @click="handleCancel">Cancel</a-button> <a-button type="warn" @click="handleCancel">Cancel</a-button>
</a-space> </a-space>
</template> </template>
<!-- 底部按钮结束 --> <!-- 底部按钮结束 -->

View File

@ -1368,9 +1368,13 @@ export default {
// //
handleRefresh(data) { handleRefresh(data) {
data.DetailedInformation = this.detailedInfomation Object.assign(data, {
data.QCFlag = this.qcFlags DetailedInformation: this.detailedInfomation,
data.BaseCtrls = this.baseCtrls QCFlag: this.qcFlags,
BaseCtrls: this.baseCtrls,
bAnalyed: this.bAnalyed
})
this.clearCompareLine() this.clearCompareLine()
this.redrawPeakLine() this.redrawPeakLine()
this.dataProcess(data) this.dataProcess(data)
@ -1378,7 +1382,7 @@ export default {
// Accept // Accept
handleAccept(data) { handleAccept(data) {
const { allData, peakSet, shadowChannelChart, shadowEnergyChart, shapeChannelData, shapeEnergyData } = data const { allData, peakSet, shadowChannelChart, shadowEnergyChart, shapeChannelData, shapeEnergyData, barChart } = data
const result = { const result = {
DetailedInformation: this.detailedInfomation, DetailedInformation: this.detailedInfomation,
@ -1386,11 +1390,12 @@ export default {
allData, allData,
shadowChannelChart, shadowChannelChart,
shadowEnergyChart, shadowEnergyChart,
shapeChannelData, shapeChannelData,
shapeEnergyData, shapeEnergyData,
peak: peakSet, peak: peakSet,
BaseCtrls: this.baseCtrls, BaseCtrls: this.baseCtrls,
bAnalyed: this.bAnalyed,
barChart
} }
this.clearCompareLine() this.clearCompareLine()
this.redrawPeakLine() this.redrawPeakLine()

View File

@ -49,6 +49,8 @@
ref="betaGammaAnalysisRef" ref="betaGammaAnalysisRef"
@getFiles="getFiles" @getFiles="getFiles"
@sendInfo="getStationName" @sendInfo="getStationName"
@reAnalyCurr="getReAnalyCurr"
@reAnalyAll="getReAnalyAll"
:sample="sampleData" :sample="sampleData"
:analyseCurrentSpectrum="analyseCurrentSpectrumData" :analyseCurrentSpectrum="analyseCurrentSpectrumData"
/> />
@ -376,18 +378,19 @@ export default {
resultDisplayFlag: [], resultDisplayFlag: [],
params_toDB: { params_toDB: {
comment: '', comment: '',
savedAnalysisResult: false,
stationName: '', stationName: '',
dbName: '', dbName: '',
sampleFileName: '', sampleFileName: '',
gasFileName: '', gasFileName: '',
detFileName: '', detFileName: '',
qcFileName: '', qcFileName: '',
bGammaEnergyValidSample: false, // bGammaEnergyValidSample: false,
bBetaEnergyValidSample: false, // bBetaEnergyValidSample: false,
bGammaEnergyValidGas: false, // bGammaEnergyValidGas: false,
bBetaEnergyValidGas: false, // bBetaEnergyValidGas: false,
bGammaEnergyValidDet: false, // bGammaEnergyValidDet: false,
bBetaEnergyValidDet: false, // bBetaEnergyValidDet: false,
checkSample: false, checkSample: false,
checkGas: false, checkGas: false,
checkDet: false, checkDet: false,
@ -425,6 +428,14 @@ export default {
}, },
methods: { methods: {
getReAnalyCurr(flag, val) {
this.isReAnalyed_beta = flag
this.params_toDB.savedAnalysisResult = true
this.resultDisplayFlag = val
},
getReAnalyAll(val) {
this.resultDisplayFlag = val
},
handleReAnalyed(val) { handleReAnalyed(val) {
this.isReAnalyed_gamma = val this.isReAnalyed_gamma = val
}, },
@ -498,6 +509,7 @@ export default {
this.analysisType = ANALYZE_TYPE.GAMMA this.analysisType = ANALYZE_TYPE.GAMMA
} }
this.sampleData = this.newSampleData = sample this.sampleData = this.newSampleData = sample
this.params_toDB.savedAnalysisResult = sample.sampleId ? true : false
this.params_toDB.comment = '' this.params_toDB.comment = ''
}, },
@ -583,11 +595,8 @@ export default {
* @param { 'all' | 'current' } type * @param { 'all' | 'current' } type
*/ */
async handleSaveResultsToDB(type) { async handleSaveResultsToDB(type) {
if (this.isBetaGamma) { if (this.isReAnalyed_gamma) {
if (type === 'current') { this.isSaving = true
this.handleSaveResultsToDB_Cuurrent()
}
} else if (this.isGamma) {
if (type == 'current') { if (type == 'current') {
const hideLoading = this.$message.loading('Saving...', 0) const hideLoading = this.$message.loading('Saving...', 0)
try { try {
@ -603,36 +612,46 @@ export default {
console.error(error) console.error(error)
} finally { } finally {
hideLoading() hideLoading()
this.isSaving = false
} }
} }
} else {
this.$message.warn('Please Analyse Spectrum First')
} }
}, },
handleSaveResultsToDB_Cuurrent() { handleSaveResultsToDB_Cuurrent() {
// xeflag params_toDB // xeflag params_toDB
if (this.resultDisplayFlag.length > 0) { if (this.params_toDB.savedAnalysisResult) {
this.resultDisplayFlag.forEach((item) => { if (this.resultDisplayFlag.length > 0) {
if (item.nuclideName === 'Xe131m') { this.resultDisplayFlag.forEach((item) => {
this.params_toDB.xe131mFlag = item.nidFlag if (item.nuclideName === 'Xe131m') {
} else if (item.nuclideName === 'Xe133') { this.params_toDB.xe131mFlag = item.nidFlag
this.params_toDB.xe133Flag = item.nidFlag } else if (item.nuclideName === 'Xe133') {
} else if (item.nuclideName === 'Xe133m') { this.params_toDB.xe133Flag = item.nidFlag
this.params_toDB.xe133mFlag = item.nidFlag } else if (item.nuclideName === 'Xe133m') {
} else if (item.nuclideName === 'Xe135') { this.params_toDB.xe133mFlag = item.nidFlag
this.params_toDB.xe135Flag = 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.sampleFileName = this.newSampleData.inputFileName
this.params_toDB.detFileName = this.newSampleData.detFileName this.params_toDB.gasFileName = this.newSampleData.gasFileName
this.params_toDB.qcFileName = this.newSampleData.qcFileName this.params_toDB.detFileName = this.newSampleData.detFileName
this.params_toDB.dbName = this.newSampleData.dbName this.params_toDB.qcFileName = this.newSampleData.qcFileName
postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => { this.params_toDB.dbName = this.newSampleData.dbName
if (res.success) { this.isSaving = true
this.$message.success('Save Successfully!') postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => {
} else { if (res.success) {
this.$message.warning('Fail To Save') this.$message.success('Save Successfully!')
} this.isSaving = false
}) } else {
this.isSaving = false
this.$message.warning(`${res.message}`)
}
})
}
} else {
this.$message.warn('Please Analyse Spectrum First')
} }
}, },
@ -712,57 +731,6 @@ export default {
handleReanalyse(...data) { handleReanalyse(...data) {
this.$refs.betaGammaAnalysisRef.reanalyse(data) this.$refs.betaGammaAnalysisRef.reanalyse(data)
}, },
// beta Analyze current spectrum
getAnalyzeCurrentSpectrum() {
let params = {
dbNames: [this.newSampleData.dbName],
sampleIds: [this.newSampleData.sampleId ? this.newSampleData.sampleId : ''],
sampleFileNames: [this.newSampleData.inputFileName],
gasFileNames: [this.newSampleData.gasFileName],
detFileNames: [this.newSampleData.detFileName],
qcFileNames: [this.newSampleData.qcFileName],
}
postAction('/spectrumAnalysis/analyseCurrentSpectrum', params).then((res) => {
if (res.success) {
this.isReAnalyed_beta = true
this.analyseCurrentSpectrumData = res.result
this.resultDisplayFlag = res.result.XeData
this.resultDisplayFlag.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))
})
} else {
this.$message.warning(res.message)
}
})
},
getAnalyzeAllSpectrum() {
let params = {
dbNames: [this.newSampleData.dbName],
sampleIds: [this.newSampleData.sampleId ? this.newSampleData.sampleId : ''],
sampleFileNames: [this.newSampleData.inputFileName],
gasFileNames: [this.newSampleData.gasFileName],
detFileNames: [this.newSampleData.detFileName],
qcFileNames: [this.newSampleData.qcFileName],
currentFileName: this.newSampleData.inputFileName,
}
postAction('/spectrumAnalysis/analyseAllSpectrum', params).then((res) => {
if (res.success) {
this.analyseCurrentSpectrumData = res.result
this.resultDisplayFlag = res.result.XeData
this.resultDisplayFlag.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))
})
} else {
this.$message.warning(res.message)
}
})
},
handleEnergyCalib() { handleEnergyCalib() {
if (this.newSampleData.sampleId) { if (this.newSampleData.sampleId) {
if (this.newSampleData.qcFileName) { if (this.newSampleData.qcFileName) {
@ -897,6 +865,7 @@ export default {
show: this.isBetaGamma, show: this.isBetaGamma,
}, },
], ],
key: 'resultsToFile',
}, },
{ {
title: 'Save Results to DB', title: 'Save Results to DB',
@ -904,6 +873,7 @@ export default {
{ {
title: 'Save Current', title: 'Save Current',
key: 'current', key: 'current',
show: this.isGamma,
}, },
{ {
title: 'Save All', title: 'Save All',
@ -932,10 +902,14 @@ export default {
width: '170px', width: '170px',
}, },
on: { on: {
menuClick: () => { menuClick: (item) => {
if (this.isGamma) { if (this.isGamma && item.key == 'resultsToFile') {
this.saveSettingModalVisible = true this.saveSettingModalVisible = true
} }
if (this.isBetaGamma && item.key == 'resultsToDB') {
// beta save to db
this.handleSaveResultsToDB_Cuurrent()
}
}, },
submenuClick: ({ item, child }) => { submenuClick: ({ item, child }) => {
if (item.key == 'resultsToDB') { if (item.key == 'resultsToDB') {
@ -1001,7 +975,8 @@ export default {
title: 'Analyze current spectrum', title: 'Analyze current spectrum',
show: this.isBetaGamma, show: this.isBetaGamma,
handler: () => { handler: () => {
this.getAnalyzeCurrentSpectrum() // this.getAnalyzeCurrentSpectrum()
this.$refs.betaGammaAnalysisRef.getAnalyzeCurrentSpectrum()
}, },
}, },
{ {
@ -1009,7 +984,8 @@ export default {
title: 'Analyze all spectra', title: 'Analyze all spectra',
show: this.isBetaGamma, show: this.isBetaGamma,
handler: () => { handler: () => {
this.getAnalyzeAllSpectrum() // this.getAnalyzeAllSpectrum()
this.$refs.betaGammaAnalysisRef.getAnalyzeAllSpectrum()
}, },
}, },
], ],