@@ -102,7 +111,7 @@
import ModalMixin from '@/mixins/ModalMixin'
import TitleOverBorder from '../TitleOverBorder.vue'
import CustomChart from '@/components/CustomChart/index.vue'
-import { getAction, postAction } from '@/api/manage'
+import { getAction, postAction, putAction } from '@/api/manage'
import { cloneDeep } from 'lodash'
import { buildLineSeries } from '@/utils/chartHelper'
import SampleDataMixin from '../../SampleDataMixin'
@@ -203,6 +212,7 @@ export default {
this.columns = columns
return {
isLoading: false,
+ isCalling: false,
isSaving: false,
equation: '',
@@ -448,6 +458,43 @@ export default {
}
},
+ // 点击call按钮
+ handleCall() {
+ this.$refs.fileInput.click()
+ },
+
+ async handleFileChange(event) {
+ const { files } = event.target
+ if (files.length) {
+ const file = files[0]
+ const { inputFileName: fileName } = this.sampleData
+ const formData = new FormData()
+ formData.append('file', file)
+ formData.append('sampleFileName', fileName)
+ formData.append('width', 922)
+ formData.append('currentText', this.currSelectedDataSource)
+
+ try {
+ this.isCalling = true
+ const { success, result, message } = await postAction('/gamma/callDataResolution', formData)
+ if (success) {
+ const { ECutAnalysis_Low, G_energy_span } = result
+ this.ECutAnalysis_Low = ECutAnalysis_Low
+ this.G_energy_span = G_energy_span
+
+ this.handleResult(result)
+ } else {
+ this.$message.error(message)
+ }
+ } catch (error) {
+ console.error(error)
+ } finally {
+ this.isCalling = false
+ }
+ }
+ event.target.value = ''
+ },
+
// 应用
async handleApply() {
try {
@@ -483,8 +530,20 @@ export default {
this.getData(item)
},
- handleSetToCurrent() {
+ async handleSetToCurrent() {
this.appliedDataSource = this.currSelectedDataSource
+ try {
+ const { inputFileName: fileName } = this.sampleData
+
+ const { success, message } = await putAction(
+ `/gamma/setCurrentResolution?fileName=${fileName}¤tName=${this.currSelectedDataSource}`
+ )
+ if (!success) {
+ this.$message.error(message)
+ }
+ } catch (error) {
+ console.error(error)
+ }
}
}
}
@@ -531,7 +590,7 @@ export default {
&.has-data {
::v-deep {
.ant-table-body {
- height: 182px;
+ height: 193px;
background-color: #06282a;
}
}
@@ -539,7 +598,7 @@ export default {
::v-deep {
.ant-table-placeholder {
- height: 183px;
+ height: 194px;
display: flex;
justify-content: center;
align-items: center;
diff --git a/src/views/spectrumAnalysis/components/Modals/SampleInfomationModal.vue b/src/views/spectrumAnalysis/components/Modals/SampleInfomationModal.vue
index 52a16cf..95b8912 100644
--- a/src/views/spectrumAnalysis/components/Modals/SampleInfomationModal.vue
+++ b/src/views/spectrumAnalysis/components/Modals/SampleInfomationModal.vue
@@ -2,15 +2,12 @@
-
-
-
-
- {{ data[item.key] }}
-
-
-
-
+
+
+ {{ item.title }}:
+ {{ data[item.key] }}
+
+
@@ -25,7 +22,7 @@
diff --git a/src/views/spectrumAnalysis/components/SpectraListInMenu.vue b/src/views/spectrumAnalysis/components/SpectraListInMenu.vue
index 6969a05..f55065b 100644
--- a/src/views/spectrumAnalysis/components/SpectraListInMenu.vue
+++ b/src/views/spectrumAnalysis/components/SpectraListInMenu.vue
@@ -1,11 +1,16 @@
@@ -26,25 +31,25 @@ export default {
this.$forceUpdate()
},
- handleRemove(spectraItem) {
- const index = this.list.findIndex(item => item == spectraItem)
- this.list.splice(index, 1)
+ handleRemove(spectraItem, index) {
// 如果删除了一个选中的
if (spectraItem.checked) {
- if (index == 0) {
- // 如果是第一个,则选中下一个
- this.handleClick(this.list[0])
- } else {
- // 如果不是第一个,则选中上一个
+ // // 如果是倒数第一个,则选中上一个
+ if (index == this.list.length - 1) {
this.handleClick(this.list[index - 1])
}
+ // 否则选中下一个
+ else {
+ this.handleClick(this.list[index + 1])
+ }
}
+ this.list.splice(index, 1)
this.$forceUpdate()
}
},
watch: {
list(newVal) {
- if (newVal.length) {
+ if (newVal.length && !newVal.find(item => item.checked)) {
this.handleClick(newVal[0])
}
}
diff --git a/src/views/spectrumAnalysis/components/SubOperators/BetaGammaQcFlags.vue b/src/views/spectrumAnalysis/components/SubOperators/BetaGammaQcFlags.vue
index 3b86cb4..99eed46 100644
--- a/src/views/spectrumAnalysis/components/SubOperators/BetaGammaQcFlags.vue
+++ b/src/views/spectrumAnalysis/components/SubOperators/BetaGammaQcFlags.vue
@@ -63,7 +63,7 @@ export default {
align-items: center;
width: 150px;
height: 30px;
- cursor: default;
+ cursor: pointer;
&:not(:last-child) {
margin-right: 2px;
diff --git a/src/views/spectrumAnalysis/gamma-analysis.vue b/src/views/spectrumAnalysis/gamma-analysis.vue
index 47a3b89..c6d48af 100644
--- a/src/views/spectrumAnalysis/gamma-analysis.vue
+++ b/src/views/spectrumAnalysis/gamma-analysis.vue
@@ -17,7 +17,7 @@
v-if="!isLoading"
slot="content"
@change="handleGraphAssistanceChange"
- @reset="handleReset"
+ @reset="handleResetChart"
/>
+
+
+
+
+
@@ -98,160 +104,22 @@ import QcFlags from './components/SubOperators/QcFlags.vue'
import GraphAssistance from './components/SubOperators/GraphAssistance.vue'
import NuclideLibrary from './components/SubOperators/NuclideLibrary.vue'
import ButtonWithSwitchIcon from './components/SubOperators/ButtonWithSwitchIcon.vue'
-import { getAction } from '@/api/manage'
+import { getAction, postAction } from '@/api/manage'
import Response from './response.json'
-import { buildLineSeries, findSeriesByName, getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper'
+import {
+ buildLineSeries,
+ findSeriesByName,
+ getAxisMax,
+ getXAxisAndYAxisByPosition,
+ rangeNumber,
+} from '@/utils/chartHelper'
import { cloneDeep } from 'lodash'
import axios from 'axios'
import NuclideReviewModal from './components/Modals/AnalyzeInteractiveToolModal/components/NuclideReviewModal.vue'
+import CompareFileListModal from './components/Modals/CompareFileListModal.vue'
+import ReProcessingModal from './components/Modals/ReProcessingModal/index.vue'
-// 初始配置
-const initialOption = {
- grid: {
- top: 40,
- left: 60,
- right: 50,
- containLabel: true,
- },
- title: {
- text: '',
- left: 'center',
- bottom: 10,
- textStyle: {
- color: '#8FD4F8',
- rich: {
- a: {
- padding: [0, 20, 0, 0],
- fontSize: 16,
- },
- },
- },
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- lineStyle: {
- color: '#3CAEBB',
- width: 1,
- type: 'solid',
- },
- },
- formatter: undefined,
- className: 'figure-chart-option-tooltip',
- },
- xAxis: {
- name: 'Channel',
- nameTextStyle: {
- color: '#8FD4F8',
- fontSize: 16,
- align: 'right',
- verticalAlign: 'top',
- padding: [30, 0, 0, 0],
- },
- axisLine: {
- lineStyle: {
- color: '#ade6ee',
- },
- },
- splitLine: {
- show: false,
- },
- axisLabel: {
- textStyle: {
- color: '#ade6ee',
- },
- },
- min: 1,
- max: 'dataMax',
- animation: false,
- axisLabel: {
- formatter: (value) => {
- return parseInt(value)
- },
- },
- },
- yAxis: {
- name: 'Counts',
- type: 'value',
- nameTextStyle: {
- color: '#8FD4F8',
- fontSize: 16,
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: '#ade6ee',
- },
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: 'rgba(173, 230, 238, .2)',
- },
- },
- axisLabel: {
- textStyle: {
- color: '#ade6ee',
- },
- },
- min: 1,
- max: 'dataMax',
- animation: false,
- axisLabel: {
- formatter: (value) => {
- return value.toFixed(1)
- },
- },
- },
- series: [],
- brush: {},
-}
-
-// 缩略图配置
-const thumbnailOption = {
- grid: {
- top: 0,
- left: 5,
- right: 5,
- bottom: 0,
- },
- xAxis: {
- type: 'category',
- axisLine: {
- show: false,
- },
- splitLine: {
- show: false,
- },
- axisLabel: {
- show: false,
- },
- min: 1,
- max: 'dataMax',
- },
- yAxis: {
- type: 'value',
- axisLine: {
- show: false,
- },
- splitLine: {
- show: false,
- },
- axisLabel: {
- show: false,
- },
- min: 1,
- max: 'dataMax',
- },
- series: [],
-}
-
-const graphAssistance = {
- axisType: 'Channel',
- Baseline: true,
- SCAC: true,
- Lc: true,
-}
+import { GammaOptions, graphAssistance } from './settings'
export default {
props: {
@@ -268,24 +136,42 @@ export default {
NuclideLibrary,
ButtonWithSwitchIcon,
NuclideReviewModal,
+ CompareFileListModal,
+ ReProcessingModal,
},
data() {
return {
isLoading: false,
isLoadingNuclide: false,
- option: cloneDeep(initialOption),
+ option: cloneDeep(GammaOptions.option),
opts: {
notMerge: false,
},
- thumbnailOption: cloneDeep(thumbnailOption),
+ thumbnailOption: cloneDeep(GammaOptions.thumbnailOption),
detailedInfomation: [],
qcFlags: [],
graphAssistance: cloneDeep(graphAssistance),
nuclideLibraryVisible: false,
- channelPeakGroup: [],
- energyPeakGroup: [],
+ channelData: {
+ peakGroup: [],
+ spectrumLine: null,
+ baseLine: null,
+ lcLine: null,
+ scacLine: null,
+ all: null,
+ baseLineCP: [],
+ },
+ energyData: {
+ peakGroup: [],
+ spectrumLine: null,
+ baseLine: null,
+ lcLine: null,
+ scacLine: null,
+ all: null,
+ baseLineCP: [],
+ },
nuclideLibraryList: [], // 当前鼠标点击选中的channel
peakInfomationTooltip: {
@@ -301,15 +187,23 @@ export default {
nuclide: '',
},
currChannel: -1,
+
+ compareFileListModalVisible: false, // Compare 弹窗
+ reprocessingModalVisible: false, // 重新分析弹窗
+ isProcessing: false, // 正在处理
}
},
created() {
this.option.title.text = '{a|Channel:0} {a|Energy:0} {a|Counts:0} {a|Detectability:0}'
+ this.option.tooltip.formatter = this.tooltipFormatter
+
this.$bus.$on('colorChange', this.handleColorChange)
this.$bus.$on('gammaRefresh', this.handleRefresh)
this.$bus.$on('accept', this.handleAccept)
},
destroyed() {
+ this.cancelLastRequest()
+
this.$bus.$off('colorChange', this.handleColorChange)
this.$bus.$off('gammaRefresh', this.handleRefresh)
this.$bus.$off('accept', this.handleAccept)
@@ -318,22 +212,17 @@ export default {
this.option.brush = { toolbox: [] }
},
methods: {
+ // 获取样品详情
async getSampleDetail() {
const { dbName, sampleId } = this.sample
try {
this.isLoading = true
- this.reset()
+ this.handleResetState()
// const { success, result, message } = Response
-
- if (this._cancelToken && typeof this._cancelToken == 'function') {
- this._cancelToken()
- }
-
- const cancelToken = new axios.CancelToken((c) => {
- this._cancelToken = c
- })
+ this.cancelLastRequest()
+ const cancelToken = this.createCancelToken()
const { success, result, message } = await getAction(
'/gamma/gammaByDB',
@@ -358,12 +247,19 @@ export default {
const { inputFileName: fileName } = this.sample
try {
this.isLoading = true
- this.option.series = []
- this.thumbnailOption.series = []
+ this.handleResetState()
// const { success, result, message } = Response
- const { success, result, message } = await getAction('/gamma/gammaByFile', {
- fileName,
- })
+
+ this.cancelLastRequest()
+ const cancelToken = this.createCancelToken()
+
+ const { success, result, message } = await getAction(
+ '/gamma/gammaByFile',
+ {
+ fileName,
+ },
+ cancelToken
+ )
console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
if (success) {
this.dataProsess(result)
@@ -375,6 +271,19 @@ export default {
}
},
+ cancelLastRequest() {
+ if (this._cancelToken && typeof this._cancelToken == 'function') {
+ this._cancelToken()
+ }
+ },
+
+ createCancelToken() {
+ const cancelToken = new axios.CancelToken((c) => {
+ this._cancelToken = c
+ })
+ return cancelToken
+ },
+
dataProsess(result) {
this.isLoading = false
@@ -399,59 +308,52 @@ export default {
this.detailedInfomation = DetailedInformation
this.qcFlags = QCFlag
- const channelPeakGroup = allData.filter((item) => item.name == 'Peak' && item.group == 'channel')
- const energyPeakGroup = allData.filter((item) => item.name == 'Peak' && item.group == 'energy')
+ const channelPeakGroup = this.getLineData(allData, 'Peak', 'channel', true)
+ const energyPeakGroup = this.getLineData(allData, 'Peak', 'energy', true)
- const channelBaseLine = allData.find((item) => item.name == 'BaseLine' && item.group == 'channel') || {}
- const energyBaseLine = allData.find((item) => item.name == 'BaseLine' && item.group == 'energy')
+ const channelBaseLine = this.getLineData(allData, 'BaseLine', 'channel')
+ const energyBaseLine = this.getLineData(allData, 'BaseLine', 'energy')
- const channelLcLine = allData.find((item) => item.name == 'Lc' && item.group == 'channel') || {}
- const energyLcLine = allData.find((item) => item.name == 'Lc' && item.group == 'energy')
+ const channelLcLine = this.getLineData(allData, 'Lc', 'channel')
+ const energyLcLine = this.getLineData(allData, 'Lc', 'energy')
- const channelScacLine = allData.find((item) => item.name == 'Scac' && item.group == 'channel') || {}
- const energyScacLine = allData.find((item) => item.name == 'Scac' && item.group == 'energy')
+ const channelScacLine = this.getLineData(allData, 'Scac', 'channel')
+ const energyScacLine = this.getLineData(allData, 'Scac', 'energy')
- this.allEnergy = allData.find((item) => item.name == 'Energy' && item.group == 'energy') || {}
- this.allChannel = allData.find((item) => item.name == 'Count' && item.group == 'channel')
+ const allChannel = this.getLineData(allData, 'Count', 'channel')
+ const allEnergy = this.getLineData(allData, 'Energy', 'energy')
- // 保存Peak Line
- this.channelPeakGroup = channelPeakGroup
- this.energyPeakGroup = energyPeakGroup
+ this.channelData = {
+ peakGroup: channelPeakGroup,
+ spectrumLine: shadowChannelChart,
+ baseLine: channelBaseLine,
+ lcLine: channelLcLine,
+ scacLine: channelScacLine,
+ all: allChannel,
+ baseLineCP: shapeChannelData,
+ }
- // 保存 Spectrum Line
- this.shadowChannelChart = shadowChannelChart
- this.shadowEnergyChart = shadowEnergyChart
-
- // 保存基线
- this.channelBaseLine = channelBaseLine
- this.energyBaseLine = energyBaseLine
-
- // 保存Lc
- this.channelLcLine = channelLcLine
- this.energyLcLine = energyLcLine
-
- // 保存Scac
- this.channelScacLine = channelScacLine
- this.energyScacLine = energyScacLine
-
- // 保存 基线控制点
- this.shapeChannelData = shapeChannelData
- this.shapeEnergyData = shapeEnergyData
-
- this.option.yAxis.max =
- shadowChannelChart.pointlist && Math.ceil(Math.max(...shadowChannelChart.pointlist.map((item) => item.y)) * 1.1)
- this.thumbnailOption.yAxis.max =
- shadowChannelChart.pointlist && Math.ceil(Math.max(...shadowChannelChart.pointlist.map((item) => item.y)) * 1.1)
+ this.energyData = {
+ peakGroup: energyPeakGroup,
+ spectrumLine: shadowEnergyChart,
+ baseLine: energyBaseLine,
+ lcLine: energyLcLine,
+ scacLine: energyScacLine,
+ all: allEnergy,
+ baseLineCP: shapeEnergyData,
+ }
+ this.resetThumbnailChartDataMax()
const series = []
// 推入Spectrum Line
series.push(
buildLineSeries(
'Spectrum',
- shadowChannelChart.pointlist && shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
+ this.transformPointListData(shadowChannelChart.pointlist),
shadowChannelChart.color,
{
+ symbolSize: 2,
markLine: {
silent: true,
symbol: 'none',
@@ -468,65 +370,33 @@ export default {
)
)
- // 右上角缩略图推入Spectrum Line
- this.thumbnailOption.series.push(
- buildLineSeries(
- 'Spectrum',
- shadowChannelChart.pointlist && shadowChannelChart.pointlist.map(({ x, y }) => [x, y]),
- shadowChannelChart.color,
- {
- silent: true,
- markLine: {
- silent: true,
- symbol: 'none',
- label: {
- show: false,
- },
- lineStyle: {
- type: 'solid',
- color: '#1397a3',
- width: 1,
- },
- data: [],
- },
- }
- )
+ // 右上角缩略图设置Spectrum Line 数据
+ this.setSeriesData(
+ this.thumbnailOption.series,
+ 'Spectrum',
+ this.transformPointListData(shadowChannelChart.pointlist),
+ shadowChannelChart.color
)
// 推入BaseLine
series.push(
- buildLineSeries(
- 'BaseLine',
- channelBaseLine.pointlist && channelBaseLine.pointlist.map(({ x, y }) => [x, y]),
- channelBaseLine.color,
- {
- zlevel: 2,
- }
- )
+ buildLineSeries('BaseLine', this.transformPointListData(channelBaseLine.pointlist), channelBaseLine.color, {
+ zlevel: 2,
+ })
)
// 推入LcLine线
series.push(
- buildLineSeries(
- 'LcLine',
- channelLcLine.pointlist && channelLcLine.pointlist.map(({ x, y }) => [x, y]),
- channelLcLine.color,
- {
- zlevel: 3,
- }
- )
+ buildLineSeries('LcLine', this.transformPointListData(channelLcLine.pointlist), channelLcLine.color, {
+ zlevel: 3,
+ })
)
// 推入Scac线
series.push(
- buildLineSeries(
- 'ScacLine',
- channelScacLine.pointlist && channelScacLine.pointlist.map(({ x, y }) => [x, y]),
- channelScacLine.color,
- {
- zlevel: 4,
- }
- )
+ buildLineSeries('ScacLine', this.transformPointListData(channelScacLine.pointlist), channelScacLine.color, {
+ zlevel: 4,
+ })
)
// 推入基线控制点
@@ -554,94 +424,131 @@ export default {
const peakLines = []
channelPeakGroup.forEach((item, index) => {
peakLines.push(
- buildLineSeries(
- `Peak_${index}`,
- item.pointlist.map(({ x, y }) => [x, y]),
- item.color,
- {
- zlevel: 6,
- }
- )
+ buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
+ zlevel: 6,
+ })
)
})
series.push(...peakLines)
- this.option.series = series
- this.option.tooltip.formatter = this.tooltipFormatter
+ // 推入Compare Line
+ series.push(
+ buildLineSeries('Compare', [], '#fff', {
+ symbolSize: 2,
+ })
+ )
+
+ this.option.series = series
},
+ // chart 的 tooltip
tooltipFormatter(params) {
- if (this.isEnergy()) {
- const energy = params[0].value[0]
- const channel = this.getChannelByEnergy(energy)
+ let channel = 0
+ let energy = 0
+ const value = params[0].value[0]
- return `Channel: ${channel}
- Energy: ${energy.toFixed(2)}
`
+ if (this.isEnergy()) {
+ energy = value.toFixed(2)
+ channel = this.getChannelByEnergy(energy)
} else {
- const channel = parseInt(params[0].value[0].toFixed())
- const energy = this.allEnergy.pointlist && this.allEnergy.pointlist[channel - 1]
- return energy
- ? `Channel: ${channel}
- Energy: ${energy.x.toFixed(2)}
`
- : undefined
+ const allPointList = this.energyData.all.pointlist
+ channel = parseInt(value.toFixed())
+ energy = allPointList && allPointList[channel - 1]
+ energy = energy ? energy.x.toFixed(2) : undefined
}
+
+ return `Channel: ${channel}
+ Energy: ${energy}
`
},
// Graph Assistance 操作
handleGraphAssistanceChange({ type, label, value }) {
+ const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
+ const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
+ const compareLineSeries = findSeriesByName(this.option.series, 'Compare')
+
// 类型变化
if (type == 'labelChange') {
switch (label) {
case 'Linear':
this.option.yAxis.type = 'value'
this.thumbnailOption.yAxis.type = 'value'
- this.handleReset()
+ this.handleResetChart()
break
case 'Log10':
this.option.yAxis.type = 'log'
this.thumbnailOption.yAxis.type = 'log'
- this.handleReset()
+ this.handleResetChart()
break
case 'Channel':
case 'Energy':
this.graphAssistance.axisType = label
this.option.xAxis.name = label
- this.handleReset()
+ this.handleResetChart()
this.redrawLineBySeriesName(
'BaseLine',
- this.energyBaseLine,
- this.channelBaseLine,
+ this.energyData.baseLine,
+ this.channelData.baseLine,
this.graphAssistance.Baseline
)
- this.redrawLineBySeriesName('LcLine', this.energyLcLine, this.channelLcLine, this.graphAssistance.Lc)
+ this.redrawLineBySeriesName(
+ 'LcLine',
+ this.energyData.lcLine,
+ this.channelData.lcLine,
+ this.graphAssistance.Lc
+ )
this.redrawLineBySeriesName(
'ScacLine',
- this.energyScacLine,
- this.channelScacLine,
+ this.energyData.scacLine,
+ this.channelData.scacLine,
this.graphAssistance.SCAC
)
- this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart)
+ this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine)
this.redrawCtrlPointBySeriesName()
this.redrawPeakLine()
this.redrawThumbnailChart()
+
+ if (this.channelCompareLine) {
+ this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
+ }
break
case 'Lines':
- this.option.series[0].type = 'line'
- this.option.series[0].symbol = 'none'
+ this.graphAssistance.spectrumType = 'Lines'
- this.thumbnailOption.series[0].type = 'line'
- this.thumbnailOption.series[0].symbol = 'none'
+ spectrumLineSeries.type = 'line'
+ spectrumLineSeries.symbol = 'none'
+
+ thumbnailSpectrumLineSeries.type = 'line'
+ thumbnailSpectrumLineSeries.symbol = 'none'
+
+ compareLineSeries.type = 'line'
+ compareLineSeries.symbol = 'none'
+
+ this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine)
+
+ if (this.channelCompareLine) {
+ this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
+ }
break
case 'Scatter':
- this.option.series[0].type = 'scatter'
- this.option.series[0].symbol = 'circle'
+ this.graphAssistance.spectrumType = 'Scatter'
- this.thumbnailOption.series[0].type = 'scatter'
- this.thumbnailOption.series[0].symbol = 'circle'
+ spectrumLineSeries.type = 'scatterGL'
+ spectrumLineSeries.symbol = 'circle'
+
+ thumbnailSpectrumLineSeries.type = 'scatterGL'
+ thumbnailSpectrumLineSeries.symbol = 'circle'
+
+ compareLineSeries.type = 'scatterGL'
+ compareLineSeries.symbol = 'circle'
+
+ this.$nextTick(() => {
+ this.rangeScatter()
+ })
break
}
}
@@ -653,19 +560,19 @@ export default {
case 'Cursor':
// 显示红色竖线
if (value) {
- this.option.series[0].markLine.lineStyle.width = 2
+ spectrumLineSeries.markLine.lineStyle.width = 2
} else {
- this.option.series[0].markLine.lineStyle.width = 0
+ spectrumLineSeries.markLine.lineStyle.width = 0
}
break
case 'Baseline':
- this.redrawLineBySeriesName('BaseLine', this.energyBaseLine, this.channelBaseLine, value)
+ this.redrawLineBySeriesName('BaseLine', this.energyData.baseLine, this.channelData.baseLine, value)
break
case 'Lc':
- this.redrawLineBySeriesName('LcLine', this.energyLcLine, this.channelLcLine, value)
+ this.redrawLineBySeriesName('LcLine', this.energyData.lcLine, this.channelData.lcLine, value)
break
case 'SCAC':
- this.redrawLineBySeriesName('ScacLine', this.energyScacLine, this.channelScacLine, value)
+ this.redrawLineBySeriesName('ScacLine', this.energyData.scacLine, this.channelData.scacLine, value)
break
}
}
@@ -676,20 +583,19 @@ export default {
},
// 根据seriesName重绘线
- redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true) {
- const series = findSeriesByName(this.option.series, seriesName)
+ redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true, color) {
if (isShow) {
const data = this.isEnergy() ? energyData : channelData
- series.data = data.pointlist.map(({ x, y }) => [x, y])
+ this.setSeriesData(this.option.series, seriesName, this.transformPointListData(data.pointlist), color)
} else {
- series.data = []
+ this.setSeriesData(this.option.series, seriesName, [])
}
},
// 重绘控制点
redrawCtrlPointBySeriesName() {
const series = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
- const data = this.isEnergy() ? this.shapeEnergyData : this.shapeChannelData
+ const data = this.isEnergy() ? this.energyData.baseLineCP : this.channelData.baseLineCP
series.data = data.map(({ size, color, point: { x, y } }) => {
return {
value: [x, y],
@@ -708,18 +614,13 @@ export default {
return !item.name.includes('Peak_')
})
- const data = this.isEnergy() ? this.energyPeakGroup : this.channelPeakGroup
+ const data = this.isEnergy() ? this.energyData.peakGroup : this.channelData.peakGroup
const peakLines = []
data.forEach((item, index) => {
peakLines.push(
- buildLineSeries(
- `Peak_${index}`,
- item.pointlist.map(({ x, y }) => [x, y]),
- item.color,
- {
- zlevel: 6,
- }
- )
+ buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
+ zlevel: 6,
+ })
)
})
@@ -728,30 +629,38 @@ export default {
// 重绘右上角的缩略图
redrawThumbnailChart() {
- const series = this.thumbnailOption.series[0]
- const data = this.isEnergy() ? this.shadowEnergyChart : this.shadowChannelChart
- series.data = data.pointlist.map(({ x, y }) => [x, y])
+ const series = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
+ const data = this.isEnergy() ? this.energyData.spectrumLine : this.channelData.spectrumLine
+ series.data = this.transformPointListData(data.pointlist)
},
// 点击图表,设置红线
handleChartClick(param) {
const { offsetX, offsetY } = param
- const point = getXAxisAndYAxisByPosition(this.$refs.chartRef.getChartInstance(), offsetX, offsetY)
+ const point = getXAxisAndYAxisByPosition(this.getChart(), offsetX, offsetY)
if (point) {
const xAxis = point[0]
- this.option.series[0].markLine.data[0].xAxis = xAxis
+ const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
+ spectrumLineSeries.markLine.data[0].xAxis = xAxis
const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
const energy = this.isEnergy()
? xAxis.toFixed(2)
- : this.allEnergy.pointlist && this.allEnergy.pointlist[channel - 1].x.toFixed(2)
- const counts = this.isEnergy() ? this.allEnergy.pointlist[channel - 1] : this.allChannel.pointlist[channel - 1]
+ : this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2)
+ const counts = this.isEnergy()
+ ? this.energyData.all.pointlist[channel - 1]
+ : this.channelData.all.pointlist[channel - 1]
this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts.y}} {a|Detectability:0}`
this.getSelPosNuclide(channel)
}
},
+ // 双击还原
+ handleChartDblClick() {
+ this.handleResetChart()
+ },
+
// 获取 Nuclide Library 数据
async getSelPosNuclide(channel) {
this.currChannel = channel
@@ -799,9 +708,10 @@ export default {
// 触发Peak Infomation
handleTogglePeak() {
- const xAxis = this.option.series[0].markLine.data[0].xAxis
+ const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
+ const xAxis = spectrumLineSeries.markLine.data[0].xAxis
const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
- const index = this.channelPeakGroup.findIndex((peakItem) => {
+ const index = this.channelData.peakGroup.findIndex((peakItem) => {
const allX = peakItem.pointlist.map((item) => item.x)
const max = Math.max(...allX)
const min = Math.min(...allX)
@@ -824,14 +734,12 @@ export default {
})
if (success) {
const html = result.replaceAll('\n', '
')
- const currPeak = this.channelPeakGroup[index]
+ const currPeak = this.channelData.peakGroup[index]
const { x, y } = currPeak.pointlist.reduce((prev, curr) => {
return prev && prev.y > curr.y ? prev : curr
})
- const chart = this.$refs.chartRef.getChartInstance()
-
- const [xPix, yPix] = chart.convertToPixel({ seriesIndex: 0 }, [x, y])
+ const [xPix, yPix] = this.getChart().convertToPixel({ seriesIndex: 0 }, [x, y])
this.peakInfomationTooltip.content = html
this.peakInfomationTooltip.visible = true
this.peakInfomationTooltip.left = xPix
@@ -854,10 +762,11 @@ export default {
* @param { 'left'| 'right' } direction
*/
moveMarkLine(direction) {
- const prevAxis = this.option.series[0].markLine.data[0].xAxis
+ const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
+ const prevAxis = spectrumLineSeries.markLine.data[0].xAxis
// 获取每一段 Channel 中的最大值
- const maxXAxises = this.channelPeakGroup.map((item) => {
+ const maxXAxises = this.channelData.peakGroup.map((item) => {
const allY = item.pointlist.map((item) => item.y)
const max = item.pointlist.find((point) => point.y == Math.max(...allY))
return max.x
@@ -868,13 +777,13 @@ export default {
// 找到第一个比prevAxis大的xAxis
find = maxXAxises.find((xAxis) => xAxis > prevAxis)
if (find) {
- this.option.series[0].markLine.data[0].xAxis = find
+ spectrumLineSeries.markLine.data[0].xAxis = find
}
} else if (direction == 'left') {
// 找到第一个比prevAxis小的xAxis
find = maxXAxises.reverse().find((xAxis) => xAxis < prevAxis)
if (find) {
- this.option.series[0].markLine.data[0].xAxis = find
+ spectrumLineSeries.markLine.data[0].xAxis = find
}
}
@@ -885,8 +794,7 @@ export default {
// 鼠标按下时开启可刷选状态
handleMouseDown() {
- const chart = this.$refs.chartRef.getChartInstance()
- chart.dispatchAction({
+ this.getChart().dispatchAction({
type: 'takeGlobalCursor',
// 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。
key: 'brush',
@@ -898,13 +806,16 @@ export default {
},
handleMouseUp() {
- setTimeout(() => {
- const chart = this.$refs.chartRef.getChartInstance()
- this.clearBrush(chart)
+ if (this.timer) {
+ window.clearTimeout(this.timer)
+ }
+ this.timer = setTimeout(() => {
+ this.clearBrush()
}, 0)
},
- clearBrush(chart) {
+ clearBrush() {
+ const chart = this.getChart()
// 清理刷选的范围
chart.dispatchAction({
type: 'brush',
@@ -930,13 +841,18 @@ export default {
const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map((num) => parseInt(num.toFixed()))
const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map((num) => parseInt(num.toFixed()))
- const xAxisMax = chart.getModel().getComponent('xAxis').axis.scale._extent[1]
- const yAxisMax = this.option.yAxis.max
+ // 拿到之前的最大值
+ const xAxisMax = getAxisMax(chart, 'xAxis')
+ const yAxisMax = getAxisMax(chart, 'yAxis')
+
+ // 拿到之前的最小值
+ const xAxisMin = this.option.xAxis.min
+ const yAxisMin = this.option.yAxis.min
let [x1, y2, x2, y1] = [...point1, ...point2] // 根据解析出的数据确定真实的范围
- const xAxisLimit = rangeNumber(1, xAxisMax)
- const yAxisLimit = rangeNumber(1, yAxisMax)
+ const xAxisLimit = rangeNumber(xAxisMin, xAxisMax)
+ const yAxisLimit = rangeNumber(yAxisMin, yAxisMax)
x1 = xAxisLimit(x1)
x2 = xAxisLimit(x2)
@@ -957,21 +873,89 @@ export default {
this.setThumbnailChartRect(x1, y2, x2, y1)
}
- const thumbnailChart = this.$refs.thumbnailChartRef.getChartInstance()
+ const thumbnailChart = this.getThumbnailChart()
const [, maxYPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [0, y1]) // 方框的上下两条边的yAxis转为pix
const [, minYPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [0, y2])
const rectHeightPixel = maxYPixel - minYPixel // 计算方框的左右边长(pix)
this.halfHeightPixel = rectHeightPixel / 2
}
- this.clearBrush(chart)
+ this.$nextTick(() => {
+ this.rangeScatter()
+ })
+ },
+
+ /**
+ * 因scatterGL 不受axis中max和min的控制,手动处理溢出部分
+ * @param {Boolean} isReset 是否重置到初始状态
+ */
+ rangeScatter(isReset) {
+ if (!this.isScatter()) {
+ return
+ }
+
+ const {
+ xAxis: { min: x1 },
+ yAxis: { min: y1 },
+ } = this.option
+
+ const chart = this.getChart()
+ const x2 = getAxisMax(chart, 'xAxis')
+ const y2 = getAxisMax(chart, 'yAxis')
+
+ const channelSpectrumData = {
+ ...this.channelData.spectrumLine,
+ pointlist: isReset
+ ? this.pointlistLimitY(this.channelData.spectrumLine.pointlist)
+ : this.pointlistLimit(this.channelData.spectrumLine.pointlist, x1, x2, y1, y2),
+ }
+ const energySpectrumData = {
+ ...this.energyData.spectrumLine,
+ pointlist: isReset
+ ? this.pointlistLimitY(this.energyData.spectrumLine.pointlist)
+ : this.pointlistLimit(this.energyData.spectrumLine.pointlist, x1, x2, y1, y2),
+ }
+ this.redrawLineBySeriesName('Spectrum', energySpectrumData, channelSpectrumData)
+
+ if (this.channelCompareLine) {
+ const channelCompareLine = {
+ ...this.channelCompareLine,
+ pointlist: isReset
+ ? this.pointlistLimitY(this.channelCompareLine.pointlist)
+ : this.pointlistLimit(this.channelCompareLine.pointlist, x1, x2, y1, y2),
+ }
+ const energyCompareLine = {
+ ...this.energyCompareLine,
+ pointlist: isReset
+ ? this.pointlistLimitY(this.energyCompareLine.pointlist)
+ : this.pointlistLimit(this.energyCompareLine.pointlist, x1, x2, y1, y2),
+ }
+ this.redrawLineBySeriesName('Compare', energyCompareLine, channelCompareLine)
+ }
+ },
+
+ /**
+ * 筛选范围内的点
+ * @param {*} pointlist
+ * @param {*} x1
+ * @param {*} x2
+ * @param {*} y1
+ * @param {*} y2
+ */
+ pointlistLimit(pointlist, x1, x2, y1, y2) {
+ return pointlist.filter(({ x, y }) => x >= x1 && x <= x2 && y >= y1 && y <= y2)
+ },
+
+ pointlistLimitY(pointlist) {
+ return pointlist.filter(({ y }) => y >= 1)
},
// 在右上角缩略图中设置范围
setThumbnailChartRect(x1, y2, x2, y1) {
this.thumbnailChartRect = [x1, y2, x2, y1]
- const { markLine } = this.thumbnailOption.series[0]
+ const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
+ const { markLine } = thumbnailSpectrumLineSeries
const pointList = [
[
[x1, y1],
@@ -999,19 +983,23 @@ export default {
// 缩略图点击
handleThumbnailChartClick(param) {
const { offsetX, offsetY } = param
- const thumbnailChart = this.$refs.thumbnailChartRef.getChartInstance()
+ const thumbnailChart = this.getThumbnailChart()
const point = getXAxisAndYAxisByPosition(thumbnailChart, offsetX, offsetY)
if (point && this.thumbnailChartRect && this.thumbnailChartRect.length) {
const [x1, y2, x2, y1] = this.thumbnailChartRect
const halfWidth = Math.ceil((x2 - x1) / 2)
- const [, maxYAxisPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [0, this.thumbnailOption.yAxis.max]) // 缩略图最大值转为pix
+ // 缩略图最大值转为pix
+ const [, maxYAxisPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [
+ 0,
+ getAxisMax(thumbnailChart, 'yAxis'),
+ ])
const [, minYAxisPixel] = thumbnailChart.convertToPixel({ seriesIndex: 0 }, [0, 1])
let [xAxis, yAxis] = point
- const xAxisMax = thumbnailChart.getModel().getComponent('xAxis').axis.scale._extent[1]
+ const xAxisMax = getAxisMax(thumbnailChart, 'xAxis')
const xAxisLimit = rangeNumber(1 + halfWidth, xAxisMax - halfWidth)
@@ -1029,8 +1017,8 @@ export default {
this.setThumbnailChartRect(xAxis - halfWidth, maxYAxis, xAxis + halfWidth, minYAxis)
if (this.isEnergy()) {
- const x1 = parseInt(this.shadowEnergyChart.pointlist[xAxis - halfWidth].x)
- const x2 = parseInt(this.shadowEnergyChart.pointlist[xAxis + halfWidth].x)
+ const x1 = parseInt(this.energyData.spectrumLine.pointlist[xAxis - halfWidth].x)
+ const x2 = parseInt(this.energyData.spectrumLine.pointlist[xAxis + halfWidth].x)
this.option.xAxis.min = x1
this.option.xAxis.max = x2
@@ -1041,85 +1029,126 @@ export default {
this.option.yAxis.min = minYAxis
this.option.yAxis.max = maxYAxis
+
+ this.$nextTick(() => {
+ this.rangeScatter()
+ })
}
},
- // 重置
- handleReset() {
+ /**
+ * 重置图表
+ */
+ handleResetChart() {
this.option.xAxis.min = 1
this.option.xAxis.max = 'dataMax'
this.option.yAxis.min = 1
- this.option.yAxis.max = Math.ceil(Math.max(...this.shadowChannelChart.pointlist.map((item) => item.y)) * 1.1)
+ this.option.yAxis.max = 'dataMax'
- this.thumbnailOption.series[0].markLine.data = []
+ const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
+ thumbnailSpectrumLineSeries.markLine.data = []
this.thumbnailChartRect = []
this.closePeakInfomationTooltip()
+
+ this.$nextTick(() => {
+ this.rangeScatter(true)
+ })
},
// 从分析工具刷新部分数据
handleRefresh(data) {
- const { allData, shadowChannelChart, shadowEnergyChart, shapeChannelData, shapeEnergyData } = data
-
- const channelPeakGroup = allData.filter((item) => item.name == 'Peak' && item.group == 'channel')
- const energyPeakGroup = allData.filter((item) => item.name == 'Peak' && item.group == 'energy')
-
- const channelBaseLine = allData.find((item) => item.name == 'BaseLine' && item.group == 'channel')
- const energyBaseLine = allData.find((item) => item.name == 'BaseLine' && item.group == 'energy')
-
- const channelLcLine = allData.find((item) => item.name == 'Lc' && item.group == 'channel')
- const energyLcLine = allData.find((item) => item.name == 'Lc' && item.group == 'energy')
-
- const channelScacLine = allData.find((item) => item.name == 'Scac' && item.group == 'channel')
- const energyScacLine = allData.find((item) => item.name == 'Scac' && item.group == 'energy')
-
- this.allEnergy = allData.find((item) => item.name == 'Energy' && item.group == 'energy')
- this.allChannel = allData.find((item) => item.name == 'Count' && item.group == 'channel')
-
- // 保存Peak Line
- this.channelPeakGroup = channelPeakGroup
- this.energyPeakGroup = energyPeakGroup
-
- // 保存 Spectrum Line
- this.shadowChannelChart = shadowChannelChart
- this.shadowEnergyChart = shadowEnergyChart
-
- // 保存基线
- this.channelBaseLine = channelBaseLine
- this.energyBaseLine = energyBaseLine
-
- // 保存Lc
- this.channelLcLine = channelLcLine
- this.energyLcLine = energyLcLine
-
- // 保存Scac
- this.channelScacLine = channelScacLine
- this.energyScacLine = energyScacLine
-
- // 保存 基线控制点
- this.shapeChannelData = shapeChannelData
- this.shapeEnergyData = shapeEnergyData
-
- this.opts.notMerge = true
- this.redrawPeakLine()
- this.redrawCtrlPointBySeriesName()
-
- this.redrawLineBySeriesName('BaseLine', this.energyBaseLine, this.channelBaseLine, this.graphAssistance.Baseline)
- this.redrawLineBySeriesName('LcLine', this.energyLcLine, this.channelLcLine, this.graphAssistance.Lc)
- this.redrawLineBySeriesName('ScacLine', this.energyScacLine, this.channelScacLine, this.graphAssistance.SCAC)
- this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart)
-
- this.redrawThumbnailChart()
- this.$nextTick(() => {
- this.resetChartOpts()
- })
+ this.handleResetState()
+ data.DetailedInformation = this.detailedInfomation
+ this.dataProsess(data)
},
// 分析工具Accept时刷新部分数据
handleAccept() {
console.log('%c [ 分析工具Accept时刷新部分数据 ]-1046', 'font-size:13px; background:pink; color:#bf2c9f;')
+ this.clearCompareLine()
},
- // 重置图表配置
+ // 显示比较弹窗
+ showCompareModal() {
+ if (this.isLoading) {
+ this.$message.warn('Sample is Loading')
+ return
+ }
+ this.handleResetChart()
+ this.clearCompareLine()
+ this.compareFileListModalVisible = true
+ },
+
+ // 文件之间对比
+ handleCompareWithFile([channelData, energyData]) {
+ this.channelCompareLine = channelData
+ this.energyCompareLine = energyData
+ this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
+
+ if (this.isScatter()) {
+ lineSeries.type = 'scatterGL'
+ }
+
+ this.$nextTick(() => {
+ this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
+ })
+ },
+
+ // 移除 Compare 线
+ clearCompareLine() {
+ const compareLine = findSeriesByName(this.option.series, 'Compare')
+ if (compareLine) {
+ compareLine.data = []
+ this.resetThumbnailChartDataMax()
+ }
+ this.channelCompareLine = undefined
+ this.energyCompareLine = undefined
+ },
+
+ // 重新分析
+ async reProcessing() {
+ if (this.isProcessing) {
+ return
+ }
+
+ if (this.isLoading) {
+ this.$message.warn('Sample is Loading')
+ return
+ }
+
+ try {
+ this.isLoading = true
+ this.handleResetState()
+
+ const { inputFileName: fileName } = this.sample
+ const { success, result, message } = await postAction(`/gamma/Reprocessing?fileName=${fileName}`)
+ if (success) {
+ result.DetailedInformation = this.detailedInfomation
+ this.dataProsess(result)
+ } else {
+ this.isLoading = false
+ const arr = message.split('\n')
+ this.$warning({
+ title: 'Warning',
+ content: () => arr.map((text) => {text}
),
+ })
+ }
+ } catch (error) {
+ console.error(error)
+ }
+ // this.reprocessingModalVisible = true
+ },
+
+ /**
+ * 重置缩略图表y轴最大值
+ */
+ resetThumbnailChartDataMax() {
+ this.thumbnailOption.yAxis.max = 'dataMax'
+ },
+
+ /**
+ * 重置图表配置
+ */
resetChartOpts() {
this.opts.notMerge = false
this.option.brush = { toolbox: [] }
@@ -1141,12 +1170,17 @@ export default {
]
},
+ /**
+ * 根据energy获取channel
+ * @param {number} energy
+ */
getChannelByEnergy(energy) {
let channel = 0
- for (let index = 1; index < this.allEnergy.pointlist.length; index++) {
- const currEnergy = this.allEnergy.pointlist[index].x
+ const pointlist = this.energyData.all.pointlist
+ for (let index = 1; index < pointlist.length; index++) {
+ const currEnergy = pointlist[index].x
if (currEnergy >= energy) {
- const prevEnergy = this.allEnergy.pointlist[index - 1].x
+ const prevEnergy = pointlist[index - 1].x
if (currEnergy - energy > energy - prevEnergy.x) {
channel = index
} else {
@@ -1158,29 +1192,38 @@ export default {
return channel
},
- // 重置页面信息
- reset() {
+ /**
+ * 重置页面信息
+ */
+ handleResetState() {
+ this.handleResetChart()
+
this.selectedChannel = -1
this.nuclideLibraryList = []
this.closePeakInfomationTooltip()
this.option.series = []
- this.thumbnailOption.series = []
this.option.xAxis.name = 'Channel'
this.option.yAxis.type = 'value'
+ this.thumbnailOption.yAxis.type = 'value'
if (this.option.series.length) {
- this.option.series[0].type = 'line'
- this.option.series[0].symbol = 'none'
- this.option.series[0].markLine.lineStyle.width = 2
+ const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
+ spectrumLineSeries.type = 'line'
+ spectrumLineSeries.symbol = 'none'
+ spectrumLineSeries.markLine.lineStyle.width = 2
}
- if (this.thumbnailOption.series.length) {
- this.thumbnailOption.series[0].type = 'line'
- this.thumbnailOption.series[0].symbol = 'none'
- }
+ const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
+ thumbnailSpectrumLineSeries.type = 'line'
+ thumbnailSpectrumLineSeries.symbol = 'none'
+
this.graphAssistance = cloneDeep(graphAssistance)
},
+ /**
+ * 颜色改变
+ * @param {*} colorConfig
+ */
handleColorChange(colorConfig) {
// 如果还没加载完,加载新的
if (this.isLoading) {
@@ -1197,34 +1240,44 @@ export default {
const { Color_Spec, Color_Peak, Color_Lc, Color_Base, Color_Scac, Color_Compare, Color_Strip, Color_Fitbase } =
colorConfig
- this.shadowChannelChart.color = Color_Spec
- this.shadowEnergyChart.color = Color_Spec
+ this.channelData.spectrumLine.color = Color_Spec
+ this.energyData.spectrumLine.color = Color_Spec
- for (let i = 0; i < this.channelPeakGroup.length; i++) {
- this.channelPeakGroup[i].color = Color_Peak
- this.energyPeakGroup[i].color = Color_Peak
+ for (let i = 0; i < this.channelData.peakGroup.length; i++) {
+ this.channelData.peakGroup[i].color = Color_Peak
+ this.energyData.peakGroup[i].color = Color_Peak
}
- this.channelLcLine.color = Color_Lc
- this.energyLcLine.color = Color_Lc
+ this.channelData.lcLine.color = Color_Lc
+ this.energyData.lcLine.color = Color_Lc
- this.channelBaseLine.color = Color_Base
- this.energyBaseLine.color = Color_Base
+ this.channelData.baseLine.color = Color_Base
+ this.energyData.baseLine.color = Color_Base
- this.channelScacLine.color = Color_Scac
- this.energyScacLine.color = Color_Scac
+ this.channelData.scacLine.color = Color_Scac
+ this.energyData.scacLine.color = Color_Scac
+
+ if (this.channelCompareLine) {
+ this.channelCompareLine.color = Color_Compare
+ this.energyCompareLine.color = Color_Compare
+ }
this.changeColorBySeriesName('Spectrum', Color_Spec)
this.changePeakLineColor(Color_Peak)
this.changeColorBySeriesName('LcLine', Color_Lc)
this.changeColorBySeriesName('BaseLine', Color_Base)
this.changeColorBySeriesName('ScacLine', Color_Scac)
+ this.changeColorBySeriesName('Compare', Color_Compare)
const thumbnailChartSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
thumbnailChartSeries.itemStyle.color = Color_Spec
},
- // 根据series名修改颜色
+ /**
+ * 根据series名修改颜色
+ * @param {*} seriesName
+ * @param {*} color
+ */
changeColorBySeriesName(seriesName, color) {
const series = findSeriesByName(this.option.series, seriesName)
series.itemStyle.color = color
@@ -1242,6 +1295,50 @@ export default {
isEnergy() {
return this.graphAssistance.axisType == 'Energy'
},
+
+ isScatter() {
+ return this.graphAssistance.spectrumType == 'Scatter'
+ },
+
+ getChart() {
+ return this.$refs.chartRef.getChartInstance()
+ },
+
+ getThumbnailChart() {
+ return this.$refs.thumbnailChartRef.getChartInstance()
+ },
+
+ /**
+ * 设置图表数据和颜色
+ */
+ setSeriesData(series, seriesName, data, color) {
+ const find = findSeriesByName(series, seriesName)
+ find.data = data
+ if (color) {
+ find.itemStyle.color = color
+ }
+ },
+
+ /**
+ * 转换pointlist类型数据到series的data可用的数据
+ */
+ transformPointListData(pointlist) {
+ if (!pointlist) {
+ return []
+ }
+ return pointlist.map(({ x, y }) => [x, y])
+ },
+
+ /**
+ * 在返回的allData中查找指定的数据
+ * @param {Array} allData
+ * @param {*} name
+ * @param {*} group
+ */
+ getLineData(allData, name, group, isList = false) {
+ const arrFunc = isList ? Array.prototype.filter : Array.prototype.find
+ return arrFunc.call(allData, (item) => item.name == name && item.group == group) || {}
+ },
},
watch: {
sample: {
diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue
index 6f2d87a..6bceca1 100644
--- a/src/views/spectrumAnalysis/index.vue
+++ b/src/views/spectrumAnalysis/index.vue
@@ -13,7 +13,7 @@
{{ operation.title }}
-
+
{{ item.title }}
@@ -89,10 +89,6 @@
-
-
-
-
@@ -162,7 +158,6 @@
@@ -209,7 +204,6 @@ import SaveSettingModal from './components/Modals/SaveSettingModal.vue'
import AnalyzeSettingModal from './components/Modals/AnalyzeSettingModal.vue'
import AnalyzeInteractiveToolModal from './components/Modals/AnalyzeInteractiveToolModal/index.vue'
import KorsumModal from './components/Modals/KorsumModal.vue'
-import ReProcessingModal from './components/Modals/ReProcessingModal/index.vue'
import ZeroTimeModal from './components/Modals/ZeroTimeModal.vue'
import EfficiencyCalibrationModal from './components/Modals/EfficiencyCalibrationModal.vue'
import EnergyCalibrationModal from './components/Modals/EnergyCalibrationModal.vue'
@@ -235,6 +229,7 @@ import BetaGammaEnergyCalibrationModal from './components/Modals/BetaGammaModals
import StripModal from './components/Modals/StripModal.vue'
import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue'
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
+import { getAction } from '@/api/manage'
// 分析类型
const ANALYZE_TYPE = {
@@ -255,7 +250,6 @@ export default {
AnalyzeSettingModal,
AnalyzeInteractiveToolModal,
KorsumModal,
- ReProcessingModal,
ZeroTimeModal,
EfficiencyCalibrationModal,
EnergyCalibrationModal,
@@ -313,7 +307,6 @@ export default {
saveSettingModalVisible: false, // 保存设置弹窗
analyzeConfigureModalVisible: false, // 分析设置弹窗
- reprocessingModalVisible: false, // 重新分析弹窗
analyzeInteractiveToolModalVisible: false, // 分析工具弹窗
zeroTimeModalVisible: false, // Zero Time 弹窗
korsumModalShow: false, // Korsum 弹窗
@@ -388,12 +381,12 @@ export default {
},
created() {
this.$bus.$on('reanalyse', this.handleReanalyse)
- this.loadSelectedSample({
- sampleId: 426530,
- sampleType: 'G',
- dbName: 'auto',
- inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
- })
+ // this.loadSelectedSample({
+ // sampleId: 426530,
+ // sampleType: 'G',
+ // dbName: 'auto',
+ // inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
+ // })
},
destroyed() {
@@ -438,7 +431,7 @@ export default {
})
arr.forEach((item) => {
item.dbName = ''
- item.sampleId = ''
+ item.sampleId = null
item.inputFileName = item.sampleFileName
item.sampleType = item.sampleSystemType
})
@@ -475,10 +468,29 @@ export default {
* 保存结果到数据库
* @param { 'all' | 'current' } type
*/
- handleSaveResultsToDB(type) {
- console.log('%c [ saveResultsToDB ]-157', 'font-size:13px; background:pink; color:#bf2c9f;', type)
- if (type === 'current') {
- this.handleSaveResultsToDB_Cuurrent()
+ async handleSaveResultsToDB(type) {
+ if (this.isBetaGamma) {
+ if (type === 'current') {
+ this.handleSaveResultsToDB_Cuurrent()
+ }
+ } else if (this.isGamma) {
+ if (type == 'current') {
+ const hideLoading = this.$message.loading('Saving...', 0)
+ try {
+ const { success, message } = await getAction('/gamma/saveToDB', {
+ fileName: this.sampleData.inputFileName
+ })
+ if (success) {
+ this.$message.success('Save Success')
+ } else {
+ this.$message.error(message)
+ }
+ } catch (error) {
+ console.error(error)
+ } finally {
+ hideLoading()
+ }
+ }
}
},
handleSaveResultsToDB_Cuurrent() {
@@ -623,8 +635,9 @@ export default {
},
{
type: 'a-menu-item',
- title: 'Clean All',
- handler: this.handleCleanAll,
+ title: 'Compare',
+ show: this.isGamma,
+ handler: () => this.$refs.gammaAnalysisRef.showCompareModal(),
},
{
type: 'a-menu-item',
@@ -638,6 +651,11 @@ export default {
show: this.isGamma,
handler: () => (this.ftransltModalVisible = true),
},
+ {
+ type: 'a-menu-item',
+ title: 'Clean All',
+ handler: this.handleCleanAll,
+ },
],
},
{
@@ -660,8 +678,7 @@ export default {
if (spectra) {
this.loadSelectedSample(spectra)
} else {
- this.analysisType = undefined
- this.sampleData = {}
+ this.handleCleanAll()
}
},
},
@@ -673,6 +690,7 @@ export default {
children: [
{
type: 'MultiLevelMenu',
+ show: this.isBetaGamma || this.isGamma,
attrs: {
children: [
{
@@ -736,9 +754,9 @@ export default {
},
{
type: 'a-menu-item',
- title: 'ReProcessing',
+ title: 'Reprocessing',
show: this.isGamma,
- handler: () => (this.reprocessingModalVisible = true),
+ handler: () => this.$refs.gammaAnalysisRef.reProcessing(),
},
{
type: 'a-menu-item',
@@ -824,7 +842,6 @@ export default {
},
{
title: 'NUCLIDELIBRARY',
- show: !this.isBetaGamma,
children: [
{
type: 'a-menu',
@@ -832,11 +849,13 @@ export default {
{
type: 'a-menu-item',
title: 'Nuclide Library',
+ show: this.isGamma,
handler: () => (this.nuclideLibraryModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Config User Library',
+ show: this.isGamma,
handler: () => (this.configUserLibModalVisible = true),
},
],
@@ -1024,6 +1043,7 @@ export default {
{
type: 'a-menu-item',
title: 'Automatic Analysis Log',
+ show: this.isBetaGamma || this.isGamma,
handler: () => {
this.autoAnalysisMogModalType = this.isGamma ? 1 : this.isBetaGamma ? 2 : 1
this.autoAnalysisMogModalVisible = true
diff --git a/src/views/spectrumAnalysis/settings.js b/src/views/spectrumAnalysis/settings.js
new file mode 100644
index 0000000..3a89271
--- /dev/null
+++ b/src/views/spectrumAnalysis/settings.js
@@ -0,0 +1,167 @@
+import { buildLineSeries } from "@/utils/chartHelper"
+
+export const GammaOptions = {
+ option: {
+ grid: {
+ top: 40,
+ left: 60,
+ right: 50,
+ containLabel: true
+ },
+ title: {
+ text: '',
+ left: 'center',
+ bottom: 10,
+ textStyle: {
+ color: '#8FD4F8',
+ rich: {
+ a: {
+ padding: [0, 20, 0, 0],
+ fontSize: 16
+ }
+ }
+ }
+ },
+ tooltip: {
+ trigger: 'axis',
+ axisPointer: {
+ lineStyle: {
+ color: '#3CAEBB',
+ width: 1,
+ type: 'solid'
+ }
+ },
+ formatter: undefined,
+ className: 'figure-chart-option-tooltip'
+ },
+ xAxis: {
+ name: 'Channel',
+ nameTextStyle: {
+ color: '#8FD4F8',
+ fontSize: 16,
+ align: 'right',
+ verticalAlign: 'top',
+ padding: [30, 0, 0, 0]
+ },
+ axisLine: {
+ lineStyle: {
+ color: '#ade6ee'
+ }
+ },
+ splitLine: {
+ show: false
+ },
+ axisLabel: {
+ textStyle: {
+ color: '#ade6ee'
+ }
+ },
+ min: 1,
+ max: 'dataMax',
+ animation: false,
+ axisLabel: {
+ formatter: value => {
+ return parseInt(value)
+ }
+ }
+ },
+ yAxis: {
+ name: 'Counts',
+ type: 'value',
+ nameTextStyle: {
+ color: '#8FD4F8',
+ fontSize: 16
+ },
+ axisLine: {
+ show: true,
+ lineStyle: {
+ color: '#ade6ee'
+ }
+ },
+ splitLine: {
+ show: true,
+ lineStyle: {
+ color: 'rgba(173, 230, 238, .2)'
+ }
+ },
+ axisLabel: {
+ textStyle: {
+ color: '#ade6ee'
+ }
+ },
+ min: 1,
+ max: 'dataMax',
+ animation: false,
+ axisLabel: {
+ formatter: value => {
+ return value.toFixed(1)
+ }
+ }
+ },
+ series: [],
+ brush: {}
+ },
+ // 缩略图配置
+ thumbnailOption: {
+ grid: {
+ top: 0,
+ left: 5,
+ right: 5,
+ bottom: 0
+ },
+ xAxis: {
+ type: 'category',
+ axisLine: {
+ show: false
+ },
+ splitLine: {
+ show: false
+ },
+ axisLabel: {
+ show: false
+ },
+ min: 1,
+ max: 'dataMax'
+ },
+ yAxis: {
+ type: 'value',
+ axisLine: {
+ show: false
+ },
+ splitLine: {
+ show: false
+ },
+ axisLabel: {
+ show: false
+ },
+ min: 1,
+ max: 'dataMax'
+ },
+ series: [
+ buildLineSeries('Spectrum', [], '#fff', {
+ silent: true,
+ markLine: {
+ silent: true,
+ symbol: 'none',
+ label: {
+ show: false
+ },
+ lineStyle: {
+ type: 'solid',
+ color: '#1397a3',
+ width: 1
+ },
+ data: []
+ }
+ })
+ ]
+ }
+}
+
+export const graphAssistance = {
+ axisType: 'Channel',
+ spectrumType: 'Lines',
+ Baseline: true,
+ SCAC: true,
+ Lc: true,
+}
\ No newline at end of file