feat: 对接分析功能
This commit is contained in:
parent
edf91d5e74
commit
52e360eca5
|
@ -89,16 +89,18 @@
|
||||||
<div class="title">Gamma Window Setting</div>
|
<div class="title">Gamma Window Setting</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="label">Gamma Window Begin:</div>
|
<div class="label">Gamma Window Begin:</div>
|
||||||
<a-input-number size="small" v-model="model.windowBegin"></a-input-number> Channel
|
<a-input-number size="small" v-model="model.windowBegin" @change="calculateTotalCount"></a-input-number>
|
||||||
|
Channel
|
||||||
<div class="label">Gamma Window End:</div>
|
<div class="label">Gamma Window End:</div>
|
||||||
<a-input-number size="small" v-model="model.windowEnd"></a-input-number> Channel
|
<a-input-number size="small" v-model="model.windowEnd" @change="calculateTotalCount"></a-input-number>
|
||||||
|
Channel
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
<div class="title">Parameter Setting</div>
|
<div class="title">Parameter Setting</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="label">Min of Energy:</div>
|
<div class="label">Min of Energy:</div>
|
||||||
<a-input-number size="small" v-model="model.energy"></a-input-number> keV
|
<a-input-number size="small" v-model="model.minEnergy"></a-input-number> keV
|
||||||
<div class="label">Half Life:</div>
|
<div class="label">Half Life:</div>
|
||||||
<a-input-number size="small" v-model="model.halfLife"></a-input-number> Day
|
<a-input-number size="small" v-model="model.halfLife"></a-input-number> Day
|
||||||
</div>
|
</div>
|
||||||
|
@ -106,16 +108,16 @@
|
||||||
<div class="setting-item">
|
<div class="setting-item">
|
||||||
<div class="title">Function of Fitting</div>
|
<div class="title">Function of Fitting</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<a-radio-group v-model="model.fittingType">
|
<a-radio-group v-model="model.fitType" @change="handleFuncChange">
|
||||||
<a-radio value="1">Linear</a-radio>
|
<a-radio value="liner">Linear</a-radio>
|
||||||
<a-radio value="2">2-polynomial</a-radio>
|
<a-radio value="poly2">2-polynomial</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btns">
|
<div class="btns">
|
||||||
<a-button type="primary">Analyse</a-button>
|
<a-button type="primary" :loading="isAnalysing" @click="handleAnalyse">Analyse</a-button>
|
||||||
<a-button @click="visible = false">Exit</a-button>
|
<a-button @click="visible = false">Exit</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -133,8 +135,10 @@
|
||||||
:class="tableList.length ? 'has-data' : ''"
|
:class="tableList.length ? 'has-data' : ''"
|
||||||
:scroll="{ y: 101 }"
|
:scroll="{ y: 101 }"
|
||||||
>
|
>
|
||||||
<template slot="delete">
|
<template slot="delete" slot-scope="text, record, index">
|
||||||
<a-button type="link" size="small">Delete</a-button>
|
<a-button type="link" size="small" @click="handleDel(index)">
|
||||||
|
<a-icon type="delete" style="color: red;"></a-icon>
|
||||||
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
<!-- 表格结束 -->
|
<!-- 表格结束 -->
|
||||||
|
@ -155,25 +159,20 @@
|
||||||
<!-- 右下角信息开始 -->
|
<!-- 右下角信息开始 -->
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<title-over-border title="Function of Fitting">
|
<title-over-border title="Function of Fitting">
|
||||||
<template v-if="model.fittingType == '1'">
|
{{ currFunction }}
|
||||||
y = ax + b
|
|
||||||
</template>
|
|
||||||
<template v-if="model.fittingType == '2'">
|
|
||||||
y = axx + bx + c
|
|
||||||
</template>
|
|
||||||
</title-over-border>
|
</title-over-border>
|
||||||
<title-over-border title="Xe Activity (Bq)">
|
<title-over-border title="Xe Activity (Bq)">
|
||||||
<div class="xe-activity">
|
<div class="xe-activity">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<label>Reference Time :</label>
|
<label>Reference Time :</label>
|
||||||
<span>
|
<span>
|
||||||
这是内容
|
{{ xeActivity.referenceTime }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<label>Xe Activity (Bq) :</label>
|
<label>Xe Activity (Bq) :</label>
|
||||||
<span>
|
<span>
|
||||||
这是内容
|
{{ xeActivity.activity }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -193,7 +192,7 @@ import ModalMixin from '@/mixins/ModalMixin'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import CustomChart from '@/components/CustomChart/index.vue'
|
import CustomChart from '@/components/CustomChart/index.vue'
|
||||||
import { exportEchartImg, getXAxisAndYAxisByPosition, splitAxis } from '@/utils/chartHelper'
|
import { exportEchartImg, getXAxisAndYAxisByPosition, splitAxis } from '@/utils/chartHelper'
|
||||||
import { getAction } from '@/api/manage'
|
import { getAction, postAction } from '@/api/manage'
|
||||||
import { useBaseChartSetting } from '../../../useChart'
|
import { useBaseChartSetting } from '../../../useChart'
|
||||||
import TitleOverBorder from '../../TitleOverBorder.vue'
|
import TitleOverBorder from '../../TitleOverBorder.vue'
|
||||||
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
||||||
|
@ -389,32 +388,23 @@ const initialResultChartOption = {
|
||||||
},
|
},
|
||||||
symbol: 'none',
|
symbol: 'none',
|
||||||
data: [],
|
data: [],
|
||||||
markLine: {
|
animation: false
|
||||||
symbol: 'none',
|
|
||||||
label: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
animation: false,
|
|
||||||
emphasis: {
|
|
||||||
disabled: true
|
|
||||||
},
|
|
||||||
lineStyle: {
|
|
||||||
color: '#f00'
|
|
||||||
},
|
|
||||||
data: []
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'line',
|
type: 'scatter',
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#A8DA56'
|
color: 'red'
|
||||||
},
|
},
|
||||||
symbol: 'none',
|
symbolSize: 6,
|
||||||
data: []
|
data: [],
|
||||||
|
zlevel: 2,
|
||||||
|
animation: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initialResultChartOption.yAxis.boundaryGap = ['20%', '20%']
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: 'Index',
|
title: 'Index',
|
||||||
|
@ -425,17 +415,17 @@ const columns = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Eb',
|
title: 'Eb',
|
||||||
dataIndex: 'Eb',
|
dataIndex: 'eb',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Nx',
|
title: 'Nx',
|
||||||
dataIndex: 'Nx',
|
dataIndex: 'nx',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Ny',
|
title: 'Ny',
|
||||||
dataIndex: 'Ny',
|
dataIndex: 'ny',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -448,11 +438,17 @@ const columns = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const initialModel = {
|
const initialModel = {
|
||||||
windowBegin: null,
|
windowBegin: undefined,
|
||||||
windowEnd: null,
|
windowEnd: undefined,
|
||||||
energy: 0.1,
|
minEnergy: 0.1,
|
||||||
halfLife: 5.243,
|
halfLife: 5.243,
|
||||||
fittingType: '1'
|
fitType: 'liner'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function of Fitting
|
||||||
|
const funcList = {
|
||||||
|
liner: 'y = ax + b',
|
||||||
|
poly2: 'y = axx + bx + c'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -484,6 +480,8 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
totalCount: [0, 0],
|
totalCount: [0, 0],
|
||||||
|
currFunction: '',
|
||||||
|
xeActivity: {},
|
||||||
|
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
|
||||||
|
@ -491,7 +489,8 @@ export default {
|
||||||
gammaChannelEnergy: [],
|
gammaChannelEnergy: [],
|
||||||
|
|
||||||
model: cloneDeep(initialModel),
|
model: cloneDeep(initialModel),
|
||||||
tableList: []
|
tableList: [],
|
||||||
|
isAnalysing: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -499,10 +498,11 @@ export default {
|
||||||
this.customToolTip.visible = false
|
this.customToolTip.visible = false
|
||||||
this.customToolTip2.visible = false
|
this.customToolTip2.visible = false
|
||||||
this.gammaSpectrumChartOption = cloneDeep(initialGammaChartOption)
|
this.gammaSpectrumChartOption = cloneDeep(initialGammaChartOption)
|
||||||
|
|
||||||
this.betaSpectrumChartOption = cloneDeep(initialBetaChartOption)
|
this.betaSpectrumChartOption = cloneDeep(initialBetaChartOption)
|
||||||
|
this.resultChartOption = cloneDeep(initialResultChartOption)
|
||||||
|
|
||||||
this.model = cloneDeep(initialModel)
|
this.model = cloneDeep(initialModel)
|
||||||
|
this.currFunction = funcList[this.model.fitType]
|
||||||
|
|
||||||
this.calculateTotalCount()
|
this.calculateTotalCount()
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ export default {
|
||||||
// 如果是左键
|
// 如果是左键
|
||||||
if (isMouseLeft) {
|
if (isMouseLeft) {
|
||||||
// 如果有右值且左值大于等于右值,清空
|
// 如果有右值且左值大于等于右值,清空
|
||||||
if(!isNullOrUndefined(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
|
if (!isNullOrUndefined(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
|
||||||
this.clearMarkLineAndToolTip()
|
this.clearMarkLineAndToolTip()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -590,7 +590,7 @@ export default {
|
||||||
}
|
}
|
||||||
// 如果是右键
|
// 如果是右键
|
||||||
else {
|
else {
|
||||||
if(!isNullOrUndefined(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
|
if (!isNullOrUndefined(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
|
||||||
this.clearMarkLineAndToolTip()
|
this.clearMarkLineAndToolTip()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -624,17 +624,112 @@ export default {
|
||||||
|
|
||||||
this.model.windowBegin = null
|
this.model.windowBegin = null
|
||||||
this.model.windowEnd = null
|
this.model.windowEnd = null
|
||||||
|
|
||||||
|
this.calculateTotalCount()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 计算Total Count
|
||||||
calculateTotalCount() {
|
calculateTotalCount() {
|
||||||
if(!this.model.windowBegin || !this.model.windowEnd) {
|
if (!this.model.windowBegin || !this.model.windowEnd || this.model.windowBegin >= this.model.windowEnd) {
|
||||||
this.totalCount = [0, 0]
|
this.totalCount = [0, 0]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gammaOriginSeriseData = this.gammaSpectrumChartOption.series[0].data
|
||||||
|
const betaProjectedSeriseData = this.betaSpectrumChartOption.series[1].data
|
||||||
|
|
||||||
|
const originSeriseTotalCount = gammaOriginSeriseData
|
||||||
|
.slice(this.model.windowBegin, this.model.windowEnd + 1)
|
||||||
|
.reduce((prev, curr) => prev + curr[1], 0)
|
||||||
|
const projectedSeriseTotalCount = betaProjectedSeriseData
|
||||||
|
.slice(this.model.windowBegin, this.model.windowEnd + 1)
|
||||||
|
.reduce((prev, curr) => prev + curr[1], 0)
|
||||||
|
this.totalCount = [originSeriseTotalCount, projectedSeriseTotalCount]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Function of Fitting 改变
|
||||||
|
handleFuncChange() {
|
||||||
|
this.xeActivity = {}
|
||||||
|
this.currFunction = funcList[this.model.fitType]
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSnapshot() {
|
handleSnapshot() {
|
||||||
exportEchartImg(this.$refs.chartRef.getChartInstance())
|
exportEchartImg(this.$refs.chartRef.getChartInstance())
|
||||||
|
},
|
||||||
|
|
||||||
|
// 分析
|
||||||
|
async handleAnalyse() {
|
||||||
|
const { windowBegin, windowEnd, minEnergy, halfLife, fitType } = this.model
|
||||||
|
if (
|
||||||
|
isNullOrUndefined(windowBegin) ||
|
||||||
|
isNullOrUndefined(windowEnd) ||
|
||||||
|
isNullOrUndefined(minEnergy) ||
|
||||||
|
isNullOrUndefined(halfLife)
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const { sampleFileName, detFileName } = this.sampleData
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
sampleId: null,
|
||||||
|
dbName: '',
|
||||||
|
sampleFileName,
|
||||||
|
detFileName,
|
||||||
|
gammaBegin: windowBegin,
|
||||||
|
gammaEnd: windowEnd,
|
||||||
|
minEnergy,
|
||||||
|
halfLife,
|
||||||
|
fitType //选择Linear 传 liner 选择2-Polynomial 传 poly2
|
||||||
|
}
|
||||||
|
this.isAnalysing = true
|
||||||
|
const { success, result, message } = await postAction('/spectrumAnalysis/analyseExtrapolation', params)
|
||||||
|
if (success) {
|
||||||
|
console.log('%c [ ]-679', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
||||||
|
const {
|
||||||
|
functionFit, // Function of Fitting
|
||||||
|
resultViewLineDataValue, // 折线
|
||||||
|
resultViewScatterDataValue, // 原点
|
||||||
|
tableData, // 表格数据
|
||||||
|
xeAct
|
||||||
|
} = result
|
||||||
|
|
||||||
|
this.currFunction = functionFit
|
||||||
|
|
||||||
|
const [lineSeries, scatterSeries] = this.resultChartOption.series
|
||||||
|
lineSeries.data = resultViewLineDataValue.map(({ x, y }) => [x, y])
|
||||||
|
scatterSeries.data = resultViewScatterDataValue.map(({ x, y }) => [x, y])
|
||||||
|
this.resetResultChartPerform()
|
||||||
|
|
||||||
|
this.xeActivity = {
|
||||||
|
referenceTime: this.detail.acquisitionStart,
|
||||||
|
activity: Number.isNaN(xeAct)? xeAct: Number(xeAct).toPrecision(6)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tableList = tableData
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.isAnalysing = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
resetResultChartPerform() {
|
||||||
|
this.resultChartOption.yAxis.min = undefined
|
||||||
|
this.resultChartOption.yAxis.max = undefined
|
||||||
|
this.resultChartOption.xAxis.min = undefined
|
||||||
|
this.resultChartOption.xAxis.max = undefined
|
||||||
|
this.resultChartOption.yAxis.interval = undefined
|
||||||
|
this.resultChartOption.xAxis.interval = undefined
|
||||||
|
},
|
||||||
|
|
||||||
|
// 表格删除
|
||||||
|
handleDel(index) {
|
||||||
|
this.tableList.splice(index, 1)
|
||||||
|
this.resultChartOption.series[1].data.splice(index, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -836,7 +931,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.xe-activity {
|
.xe-activity {
|
||||||
width: 80%;
|
width: 90%;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user