修改代码
This commit is contained in:
parent
61564dfdbf
commit
3afd5f8e61
@ -58,6 +58,23 @@ class Jlmap {
|
||||
this.$mouseController.on(this.events.Zoom, this.optionsHandler);
|
||||
}
|
||||
|
||||
loadStyle(skinStyle) {
|
||||
return selectSkinStyle(skinStyle);
|
||||
}
|
||||
|
||||
loadDefaultState() {
|
||||
const defaultStateDict = {};
|
||||
|
||||
zrUtil.each(Object.keys(deviceState), (type) => {
|
||||
defaultStateDict[type] = {};
|
||||
zrUtil.each(Object.keys(deviceState[type] || {}), (state) => {
|
||||
defaultStateDict[type][state] = deviceState[type][state].Default;
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
return defaultStateDict;
|
||||
}
|
||||
|
||||
setMap(map) {
|
||||
// 保存皮肤类型
|
||||
this.skinStyle = map.skinVO.code;
|
||||
@ -81,23 +98,6 @@ class Jlmap {
|
||||
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(); }
|
||||
}
|
||||
|
||||
loadStyle(skinStyle) {
|
||||
return selectSkinStyle(skinStyle);
|
||||
}
|
||||
|
||||
loadDefaultState() {
|
||||
const defaultStateDict = {};
|
||||
|
||||
zrUtil.each(Object.keys(deviceState), (type) => {
|
||||
defaultStateDict[type] = {};
|
||||
zrUtil.each(Object.keys(deviceState[type] || {}), (state) => {
|
||||
defaultStateDict[type][state] = deviceState[type][state].Default;
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
return defaultStateDict;
|
||||
}
|
||||
|
||||
setDefaultState() {
|
||||
const list = [];
|
||||
|
||||
|
@ -19,9 +19,6 @@ export default class Train extends Group {
|
||||
this.newScale = this.fontSize / style.Train.trainTextFontSize;
|
||||
this._create();
|
||||
this.setState(state);
|
||||
/*this.on('mousedown', this.mouseclick);
|
||||
this.on('mouseout', this.mouseleave);
|
||||
this.on('mouseover', this.mouseenter);*/
|
||||
}
|
||||
|
||||
_computed() {
|
||||
@ -51,9 +48,9 @@ export default class Train extends Group {
|
||||
}
|
||||
_create() {
|
||||
this._computed();
|
||||
this.isChangeTrainWidth(this.model,this.style);
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
this.isChangeTrainWidth(this.model, this.style);
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
if (this.point) {
|
||||
this.trainB = new TrainBody({
|
||||
zlevel: this.zlevel,
|
||||
@ -69,8 +66,8 @@ export default class Train extends Group {
|
||||
sectionModel: model.sectionModel,
|
||||
runControlStatus: model.runControlStatus,
|
||||
runStatus: model.runStatus,
|
||||
fontSize: this.fontSize,
|
||||
type: model.type,
|
||||
fontSize: this.fontSize,
|
||||
type: model.type,
|
||||
speed: model.speed,
|
||||
maLen: model.maLen
|
||||
});
|
||||
@ -83,7 +80,7 @@ export default class Train extends Group {
|
||||
y: this.point.y
|
||||
},
|
||||
drect: -1,
|
||||
scale: this.newScale
|
||||
scale: this.newScale
|
||||
});
|
||||
|
||||
this.trainR = new TrainHead({
|
||||
@ -95,37 +92,16 @@ export default class Train extends Group {
|
||||
y: this.point.y
|
||||
},
|
||||
drect: 1,
|
||||
scale: this.newScale
|
||||
scale: this.newScale
|
||||
});
|
||||
|
||||
this.add(this.trainB);
|
||||
this.add(this.trainL);
|
||||
this.add(this.trainR);
|
||||
}
|
||||
/*let rect = Object.assign({}, this.getBoundingRect());
|
||||
rect.x -= theme.trainWidth / 2;
|
||||
rect.y -= 5;
|
||||
rect.width += theme.trainWidth;
|
||||
rect.height += 10;
|
||||
|
||||
this.trainBorder = new Rect({
|
||||
zlevel: model.zlevel,
|
||||
z: this.z,
|
||||
silent: true,
|
||||
shape: rect,
|
||||
style: {
|
||||
lineDash: [3, 3],
|
||||
stroke: theme.borderColor,
|
||||
fill: theme.transparentColor
|
||||
}
|
||||
})
|
||||
|
||||
this.add(this.trainBorder);
|
||||
|
||||
this.mouseStatusRecover();*/
|
||||
}
|
||||
|
||||
//获取设备提示坐标
|
||||
// 获取设备提示坐标
|
||||
getShapeTipPoint() {
|
||||
return {
|
||||
x: (this.train.shape.x),
|
||||
@ -147,59 +123,59 @@ export default class Train extends Group {
|
||||
|
||||
// 设置服务号状态类型
|
||||
setServerNoType(type) {
|
||||
if(this.style.Train.serverNoType.length>0) {
|
||||
let flag = this.style.Train.serverNoType.some((item) =>{
|
||||
if (type === item.type){
|
||||
this.trainB.setTextTrainServerColor(item.showColor);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (this.style.Train.serverNoType.length>0) {
|
||||
const flag = this.style.Train.serverNoType.some((item) =>{
|
||||
if (type === item.type) {
|
||||
this.trainB.setTextTrainServerColor(item.showColor);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (this.style.Train.defaultServerNoColor && !flag) {
|
||||
this.trainB.setTextTrainServerColor(this.style.this.style.Train.defaultServerNoColor);
|
||||
}
|
||||
}
|
||||
this.trainB.setTextTrainServerColor(this.style.this.style.Train.defaultServerNoColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置目的地状态
|
||||
setDestinationStatus(status) {
|
||||
if(this.style.Train.destinationStatus.length>0) {
|
||||
let flag = this.style.Train.destinationStatus.some((item) =>{
|
||||
if (status === item.status){
|
||||
if (this.style.Train.destinationStatus.length>0) {
|
||||
const flag = this.style.Train.destinationStatus.some((item) =>{
|
||||
if (status === item.status) {
|
||||
this.trainB.setTextTrainTargetColor(item.showColor);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if(this.style.Train.defaultDestinationColor && !flag){
|
||||
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (this.style.Train.defaultDestinationColor && !flag) {
|
||||
this.trainB.setTextTrainTargetColor(this.style.Train.defaultDestinationColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 设置运行方向状态类型
|
||||
setDirectionType(type) {
|
||||
if (this.style.Train.directionType.length > 0){
|
||||
if (this.style.Train.directionType.length > 0) {
|
||||
this.style.Train.directionType.some((item) => {
|
||||
if (type === item.type){
|
||||
this.trainL.setLineShow(item.lineLShow);
|
||||
this.trainL.setArrowShow(item.arrowLShow);
|
||||
this.trainR.setLineShow(item.lineRShow);
|
||||
this.trainR.setLineShow(item.arrowRShow);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === item.type) {
|
||||
this.trainL.setLineShow(item.lineLShow);
|
||||
this.trainL.setArrowShow(item.arrowLShow);
|
||||
this.trainR.setLineShow(item.lineRShow);
|
||||
this.trainR.setLineShow(item.arrowRShow);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 设置列车停止方向类型
|
||||
setDirectionStopType(type) {
|
||||
if(this.style.Train.directionStopType.length > 0) {
|
||||
if (this.style.Train.directionStopType.length > 0) {
|
||||
this.style.Train.directionStopType.some((item) => {
|
||||
if (type === item.type){
|
||||
if (type === item.type) {
|
||||
this.trainL.setLineShow(item.lineLShow);
|
||||
this.trainR.setLineShow(item.lineRShow);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 设置运行状态
|
||||
setRunStatus(status) {
|
||||
@ -215,60 +191,60 @@ export default class Train extends Group {
|
||||
}
|
||||
// 设置运行模式
|
||||
setRunMode(status) {
|
||||
if(this.style.Train.runModeStatus.length > 0) {
|
||||
if (this.style.Train.runModeStatus.length > 0) {
|
||||
this.style.Train.runModeStatus.some((item) => {
|
||||
if (status === item.status) {
|
||||
this.trainL.setColor(item.trainLColor);
|
||||
this.trainR.setColor(item.trainRColor);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 设置运行控制状态类型
|
||||
setRunControlStatus(status) {
|
||||
if(this.style.Train.runControlStatus.length > 0) {
|
||||
if (this.style.Train.runControlStatus.length > 0) {
|
||||
this.style.Train.runControlStatus.some((item) => {
|
||||
if (status === item.status) {
|
||||
this.trainB.setHShow(item.hShow);
|
||||
this.trainB.setSShow(item.sShow);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 设置车门状态类型
|
||||
setDoorStatus(status) {
|
||||
if (this.style.Train.doorStatus.length > 0) {
|
||||
this.style.Train.doorStatus.some((item) => {
|
||||
if(status === item.status){
|
||||
if (status === item.status) {
|
||||
this.trainB.setDShow(item.dShow);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 设置通信状态类型
|
||||
setCommunicationStatus() {
|
||||
if (this.style.Train.communicationStatus.length > 0) {
|
||||
this.style.Train.doorStatus.some((item) => {
|
||||
if (status === item.status){
|
||||
if (status === item.status) {
|
||||
this.trainB.setTrainColor(item.trainColor);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 设置报警状态
|
||||
setAlarmStatus(status) {
|
||||
if (this.style.Train.alarmStatus.length >0) {
|
||||
this.style.Train.alarmStatus.some((item) => {
|
||||
if (status === item.status){
|
||||
if (status === item.status) {
|
||||
this.trainB.setAShow(item.aShow);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 设置状态
|
||||
@ -285,97 +261,38 @@ export default class Train extends Group {
|
||||
this.setAlarmStatus(state.alarmStatus); // 设置报警状态
|
||||
}
|
||||
}
|
||||
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
|
||||
isChangeTrainWidth(model,style) {
|
||||
if(!style.Train.changeTrainWidth)
|
||||
return;
|
||||
if (model.nameFormat) {
|
||||
let arr = model.nameFormat.split(':');
|
||||
arr.forEach(ele => {
|
||||
switch (ele) {
|
||||
case 'targetCode': {
|
||||
this.size += 3;
|
||||
break;
|
||||
}
|
||||
case 'serviceNumber': {
|
||||
this.size += 2;
|
||||
break;
|
||||
}
|
||||
case 'tripNumber': {
|
||||
this.size += 4;
|
||||
break;
|
||||
}
|
||||
case 'groupNumber': {
|
||||
this.size += 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.size = 9;
|
||||
}
|
||||
// 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度
|
||||
isChangeTrainWidth(model, style) {
|
||||
if (!style.Train.changeTrainWidth) { return; }
|
||||
if (model.nameFormat) {
|
||||
const arr = model.nameFormat.split(':');
|
||||
arr.forEach(ele => {
|
||||
switch (ele) {
|
||||
case 'targetCode': {
|
||||
this.size += 3;
|
||||
break;
|
||||
}
|
||||
case 'serviceNumber': {
|
||||
this.size += 2;
|
||||
break;
|
||||
}
|
||||
case 'tripNumber': {
|
||||
this.size += 4;
|
||||
break;
|
||||
}
|
||||
case 'groupNumber': {
|
||||
this.size += 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.size = 9;
|
||||
}
|
||||
|
||||
this.style.Train.trainWidth = this.size * this.fontSize * (2 / 3) - 16;
|
||||
}
|
||||
removeTrainDetail() {
|
||||
this.trainB.removeTrainDetail();
|
||||
}
|
||||
//获取列车包围框
|
||||
/*getBoundingRect() {
|
||||
let list = [this.trainB, this.trainL, this.trainR];
|
||||
let rect = null;
|
||||
|
||||
list.forEach(elem => {
|
||||
if (elem) {
|
||||
let tempRect = elem.getBoundingRect();
|
||||
if (tempRect.x && tempRect.y && tempRect.width && tempRect.height) {
|
||||
if (rect) {
|
||||
rect.union(tempRect);
|
||||
} else {
|
||||
rect = tempRect;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return rect || new BoundingRect(0, 0, 0, 0);
|
||||
}*/
|
||||
/* setSectionBorderShow(show) {
|
||||
let section = store.getters['map/getViewInstanceByDevice']({ _type: ModelType.Section, _code: this.model.sectionCode });
|
||||
show && section && section.mouseStatusVisible();
|
||||
show || section && section.mouseStatusRecover();
|
||||
}
|
||||
|
||||
mouseStatusVisible() {
|
||||
this.trainBorder.show();
|
||||
this.setSectionBorderShow(true);
|
||||
this.trainB.setMouseOver();
|
||||
}
|
||||
|
||||
mouseStatusRecover() {
|
||||
this.trainBorder.hide();
|
||||
this.setSectionBorderShow(false);
|
||||
this.trainB.setMouseOut();
|
||||
}
|
||||
|
||||
mouseclick(e) {
|
||||
if ([3].includes(e.which)) {
|
||||
this.selected = !this.selected;
|
||||
if (this.selected) {
|
||||
this.mouseStatusVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mouseenter(e) {
|
||||
if (!this.selected) {
|
||||
this.mouseStatusVisible();
|
||||
}
|
||||
}
|
||||
|
||||
mouseleave(e) {
|
||||
if (!this.selected) {
|
||||
this.mouseStatusRecover();
|
||||
}
|
||||
}*/
|
||||
this.style.Train.trainWidth = this.size * this.fontSize * (2 / 3) - 16;
|
||||
}
|
||||
removeTrainDetail() {
|
||||
this.trainB.removeTrainDetail();
|
||||
}
|
||||
}
|
||||
|
@ -187,8 +187,6 @@ const map = {
|
||||
state: {
|
||||
map: {}, // 地图数据
|
||||
mapList: {}, // 地图数据列表
|
||||
dataZoom: {}, // 缩放位置
|
||||
deviceUpdateCount: 0, // 地图设备更新标识
|
||||
mapViewLoadedCount: 0, // 地图视图加载完成标识
|
||||
mapDataLoadedCount: 0, // 地图数据加载完成标识
|
||||
trainDetails: null // 列车详情显示
|
||||
@ -439,12 +437,11 @@ const map = {
|
||||
},
|
||||
|
||||
mutations: {
|
||||
loadMapData: (state) => {
|
||||
++state.deviceUpdateCount;
|
||||
setMapData: (state, map) => {
|
||||
state.map = map;
|
||||
},
|
||||
mapRender: (state, devices) => {
|
||||
Vue.$jlmap && Vue.$jlmap.render(devices);
|
||||
++state.deviceUpdateCount;
|
||||
},
|
||||
mapUpdate: (devices) => {
|
||||
Vue.$jlmap && Vue.$jlmap.update(devices);
|
||||
@ -492,8 +489,8 @@ const map = {
|
||||
commit('mapClear');
|
||||
},
|
||||
|
||||
loadMapData: ({ commit }) => {
|
||||
commit('loadMapData');
|
||||
setMapData: ({ commit }, map) => {
|
||||
commit('setMapData', map);
|
||||
},
|
||||
|
||||
setTrainDetails: ({ commit }, message) => {
|
||||
|
@ -27,6 +27,7 @@ import ZoomBox from './zoom/zoom';
|
||||
import ProgressBar from '@/views/components/progressBar/index';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { TrainingMode } from '@/scripts/ConstDic';
|
||||
import { debuglog } from 'util';
|
||||
// import { Loading } from 'element-ui';
|
||||
|
||||
export default {
|
||||
@ -71,15 +72,11 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'$store.state.map.map': function (val, old) {
|
||||
if (val && val.skinStyle) {
|
||||
try {
|
||||
this.setMap(val);
|
||||
} catch (error) {
|
||||
this.mapViewLoaded(false);
|
||||
console.log(error);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
this.setMap(val);
|
||||
} catch (error) {
|
||||
this.mapViewLoaded(false);
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
'$store.state.training.rezoomCount': function (val, old) {
|
||||
|
Loading…
Reference in New Issue
Block a user