beta Save to DB 接口联调

分析接口返回的数据处理及参数调整
This commit is contained in:
任珮宇 2023-09-21 16:04:37 +08:00
parent be15cf582e
commit bff44aba5a
7 changed files with 230 additions and 61 deletions

View File

@ -101,7 +101,7 @@
<div class="result-display">
<beta-gamma-chart-container>
<template slot="title"> Result display </template>
<result-display :data="resultDisplay"></result-display>
<result-display :data="resultDisplay" @sendFlag="handleGetFlag"></result-display>
</beta-gamma-chart-container>
</div>
<!-- 结果显示结束 -->
@ -219,6 +219,14 @@ export default {
}
},
methods: {
handleGetFlag(val, obj) {
this.resultDisplay.forEach((item) => {
if (item.nuclideName === obj.nuclideName) {
item.nidFlag = val ? 1 : 0
}
})
this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode)
},
async getSampleDetail() {
this.spectraType = this.SampleType[0].value
@ -310,7 +318,9 @@ export default {
this.betaProjectedData = betaProjectedData
this.betaEnergyData = betaEnergyData
this.resultDisplay = this.currResultDisplay || XeData
this.resultDisplay = XeData
this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode)
this.qcFlags = {
AcqTimeBtn,

View File

@ -32,17 +32,17 @@ export default {
props: {
isAdd: {
type: Boolean,
default: true
}
default: true,
},
},
data() {
return {
comments: {
spectrumAnalysisCommentInfo: '',
spectrumCommentInfo: '',
spectrumOtherCommentInfo: ''
spectrumOtherCommentInfo: '',
},
isLoading: false
isLoading: false,
}
},
methods: {
@ -52,10 +52,11 @@ export default {
const { sampleId, inputFileName: sampleFileName } = this.sampleData
const res = await getAction('/spectrumAnalysis/viewComment', {
sampleId,
sampleFileName
sampleFileName,
})
if (res.success) {
this.comments = res.result
this.$emit('sedInfo', this.comments)
} else {
this.$message.error(res.message)
}
@ -72,8 +73,8 @@ export default {
},
handleOk() {
console.log('%c [ ]-26', 'font-size:13px; background:pink; color:#bf2c9f;', this.comments)
}
}
},
},
}
</script>

View File

@ -143,7 +143,7 @@
</div>
</div>
</div>
<div class="footer">
<!-- <div class="footer">
<title-over-border title="New Calibration is Applied to">
<a-radio-group v-model="newCalibrationIsAppliedTo">
<p>
@ -166,7 +166,7 @@
<a-button type="primary" @click="handleReAnalyse">Reanalyse Spectrum Using New Calibration</a-button>
<a-button type="primary" class="exit" @click="handleExit()">Exit</a-button>
</div>
</div>
</div> -->
</a-spin>
</div>
</template>

View File

@ -116,7 +116,7 @@
</div>
</div>
</div>
<div class="footer">
<!-- <div class="footer">
<title-over-border title="New Calibration is Applied to">
<a-radio-group v-model="newCalibrationIsAppliedTo">
<p>
@ -139,7 +139,7 @@
<a-button type="primary" @click="handleReAnalyse()">Reanalyse Spectrum Using New Calibration</a-button>
<a-button type="primary" class="exit" @click="handleExit()">Exit</a-button>
</div>
</div>
</div> -->
</a-spin>
</div>
</template>

View File

@ -7,14 +7,38 @@
:footer="null"
destroy-on-close
>
<a-tabs :animated="false">
<a-tab-pane tab="Gamma Detector Calibration" key="1">
<gamma-detector-calibration @exit="visible = false" :sampleId="sampleId" />
<a-tabs :animated="false" v-model="currTab">
<a-tab-pane tab="Gamma Detector Calibration" key="gamma">
<gamma-detector-calibration :sampleId="sampleId" />
</a-tab-pane>
<a-tab-pane tab="Beta Detector Calibration" key="2">
<beta-detector-calibration @exit="visible = false" :sampleId="sampleId" />
<a-tab-pane tab="Beta Detector Calibration" key="beta">
<beta-detector-calibration :sampleId="sampleId" />
</a-tab-pane>
</a-tabs>
<div class="footer">
<title-over-border title="New Calibration is Applied to">
<a-radio-group v-model="newCalibrationIsAppliedTo">
<p>
<a-radio value="1">All Spectra</a-radio>
</p>
<a-radio value="2">Current Spectrum</a-radio>
</a-radio-group>
</title-over-border>
<title-over-border title="Recalculate ROI Counts For">
<a-checkbox-group v-model="recalculateROICountsFor" @change="recalculateROICountsForChange">
<p>
<a-checkbox value="sample">Sample Data</a-checkbox>
<a-checkbox value="gasBg">GasBg Data</a-checkbox>
</p>
<a-checkbox value="detBg">DetBg Data</a-checkbox>
<a-checkbox value="qc">QC Data</a-checkbox>
</a-checkbox-group>
</title-over-border>
<div class="footer-btns">
<a-button type="primary" @click="handleReAnalyse">Reanalyse Spectrum Using New Calibration</a-button>
<a-button type="primary" class="exit" @click="handleExit">Exit</a-button>
</div>
</div>
</custom-modal>
</template>
@ -22,14 +46,42 @@
import ModalMixin from '@/mixins/ModalMixin'
import BetaDetectorCalibration from './components/BetaDetectorCalibration.vue'
import GammaDetectorCalibration from './components/GammaDetectorCalibration.vue'
import TitleOverBorder from '@/views/spectrumAnalysis/components/TitleOverBorder.vue'
export default {
components: { BetaDetectorCalibration, GammaDetectorCalibration },
components: { BetaDetectorCalibration, GammaDetectorCalibration, TitleOverBorder },
mixins: [ModalMixin],
props: {
sampleId: {
type: Number
}
type: Number,
},
},
data() {
return {
currTab: 'gamma',
newCalibrationIsAppliedTo: '2',
recalculateROICountsFor: [],
checkFlag: {
checkSample: false,
checkGas: false,
checkDet: false,
},
}
},
methods: {
recalculateROICountsForChange(checkedVal) {
this.recalculateROICountsFor = checkedVal
this.checkFlag.checkSample = checkedVal.includes('sample') ? true : false
this.checkFlag.checkGas = checkedVal.includes('gasBg') ? true : false
this.checkFlag.checkDet = checkedVal.includes('detBg') ? true : false
this.$emit('sendInfo', this.checkFlag)
},
handleReAnalyse() {
console.log(this.currTab)
},
handleExit() {
this.visible = false
},
},
}
</script>
@ -57,4 +109,35 @@ export default {
padding: 10px;
}
}
.footer {
margin-top: 10px;
display: flex;
gap: 10px;
.title-over-border {
&:first-child {
flex: 4;
}
&:nth-child(2) {
flex: 5;
.ant-checkbox-wrapper {
width: 145px;
}
}
}
&-btns {
flex: 6;
display: flex;
justify-content: flex-end;
gap: 20px;
align-items: center;
.exit {
width: 130px;
}
}
}
</style>

View File

@ -1,8 +1,8 @@
<template>
<div class="result-display-content">
<a-table :data-source="source1" rowKey="id" :columns="columns" :pagination="false">
<template slot="flag">
<a-checkbox></a-checkbox>
<template slot="flag" slot-scope="text, record">
<a-checkbox :checked="text == 1 ? true : false" @change="(e) => handleCheckboxChange(e, record)"></a-checkbox>
</template>
<template slot="concentration" slot-scope="text, record">
<div class="concentration color-box" :class="record.className">
@ -22,8 +22,8 @@
</template>
</a-table>
<a-table :data-source="source2" rowKey="id" :columns="columns" :pagination="false">
<template slot="flag">
<a-checkbox></a-checkbox>
<template slot="flag" slot-scope="text, record">
<a-checkbox :checked="text == 1 ? true : false" @change="(e) => handleCheckboxChange(e, record)"></a-checkbox>
</template>
<template slot="concentration" slot-scope="text, record">
<div class="concentration color-box" :class="record.className">
@ -50,68 +50,74 @@ const columns = [
{
title: 'Flag',
align: 'center',
dataIndex: 'nidFlag',
scopedSlots: {
customRender: 'flag'
customRender: 'flag',
},
width: 40
width: 40,
},
{
title: 'Isotope',
dataIndex: 'nuclideName',
ellipsis: true,
width: 76
width: 76,
},
{
title: 'Concentration',
dataIndex: 'conc',
scopedSlots: {
customRender: 'concentration'
customRender: 'concentration',
},
width: 128
width: 128,
},
{
title: 'Uncertainty',
dataIndex: 'concErr',
scopedSlots: {
customRender: 'uncertainty'
customRender: 'uncertainty',
},
width: 118
width: 118,
},
{
title: 'MDC[mBq/m3]',
dataIndex: 'mdc',
scopedSlots: {
customRender: 'mdc'
customRender: 'mdc',
},
width: 133
width: 133,
},
{
title: '',
scopedSlots: {
customRender: 'operator'
customRender: 'operator',
},
width: 34,
},
width: 34
}
]
export default {
props: {
data: {
type: Array,
default: () => []
}
default: () => [],
},
},
data() {
this.columns = columns
return {
source1: [],
source2: []
source2: [],
}
},
methods: {
handleCheckboxChange(e, obj) {
this.$emit('sendFlag', e.target.checked, obj)
},
},
watch: {
data: {
handler(val) {
if (val && Array.isArray(val)) {
val.forEach(item => {
val.forEach((item) => {
if (item.conc < 0) {
item.className = 'error'
} else if (item.conc > 0 && item.conc < item.mdc) {
@ -124,9 +130,9 @@ export default {
this.source2 = val.slice(2, 4)
}
},
immediate: true
}
}
immediate: true,
},
},
}
</script>

View File

@ -39,6 +39,7 @@
v-else-if="isBetaGamma"
ref="betaGammaAnalysisRef"
@getFiles="getFiles"
@sendInfo="getStationName"
:sample="sampleData"
:analyseCurrentSpectrum="analyseCurrentSpectrumData"
/>
@ -151,13 +152,18 @@
<automatic-analysis-log-modal v-model="autoAnalysisMogModalVisible" :type="autoAnalysisMogModalType" />
<!-- Beta-Gamma 的Comments 弹窗 -->
<beta-gamma-comments-modal v-model="betaGammaCommentsModalVisible" :isAdd="isBetaGammaCommentsAdd" />
<beta-gamma-comments-modal
v-model="betaGammaCommentsModalVisible"
:isAdd="isBetaGammaCommentsAdd"
@sendInfo="getcommentsInfo"
/>
<!-- Beta-Gamma 的Comments 结束 -->
<!-- Beta-Gamma 的Energy Calibration开始 -->
<beta-gamma-energy-calibration-modal
v-model="betaGammaEnergyCalibrationModalVisible"
:sampleId="this.sampleData.sampleId"
@sendInfo="getCheckFlag"
/>
<!-- Beta-Gamma 的Energy Calibration结束 -->
@ -355,6 +361,29 @@ export default {
betaGammaRlrModalVisible: false, // beta-gamma RLR
statisticsParamerHistoryModalVisible: false, // beta-gamma Statistics Paramer History
analyseCurrentSpectrumData: {},
resultDisplayFlag: [],
params_toDB: {
comment: '',
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,
},
}
},
created() {
@ -372,6 +401,18 @@ export default {
},
methods: {
getcommentsInfo(val) {
this.params_toDB.comment = val.spectrumAnalysisCommentInfo
},
getStationName(arg, val) {
this.resultDisplayFlag = arg
this.params_toDB.stationName = val
},
getCheckFlag(val) {
this.params_toDB.checkSample = val.checkSample
this.params_toDB.checkGas = val.checkGas
this.params_toDB.checkDet = val.checkDet
},
// formDB sampleData
getFiles(val) {
this.newSampleData = { ...this.sampleData, ...val }
@ -386,7 +427,6 @@ export default {
this.sampleList = this.sampleList.concat(willAddList)
},
handleLoadSampleFromFile(sampleList) {
console.log('sampleListsampleListsampleListsampleListsampleList', sampleList)
let arr = sampleList.filter((item) => {
if (Object.keys(item).length > 4) {
if (item.gasFileName && item.detFileName && item.qcFileName && item.gasFileStatus && item.detFileStatus) {
@ -396,9 +436,8 @@ export default {
}
}
})
console.log('sampleListsampleList', arr)
arr.forEach((item) => {
item.dbNames = ''
item.dbName = ''
item.sampleId = ''
item.inputFileName = item.sampleFileName
item.sampleType = item.sampleSystemType
@ -438,6 +477,37 @@ export default {
*/
handleSaveResultsToDB(type) {
console.log('%c [ saveResultsToDB ]-157', 'font-size:13px; background:pink; color:#bf2c9f;', type)
if (type === 'current') {
this.handleSaveResultsToDB_Cuurrent()
}
},
handleSaveResultsToDB_Cuurrent() {
// xeflag params_toDB
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
postAction('/spectrumAnalysis/saveToDB', this.params_toDB).then((res) => {
if (res.success) {
this.$message.success('Save Successfully!')
} else {
this.$message.warning('Fail To Save')
}
})
}
},
/**
@ -498,28 +568,27 @@ export default {
// beta Analyze current spectrum
getAnalyzeCurrentSpectrum() {
let params = {
// dbNames: [''],
// sampleIds: [''],
// sampleFileNames: ['AUX09_003-20151226_1855_S_FULL_40184.8.PHD'],
// gasFileNames: ['AUX09_003-20151226_0655_G_FULL_40184.7.PHD'],
// detFileNames: ['AUX09_003-20150527_0425_D_FULL_259450.PHD'],
dbNames: [this.sampleData.dbName],
sampleIds: [this.sampleData.sampleId],
sampleFileNames: [this.sampleData.inputFileName],
gasFileNames: [this.sampleData.gasFileName],
detFileNames: [this.sampleData.detFileName],
dbNames: [this.newSampleData.dbName],
sampleIds: [this.newSampleData.sampleId],
sampleFileNames: [this.newSampleData.inputFileName],
gasFileNames: [this.newSampleData.gasFileName],
detFileNames: [this.newSampleData.detFileName],
}
postAction('/spectrumAnalysis/analyseCurrentSpectrum', params).then((res) => {
if (res.success) {
this.analyseCurrentSpectrumData = res.result
this.resultDisplayFlag = res.result.XeData
this.resultDisplayFlag.forEach((item) => {
item.conc = item.conc.toFixed(6)
item.concErr = item.concErr.toFixed(6)
item.lc = item.lc.toFixed(6)
item.mdc = item.mdc.toFixed(6)
})
} else {
this.$message.warning(res.message)
}
})
},
saveToDb() {
console.log('savetodb')
},
handleEnergyCalib() {
if (this.newSampleData.sampleId) {
if (this.newSampleData.qcFileName) {