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

View File

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

View File

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

View File

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

View File

@ -7,14 +7,38 @@
:footer="null" :footer="null"
destroy-on-close destroy-on-close
> >
<a-tabs :animated="false"> <a-tabs :animated="false" v-model="currTab">
<a-tab-pane tab="Gamma Detector Calibration" key="1"> <a-tab-pane tab="Gamma Detector Calibration" key="gamma">
<gamma-detector-calibration @exit="visible = false" :sampleId="sampleId" /> <gamma-detector-calibration :sampleId="sampleId" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane tab="Beta Detector Calibration" key="2"> <a-tab-pane tab="Beta Detector Calibration" key="beta">
<beta-detector-calibration @exit="visible = false" :sampleId="sampleId" /> <beta-detector-calibration :sampleId="sampleId" />
</a-tab-pane> </a-tab-pane>
</a-tabs> </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> </custom-modal>
</template> </template>
@ -22,14 +46,42 @@
import ModalMixin from '@/mixins/ModalMixin' import ModalMixin from '@/mixins/ModalMixin'
import BetaDetectorCalibration from './components/BetaDetectorCalibration.vue' import BetaDetectorCalibration from './components/BetaDetectorCalibration.vue'
import GammaDetectorCalibration from './components/GammaDetectorCalibration.vue' import GammaDetectorCalibration from './components/GammaDetectorCalibration.vue'
import TitleOverBorder from '@/views/spectrumAnalysis/components/TitleOverBorder.vue'
export default { export default {
components: { BetaDetectorCalibration, GammaDetectorCalibration }, components: { BetaDetectorCalibration, GammaDetectorCalibration, TitleOverBorder },
mixins: [ModalMixin], mixins: [ModalMixin],
props: { props: {
sampleId: { 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> </script>
@ -57,4 +109,35 @@ export default {
padding: 10px; 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> </style>

View File

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

View File

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