feat: 对接分析功能
This commit is contained in:
parent
edf91d5e74
commit
52e360eca5
|
@ -89,16 +89,18 @@
|
|||
<div class="title">Gamma Window Setting</div>
|
||||
<div class="content">
|
||||
<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>
|
||||
<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 class="setting-item">
|
||||
<div class="title">Parameter Setting</div>
|
||||
<div class="content">
|
||||
<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>
|
||||
<a-input-number size="small" v-model="model.halfLife"></a-input-number> Day
|
||||
</div>
|
||||
|
@ -106,16 +108,16 @@
|
|||
<div class="setting-item">
|
||||
<div class="title">Function of Fitting</div>
|
||||
<div class="content">
|
||||
<a-radio-group v-model="model.fittingType">
|
||||
<a-radio value="1">Linear</a-radio>
|
||||
<a-radio value="2">2-polynomial</a-radio>
|
||||
<a-radio-group v-model="model.fitType" @change="handleFuncChange">
|
||||
<a-radio value="liner">Linear</a-radio>
|
||||
<a-radio value="poly2">2-polynomial</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -133,8 +135,10 @@
|
|||
:class="tableList.length ? 'has-data' : ''"
|
||||
:scroll="{ y: 101 }"
|
||||
>
|
||||
<template slot="delete">
|
||||
<a-button type="link" size="small">Delete</a-button>
|
||||
<template slot="delete" slot-scope="text, record, index">
|
||||
<a-button type="link" size="small" @click="handleDel(index)">
|
||||
<a-icon type="delete" style="color: red;"></a-icon>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-table>
|
||||
<!-- 表格结束 -->
|
||||
|
@ -155,25 +159,20 @@
|
|||
<!-- 右下角信息开始 -->
|
||||
<div class="info">
|
||||
<title-over-border title="Function of Fitting">
|
||||
<template v-if="model.fittingType == '1'">
|
||||
y = ax + b
|
||||
</template>
|
||||
<template v-if="model.fittingType == '2'">
|
||||
y = axx + bx + c
|
||||
</template>
|
||||
{{ currFunction }}
|
||||
</title-over-border>
|
||||
<title-over-border title="Xe Activity (Bq)">
|
||||
<div class="xe-activity">
|
||||
<div class="item">
|
||||
<label>Reference Time :</label>
|
||||
<span>
|
||||
这是内容
|
||||
{{ xeActivity.referenceTime }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item">
|
||||
<label>Xe Activity (Bq) :</label>
|
||||
<span>
|
||||
这是内容
|
||||
{{ xeActivity.activity }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -193,7 +192,7 @@ import ModalMixin from '@/mixins/ModalMixin'
|
|||
import { cloneDeep } from 'lodash'
|
||||
import CustomChart from '@/components/CustomChart/index.vue'
|
||||
import { exportEchartImg, getXAxisAndYAxisByPosition, splitAxis } from '@/utils/chartHelper'
|
||||
import { getAction } from '@/api/manage'
|
||||
import { getAction, postAction } from '@/api/manage'
|
||||
import { useBaseChartSetting } from '../../../useChart'
|
||||
import TitleOverBorder from '../../TitleOverBorder.vue'
|
||||
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
||||
|
@ -389,32 +388,23 @@ const initialResultChartOption = {
|
|||
},
|
||||
symbol: 'none',
|
||||
data: [],
|
||||
markLine: {
|
||||
symbol: 'none',
|
||||
label: {
|
||||
show: false
|
||||
},
|
||||
animation: false,
|
||||
emphasis: {
|
||||
disabled: true
|
||||
},
|
||||
lineStyle: {
|
||||
color: '#f00'
|
||||
},
|
||||
data: []
|
||||
}
|
||||
animation: false
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
type: 'scatter',
|
||||
itemStyle: {
|
||||
color: '#A8DA56'
|
||||
color: 'red'
|
||||
},
|
||||
symbol: 'none',
|
||||
data: []
|
||||
symbolSize: 6,
|
||||
data: [],
|
||||
zlevel: 2,
|
||||
animation: false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
initialResultChartOption.yAxis.boundaryGap = ['20%', '20%']
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: 'Index',
|
||||
|
@ -425,17 +415,17 @@ const columns = [
|
|||
},
|
||||
{
|
||||
title: 'Eb',
|
||||
dataIndex: 'Eb',
|
||||
dataIndex: 'eb',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: 'Nx',
|
||||
dataIndex: 'Nx',
|
||||
dataIndex: 'nx',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: 'Ny',
|
||||
dataIndex: 'Ny',
|
||||
dataIndex: 'ny',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
|
@ -448,11 +438,17 @@ const columns = [
|
|||
]
|
||||
|
||||
const initialModel = {
|
||||
windowBegin: null,
|
||||
windowEnd: null,
|
||||
energy: 0.1,
|
||||
windowBegin: undefined,
|
||||
windowEnd: undefined,
|
||||
minEnergy: 0.1,
|
||||
halfLife: 5.243,
|
||||
fittingType: '1'
|
||||
fitType: 'liner'
|
||||
}
|
||||
|
||||
// Function of Fitting
|
||||
const funcList = {
|
||||
liner: 'y = ax + b',
|
||||
poly2: 'y = axx + bx + c'
|
||||
}
|
||||
|
||||
export default {
|
||||
|
@ -484,6 +480,8 @@ export default {
|
|||
},
|
||||
|
||||
totalCount: [0, 0],
|
||||
currFunction: '',
|
||||
xeActivity: {},
|
||||
|
||||
isLoading: false,
|
||||
|
||||
|
@ -491,7 +489,8 @@ export default {
|
|||
gammaChannelEnergy: [],
|
||||
|
||||
model: cloneDeep(initialModel),
|
||||
tableList: []
|
||||
tableList: [],
|
||||
isAnalysing: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -499,10 +498,11 @@ export default {
|
|||
this.customToolTip.visible = false
|
||||
this.customToolTip2.visible = false
|
||||
this.gammaSpectrumChartOption = cloneDeep(initialGammaChartOption)
|
||||
|
||||
this.betaSpectrumChartOption = cloneDeep(initialBetaChartOption)
|
||||
this.resultChartOption = cloneDeep(initialResultChartOption)
|
||||
|
||||
this.model = cloneDeep(initialModel)
|
||||
this.currFunction = funcList[this.model.fitType]
|
||||
|
||||
this.calculateTotalCount()
|
||||
|
||||
|
@ -567,18 +567,18 @@ export default {
|
|||
// 图表点击
|
||||
handleChartClick({ offsetX, offsetY, event }, isMouseLeft) {
|
||||
event.preventDefault()
|
||||
|
||||
|
||||
const point = getXAxisAndYAxisByPosition(this.$refs.gammaSpectrumChart.getChartInstance(), offsetX, offsetY)
|
||||
if (point) {
|
||||
const markLineData = this.gammaSpectrumChartOption.series[0].markLine.data
|
||||
const xAxis = parseInt(point[0].toFixed())
|
||||
|
||||
|
||||
let currToolTip = this.customToolTip2
|
||||
|
||||
// 如果是左键
|
||||
if (isMouseLeft) {
|
||||
// 如果有右值且左值大于等于右值,清空
|
||||
if(!isNullOrUndefined(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
|
||||
if (!isNullOrUndefined(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
|
||||
this.clearMarkLineAndToolTip()
|
||||
return
|
||||
}
|
||||
|
@ -587,10 +587,10 @@ export default {
|
|||
|
||||
markLineData[0].xAxis = xAxis
|
||||
this.model.windowBegin = xAxis
|
||||
}
|
||||
}
|
||||
// 如果是右键
|
||||
else {
|
||||
if(!isNullOrUndefined(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
|
||||
if (!isNullOrUndefined(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
|
||||
this.clearMarkLineAndToolTip()
|
||||
return
|
||||
}
|
||||
|
@ -624,17 +624,112 @@ export default {
|
|||
|
||||
this.model.windowBegin = null
|
||||
this.model.windowEnd = null
|
||||
|
||||
this.calculateTotalCount()
|
||||
},
|
||||
|
||||
// 计算Total Count
|
||||
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]
|
||||
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() {
|
||||
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 {
|
||||
width: 80%;
|
||||
width: 90%;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
|
|
Loading…
Reference in New Issue
Block a user