This commit is contained in:
fan 2020-05-06 16:57:18 +08:00
commit 15d88d2f7f
6 changed files with 97 additions and 8 deletions

View File

@ -80,7 +80,10 @@ class SkinCode extends defaultStyle {
mouseOverStyle: {
borderColor: '#fff',
borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF'
textShadowColor: '#22DFDF',
nameShow: true,
lineDash: [3, 3],
lineWidthMore: 0
},
line: {
width: 5, // 区段宽度

View File

@ -75,6 +75,14 @@ class SkinCode extends defaultStyle {
textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle' // 文字垂直对齐方式
},
mouseOverStyle: {
borderColor: '#fff',
borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF',
nameShow: false,
lineDash: null,
lineWidthMore: 6
},
line: {
width: 4, // 区段宽度
beyondWidth: 0, // 区段宽超出宽度

View File

@ -1,7 +1,9 @@
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect';
// import Polygon from 'zrender/src/graphic/shape/Polygon';
import store from '@/store/index_APP_TARGET';
// import JTriangle from '../../utils/JTriangle';
class EMouse extends Group {
constructor(device, code) {
super();
@ -11,7 +13,7 @@ class EMouse extends Group {
}
create() {
// 名称的包围框
if (this.device.name) {
if (this.device.name && this.device.style.Section.mouseOverStyle.nameShow) {
const rect = this.device.name.getBoundingRect();
if (!this.device.isSwitchSection) {
this.sectionTextBorder = new Rect({
@ -69,16 +71,65 @@ class EMouse extends Group {
// 区段包围框
if (this.device.section) {
const rect = this.device.section.getBoundingRect();
rect.height = rect.height + this.device.style.Section.mouseOverStyle.lineWidthMore;
const shape = {
x: rect.x,
y: rect.y - this.device.style.Section.mouseOverStyle.lineWidthMore / 2,
width: rect.width,
height: rect.height
};
this.lineBorder = new Rect({
zlevel: this.device.zlevel,
z: this.device.z - 1,
shape: rect,
shape: shape,
style: {
lineDash: [3, 3],
lineDash: this.device.style.Section.mouseOverStyle.lineDash,
stroke: this.device.style.Section.mouseOverStyle.borderColor,
fill: this.device.style.transparentColor
}
});
// const model = this.device.model;
// const arr = JSON.parse(JSON.stringify(model.points));
// arr.reverse();
// const points = [];
// model.points.forEach((ele, index) => {
// if (index == model.points.length - 1) {
// this.triangle = new JTriangle(model.points[index - 1], ele);
// } else {
// console.log(ele, model.points[index + 1]);
// this.triangle = new JTriangle(ele, model.points[index + 1]);
// }
// const directx = this.triangle.drictx;
// const directy = this.triangle.dricty;
// const x = 5 * this.triangle.getSinRate();
// console.log(this.triangle.getCosRate(), this.triangle.getSinRate());
// const y = 5;
// points.push([ele.x - (directx * x), ele.y - (directy * y)]);
// });
// arr.forEach((ele, index) => {
// if (index == arr.length - 1) {
// this.triangle = new JTriangle(arr[index - 1], ele);
// } else {
// this.triangle = new JTriangle(ele, arr[index + 1]);
// }
// const directx = this.triangle.drictx;
// const directy = this.triangle.dricty;
// const x = 5 * this.triangle.getSinRate();
// const y = 5;
// points.push([ele.x + (directx * x), ele.y + (directy * y)]);
// });
// this.lineBorder = new Polygon({
// zlevel: this.device.zlevel,
// z: this.device.z - 1,
// shape: {
// points: points
// },
// style: {
// lineDash: this.device.style.Section.mouseOverStyle.lineDash,
// stroke: this.device.style.Section.mouseOverStyle.borderColor,
// fill: this.device.style.transparentColor
// }
// });
this.add(this.lineBorder);
this.lineBorder.hide();

View File

@ -771,7 +771,7 @@ export default class Section extends Group {
}
createMouseEvent() { // 鼠标事件
if (this.style.Section.mouseOverStyle) { // 只有北京线路才会有鼠标事件
if (this.style.Section.mouseOverStyle) {
this.mouseEvent = new EMouse(this, this.model.relSwitchCode);
this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });

View File

@ -165,9 +165,7 @@ export default {
this.$emit('setCenter', code);
},
drawMap() {
this.$refs.routeOperate && this.$refs.routeOperate.batchSectionListFocus(false);
this.$refs.signalOperate && this.$refs.signalOperate.batchSectionListFocus(false);
this.$refs.runLevelOperate && this.$refs.runLevelOperate.batchSectionListFocus(false);
this.tabBeforeLeave('', this.enabledTab);
this.$emit('selectView', 'draft');
},
tabBeforeLeave(activeName, oldActiveName) {

View File

@ -262,6 +262,30 @@ export default {
} else {
return [];
}
},
routeName: {
get() {
var name = '';
if (this.isSave) {
let begStation = ''; let endStation = '';
let begSection = ''; let endSection = '';
if (this.stationList) {
this.stationList.forEach(elem => {
if (elem.code === this.addModel.startStationCode) begStation = elem.name;
if (elem.code === this.addModel.endStationCode) endStation = elem.name;
});
}
if (this.sectionList) {
this.sectionList.forEach(elem => {
if (elem.code === this.addModel.startSectionCode) begSection = '(' + elem.name + ')';
if (elem.code === this.addModel.endSectionCode) endSection = '(' + elem.name + ')';
});
}
name = begStation + begSection + '-' + endStation + endSection;
}
return name;
}
}
},
watch: {
@ -277,6 +301,11 @@ export default {
},
'addModel.parkSectionCodeList':function(val, old) {
this.changeSectionSelected(val, true);
},
routeName(val, old) {
if (val) {
this.addModel.name = val;
}
}
},