From cc984c8eb0956a09d0c67e6c359b0a5d56559b08 Mon Sep 17 00:00:00 2001 From: zyy <1787816799@qq.com> Date: Tue, 14 Apr 2020 10:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BD=9B=E5=B1=B1=E7=BA=BF?= =?UTF-8?q?=E8=B7=AF=EF=BC=8C=E6=88=90=E9=83=BD=E4=B8=80=E5=8F=B7=E7=BA=BF?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=9B=BE=20=E6=96=B9=E5=90=91=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/theme/chengdu_01/planConvert.js | 10 +++++----- src/jmapNew/theme/foshan_01/planConvert.js | 10 +++++----- src/utils/runPlan.js | 19 +++++++++++++++++++ src/views/planMonitor/editTool/schedule.vue | 18 +++++++++--------- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/jmapNew/theme/chengdu_01/planConvert.js b/src/jmapNew/theme/chengdu_01/planConvert.js index 6f5fd7145..fee0509e3 100644 --- a/src/jmapNew/theme/chengdu_01/planConvert.js +++ b/src/jmapNew/theme/chengdu_01/planConvert.js @@ -1,4 +1,4 @@ -import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList } from '@/utils/runPlan'; +import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList } from '@/utils/runPlan'; export default { /** 边缘高度*/ @@ -116,7 +116,7 @@ export default { pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; /** 给服务对象添加服务名称和标记点*/ - opt.markPointData.push(createMartPoint(pointdata)); + opt.markPointData.push(createMartPointReverse(pointdata)); /** 创建服务号名称*/ opt.name = `${service.serviceNumber}`; } @@ -206,7 +206,7 @@ export default { /** 如果此记录车组号的数据为第一条时,则打上标签*/ if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) { - serie.markPoint.data.push(createMartPoint({ + serie.markPoint.data.push(createMartPointReverse({ directionCode: elem.directionCode, coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)], name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, @@ -290,9 +290,9 @@ export default { /** 根据方向计算y折返偏移量*/ getYvalueByDirectionCode(defaultVlue, directionCode, num) { if (directionCode === '1') { - defaultVlue -= this.EdgeHeight / 2 * num; - } else if (directionCode === '2') { defaultVlue += this.EdgeHeight / 2 * num; + } else if (directionCode === '2') { + defaultVlue -= this.EdgeHeight / 2 * num; } return defaultVlue; diff --git a/src/jmapNew/theme/foshan_01/planConvert.js b/src/jmapNew/theme/foshan_01/planConvert.js index 84204b00f..8e38f51f8 100644 --- a/src/jmapNew/theme/foshan_01/planConvert.js +++ b/src/jmapNew/theme/foshan_01/planConvert.js @@ -1,4 +1,4 @@ -import { createMartPoint, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan'; +import { createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor, convertSheetToList, prefixTime } from '@/utils/runPlan'; export default { /** 边缘高度*/ @@ -111,7 +111,7 @@ export default { pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeCoordMap, train.stationTimeList[1], train.directionCode, false)]; /** 给服务对象添加服务名称和标记点*/ - opt.markPointData.push(createMartPoint(pointdata)); + opt.markPointData.push(createMartPointReverse(pointdata)); /** 创建服务号名称*/ opt.name = `${service.serviceNumber}`; } @@ -197,7 +197,7 @@ export default { /** 如果此记录车组号的数据为第一条时,则打上标签*/ if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) { - serie.markPoint.data.push(createMartPoint({ + serie.markPoint.data.push(createMartPointReverse({ directionCode: elem.directionCode, coord: [parseInt(elem.secondTime), this.getCoordYByElem(stations, kmRangeCoordMap, elem, false)], name: `(${elem.groupNumber})${elem.serviceNumber}${elem.directionCode}${elem.tripNumber}`, @@ -282,9 +282,9 @@ export default { /** 根据方向计算y折返偏移量*/ getYvalueByDirectionCode(defaultVlue, directionCode, num) { if (directionCode === '1') { - defaultVlue -= this.EdgeHeight / 2 * num; - } else if (directionCode === '2') { defaultVlue += this.EdgeHeight / 2 * num; + } else if (directionCode === '2') { + defaultVlue -= this.EdgeHeight / 2 * num; } return defaultVlue; diff --git a/src/utils/runPlan.js b/src/utils/runPlan.js index 119cda930..469585a83 100644 --- a/src/utils/runPlan.js +++ b/src/utils/runPlan.js @@ -20,6 +20,25 @@ export function createMartPoint(opt) { }; } +/** 创建一个车次数据点*/ +export function createMartPointReverse(opt) { + const rotate = opt.directionCode == '1' ? 45 : (opt.directionCode == '2' ? -45 : 0); + const position = opt.type ? 'insideBottomLeft' : 'insideTopLeft'; + return { + coord: opt.coord, + name: opt.name, + label: { + normal: { + rotate: rotate, + formatter: '{b}', + backgroundColor: 'rgb(242,242,242,0.1)', + color: 'black', + position: position + } + } + }; +} + /** 创建一个车次数据序列*/ export function createSeriesModel(opt, lineStyle) { if (opt) { diff --git a/src/views/planMonitor/editTool/schedule.vue b/src/views/planMonitor/editTool/schedule.vue index f9b1d8b1e..396f87653 100644 --- a/src/views/planMonitor/editTool/schedule.vue +++ b/src/views/planMonitor/editTool/schedule.vue @@ -280,20 +280,20 @@ export default { const serviceNumber = this.$store.state.runPlan.selected.serviceNumber; let tripNumber = null; if (row) { - let data; + const data = []; tripNumber = row.tripNumber; const op = this.myChart.getOption(); op.series.forEach((item, index) => { switch (item.name) { case serviceNumber: { - const param = '\\[\\d*,\\d*,"Station_\\d*_[.\\d]*","' + tripNumber + '"\\]'; - const temp = JSON.stringify(item.data).match(new RegExp(param, 'g')); - data = JSON.parse('[' + temp.toString() + ']'); - // item.data.forEach(nor => { - // if (nor[3] == tripNumber) { - // data.push(nor); - // } - // }); + // const param = '\\[\\d*,\\d*,"Station_\\d*_[.\\d]*","' + tripNumber + '"\\]'; + // const temp = JSON.stringify(item.data).match(new RegExp(param, 'g')); + // data = JSON.parse('[' + temp.toString() + ']'); + item.data.forEach(nor => { + if (nor[3] == tripNumber) { + data.push(nor); + } + }); break; } case 'trainLabel': {