diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue
index 62837f1..6f7ebb9 100644
--- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue
+++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue
@@ -89,16 +89,18 @@
Gamma Window Setting
Gamma Window Begin:
-
Channel
+
+ Channel
Gamma Window End:
-
Channel
+
+ Channel
Parameter Setting
Min of Energy:
-
keV
+
keV
Half Life:
Day
@@ -106,16 +108,16 @@
Function of Fitting
-
- Linear
- 2-polynomial
+
+ Linear
+ 2-polynomial
@@ -133,8 +135,10 @@
:class="tableList.length ? 'has-data' : ''"
:scroll="{ y: 101 }"
>
-
- Delete
+
+
+
+
@@ -155,25 +159,20 @@
-
- y = ax + b
-
-
- y = axx + bx + c
-
+ {{ currFunction }}
- 这是内容
+ {{ xeActivity.referenceTime }}
- 这是内容
+ {{ xeActivity.activity }}
@@ -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;