fix: 修复Result Display中数据顺序不固定的问题

This commit is contained in:
Xu Zhimeng 2024-02-29 15:41:45 +08:00
parent 1abbfbb36a
commit 5177f85677

View File

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