Discover: sidebarTraces fix Trace List sort.

This commit is contained in:
chiayin
2023-04-17 14:36:07 +08:00
parent 2d48c244a1
commit d3a4ec0b8e

View File

@@ -58,22 +58,10 @@ import cytoscapeMapTrace from '@/module/cytoscapeMapTrace.js';
export default { export default {
props: { props: {
sidebarTraces: { sidebarTraces: Boolean,
type: Boolean, traces: Array,
require: true, traceTaskSeq: Array,
}, cases: Array
traces: {
type: Array,
required: true,
},
traceTaskSeq: {
type: Array,
required: true,
},
cases: {
type: Array,
required: true,
},
}, },
data() { data() {
return { return {
@@ -89,20 +77,28 @@ export default {
return this.traces.length; return this.traces.length;
}, },
traceList: function() { traceList: function() {
let list = []; // let list = [];
this.traces.forEach((trace, index) => { // this.traces.forEach((trace, index) => {
let data = { // let data = {
// id: trace.id,
// value: Number((trace.ratio * 100).toFixed(1)),
// count: trace.count,
// ratio: this.getPercentLabel(trace.ratio),
// };
// list.push(data);
// });
// return list;
return this.traces.map(trace => {
return {
id: trace.id, id: trace.id,
value: Number((trace.ratio * 100).toFixed(1)), value: Number((trace.ratio * 100).toFixed(1)),
count: trace.count, count: trace.count,
ratio: this.getPercentLabel(trace.ratio), ratio: this.getPercentLabel(trace.ratio),
}; };
}).sort((x, y) => x.id - y.id);
list.push(data);
});
return list;
}, },
}, },
methods: { methods: {