From ba6e29943b1a9523312a2d336b92644acb9de718 Mon Sep 17 00:00:00 2001 From: lVAL Date: Thu, 22 Oct 2020 11:13:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9=E6=8A=98?= =?UTF-8?q?=E8=BF=94=E6=97=B6=E9=97=B4=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/rpTools.js | 44 +++++----- .../editToolAUS/dialog/planJustTurnBack.vue | 82 +++++++++++++++++++ src/views/planMonitor/editToolAUS/index.vue | 54 ++++++++++-- src/views/planMonitor/editToolAUS/monitor.js | 45 ++++++---- src/views/planMonitor/editToolAUS/utils.js | 3 +- 5 files changed, 184 insertions(+), 44 deletions(-) create mode 100644 src/views/planMonitor/editToolAUS/dialog/planJustTurnBack.vue diff --git a/src/api/rpTools.js b/src/api/rpTools.js index 247073215..45c852aeb 100644 --- a/src/api/rpTools.js +++ b/src/api/rpTools.js @@ -62,6 +62,29 @@ export function delRpTrip(tripNo) { }) } + +/** + * 平移服务 + */ +export function translateRpService(serviceNo, data) { + return request({ + url: `/api/rpTools/${serviceNo}/service`, + method: 'put', + data + }) +} + +/** + * 删除服务 + */ +export function delRpService(serviceNo) { + return request({ + url: `/api/rpTools/${serviceNo}/service`, + method: 'delete' + }) +} + + /** * 添加区域 */ @@ -136,24 +159,3 @@ export function justTripTurnBack(tripNo, data) { data }) } - -/** - * 平移服务 - */ -export function translateService(serviceNo, data) { - return request({ - url: `/api/rpTools/${serviceNo}/service`, - method: 'put', - data - }) -} - -/** - * 删除服务 - */ -export function deleteService(serviceNo) { - return request({ - url: `/api/rpTools/${serviceNo}/service`, - method: 'delete' - }) -} diff --git a/src/views/planMonitor/editToolAUS/dialog/planJustTurnBack.vue b/src/views/planMonitor/editToolAUS/dialog/planJustTurnBack.vue new file mode 100644 index 000000000..a06838695 --- /dev/null +++ b/src/views/planMonitor/editToolAUS/dialog/planJustTurnBack.vue @@ -0,0 +1,82 @@ + + + diff --git a/src/views/planMonitor/editToolAUS/index.vue b/src/views/planMonitor/editToolAUS/index.vue index 531d5f1da..c65af0ac7 100644 --- a/src/views/planMonitor/editToolAUS/index.vue +++ b/src/views/planMonitor/editToolAUS/index.vue @@ -34,9 +34,11 @@ + - + + @@ -44,6 +46,7 @@ import Schedule from './schedule.vue'; import PlanJustRunning from './dialog/planJustRunning.vue'; import PlanJustStop from './dialog/planJustStop.vue'; +import PlanJustTurnBack from './dialog/planJustTurnBack.vue'; import PlanSetParams from './dialog/planSetParams.vue'; import PlanModifyArea from './dialog/planModifyArea.vue'; import PlanSetAreaNote from './dialog/planSetAreaNote'; @@ -54,8 +57,8 @@ import { mapGetters } from 'vuex'; import { getStationList } from '@/api/runplan'; import { getRpTools, clearRpPlan, addRpTrip, delRpTrip, - justTripNoRunning, justTripNoStop, - translateService, + justTripNoRunning, justTripNoStop, justTripTurnBack, + translateRpService, delRpService, getRpConfig, modifyRpConfig, createRpArea, modifyRpArea, modifyAreaNote, delRpArea } from '@/api/rpTools'; @@ -65,6 +68,7 @@ export default { Schedule, PlanJustRunning, PlanJustStop, + PlanJustTurnBack, PlanSetParams, PlanModifyArea, PlanSetAreaNote, @@ -207,7 +211,11 @@ export default { }).then(() => { switch(this.model.choice) { case 'Plan': - this.doRemoveTrip(); + if (['Translate', 'Edit'].includes(this.model.action)) { + this.doRemoveService(); + } else { + this.doRemoveTrip(); + } break; case 'Construction': this.doRemoveArea(); @@ -323,6 +331,26 @@ export default { }) } }, + doJustTurnBack(time) { + if (this.selected) { + const model = { + seconds: time, + stationCode: this.selected.stationCode + } + + justTripTurnBack(this.selected.tripNo, model).then(resp => { + getRpTools().then(rest => { + const planData = rest.data; + this.$store.commit('rpTools/setPlanData', planData); + this.$refs.schedule.loadChartData(planData); + }).catch(() => { + this.$messageBox('Failed to load the plan.'); + }); + }).catch(error => { + this.$message.info(error.message); + }) + } + }, doCreateTrip(data) { const model = { endStationCode: data.endStationCode, @@ -382,7 +410,7 @@ export default { seconds : this.selected.sx } - translateService(this.selected.serviceNo, model).then(resp => { + translateRpService(this.selected.serviceNo, model).then(resp => { getRpTools().then(rest => { const planData = rest.data; this.$store.commit('rpTools/setPlanData', planData); @@ -417,6 +445,22 @@ export default { }).catch(error => { this.$message.info(error.message); }); + } + }, + doRemoveService() { + if (this.selected) { + delRpService(this.selected.serviceNo).then(resp => { + getRpTools().then(rest => { + const planData = rest.data; + this.$store.commit('rpTools/setPlanData', planData); + this.$refs.schedule.loadChartData(planData); + this.onClear(); + }).catch(() => { + this.$messageBox('Failed to load the plan.'); + }); + }).catch(error => { + this.$message.info(error.message); + }) } }, doRemoveTrip() { diff --git a/src/views/planMonitor/editToolAUS/monitor.js b/src/views/planMonitor/editToolAUS/monitor.js index 689ea85e7..53c63239a 100644 --- a/src/views/planMonitor/editToolAUS/monitor.js +++ b/src/views/planMonitor/editToolAUS/monitor.js @@ -104,6 +104,11 @@ export default { }, onZrMouseOver(e) { this.pixelExecCb(e, this.doSetTarget); + if (this.model.action == 'Translate') { + this.pixelExecCb(e, this.doSetAreaTranslate); + } else if (this.model.action == 'Edit') { + this.pixelExecCb(e, this.doSetAreaDrags); + } }, onZrMouseDown(e) { if (e.target && ['area'].includes(e.target.subType)) { @@ -115,10 +120,6 @@ export default { } } - if (!e.target) { - this.$emit('clear') - } - if (this.model.choice == 'Plan') { if (this.model.action == 'Add') { this.pixelExecCb(e, this.doCreateMark); @@ -126,11 +127,13 @@ export default { } else if (this.model.choice == 'Construction') { if (this.model.action == 'Add') { this.pixelExecCb(e, this.doCreateArea); - } else if (this.model.action == 'Translate') { - this.pixelExecCb(e, this.doSetAreaTranslate); - } else if (this.model.action == 'Edit') { - this.pixelExecCb(e, this.doSetAreaDrags); } + + // if (this.model.action == 'Translate') { + // this.pixelExecCb(e, this.doSetAreaTranslate); + // } else if (this.model.action == 'Edit') { + // this.pixelExecCb(e, this.doSetAreaDrags); + // } } }, onZrMouseUp(e) { @@ -139,6 +142,11 @@ export default { this.pixelExecCb(e, this.doTranslate) } } + + if (!e.target) { + this.$emit('clear') + } + this.dragging = false; }, onZrMouseOut(e) { @@ -200,7 +208,7 @@ export default { if (this.model.action == 'Translate') { this.pixelExecCb(e, this.doSeriesDragging); } - } else if ( this.target && + } else if (this.target && this.model.choice == 'Construction') { if (this.model.action == 'Translate') { this.pixelExecCb(e, this.doAreaDragging); @@ -303,7 +311,7 @@ export default { const option = this.myChart.getOption(); const dataList = option.series[e.seriesIndex].data; const length = dataList.length; - const next = utils.findNext(dataList, e.dataIndex, (el, i) => { return el instanceof Array}); + const last = utils.findNext(dataList, e.dataIndex, (el, i) => { return el instanceof Array}); const isService = this.model.choice == 'Plan' && ['Translate', 'Edit'].includes(this.model.action); if (this.selected && @@ -338,8 +346,8 @@ export default { seriesIndex: e.seriesIndex, seriesName: isService? e.seriesName: 'service-trip', seriesId: e.seriesId, - depTime: e.dataIndex < length - 1? next[0] - value[0]: 0, - runTime: e.dataIndex < length - 1? next[0] - value[0]: 0, + depTime: e.dataIndex < length - 1? last[0] - value[0]: 0, + runTime: e.dataIndex < length - 1? last[0] - value[0]: 0, ... value[2], _x: pointInGrid[0], _y: pointInGrid[1], @@ -358,12 +366,13 @@ export default { if (e.target && ['area'].includes(e.target.subType)) { const option = this.myChart.getOption(); const shape = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.areaNo == this.target.areaNo; }); - Object.assign(shape, { - draggable: true, - ondrag: echarts.util.curry(this.onShapeDragging) - }) + + shape.draggable = true; + shape.ondrag = echarts.util.curry(this.onShapeDragging); this.myChart.setOption(option, {notMerge: true}); + + console.log(shape); } }, doSetAreaDrags({e}) { @@ -382,13 +391,15 @@ export default { const option = this.myChart.getOption(); const dataList = option.series[e.seriesIndex].data; const length = dataList.length; - const next = utils.findNext(dataList, e.dataIndex, (el, i) => { return el instanceof Array}); + const next = dataList[e.dataIndex+1]; const prev = utils.findPrev(dataList, e.dataIndex, (el, i) => { return el instanceof Array}); this.doSetSelected({e, pointInGrid}); if (e.dataIndex < length - 1 && e.value[1] == next[1]) { this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustStop }); + } else if (e.dataIndex < length - 1 && e.value[1] != next[1]) { + this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustTurnBack }); } else if (e.dataIndex == 0 || e.dataIndex > 0 && e.value[1] == prev[1]) { this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustRunning }); } diff --git a/src/views/planMonitor/editToolAUS/utils.js b/src/views/planMonitor/editToolAUS/utils.js index 82a033101..369ec2744 100644 --- a/src/views/planMonitor/editToolAUS/utils.js +++ b/src/views/planMonitor/editToolAUS/utils.js @@ -5,7 +5,8 @@ export const MenuEnum = { planJustStop: '1001', planSetParams: '1002', planModifyArea: '1003', - planSetAreaNote: '1004' + planSetAreaNote: '1004', + planJustTurnBack: '1005' } export function buildDragDataObj(position, point, that) {