fix: 颜色设置相关问题

This commit is contained in:
Xu Zhimeng 2023-12-12 15:13:19 +08:00
parent a5c4ce05ee
commit 85eb54bc6c
5 changed files with 168 additions and 74 deletions

View File

@ -122,10 +122,10 @@ export default {
colorBase: Color_Base, colorBase: Color_Base,
colorScac: Color_Scac, colorScac: Color_Scac,
colorCompare: Color_Compare, colorCompare: Color_Compare,
ColorReference: Color_Reference, colorReference: Color_Reference,
colorFitbase: Color_Fitbase, colorFitbase: Color_Fitbase,
ColorSpecSum: Color_SpecSum, colorSpecSum: Color_SpecSum,
ColorSpecCut: Color_SpecCut, colorSpecCut: Color_SpecCut,
}) })
if (success) { if (success) {
this.$emit('colorChange', this.config) this.$emit('colorChange', this.config)

View File

@ -10,6 +10,7 @@
</template> </template>
<script> <script>
import { isNullOrUndefined } from '@/utils/util'
export default { export default {
data() { data() {
return { return {
@ -29,12 +30,15 @@ export default {
}, },
handleOk() { handleOk() {
if(isNullOrUndefined(this.ratio)) {
return
}
this.resolve(this.ratio) this.resolve(this.ratio)
this.visible = false this.visible = false
}, },
handleCancel() { handleCancel() {
this.resolve() this.reject()
this.visible = false this.visible = false
}, },

View File

@ -193,6 +193,10 @@ export default {
scacLine: null, scacLine: null,
all: null, all: null,
baseLineCP: [], baseLineCP: [],
compareLine: null,
stripSumOrCutLine: null,
stripReferenceLine: null,
}, },
energyData: { energyData: {
peakGroup: [], peakGroup: [],
@ -202,6 +206,10 @@ export default {
scacLine: null, scacLine: null,
all: null, all: null,
baseLineCP: [], baseLineCP: [],
compareLine: null,
stripSumOrCutLine: null,
stripReferenceLine: null,
}, },
peakList: [], // Peak peakList: [], // Peak
baseCtrls: {}, // BaseCtrls baseCtrls: {}, // BaseCtrls
@ -710,6 +718,7 @@ export default {
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum') const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum') const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
const compareLineSeries = findSeriesByName(this.option.series, 'Compare') const compareLineSeries = findSeriesByName(this.option.series, 'Compare')
const StripSumOrCutLineSeries = findSeriesByName(this.option.series, 'StripSumOrCut')
const stripReferenceLineSeries = findSeriesByName(this.option.series, 'StripReference') const stripReferenceLineSeries = findSeriesByName(this.option.series, 'StripReference')
switch (key) { switch (key) {
@ -794,12 +803,24 @@ export default {
this.redrawThumbnailChart() this.redrawThumbnailChart()
if (this.channelCompareLine) { if (this.channelData.compareLine) {
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine) this.redrawLineBySeriesName('Compare', this.energyData.compareLine, this.channelData.compareLine)
} }
if (this.channelStripReferenceLine) { if (this.channelData.stripSumOrCutLine) {
this.redrawLineBySeriesName('StripReference', this.energyStripReferenceLine, this.channelStripReferenceLine) this.redrawLineBySeriesName(
'StripSumOrCut',
this.energyData.stripSumOrCutLine,
this.channelData.stripSumOrCutLine
)
}
if (this.channelData.stripReferenceLine) {
this.redrawLineBySeriesName(
'StripReference',
this.energyData.stripReferenceLine,
this.channelData.stripReferenceLine
)
} }
break break
@ -816,20 +837,31 @@ export default {
compareLineSeries.type = 'line' compareLineSeries.type = 'line'
compareLineSeries.symbol = 'none' compareLineSeries.symbol = 'none'
StripSumOrCutLineSeries.type = 'line'
StripSumOrCutLineSeries.symbol = 'none'
stripReferenceLineSeries.type = 'line' stripReferenceLineSeries.type = 'line'
stripReferenceLineSeries.symbol = 'none' stripReferenceLineSeries.symbol = 'none'
this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine) this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine)
if (this.channelCompareLine) { if (this.channelData.compareLine) {
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine) this.redrawLineBySeriesName('Compare', this.energyData.compareLine, this.channelData.compareLine)
} }
if (this.channelStripReferenceLine) { if (this.channelData.stripSumOrCutLine) {
this.redrawLineBySeriesName(
'StripSumOrCut',
this.energyData.stripSumOrCutLine,
this.channelData.stripSumOrCutLine
)
}
if (this.channelData.stripReferenceLine) {
this.redrawLineBySeriesName( this.redrawLineBySeriesName(
'StripReference', 'StripReference',
this.energyStripReferenceLine, this.energyData.stripReferenceLine,
this.channelStripReferenceLine this.channelData.stripReferenceLine
) )
} }
} else { } else {
@ -842,6 +874,9 @@ export default {
compareLineSeries.type = 'scatterGL' compareLineSeries.type = 'scatterGL'
compareLineSeries.symbol = 'circle' compareLineSeries.symbol = 'circle'
StripSumOrCutLineSeries.type = 'scatterGL'
StripSumOrCutLineSeries.symbol = 'circle'
stripReferenceLineSeries.type = 'scatterGL' stripReferenceLineSeries.type = 'scatterGL'
stripReferenceLineSeries.symbol = 'circle' stripReferenceLineSeries.symbol = 'circle'
@ -892,7 +927,7 @@ export default {
clearPeakLine() { clearPeakLine() {
this.opts.notMerge = true this.opts.notMerge = true
this.option.series.splice(7) this.option.series.splice(8)
this.$nextTick(() => { this.$nextTick(() => {
this.resetChartOpts() this.resetChartOpts()
}) })
@ -1276,42 +1311,63 @@ export default {
} }
this.redrawLineBySeriesName('Spectrum', energySpectrumData, channelSpectrumData) this.redrawLineBySeriesName('Spectrum', energySpectrumData, channelSpectrumData)
if (this.channelCompareLine) { if (this.channelData.compareLine) {
const channelCompareLine = { const channelCompareLine = {
...this.channelCompareLine, ...this.channelData.compareLine,
pointlist: isReset pointlist: isReset
? this.pointlistLimitY(this.channelCompareLine.pointlist) ? this.pointlistLimitY(this.channelData.compareLine.pointlist)
: this.pointlistLimit(this.channelCompareLine.pointlist, x1, x2, y1, y2), : this.pointlistLimit(this.channelData.compareLine.pointlist, x1, x2, y1, y2),
} }
let energyCompareLine = [] let energyCompareLine = []
if (this.energyCompareLine) { if (this.energyData.compareLine) {
energyCompareLine = { energyCompareLine = {
...this.energyCompareLine, ...this.energyData.compareLine,
pointlist: isReset pointlist: isReset
? this.pointlistLimitY(this.energyCompareLine.pointlist) ? this.pointlistLimitY(this.energyData.compareLine.pointlist)
: this.pointlistLimit(this.energyCompareLine.pointlist, x1, x2, y1, y2), : this.pointlistLimit(this.energyData.compareLine.pointlist, x1, x2, y1, y2),
} }
} }
this.redrawLineBySeriesName('Compare', energyCompareLine, channelCompareLine) this.redrawLineBySeriesName('Compare', energyCompareLine, channelCompareLine)
} }
if (this.channelStripReferenceLine) { if (this.channelData.stripReferenceLine) {
const channelStripReferenceLine = { const channelStripReferenceLine = {
...this.channelStripReferenceLine, ...this.channelData.stripReferenceLine,
pointlist: isReset pointlist: isReset
? this.pointlistLimitY(this.channelStripReferenceLine.pointlist) ? this.pointlistLimitY(this.channelData.stripReferenceLine.pointlist)
: this.pointlistLimit(this.channelStripReferenceLine.pointlist, x1, x2, y1, y2), : this.pointlistLimit(this.channelData.stripReferenceLine.pointlist, x1, x2, y1, y2),
}
if (this.channelData.stripSumOrCutLine) {
const channelStripSumOrCutLine = {
...this.channelData.stripSumOrCutLine,
pointlist: isReset
? this.pointlistLimitY(this.channelData.stripSumOrCutLine.pointlist)
: this.pointlistLimit(this.channelData.stripSumOrCutLine.pointlist, x1, x2, y1, y2),
}
let energyStripSumOrCutLine = []
if (this.energyData.stripSumOrCutLine) {
energyStripSumOrCutLine = {
...this.energyData.stripSumOrCutLine,
pointlist: isReset
? this.pointlistLimitY(this.energyData.stripSumOrCutLine.pointlist)
: this.pointlistLimit(this.energyData.stripSumOrCutLine.pointlist, x1, x2, y1, y2),
}
}
this.redrawLineBySeriesName('StripSumOrCut', energyStripSumOrCutLine, channelStripSumOrCutLine)
} }
let energyStripReferenceLine = [] let energyStripReferenceLine = []
if (this.energyStripReferenceLine) { if (this.energyData.stripReferenceLine) {
energyStripReferenceLine = { energyStripReferenceLine = {
...this.energyStripReferenceLine, ...this.energyData.stripReferenceLine,
pointlist: isReset pointlist: isReset
? this.pointlistLimitY(this.energyStripReferenceLine.pointlist) ? this.pointlistLimitY(this.energyData.stripReferenceLine.pointlist)
: this.pointlistLimit(this.energyStripReferenceLine.pointlist, x1, x2, y1, y2), : this.pointlistLimit(this.energyData.stripReferenceLine.pointlist, x1, x2, y1, y2),
} }
} }
@ -1541,12 +1597,12 @@ export default {
url = '/gamma/Compare' url = '/gamma/Compare'
// Strip // Strip
if (this.isStrip) { if (this.isStrip) {
const ratio = await this.$refs.stripModal.getRatio() this.ratio = await this.$refs.stripModal.getRatio()
param = { param = {
fileName, fileName,
stripFileName: selectedFileName, stripFileName: selectedFileName,
ratioRate: ratio || 1, ratioRate: this.ratio,
} }
url = '/gamma/Strip' url = '/gamma/Strip'
} }
@ -1556,24 +1612,25 @@ export default {
if (this.isStrip) { if (this.isStrip) {
const { reference: referenceLine, result: compareLine } = result const { reference: referenceLine, result: compareLine } = result
this.channelCompareLine = compareLine[0] this.channelData.stripSumOrCutLine = compareLine[0]
this.energyCompareLine = compareLine[1] this.energyData.stripSumOrCutLine = compareLine[1]
this.redrawLineBySeriesName( this.redrawLineBySeriesName(
'Compare', 'StripSumOrCut',
this.energyCompareLine, this.energyData.stripSumOrCutLine,
this.channelCompareLine, this.channelData.stripSumOrCutLine,
true, true,
this.channelCompareLine.color this.channelData.stripSumOrCutLine.color
) )
this.channelStripReferenceLine = referenceLine[0] this.channelData.stripReferenceLine = referenceLine[0]
this.energyStripReferenceLine = referenceLine[1] this.energyData.stripReferenceLine = referenceLine[1]
this.redrawLineBySeriesName( this.redrawLineBySeriesName(
'StripReference', 'StripReference',
this.energyStripReferenceLine, this.energyData.stripReferenceLine,
this.channelStripReferenceLine, this.channelData.stripReferenceLine,
true, true,
this.channelStripReferenceLine.color this.channelData.stripReferenceLine.color
) )
this.$nextTick(() => { this.$nextTick(() => {
@ -1581,8 +1638,8 @@ export default {
}) })
} else { } else {
const [channelData, energyData] = result const [channelData, energyData] = result
this.channelCompareLine = channelData this.channelData.compareLine = channelData
this.energyCompareLine = energyData this.energyData.compareLine = energyData
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color) this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
this.$nextTick(() => { this.$nextTick(() => {
@ -1613,6 +1670,8 @@ export default {
return return
} }
this.isStrip = isStrip
const { inputFileName: fileName } = this.sample const { inputFileName: fileName } = this.sample
const hide = this.$message.loading(isStrip ? 'Stripping...' : 'Comparing...', 0) const hide = this.$message.loading(isStrip ? 'Stripping...' : 'Comparing...', 0)
@ -1624,12 +1683,12 @@ export default {
url = '/gamma/CompareDB' url = '/gamma/CompareDB'
// Strip // Strip
if (isStrip) { if (isStrip) {
const ratio = await this.$refs.stripModal.getRatio() this.ratio = await this.$refs.stripModal.getRatio()
param = { param = {
fileName, fileName,
sampleId, sampleId,
ratioRate: ratio || 1, ratioRate: this.ratio,
} }
url = '/gamma/StripDB' url = '/gamma/StripDB'
} }
@ -1639,24 +1698,25 @@ export default {
if (isStrip) { if (isStrip) {
const { reference: referenceLine, result: compareLine } = result const { reference: referenceLine, result: compareLine } = result
this.channelCompareLine = compareLine[0] this.channelData.stripSumOrCutLine = compareLine[0]
this.energyCompareLine = compareLine[1] this.energyData.stripSumOrCutLine = compareLine[1]
this.redrawLineBySeriesName( this.redrawLineBySeriesName(
'Compare', 'StripSumOrCut',
this.energyCompareLine, this.energyData.stripSumOrCutLine,
this.channelCompareLine, this.channelData.stripSumOrCutLine,
true, true,
this.channelCompareLine.color this.channelData.stripSumOrCutLine.color
) )
this.channelStripReferenceLine = referenceLine[0] this.channelData.stripReferenceLine = referenceLine[0]
this.energyStripReferenceLine = referenceLine[1] this.energyData.stripReferenceLine = referenceLine[1]
this.redrawLineBySeriesName( this.redrawLineBySeriesName(
'StripReference', 'StripReference',
this.energyStripReferenceLine, this.energyData.stripReferenceLine,
this.channelStripReferenceLine, this.channelData.stripReferenceLine,
true, true,
this.channelStripReferenceLine.color this.channelData.stripReferenceLine.color
) )
this.$nextTick(() => { this.$nextTick(() => {
@ -1664,8 +1724,8 @@ export default {
}) })
} else { } else {
const [channelData, energyData] = result const [channelData, energyData] = result
this.channelCompareLine = channelData this.channelData.compareLine = channelData
this.energyCompareLine = energyData this.energyData.compareLine = energyData
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color) this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
this.$nextTick(() => { this.$nextTick(() => {
@ -1689,18 +1749,25 @@ export default {
const compareLine = findSeriesByName(this.option.series, 'Compare') const compareLine = findSeriesByName(this.option.series, 'Compare')
if (compareLine) { if (compareLine) {
compareLine.data = [] compareLine.data = []
this.resetThumbnailChartDataMax()
} }
this.channelCompareLine = undefined this.channelData.compareLine = undefined
this.energyCompareLine = undefined this.energyData.compareLine = undefined
const stripStripSumOrCutLine = findSeriesByName(this.option.series, 'StripSumOrCut')
if (stripStripSumOrCutLine) {
stripStripSumOrCutLine.data = []
}
this.channelData.stripSumOrCutLine = undefined
this.energyData.stripSumOrCutLine = undefined
const stripReferenceLine = findSeriesByName(this.option.series, 'StripReference') const stripReferenceLine = findSeriesByName(this.option.series, 'StripReference')
if (stripReferenceLine) { if (stripReferenceLine) {
stripReferenceLine.data = [] stripReferenceLine.data = []
this.resetThumbnailChartDataMax()
} }
this.channelStripReferenceLine = undefined this.channelData.stripReferenceLine = undefined
this.energyStripReferenceLine = undefined this.energyData.stripReferenceLine = undefined
this.resetThumbnailChartDataMax()
}, },
// //
@ -1850,8 +1917,17 @@ export default {
// //
changeColor(colorConfig) { changeColor(colorConfig) {
const { Color_Spec, Color_Peak, Color_Lc, Color_Base, Color_Scac, Color_Compare, Color_Reference, Color_SpecSum, Color_SpecCut, Color_Fitbase } = const {
colorConfig Color_Spec,
Color_Peak,
Color_Lc,
Color_Base,
Color_Scac,
Color_Compare,
Color_Reference,
Color_SpecSum,
Color_SpecCut,
} = colorConfig
this.channelData.spectrumLine.color = Color_Spec this.channelData.spectrumLine.color = Color_Spec
this.energyData.spectrumLine.color = Color_Spec this.energyData.spectrumLine.color = Color_Spec
@ -1870,9 +1946,11 @@ export default {
this.channelData.scacLine.color = Color_Scac this.channelData.scacLine.color = Color_Scac
this.energyData.scacLine.color = Color_Scac this.energyData.scacLine.color = Color_Scac
if (this.channelCompareLine) { if (this.channelData.compareLine) {
this.channelCompareLine.color = Color_Compare this.channelData.compareLine.color = Color_Compare
this.energyCompareLine.color = Color_Compare if (this.energyData.compareLine) {
this.energyData.compareLine.color = Color_Compare
}
} }
this.changeColorBySeriesName('Spectrum', Color_Spec) this.changeColorBySeriesName('Spectrum', Color_Spec)
@ -1880,7 +1958,12 @@ export default {
this.changeColorBySeriesName('LcLine', Color_Lc) this.changeColorBySeriesName('LcLine', Color_Lc)
this.changeColorBySeriesName('BaseLine', Color_Base) this.changeColorBySeriesName('BaseLine', Color_Base)
this.changeColorBySeriesName('ScacLine', Color_Scac) this.changeColorBySeriesName('ScacLine', Color_Scac)
this.changeColorBySeriesName('Compare', Color_Compare) if (this.isStrip) {
this.changeColorBySeriesName('StripSumOrCut', this.ratio >= 0 ? Color_SpecSum : Color_SpecCut)
this.changeColorBySeriesName('StripReference', Color_Reference)
} else {
this.changeColorBySeriesName('Compare', Color_Compare)
}
const thumbnailChartSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum') const thumbnailChartSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
thumbnailChartSeries.itemStyle.color = Color_Spec thumbnailChartSeries.itemStyle.color = Color_Spec

View File

@ -45,7 +45,12 @@ export const compareLineSeries = buildLineSeries('Compare', [], '#fff', {
z: 7 z: 7
}) })
export const stripReferenceLineSeries = buildLineSeries('StripReference', [], '#fff', { export const stripSumOrCutLineSeries = buildLineSeries('StripSumOrCut', [], '#fff', {
symbolSize: 2, symbolSize: 2,
z: 8 z: 8
}) })
export const stripReferenceLineSeries = buildLineSeries('StripReference', [], '#fff', {
symbolSize: 2,
z: 9
})

View File

@ -6,7 +6,8 @@ import {
lcLineSeries, lcLineSeries,
scacLineSeries, scacLineSeries,
spectrumSeries, spectrumSeries,
stripReferenceLineSeries stripReferenceLineSeries,
stripSumOrCutLineSeries
} from './seriesBuilder' } from './seriesBuilder'
export const GammaOptions = { export const GammaOptions = {
@ -111,6 +112,7 @@ export const GammaOptions = {
scacLineSeries, scacLineSeries,
baseLineCtrlPoint, baseLineCtrlPoint,
compareLineSeries, compareLineSeries,
stripSumOrCutLineSeries,
stripReferenceLineSeries stripReferenceLineSeries
], ],
brush: {} brush: {}