This commit is contained in:
joylink_cuiweidong 2020-12-18 16:12:53 +08:00
commit c8487b6e60
28 changed files with 365 additions and 99 deletions

View File

@ -43,18 +43,23 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
}
/** 站台客流当前人数信息 */
if(data.type == "STAND_PFI"){
// console.log(data);
let newStandData = data.body;
let count = 0;
for(let j=0;j<passerStation.stationlist.length;j++){
count = 0;
for(let i=0;i<newStandData.length;i++){
if(passerStation.stationlist[j].topstand == newStandData[i].standCode){
passerStation.stationlist[j].topspeed = newStandData[i].to;
passerStation.stationlist[j].toppassers = newStandData[i].num;
count++;
}
if(passerStation.stationlist[j].downstand == newStandData[i].standCode){
passerStation.stationlist[j].downspeed = newStandData[i].to;
passerStation.stationlist[j].downpassers = newStandData[i].num;
count++;
@ -201,6 +206,8 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
if(data.type == 'Device_Load_Destroy_3D'){
start = true;
toptrain.nowcode = null;
downtrain.nowcode = null;
console.log("仿真重开=====================");
}

View File

@ -197,6 +197,7 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap,initCode) {
this.changestation = function(stationname){
passerStation.changestation(stationname);
// console.log(passerStation.nowStation);
scope.humanWaitTop = passerStation.nowStation.toppassers;
scope.humanWaitDown = passerStation.nowStation.downpassers;
passerHuman.speed = passerStation.nowStation.topspeed + passerStation.nowStation.downspeed;
@ -232,7 +233,7 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap,initCode) {
for(let i=0;i<waitForCreatOutTop.length;i++){
for(let j=0;j<waitForCreatOutTop[i];j++){
setTimeout(function(){
console.log(passerZone.list["standtop"].doorpoints[i]);
// console.log(passerZone.list["standtop"].doorpoints[i]);
passerHuman.newHumanCreate(outStationPassers,passerZone.list["standtop"].doorpoints[i],5,"top",i);
}, Math.random()*1000*j);
}
@ -242,7 +243,7 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap,initCode) {
for(let i=0;i<waitForCreatOutDown.length;i++){
for(let j=0;j<waitForCreatOutDown[i];j++){
setTimeout(function(){
console.log(passerZone.list["standdown"].doorpoints[i]);
// console.log(passerZone.list["standdown"].doorpoints[i]);
passerHuman.newHumanCreate(outStationPassers,passerZone.list["standdown"].doorpoints[i],5,"down",i);
}, Math.random()*1000*j);
}

View File

@ -63,9 +63,7 @@ export function PasserHuman() {
newhuman.overGoal = overGoal;
}
if(newhuman.direct == "top"){
newhuman.rotation.y = Math.PI;
}
newhuman.status = 0;
newhuman.stage = stage;
@ -77,7 +75,9 @@ export function PasserHuman() {
}else{
newhuman.direct = null;
}
if(newhuman.direct == "top"){
newhuman.rotation.y = Math.PI;
}
newhuman.doorstatus = null;
if(door){
newhuman.door = door;

View File

@ -232,7 +232,9 @@ export function PasserAi(zone,finder) {
//1--top
//2-- down
if(humanlist.children[i].overGoal == "top"){
// console.log(humanlist.children[i].overGoal);
// console.log(humanlist.children[i].direct);
if(humanlist.children[i].direct == "top"){
targetPosition = passerZone.getstandposition("standtop");
path = pathFinder.find(points[0],targetPosition.point);
humanlist.children[i].direct = "top";

View File

@ -134,7 +134,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#5578B6', // 灯灯柱颜色
standardWidth: 1.5 // 灯柱宽度
standardVerticalWidth: 1.5, // 灯柱竖杆宽度
standardRailWidth: 1.5 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -142,7 +142,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#C0C0C0', // 灯柱颜色
standardWidth: 2 // 灯柱宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -148,7 +148,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#FFFFFF', // 灯柱颜色
standardWidth: 2 // 灯柱宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -126,7 +126,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#3149C3', // 灯珠颜色
standardWidth: 2 // 灯珠宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -126,7 +126,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#3149C3', // 灯珠颜色
standardWidth: 2 // 灯珠宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -140,7 +140,8 @@ class SkinCode extends defaultStyle {
standardLength: 4, // 高柱长度
standardHeight: 5, // 灯柱高度
standardColor: '#FF0000', // 灯柱颜色
standardWidth: 4 // 灯柱宽度
standardVerticalWidth: 4, // 灯柱竖杆宽度
standardRailWidth: 4 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -148,10 +148,12 @@ class SkinCode extends defaultStyle {
distance: 10, // 设备距离区段的距离
post: {
standardShow: true, // 灯柱显示
standardLength: 4, // 高柱长度
standardVerticalShape: '8', // 灯柱 竖杆 8边型
standardLength: 12, // 高柱长度
standardHeight: 5, // 灯柱高度
standardColor: '#FF0000', // 灯柱颜色
standardWidth: 4 // 灯柱宽度
standardVerticalWidth: 1, // 灯柱竖杆宽度
standardRailWidth: 6 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -129,7 +129,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#C0C0C0', // 灯柱颜色
standardWidth: 2 // 灯柱宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -165,7 +165,8 @@ class SkinCode extends defaultStyle {
standardHeight: 6, // 灯柱高度
standardColor: '#000000', // 灯柱颜色
physicColor:'#c0c0c0', // 物理点灯灯柱颜色
standardWidth: 2 // 灯柱宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -151,7 +151,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#969696', // 灯灯柱颜色
standardWidth: 3 // 灯柱宽度
standardVerticalWidth: 3, // 灯柱竖杆宽度
standardRailWidth: 3 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -134,7 +134,8 @@ class SkinCode extends defaultStyle {
standardLength: 6, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#3149C3', // 灯珠颜色
standardWidth: 2 // 灯珠宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2 // 灯柱横杆宽度
},
text: {
show: true, // 信号机名称显示

View File

@ -143,7 +143,8 @@ class SkinCode extends defaultStyle {
standardLength: 7, // 高柱长度
standardHeight: 6, // 灯柱高度
standardColor: '#fff', // 灯柱颜色
standardWidth: 2, // 灯柱宽度
standardVerticalWidth: 2, // 灯柱竖杆宽度
standardRailWidth: 2, // 灯柱横杆宽度
autoRouteColor: '#008000', // 自动进路开启灯柱颜色
shapeChange: true, // 灯柱形状改变
terminalOptional: '#CC3399' // 终端可选信号机灯柱颜色

View File

@ -246,12 +246,12 @@ export default class Section extends Group {
// 哈尔滨线路 道岔相关区段设置 默认颜色
if (this.style.Switch.sectionAction.flag && model.relSwitchCode && !flag) {
const switchModel = Vue.prototype.$jlmap.mapDevice[model.relSwitchCode];
if (switchModel.normalPosition != 0) { // 定位情况
if (switchModel && switchModel.normalPosition != 0) { // 定位情况
const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode];
sectionC && sectionC.instance && sectionC.instance.line.setStyle({ stroke: this.style.Switch.sectionAction.spareColor });
const sectionB = Vue.prototype.$jlmap.mapDevice[switchModel.sectionBCode];
sectionB && sectionB.instance && sectionB.instance.setState(sectionB, true);
} else if (switchModel.normalPosition == 0) { // 反位情况
} else if (switchModel && switchModel.normalPosition == 0) { // 反位情况
const sectionB = Vue.prototype.$jlmap.mapDevice[switchModel.sectionBCode];
sectionB && sectionB.instance && sectionB.instance.line.setStyle({ stroke: this.style.Switch.sectionAction.spareColor });
const sectionC = Vue.prototype.$jlmap.mapDevice[switchModel.sectionCCode];

View File

@ -12,23 +12,49 @@ class ESigPost extends Group {
create() {
const model = this.model;
const style = this.model.style;
// 竖杆
this.ver = new Polyline({
_subType: 'SignalLamp',
_val: '3',
zlevel: model.zlevel,
z: model.z,
shape: {
points: [
[model.x, model.y + style.Signal.post.standardHeight * 1.2],
[model.x, model.y - style.Signal.post.standardHeight * 1.2]
]
},
style: {
lineWidth: style.Signal.post.standardWidth,
stroke: style.Signal.post.standardColor
}
});
// 基座
let verPoints = [[model.x, model.y + style.Signal.post.standardHeight * 1.2], [model.x, model.y - style.Signal.post.standardHeight * 1.2]];
if (style.Signal.post.standardVerticalShape && style.Signal.post.standardVerticalShape === '8') {
verPoints = [
[model.x - model.drict * 2, model.y + style.Signal.post.standardHeight * 1.2],
[model.x - model.drict * 2, model.y - style.Signal.post.standardHeight * 1.2],
[model.x, model.y - style.Signal.post.standardHeight * 1.2],
[model.x, model.y - style.Signal.post.standardRailWidth / 2],
[model.x + model.drict * 2, model.y - style.Signal.post.standardRailWidth / 2],
[model.x + model.drict * 2, model.y + style.Signal.post.standardRailWidth / 2],
[model.x, model.y + style.Signal.post.standardRailWidth / 2],
[model.x, model.y + style.Signal.post.standardHeight * 1.2]
];
this.ver = new Polygon({
_subType: 'SignalLamp',
_val: '3',
zlevel: model.zlevel,
z: model.z,
shape: {
points: verPoints
},
style: {
lineWidth: style.Signal.post.standardVerticalWidth,
stroke: style.Signal.post.standardColor,
fill: style.Signal.post.standardColor
}
});
} else {
this.ver = new Polyline({
_subType: 'SignalLamp',
_val: '3',
zlevel: model.zlevel,
z: model.z,
shape: {
points: verPoints
},
style: {
lineWidth: style.Signal.post.standardVerticalWidth,
stroke: style.Signal.post.standardColor,
fill: style.Signal.post.standardColor
}
});
}
// 横杆
this.hor = new Polyline({
zlevel: model.zlevel,
@ -41,18 +67,13 @@ class ESigPost extends Group {
]
},
style: {
lineWidth: style.Signal.post.standardWidth,
lineWidth: style.Signal.post.standardRailWidth,
stroke: style.Signal.post.standardColor
}
});
this.add(this.ver);
this.add(this.hor);
model.type === '01' ? this.hor.hide() : this.hor.show();
if (style.Signal.post.standardShow) {
this.hor.show();
}
}
setColor(color) {
@ -100,7 +121,7 @@ class ESigPost extends Group {
if (style.Signal.post.standardShow) {
type = '01';
}
const length = style.Signal.post.standardShow ? 4 : 0;
const length = style.Signal.post.standardShow ? style.Signal.post.standardLength : 0;
if (type === '01') {
return {
x: model.x + model.drict * style.Signal.lamp.radiusR * 3 / 2 + model.drict * length,

View File

@ -180,7 +180,7 @@ class Signal extends Group {
this.sigBack.hide();
}
// 信号机名称
const sigNameX = model.position.x + model.positionPoint.x - drict * (style.Signal.post.standardWidth) + model.namePosition.x;
const sigNameX = model.position.x + model.positionPoint.x - drict * (style.Signal.post.standardVerticalWidth) + model.namePosition.x;
const sigNameY = model.position.y + model.positionPoint.y + posit * (style.Signal.distance + style.Section.line.width + style.Signal.lamp.radiusR * 2 + model.namePosition.y + style.Signal.text.distance);
const textAlign = style.Signal.text.isAlignCenter ? 'middle' : this.model.right ? 'left' : 'right';
const textVerticalAlign = posit == 1 ? 'top' : 'bottom';
@ -725,7 +725,7 @@ class Signal extends Group {
const rect = this.sigPost.getBoundingRect().clone();
return {
x: rect.x + drict * this.style.Signal.post.standardWidth,
x: rect.x + drict * this.style.Signal.post.standardVerticalWidth,
y: rect.y - offsetY
};
}

View File

@ -29,7 +29,7 @@
</el-table-column>
<el-table-column prop="tripNumber" label="车次号">
<template slot-scope="scope">
<span>{{ scope.row.serviceNumber+scope.row.tripNumber+scope.row.destinationCode }}</span>
<span>{{ scope.row.serviceNumber+scope.row.destinationCode+(scope.row.tripNumber.substring(1)) }}</span>
</template>
</el-table-column>
<el-table-column prop="groupNumber" label="车组号" />
@ -52,7 +52,7 @@
</el-table-column>
<el-table-column prop="tripNumber" label="车次号">
<template slot-scope="scope">
<span>{{ scope.row.destinationCode+scope.row.serviceNumber+scope.row.tripNumber }}</span>
<span>{{ scope.row.destinationCode+scope.row.serviceNumber+(scope.row.tripNumber.substring(1)) }}</span>
</template>
</el-table-column>
</el-table>
@ -157,7 +157,7 @@ export default {
if (device && device.code && device.deviceType === 'TRAIN') {
this.tempTableData = [device];
this.sectionCode = device.sectionModel.name;
this.tripNum = device.destinationCode + device.serviceNumber + device.tripNumber;
this.tripNum = device.destinationCode + device.serviceNumber + (device.tripNumber.substring(1));
this.groupNum = device.groupNumber;
}
}
@ -186,10 +186,10 @@ export default {
},
commit() {
this.newTripNumError = false;
if (this.newTripNum && this.newTripNum.length === 9) {
if (this.newTripNum && this.newTripNum.length === 8) {
const params = {
groupNumber: this.groupNum,
tripNumber: this.newTripNum.slice(6, 9),
tripNumber: '0' + this.newTripNum.slice(6, 8),
serviceNumber: this.newTripNum.slice(3, 6)
};
const step = {

View File

@ -794,7 +794,7 @@ export default {
this.standParamList = this.$store.state.training.prdType === '01' ? [] : [
{ name: '扣车', cmdType: CMD.Stand.CMD_STAND_SET_HOLD_TRAIN, operate: OperationEvent.StationStand.setDetainTrain.menuButton, show: false },
{ name: '取消扣车', cmdType: CMD.Stand.CMD_STAND_CANCEL_HOLD_TRAIN, operate: OperationEvent.StationStand.cancelDetainTrain.menuButton, show: false },
{ name: '越站', cmdType: CMD.Stand.CMD_STAND_SET_JUMP_STOP, operate: OperationEvent.StationStand.setJumpStop.menuButton, show: false, securityCommand: true },
{ name: '越站', cmdType: CMD.Stand.CMD_STAND_SET_JUMP_STOP, operate: OperationEvent.StationStand.setJumpStop.menuButton, show: false },
{ name: '取消越站', cmdType: CMD.Stand.CMD_STAND_CANCEL_JUMP_STOP, operate: OperationEvent.StationStand.cancelJumpStop.menuButton, show: false, securityCommand: true }
];
this.directionRodParamList = [

View File

@ -427,7 +427,7 @@ export const ProjectIcon = {
export const ProjectCode = {
login: 'DEFAULT',
designlogin: 'DEFAULT',
design: 'DEFAULT',
xty: 'XTY',
designxty: 'XTY',
gzb: 'GZB',

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.8.129:9000'; // 旭强
// BASE_API = 'http://192.168.8.119:9000'; // 张赛
// BASE_API = 'http://192.168.8.110:9000'; // 杜康
BASE_API = 'http://192.168.8.110:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -48,7 +48,7 @@
</el-tab-pane>
<el-tab-pane label="驾驶场景配置" name="driveEdit">
<div class= "editmodelconfig" :class="{active:index==isActive}" v-for="(asset,index) in driverAssetList" @click="assetSelect(driverAssetList[index],index)">
@ -341,6 +341,9 @@ export default {
updateEditSelectAsset(selsetAsset,selectData){
console.log(selectData);
if(this.nowSelect != null){
if(selsetAsset == "clear"){
}
if(selectData.fileType == "model"){
if(selsetAsset == "sceneEdit"){
this.sceneAssetList[this.nowSelect].id = selectData.id;

View File

@ -20,7 +20,7 @@
</el-form>
</el-scrollbar>
</el-tab-pane>
<el-tab-pane label="清空当前选项内容" name="delet">
<el-tab-pane label="清空当前选项内容" name="delet" @click="clearModel()">
</el-tab-pane>
</el-tabs>
@ -175,6 +175,9 @@ export default {
// this.$emit('smodel',this.modelList[index]);
updateEditSelectAsset(this.nowAssetName,this.nowAssetList[index]);
},
clearModel(){
updateEditSelectAsset("clear");
},
//
updateAssetList(newdata,newtype){
console.log(newdata);

View File

@ -277,7 +277,7 @@ export default {
const routeData = this.$router.resolve({
path:'/messageBoard',
query:{
project: this.$route.query.project,
project: this.$route.query.project || getSessionStorage('project'),
noPreLogout: true
}
});

View File

@ -501,10 +501,7 @@ export default {
model.rightStopPointOffset = model.rightStopPointOffset || model.lengthFact - 5;
}
const changeSectionList = this.handleOtherSectionChange(model);
// let changeStandList = [];
// if (this.editModel.stationCode != this.selected.stationCode) { //
const changeStandList = this.handleRelevanceStand(model);
// }
models = [...changeSectionList, ...changeStandList];
this.$emit('updateMapModel', models);
@ -512,8 +509,10 @@ export default {
this.oldLeftSectionCode = model.leftSectionCode;
this.oldRightSectionCode = model.rightSectionCode;
this.field = '';
this.$emit('deviceSelect', ''); //
} else {
this.$message('还有属性未填写,修改未生效!');
this.$emit('deviceSelect', '');
}
});
},

View File

@ -23,6 +23,8 @@ export default {
methods:{
create() { //
const createArr = []; // model
// const changeSectionLists = [];
// const changeSectionList = this.changeSectionsAttr(); //
const changeSectionList = this.changeSectionAttr(); //
changeSectionList.forEach(section => {
if (section['typeModel'] && section['typeModel'] == 'start') { //
@ -35,7 +37,7 @@ export default {
if (this.handleResetPoint(item.points)) {
sectionEnd = item.points[item.points.length - 1];
} else {
sectionEnd = item.points[0];
sectionEnd = item.points.length == 2 ? item.points[0] : item.points[item.points.length - 2];
}
if ((sectionEnd.y == section.points[section.points.length - 1].y) || (sectionEnd.x == section.points[section.points.length - 1].x)) { //
sectionB = item;
@ -50,13 +52,13 @@ export default {
if (this.handleResetPoint(section.points)) {
intersection = section.points[section.points.length - 1];
} else {
intersection = section.points[0];
intersection = section.points.length == 2 ? section.points[0] : section.points[section.points.length - 2];
}
let skew;
if (this.handleResetPoint(sectionC.points)) {
skew = sectionC.points[sectionC.points.length - 1];
} else {
skew = sectionC.points[0];
skew = sectionC.points.length == 2 ? sectionC.points[0] : sectionC.points[sectionC.points.length - 2];
}
const data = {
code: getUID('W', [...this.switchList, ...createArr]),
@ -91,7 +93,7 @@ export default {
list.forEach(item => {
let sectionStart;
if (this.handleResetPoint(item.points)) {
sectionStart = item.points[0];
sectionStart = item.points.length == 2 ? item.points[0] : item.points[item.points.length - 2];
} else {
sectionStart = item.points[item.points.length - 1];
}
@ -106,13 +108,13 @@ export default {
const switchModel = getModel('Switch');
let intersection;
if (this.handleResetPoint(section.points)) {
intersection = section.points[0];
intersection = section.points.length == 2 ? section.points[0] : section.points[section.points.length - 2];
} else {
intersection = section.points[section.points.length - 1];
}
let skew;
if (this.handleResetPoint(sectionC.points)) {
skew = sectionC.points[0];
skew = sectionC.points.length == 2 ? sectionC.points[0] : sectionC.points[sectionC.points.length - 2];
} else {
skew = sectionC.points[sectionC.points.length - 1];
}
@ -140,6 +142,92 @@ export default {
!swch && createArr.push(model); //
}
}
// if (item['typeModel'] == 'start') { //
// const section = item.A;
// const sectionB = item.B;
// const sectionC = item.C;
// if (section.code && sectionB.code && sectionC.code) {
// const uname = 'W' + section.name.replace('T', '');
// const switchModel = getModel('Switch');
// let intersection;
// if (this.handleResetPoint(section.points)) {
// intersection = section.points[section.points.length - 1];
// } else {
// intersection = section.points.length == 2 ? section.points[0] : section.points[section.points.length - 2];
// }
// let skew;
// if (this.handleResetPoint(sectionC.points)) {
// skew = sectionC.points[sectionC.points.length - 1];
// } else {
// skew = sectionC.points.length == 2 ? sectionC.points[0] : sectionC.points[sectionC.points.length - 2];
// }
// const data = {
// code: getUID('W', [...this.switchList, ...createArr]),
// name: uname,
// nameShow: true,
// timeoutShow: true,
// sectionACode: section.code,
// sectionBCode: sectionB.code,
// sectionCCode: sectionC.code,
// turnTime: 3,
// intersection: {
// x: intersection.x,
// y: intersection.y
// },
// skew: {
// x: skew.x,
// y: skew.y
// },
// normalPosition: 1 //
// };
// const model = Object.assign(switchModel, data);
// const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
// !swch && createArr.push(model); //
// }
// }
// if (item['typeModel'] == 'end') { //
// const section = item.A;
// const sectionB = item.B;
// const sectionC = item.C;
// if (section.code && sectionB.code && sectionC.code) {
// const uname = 'W' + section.name.replace('T', '');
// const switchModel = getModel('Switch');
// let intersection;
// if (this.handleResetPoint(section.points)) {
// intersection = section.points.length == 2 ? section.points[0] : section.points[section.points.length - 2];
// } else {
// intersection = section.points[section.points.length - 1];
// }
// let skew;
// if (this.handleResetPoint(sectionC.points)) {
// skew = sectionC.points.length == 2 ? sectionC.points[0] : sectionC.points[sectionC.points.length - 2];
// } else {
// skew = sectionC.points[sectionC.points.length - 1];
// }
// const data = {
// code: getUID('W', [...this.switchList, ...createArr]),
// name: uname,
// nameShow: true,
// timeoutShow: true,
// sectionACode: section.code,
// sectionBCode: sectionB.code,
// sectionCCode: sectionC.code,
// turnTime: 3,
// intersection: {
// x: intersection.x,
// y: intersection.y
// },
// skew: {
// x: skew.x,
// y: skew.y
// },
// normalPosition: 1 //
// };
// const model = Object.assign(switchModel, data);
// const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
// !swch && createArr.push(model); //
// }
// }
}
});
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
@ -147,6 +235,8 @@ export default {
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then((res) => {
// console.log(createArr, changeSectionLists);
// debugger;
const modelsList = this.createSwitchSection(createArr, changeSectionList);
modelsList.forEach(item => {
createArr.push(item);
@ -157,6 +247,133 @@ export default {
this.$message( this.$t('tip.cancelGeneration'));
});
},
findArr(arr) {
if (arr[0].slope !== arr[1].slope && arr[0].slope !== arr[2].slope) {
return arr[0];
}
for (var i = 0, len = arr.length; i < len; i++) {
if (arr[i].slope !== arr[0].slope) {
return arr[i];
}
}
},
//
// changeSectionsAttr() {
// const pointMap = {};
// const ponitMapNew = {};
// this.sectionList.forEach(item=> {
// if (item.type == '01' || item.type == '03') {
// const ponits = item.points;
// const startKey = ponits[0].x + '-' + ponits[0].y;
// const endKey = ponits[ponits.length - 1].x + '-' + ponits[ponits.length - 1].y;
// if (pointMap[startKey]) {
// pointMap[startKey].count++;
// pointMap[startKey].lists.push(item);
// if (pointMap[startKey].count >= 2) { ponitMapNew[startKey] = pointMap[startKey]; }
// } else {
// pointMap[startKey] = {count: 0, lists: [item]};
// }
// if (pointMap[endKey]) {
// pointMap[endKey].count++;
// pointMap[endKey].lists.push(item);
// if (pointMap[endKey].count >= 2) { ponitMapNew[endKey] = pointMap[endKey]; }
// } else {
// pointMap[endKey] = {count: 0, lists: [item]};
// }
// }
// });
// const keys = Object.keys(ponitMapNew);
// const switchSections = [];
// keys.forEach(key => {
// if (ponitMapNew[key].count == 2) {
// const slopeList = [];
// ponitMapNew[key].lists.forEach(sectionModel => {
// let slope = '';
// const points = sectionModel.points;
// const startKey = points[0].x + '-' + points[0].y;
// const endKey = points[points.length - 1].x + '-' + points[points.length - 1].y;
// if (key == startKey) {
// slope = ( points[1].y - points[0].y ) / ( points[1].x - points[0].x );
// }
// if (key == endKey) {
// slope = ( points[points.length - 1].y - points[points.length - 2].y ) / ( points[points.length - 1].x - points[points.length - 2].x );
// }
// slopeList.push({slope: slope, code: sectionModel.code, model: sectionModel});
// });
// const arr = [];
// let A, B;
// const sectionModelC = this.findArr(slopeList);
// slopeList.forEach(ele => {
// if (ele.slope != sectionModelC.slope) {
// arr.push(ele);
// }
// });
// const C = sectionModelC.model;
// const pointsC = C.points;
// arr.forEach(item => {
// const sectionModel = item.model;
// const points = sectionModel.points;
// const startKey = points[0].x + '-' + points[0].y;
// const endKey = points[points.length - 1].x + '-' + points[points.length - 1].y;
// const startKeyC = pointsC[0].x + '-' + pointsC[0].y;
// const endKeyC = pointsC[pointsC.length - 1].x + '-' + pointsC[pointsC.length - 1].y;
// let pointC = null;
// if (key == startKeyC) {
// pointC = JSON.parse(JSON.stringify(pointsC[1]));
// }
// if (key == endKeyC) {
// pointC = JSON.parse(JSON.stringify(pointsC[pointsC.length - 2]));
// }
// let acuteAngle;
// if (key == startKey) {
// acuteAngle = this.handleAngle([points[1], points[0], pointC]);
// }
// if (key == endKey) {
// acuteAngle = this.handleAngle([points[points.length - 2], points[points.length - 1], pointC]);
// }
// if (acuteAngle) {
// B = item.model;
// } else {
// A = item.model;
// }
// });
// let typeModel;
// if (key == A.points[A.points.length - 1].x + '-' + A.points[A.points.length - 1].y) {
// A.rightSectionCode = '';
// A.sepTypeRight = '00'; //
// B.leftSectionCode = '';
// B.sepTypeLeft = '00';
// C.leftSectionCode = '';
// C.sepTypeLeft = '00';
// typeModel = 'start';
// }
// if (key == A.points[0].x + '-' + A.points[0].y) {
// A.leftSectionCode = '';
// A.sepTypeLeft = '00'; //
// B.rightSectionCode = '';
// B.sepTypeRight = '00';
// C.rightSectionCode = '';
// C.sepTypeRight = '00';
// typeModel = 'end';
// }
// A.type = '03';
// B.type = '03';
// C.type = '03';
// switchSections.push({A: A, B: B, C: C, typeModel: typeModel });
// }
// });
// console.log(switchSections);
// return switchSections;
// },
// handleAngle(points) {
// const A = points[0];
// const B = points[1];
// const C = points[2];
// var AB = Math.sqrt(Math.pow(A.x - B.x, 2) + Math.pow(A.y - B.y, 2));
// var AC = Math.sqrt(Math.pow(A.x - C.x, 2) + Math.pow(A.y - C.y, 2));
// var BC = Math.sqrt(Math.pow(B.x - C.x, 2) + Math.pow(B.y - C.y, 2));
// return Math.pow(AB, 2) + Math.pow(BC, 2) > Math.pow(AC, 2);
// },
findSectionA(pointX, pointY, lists, code) {
const list = [];
lists.forEach(item => {
@ -208,19 +425,19 @@ export default {
},
//
handleResetPoint(points) {
return (points[points.length - 1].x >= points[0].x) && (points[points.length - 1].y >= points[0].y);
return points[points.length - 1].x >= points[points.length - 2].x;
},
//
changeSectionAttr() {
const changeSectionList = []; //
this.sectionList.forEach(section => {
if (section.type == '01') {
if (section.type == '01' || section.type == '03') {
const oneSection = section.points[section.points.length - 1];
const oneSectionStar = section.points[0];
let countA = 0;
let countB = 0;
this.sectionList.forEach(elem => {
if (elem.type == '01' && section.code != elem.code) {
if ((elem.type == '01' || section.type == '03') && section.code != elem.code) {
let twoSection, twoSectionEnd;
if (this.handleResetPoint(elem.points)) {
twoSection = elem.points[0];
@ -276,34 +493,34 @@ export default {
});
return changeSectionList;
},
checkAddListA(points, code) { // list ()
let flag = false;
this.sectionList.forEach(section => {
section.points.forEach((point, index) => {
if (index > 0 && section.code != code) {
if (point.x == points.x && point.y == points.y) {
flag = true;
}
}
});
// checkAddListA(points, code) { // list ()
// let flag = false;
// this.sectionList.forEach(section => {
// section.points.forEach((point, index) => {
// if (index > 0 && section.code != code) {
// if (point.x == points.x && point.y == points.y) {
// flag = true;
// }
// }
// });
});
return flag;
},
checkAddListB(points, code) { // list ()
let flag = false;
this.sectionList.forEach(section => {
section.points.forEach((point, index) => {
if (index == 0 && section.code != code) {
if (point.x == points.x && point.y == points.y) {
flag = true;
}
}
});
// });
// return flag;
// },
// checkAddListB(points, code) { // list ()
// let flag = false;
// this.sectionList.forEach(section => {
// section.points.forEach((point, index) => {
// if (index == 0 && section.code != code) {
// if (point.x == points.x && point.y == points.y) {
// flag = true;
// }
// }
// });
});
return flag;
},
// });
// return flag;
// },
//
createSwitchSection(list, sectionLists) {
const models = [];