fix: 优化对Result Display进行排序的位置

This commit is contained in:
Xu Zhimeng 2024-03-07 09:56:43 +08:00
parent 12656c073a
commit 794648bc56
2 changed files with 17 additions and 16 deletions

View File

@ -161,6 +161,8 @@ const SampleType = [
}, },
] ]
const sortList = ['Xe131m', 'Xe133', 'Xe133m', 'Xe135']
export default { export default {
components: { components: {
BetaGammaChartContainer, BetaGammaChartContainer,
@ -440,6 +442,8 @@ export default {
? this.resultDisplay ? this.resultDisplay
: XeData : XeData
this.sortResultDisplay()
this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode, savedAnalysisResult) this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode, savedAnalysisResult)
this.qcFlags = { this.qcFlags = {
@ -623,6 +627,15 @@ export default {
this.$refs.lineChart4Ref.setRange(minX, maxX) this.$refs.lineChart4Ref.setRange(minX, maxX)
} }
}, },
// result display
sortResultDisplay() {
this.resultDisplay.sort((a, b) => {
const index1 = sortList.indexOf(a.nuclideName)
const index2 = sortList.indexOf(b.nuclideName)
return index1 - index2
})
},
}, },
watch: { watch: {
sample: { sample: {
@ -653,7 +666,7 @@ export default {
handler(newVal, oldVal) { handler(newVal, oldVal) {
// this.currResultDisplay = newVal.XeData // this.currResultDisplay = newVal.XeData
this.resultDisplay = newVal.XeData || [] this.resultDisplay = newVal.XeData || []
this.sortResultDisplay()
this.$store.commit('UPDATE_SAMPLE_DATA', { this.$store.commit('UPDATE_SAMPLE_DATA', {
inputFileName: this.sample.inputFileName, inputFileName: this.sample.inputFileName,
key: 'XeData', key: 'XeData',

View File

@ -46,8 +46,6 @@
</template> </template>
<script> <script>
import { cloneDeep } from 'lodash'
const columns = [ const columns = [
{ {
title: 'Flag', title: 'Flag',
@ -96,8 +94,6 @@ const columns = [
width: 34, width: 34,
}, },
] ]
const sortList = ['Xe131m', 'Xe133', 'Xe133m', 'Xe135']
export default { export default {
props: { props: {
data: { data: {
@ -125,8 +121,7 @@ export default {
data: { data: {
handler(val) { handler(val) {
if (val && Array.isArray(val)) { if (val && Array.isArray(val)) {
const list = cloneDeep(val) val.forEach((item) => {
list.forEach((item) => {
if (item.conc < 0) { if (item.conc < 0) {
item.className = 'error' item.className = 'error'
} else if (item.conc > 0 && item.conc < item.mdc) { } else if (item.conc > 0 && item.conc < item.mdc) {
@ -135,15 +130,8 @@ export default {
item.className = 'success' item.className = 'success'
} }
}) })
this.source1 = val.slice(0, 2)
list.sort((a, b) => { this.source2 = val.slice(2, 4)
const index1 = sortList.indexOf(a.nuclideName)
const index2 = sortList.indexOf(b.nuclideName)
return index1 - index2
})
this.source1 = list.slice(0, 2)
this.source2 = list.slice(2, 4)
} }
}, },
immediate: true, immediate: true,