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 {
components: {
BetaGammaChartContainer,
@ -439,6 +441,8 @@ export default {
: this.resultDisplay.length > 0
? this.resultDisplay
: XeData
this.sortResultDisplay()
this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode, savedAnalysisResult)
@ -623,6 +627,15 @@ export default {
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: {
sample: {
@ -653,7 +666,7 @@ export default {
handler(newVal, oldVal) {
// this.currResultDisplay = newVal.XeData
this.resultDisplay = newVal.XeData || []
this.sortResultDisplay()
this.$store.commit('UPDATE_SAMPLE_DATA', {
inputFileName: this.sample.inputFileName,
key: 'XeData',

View File

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