调整西安二号线数据及皮肤配置

This commit is contained in:
zyy 2020-04-20 15:12:01 +08:00
parent 8af97b4aa2
commit a49a3bfaaf
8 changed files with 192 additions and 157 deletions

View File

@ -403,7 +403,7 @@ class SkinCode extends defaultStyle {
text: { text: {
show: true, // 道岔名称显示 show: true, // 道岔名称显示
position: 0, // 区段名称位置 1 上面 -1 下面 0 对称 position: 0, // 区段名称位置 1 上面 -1 下面 0 对称
offset: {x: 0, y: 8}, // 道岔名称与区段距离 offset: { x: -15, y: 9 }, // 道岔名称与区段距离
fontSize: 11, // 字体大小 fontSize: 11, // 字体大小
fontColor: '#C0C0C0', // 道岔名称颜色 fontColor: '#C0C0C0', // 道岔名称颜色
fontWeight: 'normal', // 字体粗细 fontWeight: 'normal', // 字体粗细

View File

@ -4,87 +4,81 @@
import Path from 'zrender/src/graphic/Path'; import Path from 'zrender/src/graphic/Path';
// 计轴 // 计轴
export const EAxle = Path.extend({ export default Path.extend({
type: 'EAxle', type: 'EAxle',
_subType: '', _subType: '',
shape: { buildPath: function (path, shape) {
// style: this.style, if (shape && shape.style && shape.traingle) {
// traingle: traingle11, const axleLength = 2 * shape.style.Section.axle.radius;
// drictx: 1, // const positionx = shape.point.x + shape.drictx * (shape.traingle.getCos(axleLength) * 1.2);
// dricty: 1, // const positiony = shape.point.y + shape.dricty * (shape.traingle.getCos(axleLength) * 1.2);
// point: this.model.points[0] 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);
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);
// 圆弧 // 圆弧
const arcX = positionx - model.dricty * model.traingle.getSin(axleLength); const arcX = positionx - shape.dricty * shape.traingle.getSin(axleLength);
const arcY = positiony + model.drictx * model.traingle.getSin(axleLength); const arcY = positiony + shape.drictx * shape.traingle.getSin(axleLength);
const arcR = model.style.Section.axle.radius; const arcR = shape.style.Section.axle.radius;
ctx.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false); path.arc(arcX, arcY, arcR, 0, 2 * Math.PI, false);
ctx.closePath(); path.closePath();
const x1 = positionx - model.traingle.getCos(axleLength * model.multiple1) - model.dricty * model.traingle.getSin(axleLength); const x1 = positionx - shape.traingle.getCos(axleLength * shape.multiple1) - shape.dricty * shape.traingle.getSin(axleLength);
const y1 = positiony + model.drictx * model.traingle.getSin(axleLength * model.multiple1) - model.traingle.getSin(axleLength); const y1 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple1) - shape.traingle.getSin(axleLength);
const x2 = positionx + model.traingle.getCos(axleLength * model.multiple2) - model.dricty * model.traingle.getSin(axleLength); const x2 = positionx + shape.traingle.getCos(axleLength * shape.multiple2) - shape.dricty * shape.traingle.getSin(axleLength);
const y2 = positiony + model.drictx * model.traingle.getSin(axleLength * model.multiple2) + model.traingle.getSin(axleLength); const y2 = positiony + shape.drictx * shape.traingle.getSin(axleLength * shape.multiple2) + shape.traingle.getSin(axleLength);
ctx.moveTo(x1, y1); path.moveTo(x1, y1);
ctx.lineTo(x2, y2); path.lineTo(x2, y2);
ctx.closePath(); path.closePath();
} }
} }
}); });
// export default class EAxle extends Group { // export default class EAxle extends Group {
// constructor(model) { // constructor(model) {
// super(); // super();
// this.model = model; // this.model = model;
// this.zlevel = model.zlevel; // this.zlevel = model.zlevel;
// this.z = 5; // this.z = 5;
// this.create(model); // this.create(model);
// } // }
// create(model) { // create(model) {
// if (model && model.style && model.traingle) { // if (model && model.style && model.traingle) {
// const axleLength = 2 * model.style.Section.axle.radius; // const axleLength = 2 * model.style.Section.axle.radius;
// const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength)); // const positionx = model.point.x + model.drictx * (model.traingle.getCos(axleLength) * 1.2);
// const positiony = model.point.y + model.dricty * (model.traingle.getCos(axleLength)); // 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({ // this.add(this.line);
// zlevel: this.zlevel, // this.add(this.axle);
// 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);
// }
// }
// } // }

View File

@ -6,7 +6,7 @@ import ELines from './ELines'; // 创建多线条 曲线 (私有)
import EblockLines from './EblockLines'; // 区段封锁特有 import EblockLines from './EblockLines'; // 区段封锁特有
import ESeparator from './ESeparator'; // 分隔符 (私有) import ESeparator from './ESeparator'; // 分隔符 (私有)
import EMouse from './EMouse'; import EMouse from './EMouse';
import { EAxle } from './EAxle'; // 创建计轴 import EAxle from './EAxle'; // 创建计轴
import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头 import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路箭头
import ELimitName from './ELimitName'; // 成都三号线 限速名称 import ELimitName from './ELimitName'; // 成都三号线 限速名称
import JTriangle from '../../utils/JTriangle'; import JTriangle from '../../utils/JTriangle';
@ -60,6 +60,7 @@ export default class Section extends Group {
multiple2: 1.5 multiple2: 1.5
}, },
style: { style: {
lineWidth: 2,
fill: this.style.Section.axle.color, fill: this.style.Section.axle.color,
stroke: this.style.Section.axle.color stroke: this.style.Section.axle.color
} }
@ -79,6 +80,7 @@ export default class Section extends Group {
multiple2: 1 multiple2: 1
}, },
style: { style: {
lineWidth: 2,
fill: this.style.Section.axle.color, fill: this.style.Section.axle.color,
stroke: this.style.Section.axle.color stroke: this.style.Section.axle.color
} }

View File

@ -103,8 +103,12 @@ export default {
this.timeDemon = setInterval(() => { this.timeDemon = setInterval(() => {
checkLoginLine(); checkLoginLine();
}, 5000 * 60); }, 5000 * 60);
EventBus.$on('SELECTON', () => {
this.selected = null;
});
}, },
beforeDestroy() { beforeDestroy() {
EventBus.$off('SELECTON');
this.clearAutoSave(); this.clearAutoSave();
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
if (this.timeDemon) { if (this.timeDemon) {
@ -310,11 +314,7 @@ export default {
saveMapEvent() { // saveMapEvent() { //
const map = this.$store.state.map.map; const map = this.$store.state.map.map;
// map.signalList.forEach(item => { // map.signalList.forEach(item => {
// if (!item.right) { // item.lampPostType = '02';
// item.namePosition = { x: 30, y: -14 };
// } else {
// item.namePosition = { x: -30, y: -14 };
// }
// }); // });
if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) { if (this.$refs.jlmapVisual && map && parseInt(this.$route.params.mapId)) {
if (this.verifySectionPoint(map)) { if (this.verifySectionPoint(map)) {

View File

@ -64,7 +64,11 @@ export default {
SectionSepTypeList: [], SectionSepTypeList: [],
regionList: [], regionList: [],
viewSelect: false, viewSelect: false,
axlePositionList: [{value: 1, label: '下方显示'}, {value: 0, label: '不显示'}, {value: -1, label: '上方显示'}], axlePositionList: [
{value: 1, label: '下方显示'},
{value: 0, label: '不显示'},
{value: -1, label: '上方显示'}
],
editModel: { editModel: {
code: '', code: '',
name: '', name: '',
@ -129,7 +133,7 @@ export default {
'lineCode' 'lineCode'
]), ]),
form() { form() {
const form = { return {
labelWidth: '160px', labelWidth: '160px',
items: { items: {
code: { code: {
@ -211,7 +215,6 @@ export default {
} }
} }
}; };
return form;
}, },
rules() { rules() {
var validateAssociatedSection = (rule, value, callback) => { var validateAssociatedSection = (rule, value, callback) => {
@ -223,9 +226,9 @@ export default {
} }
}; };
const rules = { const rules = {
// code: [ code: [
// { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' } { required: true, message: this.$t('rules.selectEquipment'), trigger: 'change' }
// ], ],
name: [ name: [
{ required: true, message: this.$t('rules.pleaseEnterSectionName'), trigger: 'blur' } { required: true, message: this.$t('rules.pleaseEnterSectionName'), trigger: 'blur' }
], ],
@ -414,6 +417,8 @@ export default {
this.oldPoint = JSON.parse(JSON.stringify(selected.points)); this.oldPoint = JSON.parse(JSON.stringify(selected.points));
this.oldLeftSectionCode = selected.leftSectionCode; this.oldLeftSectionCode = selected.leftSectionCode;
this.oldRightSectionCode = selected.rightSectionCode; this.oldRightSectionCode = selected.rightSectionCode;
this.editModel.leftAxlePosition = selected.leftAxlePosition || 0; //
this.editModel.rightAxlePosition = selected.rightAxlePosition || 0; //
this.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum); this.$refs.logicBlock.computedLogicSectionNumList(this.editModel.logicSectionNum);
if (this.field.toUpperCase() === 'splitSection'.toUpperCase()) { 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); 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() { edit() {
this.$refs['dataform'].validate((valid) => { this.$refs['dataform'].validate(valid => {
if (valid) { if (valid) {
if (this.editModel.type === '03' && this.editModel.leftSectionCode && this.editModel.rightSectionCode) { if (this.editModel.type === '03' && this.editModel.leftSectionCode && this.editModel.rightSectionCode) {
this.$messageBox('道岔区段应仅有一侧关联区段!'); this.$messageBox('道岔区段应仅有一侧关联区段!');

View File

@ -70,6 +70,8 @@
<script> <script>
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'SplitOrMerge', name: 'SplitOrMerge',
props: { props: {
@ -139,6 +141,13 @@ export default {
} }
}; };
}, },
watch: {
field(val) {
if (val) {
EventBus.$emit('SELECTON');
}
}
},
methods: { methods: {
hover(filed) { hover(filed) {
this.$emit('hover', filed); this.$emit('hover', filed);

View File

@ -3,16 +3,16 @@
<div style="height: 100%;"> <div style="height: 100%;">
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<el-form ref="oprt1" :model="fromData" label-width="130px" size="mini" :rules="mergeRules"> <el-form ref="oprt1" :model="fromData" label-width="130px" size="mini" :rules="mergeRules">
<el-form-item label="关联区段" prop="relevanceSectionList"> <el-form-item label="关联区段" prop="relevanceSwitchList">
<el-select v-model="fromData.relevanceSectionList" filterable multiple :placeholder="$t('rules.pleaseSelect')"> <el-select v-model="fromData.relevanceSwitchList" filterable multiple :placeholder="$t('rules.pleaseSelect')">
<el-option <el-option
v-for="item in sectionList" v-for="item in switchList"
:key="item.code" :key="item.code"
:label="item.name + '(' + item.code + ')'" :label="item.name + '(' + item.code + ')'"
:value="item.code" :value="item.code"
/> />
</el-select> </el-select>
<el-button :type="field === 'relevanceSectionList' ? 'danger' : 'primary'" size="small" @click="hover('relevanceSectionList')">{{ $t('map.activate') }}</el-button> <el-button :type="field === 'relevanceSwitchList' ? 'danger' : 'primary'" size="small" @click="hover('relevanceSwitchList')">{{ $t('map.activate') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button-group> <el-button-group>
@ -27,6 +27,8 @@
import { deepAssign } from '@/utils/index'; import { deepAssign } from '@/utils/index';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { getUID } from '@/jmapNew/utils/Uid'; import { getUID } from '@/jmapNew/utils/Uid';
import { EventBus } from '@/scripts/event-bus';
export default { export default {
name: 'CreateAxle', name: 'CreateAxle',
props:{ props:{
@ -38,9 +40,12 @@ export default {
data() { data() {
return { return {
fromData: { fromData: {
relevanceSectionList: [] relevanceSectionList: [],
relevanceSwitchList: []
}, },
mergeRules: {} mergeRules: {
relevanceSwitchList: [{ required: true, message: '请选择关联道岔', trigger: 'change' }]
}
}; };
}, },
computed: { computed: {
@ -49,78 +54,98 @@ export default {
'switchList' 'switchList'
]) ])
}, },
watch: {
field(val) {
if (val) {
EventBus.$emit('SELECTON');
}
}
},
methods:{ methods:{
hover(field) { hover(field) {
this.$emit('hover', field); this.$emit('hover', field);
}, },
createSwitchSectionManual() { createSwitchSectionManual() {
const models = []; this.$refs.oprt1.validate((valid) => {
const uid = getUID('T', this.sectionList); if (valid) {
let sectiona = []; const models = [];
this.fromData.relevanceSectionList.forEach(item => { this.hover(''); // field
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item)); const uid = getUID('T', this.sectionList);
section.parentCode = uid; let sectiona = [];
const length = section.points.length - 1; this.fromData.relevanceSectionList = [];
if (sectiona.length > 0) { this.fromData.relevanceSwitchList.forEach(item => {
sectiona.forEach(each=>{ const switchModel = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
if ((section.points[0].x == each.x && section.points[0].y == each.y) || (section.points[length].x == each.x && section.points[length].y == each.y)) { this.fromData.relevanceSectionList.push(switchModel.sectionACode);
sectiona = []; this.fromData.relevanceSectionList.push(switchModel.sectionBCode);
sectiona.push(each); this.fromData.relevanceSectionList.push(switchModel.sectionCCode);
}
}); });
} else { this.fromData.relevanceSectionList.forEach(item => {
sectiona.push(section.points[0]); const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](item));
sectiona.push(section.points[section.points.length - 1]); section.parentCode = uid;
const length = section.points.length - 1;
if (sectiona.length > 0) {
sectiona.forEach(each=>{
if ((section.points[0].x == each.x && section.points[0].y == each.y) || (section.points[length].x == each.x && section.points[length].y == each.y)) {
sectiona = [];
sectiona.push(each);
}
});
} else {
sectiona.push(section.points[0]);
sectiona.push(section.points[section.points.length - 1]);
}
models.push(section);
});
if (sectiona.length <= 0) {
return false;
}
models.push({
_type: 'Section',
code: uid,
name: uid,
type: '04',
namePosition: {
x: sectiona[sectiona.length - 1].x,
y: sectiona[sectiona.length - 1].y
},
standTrack: false,
kmRangeRight: '',
kmRangeLeft: '',
region: '',
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
reentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
transferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
// segmentation: false,
segmentationPosition: { x: 0, y: 0 },
switchSection: true,
relSwitchCode: '',
relevanceSectionList: this.fromData.relevanceSectionList,
points: [{ x: 0, y: 0 }, { x: 0, y: 0 }],
logicSectionNum: [0],
logicSectionShow: false,
sepTypeLeft: '00',
offsetLeft: 0,
sepTypeRight: '00',
offsetRight: 0,
parentCode: '',
stationCode: sectiona.stationCode,
trainPosType: sectiona.trainPosType,
curve: false,
nameShow: true
});
this.$emit('updateMapModel', models);
this.fromData.relevanceSectionList = [];
this.fromData.relevanceSwitchList = [];
} }
models.push(section);
}); });
if (sectiona.length <= 0) {
return false;
}
models.push({
_type: 'Section',
code: uid,
name: uid,
type: '04',
namePosition: {
x: sectiona[sectiona.length - 1].x,
y: sectiona[sectiona.length - 1].y
},
standTrack: false,
kmRangeRight: '',
kmRangeLeft: '',
region: '',
standTrackName: '',
standTrackNamePosition: { x: 0, y: 0 },
reentryTrack: false,
reentryTrackName: '',
reentryTrackNamePosition: { x: 0, y: 0 },
transferTrack: false,
transferTrackName: '',
transferTrackNamePosition: { x: 0, y: 0 },
// segmentation: false,
segmentationPosition: { x: 0, y: 0 },
switchSection: true,
relSwitchCode: '',
relevanceSectionList: this.fromData.relevanceSectionList,
points: [{ x: 0, y: 0 }, { x: 0, y: 0 }],
logicSectionNum: [0],
logicSectionShow: false,
sepTypeLeft: '00',
offsetLeft: 0,
sepTypeRight: '00',
offsetRight: 0,
parentCode: '',
stationCode: sectiona.stationCode,
trainPosType: sectiona.trainPosType,
curve: false,
nameShow: true
});
this.$emit('updateMapModel', models);
this.fromData.relevanceSectionList = [];
}, },
pushData(data) { pushData(data) {
this.fromData.relevanceSectionList.push(data); this.fromData.relevanceSwitchList.push(data);
} }
} }
}; };

View File

@ -60,11 +60,11 @@ export default {
this.$emit('fieldSelectSwitchSection', this.field); this.$emit('fieldSelectSwitchSection', this.field);
}, },
deviceSelect(selected) { deviceSelect(selected) {
if (this.field.toUpperCase() != 'relevanceSectionList'.toUpperCase() && selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) { if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field.toUpperCase() === 'relevanceSwitchList'.toUpperCase()) {
this.$refs.createAxle.pushData(selected.code);
} else if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase()) {
this.activeName = 'first'; this.activeName = 'first';
this.$refs.switchModel.setModel(selected); this.$refs.switchModel.setModel(selected);
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'relevanceSectionList'.toUpperCase()) {
this.$refs.createAxle.pushData(selected.code);
} }
}, },
findSectionDataByLinkCodeAndPoint(code, point) { findSectionDataByLinkCodeAndPoint(code, point) {