diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue
index 0777afb..7140185 100644
--- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue
+++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue
@@ -51,7 +51,7 @@
class="custom-tool-tip"
:style="{
top: customToolTip.top + 'px',
- left: customToolTip.left + 'px'
+ left: customToolTip.left + 'px',
}"
>
@@ -137,7 +155,7 @@
>
-
+
@@ -196,7 +214,7 @@ import { getAction, postAction } from '@/api/manage'
import { useBaseChartSetting } from '../../../useChart'
import TitleOverBorder from '../../TitleOverBorder.vue'
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
-import { isNullOrUndefined } from '@/utils/util'
+import { isNumber } from 'xe-utils/methods'
const initialGammaChartOption = {
grid: {
@@ -204,7 +222,7 @@ const initialGammaChartOption = {
right: 15,
bottom: 10,
left: 10,
- containLabel: true
+ containLabel: true,
},
xAxis: {
min: 0,
@@ -212,21 +230,21 @@ const initialGammaChartOption = {
interval: 64,
axisLine: {
lineStyle: {
- color: 'rgb(119, 181, 213, 0.5)'
- }
+ color: 'rgb(119, 181, 213, 0.5)',
+ },
},
splitLine: {
show: true,
lineStyle: {
- color: 'rgba(119, 181, 213, .2)'
- }
+ color: 'rgba(119, 181, 213, .2)',
+ },
},
axisTick: {
- show: false
+ show: false,
},
axisLabel: {
- color: '#ade6ee'
- }
+ color: '#ade6ee',
+ },
},
yAxis: {
min: 0,
@@ -235,57 +253,57 @@ const initialGammaChartOption = {
axisLine: {
show: true,
lineStyle: {
- color: 'rgb(119, 181, 213, 0.5)'
- }
+ color: 'rgb(119, 181, 213, 0.5)',
+ },
},
splitLine: {
show: true,
lineStyle: {
- color: 'rgba(119, 181, 213, .2)'
- }
+ color: 'rgba(119, 181, 213, .2)',
+ },
},
axisTick: {
- show: false
+ show: false,
},
axisLabel: {
- color: '#ade6ee'
+ color: '#ade6ee',
},
- animation: false
+ animation: false,
},
series: [
{
type: 'line',
itemStyle: {
- color: '#04ADD9'
+ color: '#04ADD9',
},
symbol: 'none',
data: [],
markLine: {
symbol: 'none',
label: {
- show: false
+ show: false,
},
animation: false,
emphasis: {
- disabled: true
+ disabled: true,
},
lineStyle: {
- color: '#f00'
+ color: '#f00',
},
- data: [{ xAxis: -1 }, { xAxis: -1 }]
+ data: [{ xAxis: -1 }, { xAxis: -1 }],
},
- animation: false
+ animation: false,
},
{
type: 'line',
itemStyle: {
- color: '#A8DA56'
+ color: '#A8DA56',
},
symbol: 'none',
data: [],
- animation: false
- }
- ]
+ animation: false,
+ },
+ ],
}
const initialBetaChartOption = {
@@ -294,7 +312,7 @@ const initialBetaChartOption = {
right: 15,
bottom: 10,
left: 10,
- containLabel: true
+ containLabel: true,
},
xAxis: {
min: 0,
@@ -302,21 +320,21 @@ const initialBetaChartOption = {
interval: 64,
axisLine: {
lineStyle: {
- color: 'rgb(119, 181, 213, 0.5)'
- }
+ color: 'rgb(119, 181, 213, 0.5)',
+ },
},
splitLine: {
show: true,
lineStyle: {
- color: 'rgba(119, 181, 213, .2)'
- }
+ color: 'rgba(119, 181, 213, .2)',
+ },
},
axisTick: {
- show: false
+ show: false,
},
axisLabel: {
- color: '#ade6ee'
- }
+ color: '#ade6ee',
+ },
},
yAxis: {
min: 0,
@@ -325,57 +343,57 @@ const initialBetaChartOption = {
axisLine: {
show: true,
lineStyle: {
- color: 'rgb(119, 181, 213, 0.5)'
- }
+ color: 'rgb(119, 181, 213, 0.5)',
+ },
},
splitLine: {
show: true,
lineStyle: {
- color: 'rgba(119, 181, 213, .2)'
- }
+ color: 'rgba(119, 181, 213, .2)',
+ },
},
axisTick: {
- show: false
+ show: false,
},
axisLabel: {
- color: '#ade6ee'
+ color: '#ade6ee',
},
- animation: false
+ animation: false,
},
series: [
{
type: 'line',
itemStyle: {
- color: '#04ADD9'
+ color: '#04ADD9',
},
symbol: 'none',
data: [],
markLine: {
symbol: 'none',
label: {
- show: false
+ show: false,
},
animation: false,
emphasis: {
- disabled: true
+ disabled: true,
},
lineStyle: {
- color: '#f00'
+ color: '#f00',
},
- data: []
+ data: [],
},
- animation: false
+ animation: false,
},
{
type: 'line',
itemStyle: {
- color: '#A8DA56'
+ color: '#A8DA56',
},
symbol: 'none',
data: [],
- animation: false
- }
- ]
+ animation: false,
+ },
+ ],
}
const initialResultChartOption = {
@@ -384,23 +402,23 @@ const initialResultChartOption = {
{
type: 'line',
itemStyle: {
- color: '#04ADD9'
+ color: '#04ADD9',
},
symbol: 'none',
data: [],
- animation: false
+ animation: false,
},
{
type: 'scatter',
itemStyle: {
- color: 'red'
+ color: 'red',
},
symbolSize: 6,
data: [],
zlevel: 2,
- animation: false
- }
- ]
+ animation: false,
+ },
+ ],
}
initialResultChartOption.yAxis.boundaryGap = ['20%', '20%']
@@ -411,30 +429,30 @@ const columns = [
customRender: (_, __, index) => {
return index + 1
},
- align: 'center'
+ align: 'center',
},
{
title: 'Eb',
dataIndex: 'eb',
- align: 'center'
+ align: 'center',
},
{
title: 'Nx',
dataIndex: 'nx',
- align: 'center'
+ align: 'center',
},
{
title: 'Ny',
dataIndex: 'ny',
- align: 'center'
+ align: 'center',
},
{
title: 'Delete',
scopedSlots: {
- customRender: 'delete'
+ customRender: 'delete',
},
- align: 'center'
- }
+ align: 'center',
+ },
]
const initialModel = {
@@ -442,20 +460,20 @@ const initialModel = {
windowEnd: undefined,
minEnergy: 0.1,
halfLife: 5.243,
- fitType: 'liner'
+ fitType: 'liner',
}
// Function of Fitting
const funcList = {
liner: 'y = ax + b',
- poly2: 'y = axx + bx + c'
+ poly2: 'y = axx + bx + c',
}
export default {
mixins: [ModalMixin, SampleDataMixin],
components: {
CustomChart,
- TitleOverBorder
+ TitleOverBorder,
},
data() {
this.columns = columns
@@ -469,14 +487,14 @@ export default {
left: 0,
visible: false,
channel: '',
- energy: ''
+ energy: '',
},
customToolTip2: {
top: 0,
left: 0,
visible: false,
channel: '',
- energy: ''
+ energy: '',
},
totalCount: [0, 0],
@@ -490,7 +508,7 @@ export default {
model: cloneDeep(initialModel),
tableList: [],
- isAnalysing: false
+ isAnalysing: false,
}
},
methods: {
@@ -502,7 +520,7 @@ export default {
this.resultChartOption = cloneDeep(initialResultChartOption)
this.model = cloneDeep(initialModel)
- this.currFunction = funcList[this.model.fitType]
+ this.handleFuncChange()
this.tableList = []
this.calculateTotalCount()
@@ -516,7 +534,7 @@ export default {
const { sampleId, inputFileName: sampleFileName } = this.sampleData
const { success, result, message } = await getAction('/spectrumAnalysis/viewExtrapolation', {
sampleId,
- sampleFileName
+ sampleFileName,
})
if (success) {
this.detail = result
@@ -526,7 +544,7 @@ export default {
betaProjectedSeriseData,
gammaChannelEnergy,
gammaOriginSeriseData,
- gammaProjectedSeriseData
+ gammaProjectedSeriseData,
} = result
this.gammaChannelEnergy = gammaChannelEnergy
@@ -579,8 +597,8 @@ export default {
// 如果是左键
if (isMouseLeft) {
// 如果有右值且左值大于等于右值,清空
- if (!isNullOrUndefined(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
- this.clearMarkLineAndToolTip()
+ if (!isNumber(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
+ this.reset()
return
}
@@ -591,8 +609,8 @@ export default {
}
// 如果是右键
else {
- if (!isNullOrUndefined(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
- this.clearMarkLineAndToolTip()
+ if (!isNumber(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
+ this.reset()
return
}
@@ -612,10 +630,11 @@ export default {
currToolTip.energy = parseInt(energy) + 'keV'
this.calculateTotalCount()
+ this.getTableAndChartData()
}
},
- clearMarkLineAndToolTip() {
+ reset() {
const markLineData = this.gammaSpectrumChartOption.series[0].markLine.data
markLineData[0].xAxis = -1
markLineData[1].xAxis = -1
@@ -626,12 +645,18 @@ export default {
this.model.windowBegin = null
this.model.windowEnd = null
+ this.tableList = []
+ const [lineSeries, scatterSeries] = this.resultChartOption.series
+ lineSeries.data = []
+ scatterSeries.data = []
+
this.calculateTotalCount()
},
// 计算Total Count
calculateTotalCount() {
- if (!this.model.windowBegin || !this.model.windowEnd || this.model.windowBegin >= this.model.windowEnd) {
+ const { windowBegin, windowEnd } = this.model
+ if (!isNumber(windowBegin) || !isNumber(windowEnd) || windowBegin >= windowEnd) {
this.totalCount = [0, 0]
return
}
@@ -658,56 +683,96 @@ export default {
exportEchartImg(this.$refs.chartRef.getChartInstance())
},
- // 分析
- async handleAnalyse() {
+ handleGammaWindowSettingChange() {
+ this.calculateTotalCount()
+ this.getTableAndChartData()
+ },
+
+ handleParameterSettingChange() {
+ this.getTableAndChartData()
+ },
+
+ /**
+ * 获取表格和图表数据
+ */
+ async getTableAndChartData() {
const { windowBegin, windowEnd, minEnergy, halfLife, fitType } = this.model
- if (
- isNullOrUndefined(windowBegin) ||
- isNullOrUndefined(windowEnd) ||
- isNullOrUndefined(minEnergy) ||
- isNullOrUndefined(halfLife)
- ) {
+ const [lineSeries, scatterSeries] = this.resultChartOption.series
+ lineSeries.data = []
+
+ if (!this.validateSettingValue()) {
+ scatterSeries.data = []
+ this.tableList = []
return
}
- try {
- const { sampleFileName, detFileName } = this.sampleData
+ const { sampleId, dbName, sampleFileName, detFileName } = this.sampleData
+ try {
const params = {
- sampleId: null,
- dbName: '',
+ sampleId,
+ dbName,
sampleFileName,
detFileName,
gammaBegin: windowBegin,
gammaEnd: windowEnd,
minEnergy,
halfLife,
- fitType //选择Linear 传 liner 选择2-Polynomial 传 poly2
+ fitType, //选择Linear 传 liner 选择2-Polynomial 传 poly2
}
+ const { success, result, message } = await postAction('/spectrumAnalysis/changeDataExtrapolation', params)
+ if (success) {
+ const { resultViewScatterDataValue, tableData } = result
+ scatterSeries.data = resultViewScatterDataValue.map(({ x, y }) => [x, y])
+ this.resetResultChartPerform()
+
+ this.tableList = tableData
+ } else {
+ this.$message.error(message)
+ }
+ } catch (error) {
+ console.error(error)
+ }
+ },
+
+ // 分析
+ async handleAnalyse() {
+ const { minEnergy, halfLife, fitType } = this.model
+ if (!this.validateSettingValue()) {
+ return
+ }
+ try {
+ const { acquisitionRealTime: acqRealTime, acquisitionStart: acqStartTime } = this.detail
+
+ const params = {
+ eb: this.tableList.map(({ eb }) => eb),
+ nx: this.tableList.map(({ nx }) => nx),
+ ny: this.tableList.map(({ ny }) => ny),
+ acqRealTime,
+ minEnergy,
+ halfLife,
+ acqStartTime,
+ fitType,
+ }
+
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
+ xeAct,
} = result
this.currFunction = functionFit
- const [lineSeries, scatterSeries] = this.resultChartOption.series
+ const [lineSeries] = 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)
+ activity: Number.isNaN(xeAct) ? xeAct : Number(xeAct).toPrecision(6),
}
-
- this.tableList = tableData
} else {
this.$message.error(message)
}
@@ -718,6 +783,18 @@ export default {
}
},
+ validateSettingValue() {
+ const { windowBegin, windowEnd, minEnergy, halfLife } = this.model
+ if (!isNumber(windowBegin) || !isNumber(windowEnd) || !isNumber(minEnergy) || !isNumber(halfLife)) {
+ return false
+ }
+
+ return true
+ },
+
+ /**
+ * 图表最大值、最小值等设为按实际情况取值
+ */
resetResultChartPerform() {
this.resultChartOption.yAxis.min = undefined
this.resultChartOption.yAxis.max = undefined
@@ -731,8 +808,8 @@ export default {
handleDel(index) {
this.tableList.splice(index, 1)
this.resultChartOption.series[1].data.splice(index, 1)
- }
- }
+ },
+ },
}