Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
35790f6693
@ -569,11 +569,9 @@ export default {
|
||||
signalSectionSuccessful: 'Signal close section created successfully!',
|
||||
signalSectionUpdateSucceeded: 'Update signal close to section successful!',
|
||||
|
||||
crossCoding:'Cross code',
|
||||
crossName:'Cross name',
|
||||
relateSwitchList:'Related switchList',
|
||||
relateSectionList:'Related sectionList',
|
||||
cross:'cross',
|
||||
generateCross:'generate cross',
|
||||
|
||||
belongsSection: 'Belongs section:',
|
||||
coordinateMode: 'Coordinate mode',
|
||||
|
@ -25,9 +25,7 @@ export default {
|
||||
linkSelectName: 'Enter the Link name',
|
||||
linkSelectDisplayLength: 'Please enter the actual length of the Link',
|
||||
|
||||
pleaseSelectCross:'Please select cross',
|
||||
pleaseInputCrossName:'Please input cross name',
|
||||
pleaseSelectSwitch:'Please select switch',
|
||||
|
||||
lengthShow: 'According to the length of the:',
|
||||
lengthFact: 'The real length:',
|
||||
|
@ -563,11 +563,9 @@ export default {
|
||||
interlockingBlocks: '联锁区段',
|
||||
alwaysRed: '是否总是显示红灯',
|
||||
|
||||
crossCoding:'岔心编号',
|
||||
crossName:'岔心名称',
|
||||
relateSwitchList:'关联道岔',
|
||||
relateSectionList:'关联区段',
|
||||
cross:'岔心',
|
||||
generateCross:'一键生成岔心',
|
||||
|
||||
belongsSection: '所属区段:',
|
||||
coordinateMode: '坐标方式',
|
||||
|
@ -24,9 +24,7 @@ export default {
|
||||
linkSelectName: '请输入Link名称',
|
||||
linkSelectDisplayLength: '请输入Link实际长度',
|
||||
|
||||
pleaseSelectCross:'请选择岔心',
|
||||
pleaseInputCrossName:'请输入岔心名称',
|
||||
pleaseSelectSwitch:'请选择道岔',
|
||||
|
||||
lengthShow: '显示长度:',
|
||||
lengthFact: '真实长度:',
|
||||
|
@ -116,7 +116,9 @@ export function sandBoxConnect(manager,routegroup,section,signal,station,train )
|
||||
train.trainGroup.add(train.trainlist[data.body[i].code]);
|
||||
}else{
|
||||
let realprogress = section.topSectionList[data.body[i].section].leftProgress+(section.topSectionList[data.body[i].section].rightProgress - section.topSectionList[data.body[i].section].leftProgress)*data.body[i].offset;
|
||||
train.trainlist[data.body[i].code].position.copy(manager.topCurve.getPoint(realprogress));
|
||||
let realpos = manager.topCurve.getPoint(realprogress);
|
||||
train.trainlist[data.body[i].code].position.x = realpos.x;
|
||||
train.trainlist[data.body[i].code].position.z = realpos.z;
|
||||
|
||||
train.trainlist[data.body[i].code].up = new THREE.Vector3(1,0,0);
|
||||
let tangent = manager.topCurve.getTangentAt(realprogress).normalize();
|
||||
@ -144,7 +146,10 @@ export function sandBoxConnect(manager,routegroup,section,signal,station,train )
|
||||
}else{
|
||||
|
||||
let realprogress = section.downSectionList[data.body[i].section].leftProgress +(section.downSectionList[data.body[i].section].rightProgress - section.downSectionList[data.body[i].section].leftProgress)*data.body[i].offset;
|
||||
train.trainlist[data.body[i].code].position.copy(manager.downCurve.getPoint(realprogress));
|
||||
let realpos = manager.downCurve.getPoint(realprogress);
|
||||
train.trainlist[data.body[i].code].position.x = realpos.x;
|
||||
train.trainlist[data.body[i].code].position.z = realpos.z;
|
||||
|
||||
|
||||
train.trainlist[data.body[i].code].up = new THREE.Vector3(-1,0,0);
|
||||
let tangent = manager.downCurve.getTangentAt(realprogress).normalize();
|
||||
|
@ -23,6 +23,15 @@ export function signalModel(scene) {
|
||||
|
||||
newsignal.position.copy(downCurve.getPoint(downData[j].leftProgress));
|
||||
|
||||
newsignal.up = new THREE.Vector3(1,0,0);
|
||||
newsignal.axis = new THREE.Vector3();
|
||||
let tangent = downCurve.getTangentAt(downData[j].leftProgress).normalize();
|
||||
newsignal.axis.crossVectors(newsignal.up, tangent).normalize();
|
||||
let radians = Math.acos(newsignal.up.dot(tangent));
|
||||
newsignal.quaternion.setFromAxisAngle(newsignal.axis, radians);
|
||||
|
||||
|
||||
|
||||
scene.add( newsignal );
|
||||
j = downData.length;
|
||||
}
|
||||
|
@ -11,9 +11,11 @@ export function trainModel(scene) {
|
||||
var trainBox = new THREE.Mesh( geometry, material );
|
||||
trainBox.code = trainData[i].code;
|
||||
trainBox.groupNumber = trainData[i].groupNumber;
|
||||
|
||||
trainBox.dispose = false;
|
||||
trainBox.up = new THREE.Vector3(1, 0, 0);
|
||||
trainBox.axis = new THREE.Vector3();
|
||||
trainBox.position.y = 5;
|
||||
scope.trainlist[trainData[i].groupNumber] = trainBox;
|
||||
}
|
||||
}
|
||||
|
@ -829,6 +829,14 @@ class SkinCode extends defaultStyle {
|
||||
fontOffsetY: 24
|
||||
};
|
||||
|
||||
// /** 岔心 */
|
||||
// this[deviceType.Cross] = {
|
||||
// centerSquare:{
|
||||
// defaultColor:'#fff'
|
||||
// }
|
||||
|
||||
// };
|
||||
|
||||
this[deviceType.Responder] = {
|
||||
block: {
|
||||
mapStyle: {
|
||||
|
@ -275,4 +275,5 @@ deviceRender[deviceType.Responder] = {
|
||||
_type: deviceType.Responder,
|
||||
zlevel: 1
|
||||
};
|
||||
|
||||
export default deviceRender;
|
||||
|
@ -253,5 +253,5 @@ deviceState[deviceType.Train] = {
|
||||
|
||||
};
|
||||
deviceState[deviceType.Responder] = {
|
||||
}
|
||||
};
|
||||
export default deviceState;
|
||||
|
95
src/jmapNew/shape/Cross/index.js
Normal file
95
src/jmapNew/shape/Cross/index.js
Normal file
@ -0,0 +1,95 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Polyline from 'zrender/src/graphic/shape/Polyline';
|
||||
|
||||
export default class Cross extends Group {
|
||||
// _type: 'Cross',
|
||||
// code: getUID('Cross', this.crossList),
|
||||
// position:each.position,
|
||||
// relatedSwitch:each.relatedSwitch
|
||||
constructor(model, style) {
|
||||
super();
|
||||
this._code = model.code;
|
||||
this._type = model._type;
|
||||
this.zlevel = model.zlevel;
|
||||
this.z = 0;
|
||||
this.model = model;
|
||||
this.style = style;
|
||||
this.isShowShape = true;
|
||||
this.create();
|
||||
this.setState(model);
|
||||
}
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
// position;
|
||||
// relatedSwitch;
|
||||
// model.position.x,
|
||||
// model.position.y,
|
||||
// const relatedSwitchList = model.relatedSwitch;
|
||||
const offset = this.style.Section.line.width / (2 * 0.7071);
|
||||
const points = [
|
||||
[model.position.x, model.position.y + offset],
|
||||
[model.position.x + offset, model.position.y + offset],
|
||||
[model.position.x, model.position.y + 2 * offset],
|
||||
[model.position.x - offset, model.position.y + offset],
|
||||
[model.position.x, model.position.y + offset]
|
||||
];
|
||||
this.centerSquare = new Polyline({
|
||||
zlevel: this.zlevel,
|
||||
z:this.z + 1,
|
||||
shape: {
|
||||
points:points
|
||||
},
|
||||
style: {
|
||||
stroke: this.style.Cross.centerSquare.defaultColor,
|
||||
fill:this.style.Cross.centerSquare.defaultColor
|
||||
}
|
||||
});
|
||||
this.add(this.centerSquare);
|
||||
// let relatedSwitchList[0].sectionCCode
|
||||
// if (model && model.points.length > 1) {
|
||||
// const points = [];
|
||||
// const modelPoints = model.points;
|
||||
// const length = modelPoints.length;
|
||||
// for (let i = 0; i < length; i++) {
|
||||
// points.push([modelPoints[i].x, modelPoints[i].y]);
|
||||
// }
|
||||
// this.segment = new Polyline({
|
||||
// zlevel: this.zlevel,
|
||||
// z:this.z,
|
||||
// shape: {
|
||||
// points:points
|
||||
// },
|
||||
// style: {
|
||||
// lineWidth: model.width,
|
||||
// stroke: model.lineColor || this.style.lineColor
|
||||
// }
|
||||
// });
|
||||
// this.add(this.segment);
|
||||
// }
|
||||
}
|
||||
|
||||
setLineType(type) {
|
||||
switch (type) {
|
||||
case '01': break;
|
||||
case '02':
|
||||
this.segment && this.segment.setStyle('lineDash', this.style.lineDash || [4]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setState(model) {
|
||||
if (!this.isShowShape) return;
|
||||
this.setLineType(model.type);
|
||||
}
|
||||
setShowStation(stationCode) {
|
||||
if (!stationCode || this.model.stationCode === stationCode) {
|
||||
this.segment && this.segment.show();
|
||||
this.isShowShape = true;
|
||||
this.setState(this.model);
|
||||
} else {
|
||||
this.segment && this.segment.hide();
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,9 +17,9 @@ export default class Responder extends Group {
|
||||
this.isShowShape = true;
|
||||
this.z = model.zIndex || 1;
|
||||
if (model.previewOrMapDraw) {
|
||||
this.create();
|
||||
this.setState(model);
|
||||
}
|
||||
this.create();
|
||||
this.setState(model);
|
||||
}
|
||||
}
|
||||
|
||||
create() {
|
||||
|
@ -34,7 +34,7 @@ export default class Section extends Group {
|
||||
}
|
||||
|
||||
create() {
|
||||
// 区段type 01计轴区段;02逻辑区段;03道岔区段 04道岔计轴区段
|
||||
// 区段type 01计轴区段;02逻辑区段;03道岔区段 04道岔计轴区段 05 岔心
|
||||
// 站台所有的绘图元素
|
||||
const elementTypeList = {
|
||||
'name': ETextName, // 区段名称
|
||||
|
@ -26,105 +26,105 @@ export default {
|
||||
label: '发送',
|
||||
handler: this.sendRequestList
|
||||
},
|
||||
{
|
||||
label: '取消',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '全部扣车',
|
||||
children: [
|
||||
{
|
||||
label: '正线上全部扣车',
|
||||
handler: this.undeveloped
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '全部发车',
|
||||
children: [
|
||||
{
|
||||
label: '缓解正线所有列车',
|
||||
handler: this.undeveloped
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '停止所有列车',
|
||||
children: [
|
||||
{
|
||||
label: '停止正线所有列车',
|
||||
handler: this.undeveloped
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// label: '取消',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '全部扣车',
|
||||
// children: [
|
||||
// {
|
||||
// label: '正线上全部扣车',
|
||||
// handler: this.undeveloped
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// label: '全部发车',
|
||||
// children: [
|
||||
// {
|
||||
// label: '缓解正线所有列车',
|
||||
// handler: this.undeveloped
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// label: '停止所有列车',
|
||||
// children: [
|
||||
// {
|
||||
// label: '停止正线所有列车',
|
||||
// handler: this.undeveloped
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
label: '车站选择',
|
||||
children: []
|
||||
},
|
||||
{
|
||||
label: '列车选择',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '缩放',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '显示控制',
|
||||
children: [
|
||||
{
|
||||
label: '正线及车辆段',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '列车信息',
|
||||
handler: this.undeveloped
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '下一窗口',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '上一窗口',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '激活所有菜单',
|
||||
children: [
|
||||
{
|
||||
label: '确认',
|
||||
handler: this.undeveloped
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '恢复激活菜单',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '进路模式 - 授权车站',
|
||||
children: [
|
||||
{
|
||||
label: '自动',
|
||||
handler: this.undeveloped
|
||||
},
|
||||
{
|
||||
label: '人工',
|
||||
handler: this.undeveloped
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '列车报警确认',
|
||||
children: [
|
||||
{
|
||||
label: '列车完整性报警确认',
|
||||
handler: this.undeveloped
|
||||
}
|
||||
]
|
||||
}
|
||||
// {
|
||||
// label: '列车选择',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '缩放',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '显示控制',
|
||||
// children: [
|
||||
// {
|
||||
// label: '正线及车辆段',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '列车信息',
|
||||
// handler: this.undeveloped
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// label: '下一窗口',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '上一窗口',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '激活所有菜单',
|
||||
// children: [
|
||||
// {
|
||||
// label: '确认',
|
||||
// handler: this.undeveloped
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// label: '恢复激活菜单',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '进路模式 - 授权车站',
|
||||
// children: [
|
||||
// {
|
||||
// label: '自动',
|
||||
// handler: this.undeveloped
|
||||
// },
|
||||
// {
|
||||
// label: '人工',
|
||||
// handler: this.undeveloped
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// label: '列车报警确认',
|
||||
// children: [
|
||||
// {
|
||||
// label: '列车完整性报警确认',
|
||||
// handler: this.undeveloped
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
]
|
||||
};
|
||||
},
|
||||
@ -174,7 +174,7 @@ export default {
|
||||
};
|
||||
},
|
||||
initMenu() {
|
||||
this.menuNormal[5].children = this.initStationList();
|
||||
this.menuNormal[1].children = this.initStationList();
|
||||
this.menu = this.menuNormal;
|
||||
},
|
||||
doShow(point) {
|
||||
|
@ -6,6 +6,49 @@
|
||||
'left': uiLeft,
|
||||
'display': uiDisplay,
|
||||
}">
|
||||
<el-card class="box-title">
|
||||
设备信息
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<!-- 列车 -->
|
||||
<div v-if="selectmodel.code" class="text item">
|
||||
列车编号:{{selectmodel.code}}
|
||||
</div>
|
||||
<div v-if="selectmodel.v" class="text item">
|
||||
速度:{{selectmodel.v}}
|
||||
</div>
|
||||
<div v-if="selectmodel.right" class="text item">
|
||||
行进方向:{{selectmodel.right}}
|
||||
</div>
|
||||
<div v-if="selectmodel.num" class="text item">
|
||||
车内人数:{{selectmodel.num}}
|
||||
</div>
|
||||
<div v-if="selectmodel.leftdoor" class="text item">
|
||||
左侧车门:{{selectmodel.leftdoor}}
|
||||
</div>
|
||||
<div v-if="selectmodel.rightdoor" class="text item">
|
||||
右侧车门:{{selectmodel.rightdoor}}
|
||||
</div>
|
||||
|
||||
<!-- 车站 -->
|
||||
<div v-if="selectmodel.name" class="text item">
|
||||
车站:{{selectmodel.name}}
|
||||
</div>
|
||||
<div v-if="selectmodel.topnum" class="text item">
|
||||
上行站台人数:{{selectmodel.topnum}}
|
||||
</div>
|
||||
<div v-if="selectmodel.downnum" class="text item">
|
||||
下行站台人数:{{selectmodel.downnum}}
|
||||
</div>
|
||||
<div v-if="selectmodel.topdoor" class="text item">
|
||||
上行车门:{{selectmodel.topdoor}}
|
||||
</div>
|
||||
<div v-if="selectmodel.downdoor" class="text item">
|
||||
下行车门:{{selectmodel.downdoor}}
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@ -26,6 +69,14 @@ export default {
|
||||
uiDisplay:'none',
|
||||
uiTop:'0px',
|
||||
uiLeft:'0px',
|
||||
selectmodel:{
|
||||
code:"asd123",
|
||||
v:"80km/h",
|
||||
right:"上行",
|
||||
num:100,
|
||||
leftdoor:"关闭",
|
||||
rightdoor:"关闭"
|
||||
},
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
@ -63,4 +114,37 @@ export default {
|
||||
background-size:100%;
|
||||
// display:none;
|
||||
}
|
||||
.text {
|
||||
font-size: 8px;
|
||||
color:#ffffff;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
.clearfix:after {
|
||||
clear: both
|
||||
}
|
||||
.box-title{
|
||||
position: absolute;
|
||||
top:20px;
|
||||
left:7px;
|
||||
width: 120px;
|
||||
text-align: center;
|
||||
}
|
||||
.box-card {
|
||||
position: absolute;
|
||||
top:45px;
|
||||
left:7px;
|
||||
width: 136px;
|
||||
background-color:rgba(0,0,0,0);
|
||||
}
|
||||
</style>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<!-- 设备视图 -->
|
||||
<el-button v-if="isShow3dmodel && isShowScheduling" size="small" @click="jumpjlmap3dmodel">{{ $t('display.demon.deviceView') }}</el-button>
|
||||
<!-- 三维视图 / 司机视角 -->
|
||||
<el-button v-if="isShowScheduling || isDriver" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
||||
<el-button v-if="isShowScheduling || isDriver || isDISPATCHER" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
||||
<!-- cctv视图 -->
|
||||
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dpassflow">{{ $t('display.demon.passengerflow') }}</el-button>
|
||||
<!-- 客流规划视图 -->
|
||||
@ -128,10 +128,13 @@ export default {
|
||||
},
|
||||
isShowScheduling() {
|
||||
// 行调与管理员 可显示
|
||||
return (this.$store.state.training.prdType == '02' || this.isAdmin) && !this.$route.query.projectDevice;
|
||||
return (this.$store.state.training.prdType == '02' || this.isAdmin) && (!this.$route.query.projectDevice);
|
||||
},
|
||||
isDISPATCHER(){
|
||||
return (this.$store.state.training.prdType == '02' || this.isAdmin) && (!this.$route.query.projectDevice || this.project == 'sdy');
|
||||
},
|
||||
isStationSupervisor() {
|
||||
return this.userRole == 'STATION_SUPERVISOR' && !this.$route.query.projectDevice;
|
||||
return this.userRole == 'STATION_SUPERVISOR' && (!this.$route.query.projectDevice || this.project == 'sdy');
|
||||
},
|
||||
isDriver() {
|
||||
return this.userRole == 'DRIVER' && !this.$route.query.projectDevice;
|
||||
|
@ -1,249 +0,0 @@
|
||||
<template>
|
||||
<el-tabs v-model="activeName" class="card">
|
||||
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
|
||||
<operate-property
|
||||
ref="dataform"
|
||||
:form="form"
|
||||
:edit-model="editModel"
|
||||
:rules="rules"
|
||||
type="Line"
|
||||
@updateMapModel="updateMapModel"
|
||||
@clearDeviceSelect="clearDeviceSelect"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second" :lazy="lazy">
|
||||
<create-operate
|
||||
ref="createForm"
|
||||
:create-form="createForm"
|
||||
:add-model="addModel"
|
||||
:create-rules="rules"
|
||||
@create="create"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" :label="$t('map.batchOperation')" name="third" :lazy="lazy">
|
||||
<div class="view-content" style="text-align:center;">
|
||||
<el-button type="primary" size="big" style="margin-top:10px" @click="generateCross">{{ $t('map.generateCross') }}</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</template>
|
||||
<script>
|
||||
// import ConstConfig from '@/scripts/ConstConfig';
|
||||
// import Cookies from 'js-cookie';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmapNew/utils/Uid';
|
||||
import OperateProperty from './components/operateProperty';
|
||||
import { deepAssign } from '@/utils/index';
|
||||
import CreateOperate from './components/createOperate';
|
||||
|
||||
export default {
|
||||
name:'CrossDraft',
|
||||
components: {
|
||||
OperateProperty,
|
||||
CreateOperate
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: 'first',
|
||||
lazy: true,
|
||||
field: '',
|
||||
crossList:[],
|
||||
editModel: {
|
||||
code: '',
|
||||
name: '',
|
||||
relateSwitchList: []
|
||||
},
|
||||
addModel:{
|
||||
name: '',
|
||||
relateSwitchList: []
|
||||
},
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: this.$t('rules.pleaseSelectCross'), trigger: 'change' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.pleaseInputCrossName'), trigger: 'blur' }
|
||||
],
|
||||
relateSwitchList:[
|
||||
{ required: true, message: this.$t('rules.pleaseSelectSwitch'), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'switchList',
|
||||
'crossList'
|
||||
]),
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items: {
|
||||
draw: {
|
||||
name: this.$t('map.drawData'),
|
||||
item: [
|
||||
{ prop: 'code', label: this.$t('map.crossCoding'), type: 'select', optionLabel: 'code', optionValue: 'code',
|
||||
options: this.crossList, deviceChange: this.deviceChange },
|
||||
{ prop: 'name', label: this.$t('map.crossName'), type: 'input' },
|
||||
{ prop: 'relateSwitchList', label: this.$t('map.relateSwitchList'), type: 'multiSelect', optionLabel: 'name&&code',
|
||||
optionValue: 'code', options: this.switchList, disabled:true }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
return form;
|
||||
},
|
||||
createForm() {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items:{
|
||||
all:{
|
||||
name:'',
|
||||
item: [
|
||||
{ prop: 'name', label: this.$t('map.crossName'), type: 'input' },
|
||||
{ prop: 'relateSwitchList', label:this.$t('map.relateSwitchList'), type: 'multiSelectHover',
|
||||
optionLabel: 'name&&code', optionValue: 'code', options: this.switchList, hover: this.hover,
|
||||
buttonType: 'relatedSwitch', buttonShowType: this.relatedSwitchButtonShow, deviceChange: this.changeSwitch }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
return form;
|
||||
},
|
||||
relatedSwitchButtonShow() {
|
||||
return this.field === 'relatedSwitch';
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
hover(field) {
|
||||
this.field = field == this.field ? '' : field;
|
||||
if (this.field) {
|
||||
this.$emit('deviceSelect', 'Cross');
|
||||
} else {
|
||||
this.$emit('deviceSelect', '');
|
||||
}
|
||||
},
|
||||
updateMapModel(data) {
|
||||
this.$emit('updateMapModel', data);
|
||||
},
|
||||
clearDeviceSelect() {
|
||||
this.$emit('deviceSelect', '');
|
||||
},
|
||||
create() {
|
||||
if (this.addModel.relateSwitchList.length != 4) {
|
||||
this.$message.error('关联的道岔只能是4个');
|
||||
return false;
|
||||
} else {
|
||||
const resultData = this.getCrossCenterPoint(this.addModel.relateSwitchList);
|
||||
if (resultData.length > 0) {
|
||||
this.updateMapDraw(resultData);
|
||||
this.$refs.createForm.resetForm();
|
||||
} else {
|
||||
this.$message.error('选择的关联道岔不对');
|
||||
}
|
||||
}
|
||||
},
|
||||
updateMapDraw(resultData) {
|
||||
resultData.forEach(each=>{
|
||||
const model = {
|
||||
_type: 'Cross',
|
||||
code: getUID('Cross', this.crossList),
|
||||
position:each.position,
|
||||
sectionList:each.sectionList
|
||||
};
|
||||
this.$emit('updateMapModel', model);
|
||||
});
|
||||
},
|
||||
generateCross() {
|
||||
if (this.switchList.length >= 4) {
|
||||
const resultData = this.getCrossCenterPoint(this.switchList);
|
||||
this.updateMapDraw(resultData);
|
||||
}
|
||||
},
|
||||
getCrossCenterPoint(switchList) {
|
||||
this.deleteCross();
|
||||
const swicthPList = {};
|
||||
switchList.forEach(data=>{
|
||||
if (data.code) { data = data.code; }
|
||||
const switchObj = this.$store.getters['map/getDeviceByCode'](data);
|
||||
const section = this.$store.getters['map/getDeviceByCode'](switchObj.sectionCCode);
|
||||
const endPoint = section.points[section.points.length - 1];
|
||||
const startPoint = section.points[0];
|
||||
const objStart = swicthPList[startPoint.x + '-' + startPoint.y];
|
||||
const objEnd = swicthPList[endPoint.x + '-' + endPoint.y];
|
||||
if (objStart) {
|
||||
objStart.count = objStart.count + 1;
|
||||
objStart.sectionList.push(section.code);
|
||||
} else {
|
||||
swicthPList[startPoint.x + '-' + startPoint.y] = {count:1, sectionList:[section.code]};
|
||||
}
|
||||
if (objEnd) {
|
||||
objEnd.count = objEnd.count + 1;
|
||||
objEnd.sectionList.push(section.code);
|
||||
} else {
|
||||
swicthPList[endPoint.x + '-' + endPoint.y] = {count:1, sectionList:[section.code]};
|
||||
}
|
||||
});
|
||||
const resultData = [];
|
||||
const values = Object.values(swicthPList);
|
||||
const keys = Object.keys(swicthPList);
|
||||
values.forEach((each, index)=>{
|
||||
if (each.count == 4) {
|
||||
resultData.push({position:keys[index], sectionList:swicthPList[keys[index]].sectionList});
|
||||
}
|
||||
});
|
||||
return resultData;
|
||||
},
|
||||
// 一键删除岔芯
|
||||
deleteCross() {
|
||||
const models = [];
|
||||
this.crossList.forEach(item => {
|
||||
models.push({...item, _dispose: true});
|
||||
});
|
||||
this.crossList.forEach(item => {
|
||||
if (item.type == '04') {
|
||||
models.push({...item, _dispose: true});
|
||||
}
|
||||
});
|
||||
this.$emit('updateMapModel', models);
|
||||
},
|
||||
changeSwitch(switchList) {
|
||||
const result = this.judgeRelateSwitch();
|
||||
if (!result) { this.addModel.relateSwitchList.pop(); }
|
||||
},
|
||||
deviceSelect(selected) {
|
||||
if (selected && selected._type.toUpperCase() === 'Cross'.toUpperCase() && this.field != 'relatedSwitch') {
|
||||
this.$refs.createForm && this.$refs.createForm.resetFields();
|
||||
this.$refs.dataform && this.$refs.dataform.resetFields();
|
||||
this.activeName = 'first';
|
||||
this.editModel = deepAssign(this.editModel, selected);
|
||||
} else if (selected && selected._type.toUpperCase() === 'Switch'.toUpperCase() && this.field == 'relatedSwitch') {
|
||||
this.activeName = 'second';
|
||||
if (!this.addModel.relateSwitchList.includes(selected.code)) {
|
||||
this.judgeRelateSwitch() && this.addModel.relateSwitchList.push(selected.code);
|
||||
}
|
||||
}
|
||||
},
|
||||
judgeRelateSwitch() {
|
||||
if (this.addModel.relateSwitchList.length >= 4) {
|
||||
this.$message.error('关联的道岔不能超过4个');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.card {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
@ -67,7 +67,6 @@ import Arrow from './arrow';
|
||||
import SplitScreen from './splitScreen';
|
||||
import FloodGate from './floodGate';
|
||||
import DirectionRod from './directionRod';
|
||||
import Cross from './cross';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
@ -98,8 +97,7 @@ export default {
|
||||
Arrow,
|
||||
SplitScreen,
|
||||
FloodGate,
|
||||
DirectionRod,
|
||||
Cross
|
||||
DirectionRod
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -140,8 +138,7 @@ export default {
|
||||
{label: '站间分隔', name:'SplitStation', menus:SplitStation},
|
||||
{label: '箭头', name:'Arrow', menus:Arrow},
|
||||
{label: '防淹门', name: 'FloodGate', menus: FloodGate},
|
||||
{label: '方向杆', name: 'DirectionRod', menus: DirectionRod},
|
||||
{label: this.$t('map.cross'), name: 'Cross', menus: Cross}
|
||||
{label: '方向杆', name: 'DirectionRod', menus: DirectionRod}
|
||||
],
|
||||
selectDevice:'',
|
||||
enabledTab: 'Section',
|
||||
|
156
src/views/newMap/newMapdraft/mapoperate/section/crossSection.vue
Normal file
156
src/views/newMap/newMapdraft/mapoperate/section/crossSection.vue
Normal file
@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<create-operate
|
||||
ref="createForm"
|
||||
:create-form="createForm"
|
||||
:add-model="addModel"
|
||||
:create-rules="rules"
|
||||
@create="create"
|
||||
/>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { getUID } from '@/jmapNew/utils/Uid';
|
||||
import CreateOperate from '../components/createOperate';
|
||||
export default {
|
||||
name:'CrossDraft',
|
||||
components: {
|
||||
CreateOperate
|
||||
},
|
||||
props: {
|
||||
field: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
addModel:{
|
||||
name: '',
|
||||
relateSectionList: []
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.pleaseInputCrossName'), trigger: 'blur' }
|
||||
],
|
||||
relateSectionList:[
|
||||
{ required: true, message: this.$t('rules.pleaseSelect'), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList'
|
||||
]),
|
||||
activeSectionList() {
|
||||
return this.sectionList.filter(section=>{ return section.type === '01'; });
|
||||
},
|
||||
createForm() {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items:{
|
||||
all:{
|
||||
name:'',
|
||||
item: [
|
||||
{ prop: 'name', label: this.$t('map.crossName'), type: 'input' },
|
||||
{ prop: 'relateSectionList', label:this.$t('map.relateSectionList'), type: 'multiSelectHover',
|
||||
optionLabel: 'name&&code', optionValue: 'code', options: this.activeSectionList, hover: this.hover,
|
||||
buttonType: 'relatedSection', buttonShowType: this.relatedSectionButtonShow, deviceChange: this.changeSection }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
return form;
|
||||
},
|
||||
relatedSectionButtonShow() {
|
||||
return this.field === 'relatedSection';
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
changeSection(switchList) {
|
||||
const result = this.judgeRelateSection();
|
||||
if (!result) { this.addModel.relateSectionList.pop(); }
|
||||
},
|
||||
hover(field) {
|
||||
this.$emit('hover', field);
|
||||
},
|
||||
judgeRelateSection() {
|
||||
if (this.addModel.relateSectionList.length > 2) {
|
||||
this.$message.error('关联的区段不能超过两个');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
addSectionData(selectedCode) {
|
||||
if (!this.addModel.relateSectionList.includes(selectedCode)) {
|
||||
this.addModel.relateSectionList.push(selectedCode);
|
||||
this.changeSection();
|
||||
}
|
||||
},
|
||||
create() {
|
||||
if (this.addModel.relateSectionList.length != 2) {
|
||||
this.$message.error('关联的区段只能为两个');
|
||||
return false;
|
||||
} else {
|
||||
const resultData = this.getCrossCenterPoint(this.addModel.relateSectionList);
|
||||
if (resultData) {
|
||||
const sectionA = this.$store.getters['map/getDeviceByCode'](this.addModel.relateSectionList[0]);
|
||||
this.updateMapDraw(sectionA.standCode);
|
||||
this.$refs.createForm.resetForm();
|
||||
} else {
|
||||
this.$message.error('选择的关联区段不对');
|
||||
}
|
||||
}
|
||||
},
|
||||
getCrossCenterPoint(relateSectionList) {
|
||||
const sectionA = this.$store.getters['map/getDeviceByCode'](relateSectionList[0]);
|
||||
const sectionB = this.$store.getters['map/getDeviceByCode'](relateSectionList[1]);
|
||||
const endPointA = sectionA.points[sectionA.points.length - 1];
|
||||
const startPointA = sectionA.points[0];
|
||||
const endPointB = sectionB.points[sectionB.points.length - 1];
|
||||
const startPointB = sectionB.points[0];
|
||||
return this.segmentsIntr(startPointA, endPointA, startPointB, endPointB);
|
||||
},
|
||||
|
||||
segmentsIntr(a, b, c, d) {
|
||||
// 三角形abc 面积的2倍
|
||||
var area_abc = (a.x - c.x) * (b.y - c.y) - (a.y - c.y) * (b.x - c.x);
|
||||
// 三角形abd 面积的2倍
|
||||
var area_abd = (a.x - d.x) * (b.y - d.y) - (a.y - d.y) * (b.x - d.x);
|
||||
// 面积符号相同则两点在线段同侧,不相交 (对点在线段上的情况,本例当作不相交处理);
|
||||
if ( area_abc * area_abd >= 0 ) {
|
||||
return false;
|
||||
}
|
||||
// 三角形cda 面积的2倍
|
||||
var area_cda = (c.x - a.x) * (d.y - a.y) - (c.y - a.y) * (d.x - a.x);
|
||||
// 三角形cdb 面积的2倍
|
||||
// 注意: 这里有一个小优化.不需要再用公式计算面积,而是通过已知的三个面积加减得出.
|
||||
var area_cdb = area_cda + area_abc - area_abd;
|
||||
if ( area_cda * area_cdb >= 0 ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
// // 计算交点坐标
|
||||
// var t = area_cda / ( area_abd - area_abc );
|
||||
// var dx = t * (b.x - a.x);
|
||||
// var dy = t * (b.y - a.y);
|
||||
// return { x: a.x + dx, y: a.y + dy };
|
||||
},
|
||||
|
||||
updateMapDraw(standCode) {
|
||||
const model = {
|
||||
_type: 'Section',
|
||||
code: getUID('T', this.sectionList),
|
||||
type:'05', // 岔心
|
||||
namePosition:{x:50, y:0},
|
||||
name:this.addModel.name,
|
||||
relateSectionList:this.addModel.relateSectionList,
|
||||
stationCode:standCode
|
||||
};
|
||||
this.$emit('updateMapModel', model);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -46,6 +46,9 @@
|
||||
@tipInfoHandle="tipInfoHandle"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" :label="$t('map.cross')" name="six" :lazy="lazy">
|
||||
<cross-section ref="crossSection" :field="field" @hover="hover" />
|
||||
</el-tab-pane>
|
||||
<tip-info ref="tipInfo" :tip-info-list="tipInfoList" />
|
||||
</el-tabs>
|
||||
</template>
|
||||
@ -60,6 +63,7 @@ import TipInfo from './tipInfo';
|
||||
import CreateSection from './create';
|
||||
import SplitOrMerge from './splitOrMerge';
|
||||
import BatchSettings from './batchSettings';
|
||||
import CrossSection from './crossSection';
|
||||
import getModel from '../models.js';
|
||||
|
||||
export default {
|
||||
@ -70,7 +74,8 @@ export default {
|
||||
TipInfo,
|
||||
CreateSection,
|
||||
SplitOrMerge,
|
||||
BatchSettings
|
||||
BatchSettings,
|
||||
CrossSection
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -408,7 +413,16 @@ export default {
|
||||
deviceSelect(selected) {
|
||||
// 判断是否激活选择站台
|
||||
if (selected && selected._type === 'Section') {
|
||||
if (this.field === 'leftSection') {
|
||||
if (this.field == 'relatedSection' ) {
|
||||
if (selected.type === '01') {
|
||||
this.activeName = 'six';
|
||||
this.$refs.crossSection.addSectionData(selected.code);
|
||||
this.$emit('deviceSelect', '');
|
||||
} else {
|
||||
this.$message.error('请选择物理区段');
|
||||
}
|
||||
return;
|
||||
} else if (this.field === 'leftSection') {
|
||||
if (selected.type === '01' || selected.type === '03') {
|
||||
this.editModel.leftSectionCode = selected.code;
|
||||
this.activeName = 'first';
|
||||
|
@ -87,9 +87,9 @@ export default {
|
||||
}
|
||||
},
|
||||
handleCommit() {
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
this.$refs.form.validate(() => {
|
||||
if (this.$route.query.planId || this.loadRunPlanId) {
|
||||
checkServiceNumberExist({ planId: this.$route.query.planId || this.loadRunPlanId, serviceNumber: this.serviceNumber }).then(resp => {
|
||||
checkServiceNumberExist({ planId: this.$route.query.planId || this.loadRunPlanId, serviceNumber: this.formModel.serviceNumber }).then(resp => {
|
||||
if (resp.data) {
|
||||
this.$emit('dispatchDialog', {
|
||||
name: 'offLine',
|
||||
@ -117,8 +117,8 @@ export default {
|
||||
},
|
||||
handleConfirm(isNew = false) {
|
||||
this.doClose();
|
||||
this.$store.dispatch('runPlan/addserviceNumber', this.serviceNumber);
|
||||
this.$emit('dispatchDialog', { name: 'editPlanningTrain', params: { serviceNumber: this.serviceNumber, isNew:isNew } });
|
||||
this.$store.dispatch('runPlan/addserviceNumber', this.formModel.serviceNumber);
|
||||
this.$emit('dispatchDialog', { name: 'editPlanningTrain', params: { serviceNumber: this.formModel.serviceNumber, isNew:isNew } });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user