diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index 6c27decde..e604956e6 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -403,7 +403,7 @@ class SkinCode extends defaultStyle { text: { show: true, // 道岔名称显示 position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 - offset: {x: 0, y: 8}, // 道岔名称与区段距离 + offset: { x: -15, y: 9 }, // 道岔名称与区段距离 fontSize: 11, // 字体大小 fontColor: '#C0C0C0', // 道岔名称颜色 fontWeight: 'normal', // 字体粗细 diff --git a/src/jmapNew/shape/Section/EAxle.js b/src/jmapNew/shape/Section/EAxle.js index d094e0c6b..9a4d03864 100644 --- a/src/jmapNew/shape/Section/EAxle.js +++ b/src/jmapNew/shape/Section/EAxle.js @@ -4,87 +4,81 @@ import Path from 'zrender/src/graphic/Path'; // 计轴 -export const EAxle = Path.extend({ +export default Path.extend({ type: 'EAxle', _subType: '', - shape: { - // style: this.style, - // traingle: traingle11, - // drictx: 1, - // dricty: 1, - // point: this.model.points[0] - }, - buildPath: function (ctx, model) { - if (model && model.style && model.traingle) { - const axleLength = 2 * model.style.Section.axle.radius; - const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength) * 1.2); - const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength) * 1.2); + buildPath: function (path, shape) { + if (shape && shape.style && shape.traingle) { + const axleLength = 2 * shape.style.Section.axle.radius; + // const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.2); + // const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.2); + const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.05); + const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.05); // 圆弧 - const arcX = positionx - model.dricty * model.traingle.getSin(axleLength); - const arcY = positiony + model.drictx * model.traingle.getSin(axleLength); - const arcR = model.style.Section.axle.radius; - ctx.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); - ctx.closePath(); + const arcX = positionx - shape.dricty * shape.traingle.getSin(axleLength); + const arcY = positiony + shape.drictx * shape.traingle.getSin(axleLength); + const arcR = shape.style.Section.axle.radius; + path.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); + path.closePath(); - const x1 = positionx - model.traingle.getCos(axleLength * model.multiple1) - model.dricty * model.traingle.getSin(axleLength); - const y1 = positiony + model.drictx * model.traingle.getSin(axleLength * model.multiple1) - model.traingle.getSin(axleLength); - const x2 = positionx + model.traingle.getCos(axleLength * model.multiple2) - model.dricty * model.traingle.getSin(axleLength); - const y2 = positiony + model.drictx * model.traingle.getSin(axleLength * model.multiple2) + model.traingle.getSin(axleLength); - ctx.moveTo(x1, y1); - ctx.lineTo(x2, y2); - ctx.closePath(); + const x1 = positionx - shape.traingle.getCos(axleLength * shape.multiple1) - shape.dricty * shape.traingle.getSin(axleLength); + const y1 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple1) - shape.traingle.getSin(axleLength); + const x2 = positionx + shape.traingle.getCos(axleLength * shape.multiple2) - shape.dricty * shape.traingle.getSin(axleLength); + const y2 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple2) + shape.traingle.getSin(axleLength); + path.moveTo(x1, y1); + path.lineTo(x2, y2); + path.closePath(); } } }); // export default class EAxle extends Group { -// constructor(model) { -// super(); -// this.model = model; -// this.zlevel = model.zlevel; -// this.z = 5; -// this.create(model); -// } +// constructor(model) { +// super(); +// this.model = model; +// this.zlevel = model.zlevel; +// this.z = 5; +// this.create(model); +// } -// create(model) { -// if (model && model.style && model.traingle) { -// const axleLength = 2 * model.style.Section.axle.radius; -// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); -// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); +// create(model) { +// if (model && model.style && model.traingle) { +// const axleLength = 2 * model.style.Section.axle.radius; +// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength) * 1.2); +// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength) * 1.2); +// this.line = new Line({ +// zlevel: this.zlevel, +// z: this.z, +// progressive: model.progressive, +// shape: { +// x1: positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), +// y1: positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength), +// x2: positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), +// y2: positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength) +// }, +// style: { +// GBaseLineWidth: 2, +// stroke: model.style.Section.axle.color +// } +// }); +// this.axle = new Circle({ +// zlevel: this.zlevel, +// z: this.z, +// progressive: model.progressive, +// shape: { +// cx: positionx - model.dricty * model.traingle.getSin(axleLength), +// cy: positiony + model.drictx * model.traingle.getSin(axleLength), +// r: model.style.Section.axle.radius +// }, +// style: { +// GBaseLineWidth: 1, +// stroke: model.style.Section.axle.color, +// fill: model.style.transparentColor +// } +// }); -// this.line = new Line({ -// zlevel: this.zlevel, -// z: this.z, -// progressive: model.progressive, -// shape: { -// x1: positionx - model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), -// y1: positiony + model.drictx * model.traingle.getSin(axleLength) - model.traingle.getSin(axleLength), -// x2: positionx + model.traingle.getCos(axleLength) - model.dricty * model.traingle.getSin(axleLength), -// y2: positiony + model.drictx * model.traingle.getSin(axleLength) + model.traingle.getSin(axleLength) -// }, -// style: { -// GBaseLineWidth: 1, -// stroke: model.style.Section.axle.color -// } -// }); -// this.axle = new Circle({ -// zlevel: this.zlevel, -// z: this.z, -// progressive: model.progressive, -// shape: { -// cx: positionx - model.dricty * model.traingle.getSin(axleLength), -// cy: positiony + model.drictx * model.traingle.getSin(axleLength), -// r: model.style.Section.axle.radius -// }, -// style: { -// GBaseLineWidth: 1, -// stroke: model.style.Section.axle.color, -// fill: model.style.transparentColor -// } -// }); - -// this.add(this.line); -// this.add(this.axle); -// } -// } +// this.add(this.line); +// this.add(this.axle); +// } +// } // } diff --git a/src/jmapNew/shape/Section/index.js b/src/jmapNew/shape/Section/index.js index b55d1709a..adc308203 100644 --- a/src/jmapNew/shape/Section/index.js +++ b/src/jmapNew/shape/Section/index.js @@ -6,7 +6,7 @@ import ELines from './ELines'; // 创建多线条 曲线 (私有) import EblockLines from './EblockLines'; // 区段封锁特有 import ESeparator from './ESeparator'; // 分隔符 (私有) import EMouse from './EMouse'; -import { EAxle } from './EAxle'; // 创建计轴 +import EAxle from './EAxle'; // 创建计轴 import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头 import ELimitName from './ELimitName'; // 成都三号线 限速名称 import JTriangle from '../../utils/JTriangle'; @@ -60,6 +60,7 @@ export default class Section extends Group { multiple2: 1.5 }, style: { + lineWidth: 2, fill: this.style.Section.axle.color, stroke: this.style.Section.axle.color } @@ -79,6 +80,7 @@ export default class Section extends Group { multiple2: 1 }, style: { + lineWidth: 2, fill: this.style.Section.axle.color, stroke: this.style.Section.axle.color } diff --git a/src/views/newMap/newMapdraft/index.vue b/src/views/newMap/newMapdraft/index.vue index b22721419..d405700d7 100644 --- a/src/views/newMap/newMapdraft/index.vue +++ b/src/views/newMap/newMapdraft/index.vue @@ -103,8 +103,12 @@ export default { this.timeDemon = setInterval(() => { checkLoginLine(); }, 5000 * 60); + EventBus.$on('SELECTON', () => { + this.selected = null; + }); }, beforeDestroy() { + EventBus.$off('SELECTON'); this.clearAutoSave(); this.$store.dispatch('map/mapClear'); if (this.timeDemon) { @@ -310,11 +314,7 @@ export default { saveMapEvent() { // 保存地图 const map = this.$store.state.map.map; // map.signalList.forEach(item => { - // if (!item.right) { - // item.namePosition = { x: 30, y: -14 }; - // } else { - // item.namePosition = { x: -30, y: -14 }; - // } + // item.lampPostType = '02'; // }); if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) { if (this.verifySectionPoint(map)) { diff --git a/src/views/newMap/newMapdraft/mapoperate/section/index.vue b/src/views/newMap/newMapdraft/mapoperate/section/index.vue index 70d60dfea..1cd16bb2d 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/index.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/index.vue @@ -64,7 +64,11 @@ export default { SectionSepTypeList: [], regionList: [], viewSelect: false, - axlePositionList: [{value: 1, label: '下方显示'}, {value: 0, label: '不显示'}, {value: -1, label: '上方显示'}], + axlePositionList: [ + {value: 1, label: '下方显示'}, + {value: 0, label: '不显示'}, + {value: -1, label: '上方显示'} + ], editModel: { code: '', name: '', @@ -129,7 +133,7 @@ export default { 'lineCode' ]), form() { - const form = { + return { labelWidth: '160px', items: { code: { @@ -211,7 +215,6 @@ export default { } } }; - return form; }, rules() { var validateAssociatedSection = (rule, value, callback) => { @@ -223,9 +226,9 @@ export default { } }; const rules = { - // code: [ - // { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' } - // ], + code: [ + { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' } + ], name: [ { required: true, message: this.$t('rules.pleaseEnterSectionName'), trigger: 'blur' } ], @@ -414,6 +417,8 @@ export default { this.oldPoint = JSON.parse(JSON.stringify(selected.points)); this.oldLeftSectionCode = selected.leftSectionCode; this.oldRightSectionCode = selected.rightSectionCode; + this.editModel.leftAxlePosition = selected.leftAxlePosition || 0; // 重置计轴显示 + this.editModel.rightAxlePosition = selected.rightAxlePosition || 0; // 重置计轴显示 this.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum); if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) { this.$refs.splitOrMerge.addModel.splitOffsetMax = Math.sqrt(new JTriangle(selected.points[0], selected.points[selected.points.length - 1]).abspowz); @@ -463,7 +468,7 @@ export default { }, // 修改区段属性 edit() { - this.$refs['dataform'].validate((valid) => { + this.$refs['dataform'].validate(valid => { if (valid) { if (this.editModel.type === '03' && this.editModel.leftSectionCode && this.editModel.rightSectionCode) { this.$messageBox('道岔区段应仅有一侧关联区段!'); diff --git a/src/views/newMap/newMapdraft/mapoperate/section/splitOrMerge.vue b/src/views/newMap/newMapdraft/mapoperate/section/splitOrMerge.vue index aea961c2d..8fa5f8460 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/splitOrMerge.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/splitOrMerge.vue @@ -70,6 +70,8 @@