diff --git a/src/views/planMonitor/editTool/schedule.vue b/src/views/planMonitor/editTool/schedule.vue index e71a628cf..eb0c8620c 100644 --- a/src/views/planMonitor/editTool/schedule.vue +++ b/src/views/planMonitor/editTool/schedule.vue @@ -257,15 +257,18 @@ export default { const op = this.myChart.getOption(); op.series.forEach((item, index) => { item.lineStyle.color = '#000'; - if (item.name == serviceNumber) { + switch (item.name) { + case serviceNumber: { item.lineStyle.color = 'red'; + break; } - if (item.name == 'trainLabel') { - item.data = []; + case 'trainLabel': { op.series.splice(index, 1); + break; + } } }); - this.myChart.setOption(op); + this.myChart.setOption(op, true); } this.$store.dispatch('runPlan/setSelected', { serviceNumber: serviceNumber, tripNumber: null }); this.analyticalTripNumber(serviceObj.trainMap || {}); @@ -278,16 +281,19 @@ export default { tripNumber = row.tripNumber; const op = this.myChart.getOption(); op.series.forEach((item, index) => { - if (item.name == serviceNumber) { + switch (item.name) { + case serviceNumber: { item.data.forEach(nor => { if (nor[3] == tripNumber) { data.push(nor); } }); + break; } - if (item.name == 'trainLabel') { - item.data = []; + case 'trainLabel': { op.series.splice(index, 1); + break; + } } }); op.series.push({