Merge branch 'feature-analysis-RLR-renpy' of http://git.hivekion.com:3000/xiaoguangbin/AnalysisSystemForRadionuclide_vue into master-dev

This commit is contained in:
xiaoguangbin 2023-09-27 16:23:42 +08:00
commit b746b3efa5
10 changed files with 502 additions and 383 deletions

View File

@ -99,6 +99,7 @@ export function findSeriesByName(series, seriesName) {
* 限定数字在一定范围 * 限定数字在一定范围
* @param {Number} min * @param {Number} min
* @param {Number} max * @param {Number} max
* @returns {(num: number) => number }
*/ */
export function rangeNumber(min, max) { export function rangeNumber(min, max) {
return num => { return num => {

View File

@ -133,6 +133,7 @@ import BetaGammaQcFlags from './components/SubOperators/BetaGammaQcFlags.vue'
import PopOverWithIcon from './components/SubOperators/PopOverWithIcon.vue' import PopOverWithIcon from './components/SubOperators/PopOverWithIcon.vue'
import Spectra from './components/SubOperators/Spectra.vue' import Spectra from './components/SubOperators/Spectra.vue'
import CustomSelect from '@/components/CustomSelect/index.vue' import CustomSelect from '@/components/CustomSelect/index.vue'
import axios from 'axios'
const StatisticsType = { const StatisticsType = {
'Collection Time': 'Colloc_Time', 'Collection Time': 'Colloc_Time',
@ -219,6 +220,9 @@ export default {
currSample: {}, currSample: {},
} }
}, },
destroyed() {
this.cancelLastRequest()
},
methods: { methods: {
handleGetFlag(val, obj) { handleGetFlag(val, obj) {
this.resultDisplay.forEach((item) => { this.resultDisplay.forEach((item) => {
@ -234,10 +238,16 @@ export default {
const { dbName, sampleId } = this.sample const { dbName, sampleId } = this.sample
try { try {
this.isLoading = true this.isLoading = true
const { success, result, message } = await getAction('/spectrumAnalysis/getDBSpectrumChart', { this.cancelLastRequest()
dbName, const cancelToken = this.createCancelToken()
sampleId, const { success, result, message } = await getAction(
}) '/spectrumAnalysis/getDBSpectrumChart',
{
dbName,
sampleId,
},
cancelToken
)
if (success) { if (success) {
this.sampleDetail = result this.sampleDetail = result
this.changeChartByType('sample') this.changeChartByType('sample')
@ -264,7 +274,13 @@ export default {
} }
try { try {
this.isLoading = true this.isLoading = true
const { success, result, message } = await getAction('/spectrumAnalysis/getFileSpectrumChart', params) this.cancelLastRequest()
const cancelToken = this.createCancelToken()
const { success, result, message } = await getAction(
'/spectrumAnalysis/getFileSpectrumChart',
params,
cancelToken
)
if (success) { if (success) {
this.sampleDetail = result this.sampleDetail = result
this.changeChartByType('sample') this.changeChartByType('sample')
@ -277,6 +293,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
},
changeChartByType(val) { changeChartByType(val) {
if (val === 'qc' && !this.sample.qcFileStatus) { if (val === 'qc' && !this.sample.qcFileStatus) {
this.$message.warning('No qc spectrum file!') this.$message.warning('No qc spectrum file!')

View File

@ -411,8 +411,7 @@ export default {
// //
chart.dispatchAction({ chart.dispatchAction({
type: 'takeGlobalCursor', type: 'takeGlobalCursor'
rushOption: false
}) })
}, },

View File

@ -3,7 +3,7 @@
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<pre>{{ content }}</pre> <pre>{{ content }}</pre>
</a-spin> </a-spin>
<div slot="custom-footer" style="text-align: center;"> <div slot="custom-footer" style="text-align: center">
<a-space :size="20"> <a-space :size="20">
<a-button type="primary" @click="handleOk">Export</a-button> <a-button type="primary" @click="handleOk">Export</a-button>
<a-button @click="visible = false">Cancel</a-button> <a-button @click="visible = false">Cancel</a-button>
@ -14,25 +14,25 @@
<script> <script>
import ModalMixin from '@/mixins/ModalMixin' import ModalMixin from '@/mixins/ModalMixin'
import { getAction } from '../../../../api/manage' import { getAction, postAction } from '../../../../api/manage'
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver'
import SampleDataMixin from '../../SampleDataMixin' import SampleDataMixin from '../../SampleDataMixin'
export default { export default {
mixins: [ModalMixin, SampleDataMixin], mixins: [ModalMixin, SampleDataMixin],
props: { props: {
type: { type: {
type: Number type: Number,
}, },
extraData: { extraData: {
type: Object, type: Object,
default: () => ({}) default: () => ({}),
} },
}, },
data() { data() {
return { return {
content: '', content: '',
isLoading: true, isLoading: true,
fileName: '' fileName: '',
} }
}, },
methods: { methods: {
@ -56,15 +56,22 @@ export default {
this.content = '' this.content = ''
this.isLoading = true this.isLoading = true
const { sampleId, inputFileName: fileName } = this.sampleData const { sampleId, inputFileName: fileName } = this.sampleData
const res = await getAction(url, { const method = this.type == 4? postAction : getAction
const res = await method(url, {
sampleId, sampleId,
fileName, fileName,
...this.extraData ...this.extraData,
}) })
if (res.success) {
this.content = res.result if (typeof res == 'string') {
this.content = res
} else { } else {
this.content = "" const { success, result, message } = res
if (success) {
this.content = result
} else {
this.$message.error(message)
}
} }
} catch (error) { } catch (error) {
console.error(error) console.error(error)
@ -77,9 +84,9 @@ export default {
this.getContent() this.getContent()
}, },
handleOk() { handleOk() {
this.fileName="" this.fileName = ''
if (this.content) { if (this.content) {
let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' })
// if (this.type == 1 || this.type == 3) { // if (this.type == 1 || this.type == 3) {
// saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'} ARR.txt`) // saveAs(strData, `${this.type == 1 ?'Gamma-':'Beta-'} ARR.txt`)
// } else { // } else {
@ -88,25 +95,25 @@ export default {
let _this = this let _this = this
this.$confirm({ this.$confirm({
title: 'Please enter file name', title: 'Please enter file name',
content: h => <a-input v-model={_this.fileName} />, content: (h) => <a-input v-model={_this.fileName} />,
okText: 'Cancle', okText: 'Cancle',
cancelText: 'Save', cancelText: 'Save',
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}}, okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}}, cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
onOk() { onOk() {
console.log('Cancel'); console.log('Cancel')
}, },
onCancel() { onCancel() {
if (_this.fileName) { if (_this.fileName) {
saveAs(strData, `${_this.fileName}.txt`) saveAs(strData, `${_this.fileName}.txt`)
} }
}, },
}); })
} else { } else {
this.$message.warning("No data can be saved!") this.$message.warning('No data can be saved!')
} }
} },
} },
} }
</script> </script>

View File

@ -451,6 +451,14 @@ export default {
methods: { methods: {
beforeModalOpen() { beforeModalOpen() {
this.customToolTip.visible = false this.customToolTip.visible = false
const gammaSeries = this.gammaSpectrumChartOption.series
gammaSeries[0].data = []
gammaSeries[1].data = []
const betaSeries = this.betaSpectrumChartOption.series
betaSeries[0].data = []
betaSeries[1].data = []
this.getDetail() this.getDetail()
}, },

View File

@ -37,6 +37,7 @@
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '../../../../api/manage' import { getAction } from '../../../../api/manage'
import moment from 'moment' import moment from 'moment'
import { cloneDeep } from 'lodash'
const columns = [ const columns = [
{ {
@ -201,7 +202,7 @@ export default {
} }
this.selectedRowKeys = [] this.selectedRowKeys = []
this.visible = false this.visible = false
this.$emit('loadSample', this.selectionRows) this.$emit('loadSample', cloneDeep(this.selectionRows))
}, },
// //

View File

@ -1,11 +1,16 @@
<template> <template>
<a-menu class="spectra-list-in-menu"> <a-menu class="spectra-list-in-menu">
<a-menu-item class="spectra-list-in-menu-item" v-for="(item,index) in list" :key="`${item.sampleId}${index}`" @click="handleClick(item)"> <a-menu-item
class="spectra-list-in-menu-item"
v-for="(item, index) in list"
:key="`${item.sampleId}${index}`"
@click="handleClick(item)"
>
<span class="checkbox"> <span class="checkbox">
<a-icon v-if="item.checked" type="check" style="color: #0de30d" /> <a-icon v-if="item.checked" type="check" style="color: #0de30d" />
</span> </span>
<span class="name">{{ item.inputFileName }}</span> <span class="name">{{ item.inputFileName }}</span>
<a-icon type="delete" @click.stop="handleRemove(item)" /> <a-icon type="delete" @click.stop="handleRemove(item, index)" />
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</template> </template>
@ -26,25 +31,25 @@ export default {
this.$forceUpdate() this.$forceUpdate()
}, },
handleRemove(spectraItem) { handleRemove(spectraItem, index) {
const index = this.list.findIndex(item => item == spectraItem)
this.list.splice(index, 1)
// //
if (spectraItem.checked) { if (spectraItem.checked) {
if (index == 0) { // //
// if (index == this.list.length - 1) {
this.handleClick(this.list[0])
} else {
//
this.handleClick(this.list[index - 1]) this.handleClick(this.list[index - 1])
} }
//
else {
this.handleClick(this.list[index + 1])
}
} }
this.list.splice(index, 1)
this.$forceUpdate() this.$forceUpdate()
} }
}, },
watch: { watch: {
list(newVal) { list(newVal) {
if (newVal.length) { if (newVal.length && !newVal.find(item => item.checked)) {
this.handleClick(newVal[0]) this.handleClick(newVal[0])
} }
} }

View File

@ -119,154 +119,7 @@ import NuclideReviewModal from './components/Modals/AnalyzeInteractiveToolModal/
import CompareFileListModal from './components/Modals/CompareFileListModal.vue' import CompareFileListModal from './components/Modals/CompareFileListModal.vue'
import ReProcessingModal from './components/Modals/ReProcessingModal/index.vue' import ReProcessingModal from './components/Modals/ReProcessingModal/index.vue'
// import { GammaOptions, graphAssistance } from './settings'
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',
spectrumType: 'Lines',
Baseline: true,
SCAC: true,
Lc: true,
}
export default { export default {
props: { props: {
@ -290,19 +143,35 @@ export default {
return { return {
isLoading: false, isLoading: false,
isLoadingNuclide: false, isLoadingNuclide: false,
option: cloneDeep(initialOption), option: cloneDeep(GammaOptions.option),
opts: { opts: {
notMerge: false, notMerge: false,
}, },
thumbnailOption: cloneDeep(thumbnailOption), thumbnailOption: cloneDeep(GammaOptions.thumbnailOption),
detailedInfomation: [], detailedInfomation: [],
qcFlags: [], qcFlags: [],
graphAssistance: cloneDeep(graphAssistance), graphAssistance: cloneDeep(graphAssistance),
nuclideLibraryVisible: false, nuclideLibraryVisible: false,
channelPeakGroup: [], channelData: {
energyPeakGroup: [], 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 nuclideLibraryList: [], // channel
peakInfomationTooltip: { peakInfomationTooltip: {
@ -326,11 +195,15 @@ export default {
}, },
created() { created() {
this.option.title.text = '{a|Channel:0} {a|Energy:0} {a|Counts:0} {a|Detectability:0}' 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('colorChange', this.handleColorChange)
this.$bus.$on('gammaRefresh', this.handleRefresh) this.$bus.$on('gammaRefresh', this.handleRefresh)
this.$bus.$on('accept', this.handleAccept) this.$bus.$on('accept', this.handleAccept)
}, },
destroyed() { destroyed() {
this.cancelLastRequest()
this.$bus.$off('colorChange', this.handleColorChange) this.$bus.$off('colorChange', this.handleColorChange)
this.$bus.$off('gammaRefresh', this.handleRefresh) this.$bus.$off('gammaRefresh', this.handleRefresh)
this.$bus.$off('accept', this.handleAccept) this.$bus.$off('accept', this.handleAccept)
@ -339,6 +212,7 @@ export default {
this.option.brush = { toolbox: [] } this.option.brush = { toolbox: [] }
}, },
methods: { methods: {
//
async getSampleDetail() { async getSampleDetail() {
const { dbName, sampleId } = this.sample const { dbName, sampleId } = this.sample
try { try {
@ -347,14 +221,8 @@ export default {
this.handleResetState() this.handleResetState()
// const { success, result, message } = Response // const { success, result, message } = Response
this.cancelLastRequest()
if (this._cancelToken && typeof this._cancelToken == 'function') { const cancelToken = this.createCancelToken()
this._cancelToken()
}
const cancelToken = new axios.CancelToken((c) => {
this._cancelToken = c
})
const { success, result, message } = await getAction( const { success, result, message } = await getAction(
'/gamma/gammaByDB', '/gamma/gammaByDB',
@ -381,9 +249,17 @@ export default {
this.isLoading = true this.isLoading = true
this.handleResetState() this.handleResetState()
// const { success, result, message } = Response // 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) console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
if (success) { if (success) {
this.dataProsess(result) this.dataProsess(result)
@ -395,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) { dataProsess(result) {
this.isLoading = false this.isLoading = false
@ -419,44 +308,40 @@ export default {
this.detailedInfomation = DetailedInformation this.detailedInfomation = DetailedInformation
this.qcFlags = QCFlag this.qcFlags = QCFlag
const channelPeakGroup = allData.filter((item) => item.name == 'Peak' && item.group == 'channel') const channelPeakGroup = this.getLineData(allData, 'Peak', 'channel', true)
const energyPeakGroup = allData.filter((item) => item.name == 'Peak' && item.group == 'energy') const energyPeakGroup = this.getLineData(allData, 'Peak', 'energy', true)
const channelBaseLine = allData.find((item) => item.name == 'BaseLine' && item.group == 'channel') || {} const channelBaseLine = this.getLineData(allData, 'BaseLine', 'channel')
const energyBaseLine = allData.find((item) => item.name == 'BaseLine' && item.group == 'energy') const energyBaseLine = this.getLineData(allData, 'BaseLine', 'energy')
const channelLcLine = allData.find((item) => item.name == 'Lc' && item.group == 'channel') || {} const channelLcLine = this.getLineData(allData, 'Lc', 'channel')
const energyLcLine = allData.find((item) => item.name == 'Lc' && item.group == 'energy') const energyLcLine = this.getLineData(allData, 'Lc', 'energy')
const channelScacLine = allData.find((item) => item.name == 'Scac' && item.group == 'channel') || {} const channelScacLine = this.getLineData(allData, 'Scac', 'channel')
const energyScacLine = allData.find((item) => item.name == 'Scac' && item.group == 'energy') const energyScacLine = this.getLineData(allData, 'Scac', 'energy')
this.allEnergy = allData.find((item) => item.name == 'Energy' && item.group == 'energy') || {} const allChannel = this.getLineData(allData, 'Count', 'channel')
this.allChannel = allData.find((item) => item.name == 'Count' && item.group == 'channel') const allEnergy = this.getLineData(allData, 'Energy', 'energy')
// Peak Line this.channelData = {
this.channelPeakGroup = channelPeakGroup peakGroup: channelPeakGroup,
this.energyPeakGroup = energyPeakGroup spectrumLine: shadowChannelChart,
baseLine: channelBaseLine,
lcLine: channelLcLine,
scacLine: channelScacLine,
all: allChannel,
baseLineCP: shapeChannelData,
}
// Spectrum Line this.energyData = {
this.shadowChannelChart = shadowChannelChart peakGroup: energyPeakGroup,
this.shadowEnergyChart = shadowEnergyChart spectrumLine: shadowEnergyChart,
baseLine: energyBaseLine,
// 线 lcLine: energyLcLine,
this.channelBaseLine = channelBaseLine scacLine: energyScacLine,
this.energyBaseLine = energyBaseLine all: allEnergy,
baseLineCP: shapeEnergyData,
// Lc }
this.channelLcLine = channelLcLine
this.energyLcLine = energyLcLine
// Scac
this.channelScacLine = channelScacLine
this.energyScacLine = energyScacLine
// 线
this.shapeChannelData = shapeChannelData
this.shapeEnergyData = shapeEnergyData
this.resetThumbnailChartDataMax() this.resetThumbnailChartDataMax()
const series = [] const series = []
@ -465,7 +350,7 @@ export default {
series.push( series.push(
buildLineSeries( buildLineSeries(
'Spectrum', 'Spectrum',
shadowChannelChart.pointlist && shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), this.transformPointListData(shadowChannelChart.pointlist),
shadowChannelChart.color, shadowChannelChart.color,
{ {
symbolSize: 2, symbolSize: 2,
@ -485,65 +370,33 @@ export default {
) )
) )
// Spectrum Line // Spectrum Line
this.thumbnailOption.series.push( this.setSeriesData(
buildLineSeries( this.thumbnailOption.series,
'Spectrum', 'Spectrum',
shadowChannelChart.pointlist && shadowChannelChart.pointlist.map(({ x, y }) => [x, y]), this.transformPointListData(shadowChannelChart.pointlist),
shadowChannelChart.color, shadowChannelChart.color
{
silent: true,
markLine: {
silent: true,
symbol: 'none',
label: {
show: false,
},
lineStyle: {
type: 'solid',
color: '#1397a3',
width: 1,
},
data: [],
},
}
)
) )
// BaseLine // BaseLine
series.push( series.push(
buildLineSeries( buildLineSeries('BaseLine', this.transformPointListData(channelBaseLine.pointlist), channelBaseLine.color, {
'BaseLine', zlevel: 2,
channelBaseLine.pointlist && channelBaseLine.pointlist.map(({ x, y }) => [x, y]), })
channelBaseLine.color,
{
zlevel: 2,
}
)
) )
// LcLine线 // LcLine线
series.push( series.push(
buildLineSeries( buildLineSeries('LcLine', this.transformPointListData(channelLcLine.pointlist), channelLcLine.color, {
'LcLine', zlevel: 3,
channelLcLine.pointlist && channelLcLine.pointlist.map(({ x, y }) => [x, y]), })
channelLcLine.color,
{
zlevel: 3,
}
)
) )
// Scac线 // Scac线
series.push( series.push(
buildLineSeries( buildLineSeries('ScacLine', this.transformPointListData(channelScacLine.pointlist), channelScacLine.color, {
'ScacLine', zlevel: 4,
channelScacLine.pointlist && channelScacLine.pointlist.map(({ x, y }) => [x, y]), })
channelScacLine.color,
{
zlevel: 4,
}
)
) )
// 线 // 线
@ -571,14 +424,9 @@ export default {
const peakLines = [] const peakLines = []
channelPeakGroup.forEach((item, index) => { channelPeakGroup.forEach((item, index) => {
peakLines.push( peakLines.push(
buildLineSeries( buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
`Peak_${index}`, zlevel: 6,
item.pointlist.map(({ x, y }) => [x, y]), })
item.color,
{
zlevel: 6,
}
)
) )
}) })
series.push(...peakLines) series.push(...peakLines)
@ -591,25 +439,26 @@ export default {
) )
this.option.series = series this.option.series = series
this.option.tooltip.formatter = this.tooltipFormatter
}, },
// chart tooltip
tooltipFormatter(params) { tooltipFormatter(params) {
if (this.isEnergy()) { let channel = 0
const energy = params[0].value[0] let energy = 0
const channel = this.getChannelByEnergy(energy) const value = params[0].value[0]
return `<div class="channel">Channel: ${channel}</div> if (this.isEnergy()) {
<div class="energy">Energy: ${energy.toFixed(2)}</div>` energy = value.toFixed(2)
channel = this.getChannelByEnergy(energy)
} else { } else {
const channel = parseInt(params[0].value[0].toFixed()) const allPointList = this.energyData.all.pointlist
const energy = this.allEnergy.pointlist && this.allEnergy.pointlist[channel - 1] channel = parseInt(value.toFixed())
return energy energy = allPointList && allPointList[channel - 1]
? `<div class="channel">Channel: ${channel}</div> energy = energy ? energy.x.toFixed(2) : undefined
<div class="energy">Energy: ${energy.x.toFixed(2)}</div>`
: undefined
} }
return `<div class="channel">Channel: ${channel}</div>
<div class="energy">Energy: ${energy}</div>`
}, },
// Graph Assistance // Graph Assistance
@ -640,19 +489,24 @@ export default {
this.redrawLineBySeriesName( this.redrawLineBySeriesName(
'BaseLine', 'BaseLine',
this.energyBaseLine, this.energyData.baseLine,
this.channelBaseLine, this.channelData.baseLine,
this.graphAssistance.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( this.redrawLineBySeriesName(
'ScacLine', 'ScacLine',
this.energyScacLine, this.energyData.scacLine,
this.channelScacLine, this.channelData.scacLine,
this.graphAssistance.SCAC this.graphAssistance.SCAC
) )
this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart) this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine)
this.redrawCtrlPointBySeriesName() this.redrawCtrlPointBySeriesName()
this.redrawPeakLine() this.redrawPeakLine()
@ -674,7 +528,7 @@ export default {
compareLineSeries.type = 'line' compareLineSeries.type = 'line'
compareLineSeries.symbol = 'none' compareLineSeries.symbol = 'none'
this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart) this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine)
if (this.channelCompareLine) { if (this.channelCompareLine) {
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine) this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
@ -712,13 +566,13 @@ export default {
} }
break break
case 'Baseline': case 'Baseline':
this.redrawLineBySeriesName('BaseLine', this.energyBaseLine, this.channelBaseLine, value) this.redrawLineBySeriesName('BaseLine', this.energyData.baseLine, this.channelData.baseLine, value)
break break
case 'Lc': case 'Lc':
this.redrawLineBySeriesName('LcLine', this.energyLcLine, this.channelLcLine, value) this.redrawLineBySeriesName('LcLine', this.energyData.lcLine, this.channelData.lcLine, value)
break break
case 'SCAC': case 'SCAC':
this.redrawLineBySeriesName('ScacLine', this.energyScacLine, this.channelScacLine, value) this.redrawLineBySeriesName('ScacLine', this.energyData.scacLine, this.channelData.scacLine, value)
break break
} }
} }
@ -730,22 +584,18 @@ export default {
// seriesName线 // seriesName线
redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true, color) { redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true, color) {
const series = findSeriesByName(this.option.series, seriesName)
if (isShow) { if (isShow) {
const data = this.isEnergy() ? energyData : channelData 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 { } else {
series.data = [] this.setSeriesData(this.option.series, seriesName, [])
}
if (color) {
series.itemStyle.color = color
} }
}, },
// //
redrawCtrlPointBySeriesName() { redrawCtrlPointBySeriesName() {
const series = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point') 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 } }) => { series.data = data.map(({ size, color, point: { x, y } }) => {
return { return {
value: [x, y], value: [x, y],
@ -764,18 +614,13 @@ export default {
return !item.name.includes('Peak_') 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 = [] const peakLines = []
data.forEach((item, index) => { data.forEach((item, index) => {
peakLines.push( peakLines.push(
buildLineSeries( buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
`Peak_${index}`, zlevel: 6,
item.pointlist.map(({ x, y }) => [x, y]), })
item.color,
{
zlevel: 6,
}
)
) )
}) })
@ -785,8 +630,8 @@ export default {
// //
redrawThumbnailChart() { redrawThumbnailChart() {
const series = findSeriesByName(this.thumbnailOption.series, 'Spectrum') const series = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
const data = this.isEnergy() ? this.shadowEnergyChart : this.shadowChannelChart const data = this.isEnergy() ? this.energyData.spectrumLine : this.channelData.spectrumLine
series.data = data.pointlist.map(({ x, y }) => [x, y]) series.data = this.transformPointListData(data.pointlist)
}, },
// 线 // 线
@ -801,8 +646,10 @@ export default {
const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed()) const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
const energy = this.isEnergy() const energy = this.isEnergy()
? xAxis.toFixed(2) ? xAxis.toFixed(2)
: this.allEnergy.pointlist && this.allEnergy.pointlist[channel - 1].x.toFixed(2) : this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2)
const counts = this.isEnergy() ? this.allEnergy.pointlist[channel - 1] : this.allChannel.pointlist[channel - 1] 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.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts.y}} {a|Detectability:0}`
this.getSelPosNuclide(channel) this.getSelPosNuclide(channel)
@ -864,7 +711,7 @@ export default {
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum') const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
const xAxis = spectrumLineSeries.markLine.data[0].xAxis const xAxis = spectrumLineSeries.markLine.data[0].xAxis
const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed()) 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 allX = peakItem.pointlist.map((item) => item.x)
const max = Math.max(...allX) const max = Math.max(...allX)
const min = Math.min(...allX) const min = Math.min(...allX)
@ -887,7 +734,7 @@ export default {
}) })
if (success) { if (success) {
const html = result.replaceAll('\n', '<br>') const html = result.replaceAll('\n', '<br>')
const currPeak = this.channelPeakGroup[index] const currPeak = this.channelData.peakGroup[index]
const { x, y } = currPeak.pointlist.reduce((prev, curr) => { const { x, y } = currPeak.pointlist.reduce((prev, curr) => {
return prev && prev.y > curr.y ? prev : curr return prev && prev.y > curr.y ? prev : curr
}) })
@ -919,7 +766,7 @@ export default {
const prevAxis = spectrumLineSeries.markLine.data[0].xAxis const prevAxis = spectrumLineSeries.markLine.data[0].xAxis
// Channel // Channel
const maxXAxises = this.channelPeakGroup.map((item) => { const maxXAxises = this.channelData.peakGroup.map((item) => {
const allY = item.pointlist.map((item) => item.y) const allY = item.pointlist.map((item) => item.y)
const max = item.pointlist.find((point) => point.y == Math.max(...allY)) const max = item.pointlist.find((point) => point.y == Math.max(...allY))
return max.x return max.x
@ -978,7 +825,6 @@ export default {
// //
chart.dispatchAction({ chart.dispatchAction({
type: 'takeGlobalCursor', type: 'takeGlobalCursor',
brushOption: false
}) })
}, },
@ -1058,16 +904,16 @@ export default {
const y2 = getAxisMax(chart, 'yAxis') const y2 = getAxisMax(chart, 'yAxis')
const channelSpectrumData = { const channelSpectrumData = {
...this.shadowChannelChart, ...this.channelData.spectrumLine,
pointlist: isReset pointlist: isReset
? this.pointlistLimitY(this.shadowChannelChart.pointlist) ? this.pointlistLimitY(this.channelData.spectrumLine.pointlist)
: this.pointlistLimit(this.shadowChannelChart.pointlist, x1, x2, y1, y2), : this.pointlistLimit(this.channelData.spectrumLine.pointlist, x1, x2, y1, y2),
} }
const energySpectrumData = { const energySpectrumData = {
...this.shadowEnergyChart, ...this.energyData.spectrumLine,
pointlist: isReset pointlist: isReset
? this.pointlistLimitY(this.shadowEnergyChart.pointlist) ? this.pointlistLimitY(this.energyData.spectrumLine.pointlist)
: this.pointlistLimit(this.shadowEnergyChart.pointlist, x1, x2, y1, y2), : this.pointlistLimit(this.energyData.spectrumLine.pointlist, x1, x2, y1, y2),
} }
this.redrawLineBySeriesName('Spectrum', energySpectrumData, channelSpectrumData) this.redrawLineBySeriesName('Spectrum', energySpectrumData, channelSpectrumData)
@ -1171,8 +1017,8 @@ export default {
this.setThumbnailChartRect(xAxis - halfWidth, maxYAxis, xAxis + halfWidth, minYAxis) this.setThumbnailChartRect(xAxis - halfWidth, maxYAxis, xAxis + halfWidth, minYAxis)
if (this.isEnergy()) { if (this.isEnergy()) {
const x1 = parseInt(this.shadowEnergyChart.pointlist[xAxis - halfWidth].x) const x1 = parseInt(this.energyData.spectrumLine.pointlist[xAxis - halfWidth].x)
const x2 = parseInt(this.shadowEnergyChart.pointlist[xAxis + halfWidth].x) const x2 = parseInt(this.energyData.spectrumLine.pointlist[xAxis + halfWidth].x)
this.option.xAxis.min = x1 this.option.xAxis.min = x1
this.option.xAxis.max = x2 this.option.xAxis.max = x2
@ -1190,7 +1036,9 @@ export default {
} }
}, },
// /**
* 重置图表
*/
handleResetChart() { handleResetChart() {
this.option.xAxis.min = 1 this.option.xAxis.min = 1
this.option.xAxis.max = 'dataMax' this.option.xAxis.max = 'dataMax'
@ -1291,12 +1139,16 @@ export default {
// this.reprocessingModalVisible = true // this.reprocessingModalVisible = true
}, },
// y /**
* 重置缩略图表y轴最大值
*/
resetThumbnailChartDataMax() { resetThumbnailChartDataMax() {
this.thumbnailOption.yAxis.max = 'dataMax' this.thumbnailOption.yAxis.max = 'dataMax'
}, },
// /**
* 重置图表配置
*/
resetChartOpts() { resetChartOpts() {
this.opts.notMerge = false this.opts.notMerge = false
this.option.brush = { toolbox: [] } this.option.brush = { toolbox: [] }
@ -1318,12 +1170,17 @@ export default {
] ]
}, },
/**
* 根据energy获取channel
* @param {number} energy
*/
getChannelByEnergy(energy) { getChannelByEnergy(energy) {
let channel = 0 let channel = 0
for (let index = 1; index < this.allEnergy.pointlist.length; index++) { const pointlist = this.energyData.all.pointlist
const currEnergy = this.allEnergy.pointlist[index].x for (let index = 1; index < pointlist.length; index++) {
const currEnergy = pointlist[index].x
if (currEnergy >= energy) { if (currEnergy >= energy) {
const prevEnergy = this.allEnergy.pointlist[index - 1].x const prevEnergy = pointlist[index - 1].x
if (currEnergy - energy > energy - prevEnergy.x) { if (currEnergy - energy > energy - prevEnergy.x) {
channel = index channel = index
} else { } else {
@ -1335,15 +1192,19 @@ export default {
return channel return channel
}, },
// /**
* 重置页面信息
*/
handleResetState() { handleResetState() {
this.handleResetChart()
this.selectedChannel = -1 this.selectedChannel = -1
this.nuclideLibraryList = [] this.nuclideLibraryList = []
this.closePeakInfomationTooltip() this.closePeakInfomationTooltip()
this.option.series = [] this.option.series = []
this.thumbnailOption.series = []
this.option.xAxis.name = 'Channel' this.option.xAxis.name = 'Channel'
this.option.yAxis.type = 'value' this.option.yAxis.type = 'value'
this.thumbnailOption.yAxis.type = 'value'
if (this.option.series.length) { if (this.option.series.length) {
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum') const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
@ -1352,14 +1213,17 @@ export default {
spectrumLineSeries.markLine.lineStyle.width = 2 spectrumLineSeries.markLine.lineStyle.width = 2
} }
if (this.thumbnailOption.series.length) { const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum') thumbnailSpectrumLineSeries.type = 'line'
thumbnailSpectrumLineSeries.type = 'line' thumbnailSpectrumLineSeries.symbol = 'none'
thumbnailSpectrumLineSeries.symbol = 'none'
}
this.graphAssistance = cloneDeep(graphAssistance) this.graphAssistance = cloneDeep(graphAssistance)
}, },
/**
* 颜色改变
* @param {*} colorConfig
*/
handleColorChange(colorConfig) { handleColorChange(colorConfig) {
// //
if (this.isLoading) { if (this.isLoading) {
@ -1376,22 +1240,22 @@ export default {
const { Color_Spec, Color_Peak, Color_Lc, Color_Base, Color_Scac, Color_Compare, Color_Strip, Color_Fitbase } = const { Color_Spec, Color_Peak, Color_Lc, Color_Base, Color_Scac, Color_Compare, Color_Strip, Color_Fitbase } =
colorConfig colorConfig
this.shadowChannelChart.color = Color_Spec this.channelData.spectrumLine.color = Color_Spec
this.shadowEnergyChart.color = Color_Spec this.energyData.spectrumLine.color = Color_Spec
for (let i = 0; i < this.channelPeakGroup.length; i++) { for (let i = 0; i < this.channelData.peakGroup.length; i++) {
this.channelPeakGroup[i].color = Color_Peak this.channelData.peakGroup[i].color = Color_Peak
this.energyPeakGroup[i].color = Color_Peak this.energyData.peakGroup[i].color = Color_Peak
} }
this.channelLcLine.color = Color_Lc this.channelData.lcLine.color = Color_Lc
this.energyLcLine.color = Color_Lc this.energyData.lcLine.color = Color_Lc
this.channelBaseLine.color = Color_Base this.channelData.baseLine.color = Color_Base
this.energyBaseLine.color = Color_Base this.energyData.baseLine.color = Color_Base
this.channelScacLine.color = Color_Scac this.channelData.scacLine.color = Color_Scac
this.energyScacLine.color = Color_Scac this.energyData.scacLine.color = Color_Scac
if (this.channelCompareLine) { if (this.channelCompareLine) {
this.channelCompareLine.color = Color_Compare this.channelCompareLine.color = Color_Compare
@ -1409,7 +1273,11 @@ export default {
thumbnailChartSeries.itemStyle.color = Color_Spec thumbnailChartSeries.itemStyle.color = Color_Spec
}, },
// series /**
* 根据series名修改颜色
* @param {*} seriesName
* @param {*} color
*/
changeColorBySeriesName(seriesName, color) { changeColorBySeriesName(seriesName, color) {
const series = findSeriesByName(this.option.series, seriesName) const series = findSeriesByName(this.option.series, seriesName)
series.itemStyle.color = color series.itemStyle.color = color
@ -1439,6 +1307,38 @@ export default {
getThumbnailChart() { getThumbnailChart() {
return this.$refs.thumbnailChartRef.getChartInstance() 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: { watch: {
sample: { sample: {

View File

@ -13,7 +13,7 @@
<a-button type="primary">{{ operation.title }}</a-button> <a-button type="primary">{{ operation.title }}</a-button>
<div slot="overlay"> <div slot="overlay">
<template v-for="(child, index) in operation.children"> <template v-for="(child, index) in operation.children">
<component :is="child.type" :key="index" v-bind="child.attrs" v-on="child.on"> <component v-if="child.show !== false" :is="child.type" :key="index" v-bind="child.attrs" v-on="child.on">
<template v-for="item in child.children"> <template v-for="item in child.children">
<component v-if="item.show !== false" :is="item.type" :key="item.title" @click="item.handler"> <component v-if="item.show !== false" :is="item.type" :key="item.title" @click="item.handler">
{{ item.title }} {{ item.title }}
@ -382,12 +382,12 @@ export default {
}, },
created() { created() {
this.$bus.$on('reanalyse', this.handleReanalyse) this.$bus.$on('reanalyse', this.handleReanalyse)
this.loadSelectedSample({ // this.loadSelectedSample({
sampleId: 426530, // sampleId: 426530,
sampleType: 'G', // sampleType: 'G',
dbName: 'auto', // dbName: 'auto',
inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD', // inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
}) // })
}, },
destroyed() { destroyed() {
@ -432,7 +432,7 @@ export default {
}) })
arr.forEach((item) => { arr.forEach((item) => {
item.dbName = '' item.dbName = ''
item.sampleId = '' item.sampleId = null
item.inputFileName = item.sampleFileName item.inputFileName = item.sampleFileName
item.sampleType = item.sampleSystemType item.sampleType = item.sampleSystemType
}) })
@ -679,8 +679,7 @@ export default {
if (spectra) { if (spectra) {
this.loadSelectedSample(spectra) this.loadSelectedSample(spectra)
} else { } else {
this.analysisType = undefined this.handleCleanAll()
this.sampleData = {}
} }
}, },
}, },
@ -692,6 +691,7 @@ export default {
children: [ children: [
{ {
type: 'MultiLevelMenu', type: 'MultiLevelMenu',
show: this.isBetaGamma || this.isGamma,
attrs: { attrs: {
children: [ children: [
{ {
@ -843,7 +843,6 @@ export default {
}, },
{ {
title: 'NUCLIDELIBRARY', title: 'NUCLIDELIBRARY',
show: !this.isBetaGamma,
children: [ children: [
{ {
type: 'a-menu', type: 'a-menu',
@ -851,11 +850,13 @@ export default {
{ {
type: 'a-menu-item', type: 'a-menu-item',
title: 'Nuclide Library', title: 'Nuclide Library',
show: this.isGamma,
handler: () => (this.nuclideLibraryModalVisible = true), handler: () => (this.nuclideLibraryModalVisible = true),
}, },
{ {
type: 'a-menu-item', type: 'a-menu-item',
title: 'Config User Library', title: 'Config User Library',
show: this.isGamma,
handler: () => (this.configUserLibModalVisible = true), handler: () => (this.configUserLibModalVisible = true),
}, },
], ],
@ -1043,6 +1044,7 @@ export default {
{ {
type: 'a-menu-item', type: 'a-menu-item',
title: 'Automatic Analysis Log', title: 'Automatic Analysis Log',
show: this.isBetaGamma || this.isGamma,
handler: () => { handler: () => {
this.autoAnalysisMogModalType = this.isGamma ? 1 : this.isBetaGamma ? 2 : 1 this.autoAnalysisMogModalType = this.isGamma ? 1 : this.isBetaGamma ? 2 : 1
this.autoAnalysisMogModalVisible = true this.autoAnalysisMogModalVisible = true

View File

@ -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,
}