增加修改折返时间的功能
This commit is contained in:
parent
f749a9bfdb
commit
ba6e29943b
@ -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'
|
||||
})
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag append-to-body title="Modify turn back time" :visible.sync="dialogShow" width="30%" :close-on-click-modal="false" :before-close="doClose">
|
||||
<el-form ref="form" label-width="160px" :model="formModel" :rules="rules">
|
||||
<el-form-item label="Turn back time" prop="time">
|
||||
<el-input-number v-model="formModel.time" controls-position="right" :min="0" />
|
||||
<span style="padding-left: 10px">s</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="doConfirm">{{ $t('map.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { MenuEnum } from '../utils.js';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null
|
||||
}
|
||||
},
|
||||
stations: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
config: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogShow: false,
|
||||
formModel: {
|
||||
time: 0,
|
||||
},
|
||||
rules: {
|
||||
time: [
|
||||
{
|
||||
type: 'number', min: 0, message: 'Please select turn back time.', trigger: 'blur'
|
||||
}
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](MenuEnum.planJustTurnBack)) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
},
|
||||
selected: function(val) {
|
||||
if (val) this.formModel.time = val.runTime;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
this.dialogShow = true;
|
||||
},
|
||||
doClose() {
|
||||
this.dialogShow = false;
|
||||
},
|
||||
doConfirm() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if(valid) {
|
||||
this.$emit('justTurnBack', this.formModel.time);
|
||||
this.doClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -34,9 +34,11 @@
|
||||
</schedule>
|
||||
<plan-just-running :config="config" :selected="selected" :stations="stations" @justRunning="doJustRunning" />
|
||||
<plan-just-stop :config="config" :selected="selected" :stations="stations" @justStop="doJustStop"/>
|
||||
<plan-just-turn-back :config="config" :selected="selected" :stations="stations" @justTurnBack="doJustTurnBack"/>
|
||||
<plan-set-params :config="config" @setParams="doSetPlanParams" />
|
||||
<plan-modify-area :target="target" :stations="stations" @modifyArea="doModifyArea" />
|
||||
<plan-set-area-note :target="target" @setAreaNote="doSetAreaNote" />
|
||||
|
||||
<plan-modify-area :target="target" :stations="stations" @modifyArea="doModifyArea" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -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() {
|
||||
|
@ -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 });
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user