修改AUSTool功能

This commit is contained in:
lVAL 2020-10-22 18:20:29 +08:00
parent a7011888b4
commit 439e9194c6
4 changed files with 116 additions and 62 deletions

View File

@ -233,5 +233,28 @@ export default {
}
}
return null;
},
/** 检查公里表是否超出范围*/
limitAreaKmRange(stations, model) {
const closerKmRange = model.closerKmRange||0;
const fartherKmRange = model.fartherKmRange||0;
const length = stations.length;
const last = stations[length-1]||{};
const minRange = this.EdgeHeight/2;
const maxRange = last.kmRange;
if (closerKmRange < minRange) {
const offset = closerKmRange - minRange
model.closerKmRange = minRange;
model.fartherKmRange -= offset;
return Math.abs(offset) > 2;
} else if (fartherKmRange > maxRange) {
const offset = fartherKmRange - maxRange;
model.fartherKmRange = maxRange;
model.closerKmRange -= offset;
return Math.abs(offset) > 2;
}
return false;
}
};

View File

@ -2,8 +2,8 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.169:9000'; // 旭强
// BASE_API = 'http://192.168.3.175:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9008'; // 杜康

View File

@ -12,6 +12,7 @@
@clear="onClear"
@create="onCreate"
@translate="onTranslate"
@refresh="refresh"
>
<template slot="header">
<div class="header">
@ -201,11 +202,6 @@ export default {
}
},
onRemove(){
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
switch(this.model.choice) {
case 'Plan':
if (['Translate', 'Edit'].includes(this.model.action)) {
@ -218,9 +214,6 @@ export default {
this.doRemoveArea();
break;
}
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
});
},
doNewPlan() {
clearRpPlan().then(resp => {
@ -373,26 +366,48 @@ export default {
},
doRemoveService() {
if (this.selected) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delRpService(this.selected.serviceNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
})
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
});
}
},
doRemoveTrip() {
if (this.selected) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delRpTrip(this.selected.tripNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
})
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
});
}
},
doRemoveArea() {
if (this.target) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const data = this.target.model;
delRpArea(data.areaNo).then(resp => {
this.refresh();
@ -400,6 +415,9 @@ export default {
this.refresh();
this.$message.info(error.message);
})
}).catch(() => {
this.$message({ type: 'info', message: 'Deletion cancelled.' });
});
}
},
refresh() {

View File

@ -117,7 +117,6 @@ export default {
onZrMouseDown(e) {
if (e.target && ['area'].includes(e.target.subType)) {
this.pixelExecCb(e, this.doSetTarget);
this.dragging = true;
if (this.model.choice == 'Construction') {
if (this.model.action == 'Note') {
this.pixelExecCb(e, this.doPopDialog);
@ -146,13 +145,14 @@ export default {
this.pixelExecCb(e, this.doTranslate)
}
}
}
if (!e.target) {
this.$emit('clear')
}
this.dragging = false;
}
// if (!e.target) {
// this.$emit('clear')
// }
},
onZrMouseOut(e) {
},
@ -173,7 +173,6 @@ export default {
}
},
onMouseDown(e) {
this.dragging = true;
if (this.model.choice == 'Plan') {
if (this.model.action == 'Edit') {
this.pixelExecCb(e, this.doPopDialog);
@ -302,7 +301,7 @@ export default {
_y: pointInGrid[1]
})
this.target = target;
this.target = e.target;
this.$emit('tag', target);
}
},
@ -314,7 +313,7 @@ export default {
const option = this.myChart.getOption();
const dataList = option.series[e.seriesIndex].data;
const length = dataList.length;
const last = utils.findNext(dataList, e.dataIndex, (el, i) => { return el instanceof Array});
const next = 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 &&
@ -349,8 +348,8 @@ export default {
seriesIndex: e.seriesIndex,
seriesName: isService? e.seriesName: 'service-trip',
seriesId: e.seriesId,
depTime: e.dataIndex < length - 1? last[0] - value[0]: 0,
runTime: e.dataIndex < length - 1? last[0] - value[0]: 0,
depTime: e.dataIndex < length - 1? next[0] - value[0]: 0,
runTime: e.dataIndex < length - 1? next[0] - value[0]: 0,
... value[2],
_x: pointInGrid[0],
_y: pointInGrid[1],
@ -413,14 +412,15 @@ export default {
const option = this.myChart.getOption();
const dataList = option.series[e.seriesIndex].data;
const length = dataList.length;
const next = dataList[e.dataIndex+1];
const near = dataList[e.dataIndex+1];
const prev = utils.findPrev(dataList, e.dataIndex, (el, i) => { return el instanceof Array});
const next = utils.findNext(dataList, e.dataIndex, (el, i) => { return el instanceof Array});
this.doSetSelected({e, pointInGrid});
if (e.dataIndex < length - 1 && e.value[1] == next[1]) {
if (e.dataIndex < length - 1 && e.value[1] == near[1]) {
this.$store.dispatch('menuOperation/setPopMenu', { position: point, menu: MenuEnum.planJustStop });
} else if (e.dataIndex < length - 1 && e.value[1] != next[1]) {
} else if (e.dataIndex < length - 1 && e.value[1] != near[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 });
@ -434,7 +434,8 @@ export default {
}
},
doSeriesDragging({e, pointInGrid}) {
if (this.selected && this.dragging) {
if (this.selected) {
this.dragging = true;
this.selected.dx = pointInGrid[0] - this.selected._x;
this.selected.dy = pointInGrid[1] - this.selected._y;
this.selected._x = pointInGrid[0];
@ -469,12 +470,14 @@ export default {
}
},
doAreaDragging({e, pointInGrid}) {
if (this.target && ['area'].includes(this.target.subType) && this.dragging) {
if (this.target && ['area'].includes(this.target.subType)) {
this.dragging = true;
const target = this.target;
const model = target.model;
const dx = pointInGrid[0] - model._x;
const dy = pointInGrid[1] - model._y;
model._x = pointInGrid[0];
model._y = pointInGrid[1];
@ -482,10 +485,15 @@ export default {
model.endTime += dx;
model.fartherKmRange += dy;
model.closerKmRange += dy;
if (this.planUtil.limitAreaKmRange(this.stations, model)) {
this.onZrMouseUp(e);
}
}
},
doAreaHornDragging({e, pointInGrid}) {
if (e.target && ['drag'].includes(e.target.subType) && this.dragging) {
if (e.target && ['drag'].includes(e.target.subType)) {
this.dragging = true;
const option = this.myChart.getOption();
const target = this.target;
const model = target.model;
@ -495,6 +503,7 @@ export default {
const dx = pointInGrid[0] - model._x;
const dy = pointInGrid[1] - model._y;
model._x = pointInGrid[0];
model._y = pointInGrid[1];
@ -517,6 +526,10 @@ export default {
break;
}
if (this.planUtil.limitAreaKmRange(this.stations, model)) {
this.onZrMouseUp(e);
}
const args = this.planUtil.calcAreaArgsByModel(this.myChart, model);
const graph = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
graph.position = args.position;