This commit is contained in:
fan 2019-08-02 14:26:58 +08:00
commit 92bdbf7a99
24 changed files with 89 additions and 154 deletions

View File

@ -2,7 +2,7 @@ const mapDeviceStyle = {
// '01': 'chengdu_04',
'02': 'fuzhou_01',
'03': 'bejing_01',
'04': 'chengdu_03',
// '03': 'chengdu_03',
'05': 'batong_01' // 暂时没有画北京八通线
};

View File

@ -24,8 +24,7 @@ class SkinStyle extends defaultStyle {
textVerticalAlign: 'middle', // 文字垂直对齐方式
position: 1 // 区段名称位置 1 上面 -1 下面 0 默认
},
mouse: true,
mouseEvent: {
mouseOverStyle: {
borderColor: '#fff',
borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF'
@ -155,8 +154,7 @@ class SkinStyle extends defaultStyle {
/** 信号灯按钮闪烁颜色*/
signalButtonLightenColor: '#E4EF50'
},
mouseEvent: true,
mouse: {
mouseOverStyle: {
borderLineColor: '#FFFFFF',
borderLineDash: [3, 3],
nameBackgroundColor: '#22DFDF',
@ -211,8 +209,7 @@ class SkinStyle extends defaultStyle {
offset: {x: -8, y: 22}, // 运行等级偏移量
textColor: '#FFFFFF' // 停站等级字体颜色
},
mouseEvent: true,
mouse: {
mouseOverStyle: {
borderLineColor: '#FFFFFF',
borderLineDash: [3, 3]
}
@ -244,8 +241,6 @@ class SkinStyle extends defaultStyle {
stationControlRedColor: '#FF0000',
/** 控制模式黄色*/
stationControlYellowColor: '#FFFF00',
/** 是否有鼠标悬浮事件 */
mouseEvent: true,
/** 鼠标悬浮样式 */
mouseOverStyle: {
fontSize: 10,
@ -262,8 +257,7 @@ class SkinStyle extends defaultStyle {
};
this[deviceType.Switch] = {
mouse: true,
mouseEvent: {
mouseOverStyle: {
borderBackgroundColor: '#22DFDF',
borderColor: '#fff',
textShadowColor: '#22DFDF'
@ -297,7 +291,6 @@ class SkinStyle extends defaultStyle {
radiusR: 6,
controlColor: '#FFFF00'
},
mouseEvent: true,
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
@ -318,7 +311,6 @@ class SkinStyle extends defaultStyle {
radiusR: 6,
controlColor: '#00FF00'
},
mouseEvent: true,
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',
@ -339,7 +331,6 @@ class SkinStyle extends defaultStyle {
radiusR: 6,
controlColor: '#ECE9D8'
},
mouseEvent: true,
mouseOverStyle: {
fontSize: 10,
fontFormat: 'consolas',

View File

@ -61,7 +61,7 @@ export default class LcControl extends Group {
}
createMouseEvent() {
if (this.style.LcControl.mouseEvent) {
if (this.style.LcControl.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.mouseoverText = (e) => {

View File

@ -61,7 +61,7 @@ export default class LimitControl extends Group {
}
createMouseEvent() {
if (this.style.LimitControl.mouseEvent) {
if (this.style.LimitControl.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.mouseoverText = (e) => {

View File

@ -57,7 +57,7 @@ class EMouse extends Group {
x: rect.x + (rect.width / 2),
y: rect.y + (rect.height / 2),
text: this.device.model.name,
textFill: this.device.style.Section.mouseEvent.textShadowColor, // 黄色
textFill: this.device.style.Section.mouseOverStyle.textShadowColor, // 黄色
textAlign: 'middle',
textVerticalAlign: 'top',
textFont: 'bold ' + (fontSize + 1) + 'px ' + this.device.style.textFontFormat
@ -74,7 +74,7 @@ class EMouse extends Group {
shape: rect,
style: {
lineDash: [3, 3],
stroke: this.device.style.Section.mouseEvent.borderColor,
stroke: this.device.style.Section.mouseOverStyle.borderColor,
fill: this.device.style.transparentColor
}
});

View File

@ -18,10 +18,10 @@ export default class Section extends Group {
this.zlevel = model.zlevel;
this.z = 5 + parseInt(model.layer || 0);
this.model = model;
this.selected = false;
this.style = style;
this.create();
this.createMouseEvent();
this.setState(model);
}
create() {
@ -38,39 +38,16 @@ export default class Section extends Group {
if (model.type === '01') {
this.createAxles(); // 创建计轴
}
this.setState(model);
}
}
createMouseEvent() {
// 鼠标事件
if (this.style.Section.mouse) {
if (this.style.Section.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
// this.on('mousedown', this.mouseclick);
this.on('mouseout', this.mouseleave);
this.on('mouseover', this.mouseenter);
}
}
mouseclick(e) {
if ([3].includes(e.which)) {
this.selected = !this.selected;
if (this.selected) {
this.mouseEvent.mouseover(e.target._subType);
}
}
}
mouseenter(e) {
if (!this.selected) {
this.mouseEvent.mouseover(e.target._subType);
}
}
mouseleave(e) {
if (!this.selected) {
this.mouseEvent.mouseout(e);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e.target._subType); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}

View File

@ -18,8 +18,8 @@ export default class EMouse extends Group {
z: 6,
shape: this.device.getBoundingRect(),
style: {
lineDash: this.style.Signal.mouse.borderLineDash,
stroke: this.style.Signal.mouse.borderLineColor,
lineDash: this.style.Signal.mouseOverStyle.borderLineDash,
stroke: this.style.Signal.mouseOverStyle.borderLineColor,
fill: this.style.transparentColor
}
});
@ -30,9 +30,9 @@ export default class EMouse extends Group {
z: 5,
shape: this.device.sigName.getBoundingRect(),
style: {
lineDash: this.style.Signal.mouse.borderLineDash,
stroke: this.style.Signal.mouse.borderLineColor,
fill: this.style.Signal.mouse.nameBackgroundColor
lineDash: this.style.Signal.mouseOverStyle.borderLineDash,
stroke: this.style.Signal.mouseOverStyle.borderLineColor,
fill: this.style.Signal.mouseOverStyle.nameBackgroundColor
}
});
@ -46,7 +46,7 @@ export default class EMouse extends Group {
this.nameRect.show();
this.lampRect.show();
this.device.lamps.forEach(elem => {
elem.setBorderColor(this.style.Signal.mouse.lampBorderLineColor);
elem.setBorderColor(this.style.Signal.mouseOverStyle.lampBorderLineColor);
});
this.device.sigName.setColor(this.style.backgroundColor);
}

View File

@ -159,7 +159,7 @@ class Signal extends Group {
}
createMouseEvent() {
if (this.style.Signal.mouseEvent) {
if (this.style.Signal.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.onmouseover = (e) => {

View File

@ -14,6 +14,7 @@ export default class Station extends Group {
this.model = model;
this.style = style;
this.create();
this.setState(model);
}
create() {
@ -57,7 +58,6 @@ export default class Station extends Group {
this.add(this.stationText);
this.add(this.mileageText);
this.setShowMileageText(model.kmPostShow);
this.setState(model);
}
}

View File

@ -6,9 +6,9 @@ export default class EMouse extends Group {
super();
this.device = device;
this.down = true;
this._create();
this.create();
}
_create() {
create() {
this.text = new Text({
_subType: 'Text',
zlevel: this.device.zlevel,
@ -26,6 +26,7 @@ export default class EMouse extends Group {
textVerticalAlign: this.device.style.StationControl.mouseOverStyle.textVerticalAlign
}
});
this.add(this.text);
this.text.hide();
}

View File

@ -15,6 +15,7 @@ export default class StationControl extends Group {
this._code = model.code;
this._type = model._type;
this.zlevel = model.zlevel;
this.z = 1;
this.model = model;
this.style = style;
this.create();
@ -28,6 +29,7 @@ export default class StationControl extends Group {
_subType: 'emergency',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x - this.style.StationControl.stationControlDistance * 3 / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationOffset.y
@ -40,6 +42,7 @@ export default class StationControl extends Group {
_subType: 'center',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x - this.style.StationControl.stationControlDistance / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationOffset.y
@ -52,6 +55,7 @@ export default class StationControl extends Group {
_subType: 'substation',
style: this.style,
zlevel: this.zlevel,
z: this.z,
point: {
x: model.position.x + this.style.StationControl.stationControlDistance / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationOffset.y
@ -65,7 +69,7 @@ export default class StationControl extends Group {
const point = arrows(this.model.position.x, this.model.position.y + this.style.StationControl.stationControlmodeR / 2, this.style.StationControl.stationControlDistance / 6, this.style.StationControl.stationControlmodeR * 0.8);
this.arrowsControl = new EArrow({
zlevel: this.zlevel,
z: 1,
z: this.z,
style: this.style,
count: this.count,
drict: 1,
@ -123,15 +127,11 @@ export default class StationControl extends Group {
}
}
createMouseEvent() {
if (this.style.ZcControl.mouseEvent) {
if (this.style.ZcControl.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.onmouseover = (e) => {
this.mouseEvent.mouseover(e);
};
this.onmouseout = (e) => {
this.mouseEvent.mouseout(e);
};
this.onmouseover = (e) => { this.mouseEvent.mouseover(e); };
this.onmouseout = (e) => { this.mouseEvent.mouseout(e); };
}
}
getShapeTipPoint() {

View File

@ -65,8 +65,8 @@ export default class StationDelayUnlock extends Group {
if (this.rect.height < 20) this.rect.height = 20;
this.table = new Rect({
zlevel: this.zlevel - 1,
z: this.z,
zlevel: this.zlevel,
z: this.z - 1,
shape: {
x: model.position.x - this.lPadding,
y: model.position.y - this.vPadding,

View File

@ -18,8 +18,8 @@ export default class EMouse extends Group {
z: 0,
shape: this.device.getBoundingRect(),
style: {
lineDash: this.style.StationStand.mouse.borderLineDash,
stroke: this.style.StationStand.mouse.borderLineColor,
lineDash: this.style.StationStand.mouseOverStyle.borderLineDash,
stroke: this.style.StationStand.mouseOverStyle.borderLineColor,
fill: this.style.transparentColor
}
});

View File

@ -158,7 +158,7 @@ class StationStand extends Group {
}
createMouseEvent() {
if (this.style.StationStand.mouseEvent) {
if (this.style.StationStand.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
this.onmouseover = (e) => {

View File

@ -1,6 +1,5 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
// import Vue from 'vue';
class EMouse extends Group {
constructor(device) {
@ -33,8 +32,8 @@ class EMouse extends Group {
style: {
lineWidth: 1,
lineDash: [3, 3],
stroke: this.device.style.Switch.mouseEvent.borderColor,
fill: this.device.style.Switch.mouseEvent.borderBackgroundColor
stroke: this.device.style.Switch.mouseOverStyle.borderColor,
fill: this.device.style.Switch.mouseOverStyle.borderBackgroundColor
}
});
this.add(this.textRect);
@ -60,7 +59,7 @@ class EMouse extends Group {
shape: Object.assign({ r: 4 }, rect),
style: {
lineDash: [3, 3],
stroke: this.device.style.Switch.mouseEvent.borderColor,
stroke: this.device.style.Switch.mouseOverStyle.borderColor,
fill: this.device.style.transparentColor
}
});
@ -69,19 +68,6 @@ class EMouse extends Group {
this.switchBorder.hide();
}
mouseover() {
// 显示车次窗
// const section = Vue.prototype.$jlmap.mapDevice[this.device.model.switchSectionCode].instance;
// section && section.setTrainWindowEventShow(true);
this.switchBorder && this.switchBorder.show();
this.device.setLossAction(false);
this.device.setSwitchCoreColor(this.device.style.Switch.mouseEvent.borderBackgroundColor);
this.device.setTextStyle({
textFill: '#000'
});
this.textRect && this.textRect.show();
}
mouseout() {
// const section = Vue.prototype.$jlmap.mapDevice[this.device.model.switchSectionCode].instance;
// section && section.setTrainWindowEventShow(false);
@ -93,5 +79,19 @@ class EMouse extends Group {
this.textRect && this.textRect.hide();
this.device.setState(this.device.model);
}
mouseover() {
// 显示车次窗
// const section = Vue.prototype.$jlmap.mapDevice[this.device.model.switchSectionCode].instance;
// section && section.setTrainWindowEventShow(true);
this.switchBorder && this.switchBorder.show();
this.device.setLossAction(false);
this.device.setSwitchCoreColor(this.device.style.Switch.mouseOverStyle.borderBackgroundColor);
this.device.setTextStyle({
textFill: '#000'
});
this.textRect && this.textRect.show();
}
}
export default EMouse;

View File

@ -20,39 +20,17 @@ export default class Switch extends Group {
this.zlevel = model.zlevel;
this.z = 6;
this._create();
this.setState(model);
this.createMouseEvent();
this.setState(model);
}
createMouseEvent() {
// 鼠标事件
if (this.style.Switch.mouse) {
if (this.style.Switch.mouseOverStyle) {
this.mouseEvent = new EMouse(this);
this.add(this.mouseEvent);
// this.on('mousedown', this.mouseclick);
this.on('mouseout', this.mouseleave);
this.on('mouseover', this.mouseenter);
}
}
mouseclick(e) {
if ([3].includes(e.which)) {
this.selected = !this.selected;
if (this.selected) {
this.mouseEvent.mouseover();
}
}
}
mouseenter(e) {
if (!this.selected) {
this.mouseEvent.mouseover();
}
}
mouseleave() {
if (!this.selected) {
this.mouseEvent.mouseout();
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });
this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); });
}
}
@ -197,7 +175,7 @@ export default class Switch extends Group {
/** 设置道岔文字颜色*/
setTextColor(color) {
this.name.getNameText().setStyle('textFill', color);
this.name.getNameText().setStyle({textFill: color});
}
/** 设置道岔背景颜色*/
@ -207,7 +185,7 @@ export default class Switch extends Group {
/** 设置道岔文字边框颜色 */
setHasTextBorder(width) {
this.name.getTextRect().setStyle('lineWidth', width);
this.name.getTextRect().setStyle({lineWidth: width});
}
/** 恢复状态*/
@ -218,20 +196,7 @@ export default class Switch extends Group {
this.relocShelter.stopAnimation(false);
this.relocShelter.hide();
this.releaseBackground.hide();
this.setHasTextBorder(0);
switch (this.model.locateType) {
case '01':
this.setTextColor(this.style.Switch.text.switchTextLocateColor);
break;
case '02':
this.setTextColor(this.style.Switch.text.switchInversionColor);
break;
default:
this.setTextColor(this.style.Switch.text.switchTextLossColor);
break;
}
}
/** 定位*/
@ -240,6 +205,7 @@ export default class Switch extends Group {
this.setSwitchCoreInvisible(true);
this.locShelter.show();
this.relocShelter.hide();
this.setTextColor(this.style.Switch.text.switchTextLocateColor);
}
/** 反位*/
@ -248,6 +214,7 @@ export default class Switch extends Group {
this.setSwitchCoreInvisible(true);
this.locShelter.hide();
this.relocShelter.show();
this.setTextColor(this.style.Switch.text.switchInversionColor);
this.setSectionState(this.relocShelter.getSection(), 'fill', this.model.sectionAstatus);
}
@ -257,6 +224,7 @@ export default class Switch extends Group {
this.locShelter.hide();
this.relocShelter.hide();
this.setSwitchCoreInvisible(false);
this.setTextColor(this.style.Switch.text.switchTextLossColor);
nameFlicker && this.nameTextAnimation();
}

View File

@ -10,8 +10,8 @@ export default class TextTrainNumber extends Group {
create() {
const model = this.model;
this.textTrainNumber = new Text({
zlevel: model.zlevel+1,
z: model.z,
zlevel: model.zlevel,
z: model.z+1,
style: {
x: parseInt(model.point.x + model.lrPadding),
y: parseInt(model.point.y + model.upPadding),

View File

@ -28,8 +28,8 @@ class TrainWindow extends Group {
const point = model.point||model.position;
this.trainRect = new Polygon({
_subType: 'TrainWindow',
zlevel: this.zlevel - 1,
z: this.z,
zlevel: this.zlevel,
z: this.z - 1,
shape: {
smooth: this.style.TrainWindow.trainWindowSmooth,
points: [

View File

@ -74,7 +74,7 @@
dialogShow: false,
loading: false,
operate: null,
nameLevels: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12],
nameLevels: [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12],
}
},
components: {

View File

@ -74,7 +74,7 @@
dialogShow: false,
loading: false,
operate: null,
nameLevels: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12],
nameLevels: [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12],
}
},
components: {

View File

@ -2,11 +2,11 @@
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:9010' // 袁琪
// BASE_API = 'http://192.168.3.6:9010'; // 旭强
// BASE_API = 'http://192.168.3.4:9010' // 琰培
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000'; // 琰培
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -27,7 +27,6 @@ import ZoomBox from './zoom/zoom';
import ProgressBar from '@/views/components/progressBar/index';
import { mapGetters } from 'vuex';
import { TrainingMode } from '@/scripts/ConstDic';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'JlmapVisual',
@ -99,27 +98,27 @@ export default {
}
},
created() {
EventBus.$on('viewLoading', (loading) => {
eventBus.$on('viewLoading', (loading) => {
this.mapViewLoaded(loading);
});
EventBus.$on('viewProgressAt', (percentage) => {
eventBus.$on('viewProgressAt', (percentage) => {
this.mapViewProgressAt(percentage);
});
EventBus.$on('refresh', () => {
eventBus.$on('refresh', () => {
this.refresh(this.$store.state.map.map);
});
},
mounted() {
this.initLoadPage();
},
beforeDestroy() {
EventBus.$off('refresh');
EventBus.$off('viewLoading');
EventBus.$off('viewProgressAt');
async beforeDestroy() {
await this.$store.dispatch('training/setPrdType', null);
eventBus.$off('refresh');
eventBus.$off('viewLoading');
eventBus.$off('viewProgressAt');
if (this.$jlmap) {
this.$jlmap.dispose();
}
this.$store.dispatch('training/setPrdType', null);
},
methods: {
// jlmap

View File

@ -80,7 +80,7 @@
let self = this;
window.onclick = function (e) {
self.doClose();
};
}
},
methods: {
doShow(point) {
@ -129,7 +129,6 @@
},
importChart(file) {
let skinStyle = this.selected ? this.selected.id : null;
const that = this;
if (file && skinStyle) {
const loading = this.$loading({
lock: true,
@ -157,11 +156,10 @@
if (wb) {
try {
let jsonData = [];
const PlanConvert = that.$theme.loadPlanConvert(skinStyle);
let PlanConvert = that.$theme.loadPlanConvert(skinStyle);
for (let index in wb.Sheets) {
jsonData = PlanConvert.importData(wb.Sheets[index], jsonData);
}
console.log(jsonData, '解析数据');
importRunPlan({ skinStyle: skinStyle, runPlanList: jsonData }).then(response => {
loading.close();

View File

@ -56,10 +56,11 @@
this.loading = true;
this.editModel.planId = this.selected.id;
publishRunPlan(this.editModel).then(resp => {
this.$message.success('发布运行成功');
this.loading = false;
if (resp.data && resp.data.length) {
this.$emit('showCheckInfo', { contextList: resp.data });
} else {
this.$message.success('发布运行成功');
}
this.close();
}).catch(error => {