Merge remote-tracking branch 'origin/test'
This commit is contained in:
commit
ac096dd663
@ -51,7 +51,7 @@ export default {
|
||||
menuSignal: {
|
||||
routeSelect: '进路选排',
|
||||
routeCancel: '进路取消',
|
||||
signalBlock: '信号封闭',
|
||||
signalBlock: '信号封锁',
|
||||
signalDeblock: '信号解封',
|
||||
signalReopen: '信号重开',
|
||||
guideRouteHandle: '引导进路办理',
|
||||
|
@ -27,7 +27,11 @@ export function parser(data, skinCode, showConfig) {
|
||||
zrUtil.each(centralStationList, elem => {
|
||||
mapDevice[elem.code].stationCode = elem.code;
|
||||
zrUtil.each(elem.chargeStationCodeList || [], item => {
|
||||
if (mapDevice[item]) {
|
||||
mapDevice[item].stationCode = elem.code;
|
||||
} else {
|
||||
console.error('未获取到设备' + item);
|
||||
}
|
||||
});
|
||||
});
|
||||
zrUtil.each(data.sectionList || [], elem => {
|
||||
|
@ -423,21 +423,21 @@ export default {
|
||||
break;
|
||||
case 'center':
|
||||
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_APPLY_FOR_CENTER_CONTROL;
|
||||
// delete operate.over;
|
||||
delete operate.over;
|
||||
operate.subType = 'center';
|
||||
operate.param = {stationCodes: [model.code]};
|
||||
operate.code = model.code;
|
||||
break;
|
||||
case 'emergency':
|
||||
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL;
|
||||
// delete operate.over;
|
||||
delete operate.over;
|
||||
operate.subType = 'emergency';
|
||||
operate.param = {stationCodes: [model.code]};
|
||||
operate.code = model.code;
|
||||
break;
|
||||
case 'interconnected':
|
||||
operate.cmdType = CMD.ControlConvertMenu.CMD_CM_EMERGENCY_STATION_CONTROL;
|
||||
// delete operate.over;
|
||||
delete operate.over;
|
||||
operate.subType = 'interconnected';
|
||||
operate.param = {stationCodes: [model.code]};
|
||||
operate.code = model.code;
|
||||
|
@ -34,6 +34,9 @@
|
||||
<el-button :disabled="showRight" type="primary" size="mini" icon="el-icon-arrow-right" @click="adjustDirection" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="text-align: center;margin-top: 15px;">
|
||||
<el-button type="primary" size="mini" @click="handleRun">自动运行</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -41,6 +44,7 @@
|
||||
import LeftTrain from '@/assets/left_train.png';
|
||||
import RightTrain from '@/assets/right_train.png';
|
||||
import { sandTableTrainControl } from '@/api/simulation';
|
||||
import {menuOperate} from '@/jmapNew/theme/components/utils/menuOperate';
|
||||
export default {
|
||||
name: 'TrainOperation',
|
||||
data() {
|
||||
@ -113,12 +117,36 @@ export default {
|
||||
adjustDirection() {
|
||||
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: !this.right, speed: this.speed }).then(resp => {
|
||||
this.right = !this.right;
|
||||
}).catch(err => { this.$message.error(err.message); });
|
||||
}).catch(err => { this.$message.error(err.message); }).finally(() => { this.changeSpeedFlag = false; });
|
||||
},
|
||||
brakeTrain() {
|
||||
sandTableTrainControl(this.$route.query.group, { groupNumber: this.groupNumber, right: this.right, speed: 0 }).then(resp => {
|
||||
this.speed = 0;
|
||||
}).catch(err => { this.$message.error(err.message); });
|
||||
}).catch(err => { this.$message.error(err.message); }).finally(() => { this.changeSpeedFlag = false; });
|
||||
},
|
||||
handleRun() {
|
||||
const step = {
|
||||
over: true,
|
||||
operation: menuOperate.Common.trainDrive.operation,
|
||||
cmdType: menuOperate.Common.trainDrive.cmdType,
|
||||
param: {
|
||||
groupNumber: this.groupNumber,
|
||||
param: {
|
||||
speedLimit: '',
|
||||
through: 0,
|
||||
targetDeviceCode: ''
|
||||
}
|
||||
}
|
||||
};
|
||||
this.$store.dispatch('trainingNew/next', step).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
} else {
|
||||
this.$messageBox('Failed to set or cancel the fault!');
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$messageBox(error.message || 'Failed to set or cancel the fault!');
|
||||
}).finally(() => { this.changeSpeedFlag = false; });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -107,7 +107,7 @@ export default {
|
||||
this.tempData = [{
|
||||
code: selected.code,
|
||||
name: selected.name,
|
||||
status: selected.blockade ? this.$t('menu.unblocked') : this.$t('menu.blocked') }];
|
||||
status: selected.blockade ? this.$t('menu.blocked') : this.$t('menu.unblocked') }];
|
||||
const timer = setInterval(() => {
|
||||
if (this.$refs.table) {
|
||||
this.$refs.table.setCurrentRow(this.tempData[0]);
|
||||
|
@ -149,7 +149,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation && !(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER')) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Section) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
@ -205,7 +205,9 @@ export default {
|
||||
});
|
||||
},
|
||||
doShow(point) {
|
||||
if (!(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER' && this.operatemode !== OperateMode.FAULT)) {
|
||||
this.initMenu();
|
||||
}
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Signal) && !this.buttonOperation && !(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER')) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Signal) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
@ -361,7 +361,9 @@ export default {
|
||||
}
|
||||
},
|
||||
doShow(point) {
|
||||
if (!(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER' && this.operatemode !== OperateMode.FAULT)) {
|
||||
this.initMenu();
|
||||
}
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Station) && !this.buttonOperation && !(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER')) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Station) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
@ -154,7 +154,9 @@ export default {
|
||||
},
|
||||
doShow(point) {
|
||||
if (this.selected.ciStation) {
|
||||
if (!(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER' && this.operatemode !== OperateMode.FAULT)) {
|
||||
this.initMenu();
|
||||
}
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationStand) && !this.buttonOperation && !(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER')) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.StationStand) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
@ -221,7 +221,9 @@ export default {
|
||||
// }
|
||||
},
|
||||
doShow(point) {
|
||||
if (!(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER' && this.operatemode !== OperateMode.FAULT)) {
|
||||
this.initMenu();
|
||||
}
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function (val) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation && !(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER')) {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Switch) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
@ -207,7 +207,9 @@ export default {
|
||||
});
|
||||
},
|
||||
doShow(point) {
|
||||
if (!(this.work == 'localWork' && this.roles == 'DEPOT_DISPATCHER' && this.operatemode !== OperateMode.FAULT)) {
|
||||
this.initMenu();
|
||||
}
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ export default {
|
||||
}
|
||||
},
|
||||
'$store.state.menuOperation.selected': function (val) {
|
||||
if (val._type === 'Train' && val._event === MouseEvent.Left && this.project === 'srsandbox') {
|
||||
if (val._type === 'Train' && val._event === MouseEvent.Left && (this.project === 'srsandbox' || this.project === 'ngysandtable')) {
|
||||
this.$refs.trainOperation.doShow(val);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { createMartPoint, createMartPointReverse, createSeriesModel, createMarkLineModels, hexColor } from './util';
|
||||
import store from '@/store/index';
|
||||
// import store from '@/store/index';
|
||||
|
||||
const defaultConfig = {
|
||||
/** 边缘高度*/
|
||||
@ -49,7 +49,6 @@ class EqualDistanceParser {
|
||||
var idx = 0;
|
||||
var lastPoint = null;
|
||||
var nextPoint = null;
|
||||
|
||||
/** 如果车次号为空,不显示名称*/
|
||||
if (train.tripNumber) {
|
||||
// 如果不是被删除的首个车次
|
||||
@ -59,9 +58,9 @@ class EqualDistanceParser {
|
||||
pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
|
||||
pointdata.color = '#000' || lineStyle.color;
|
||||
pointdata.directionCode = train.right ? '2' : '1';
|
||||
if (!store.state.map.mapConfig.upRight) {
|
||||
pointdata.directionCode = train.right ? '1' : '2';
|
||||
}
|
||||
// if (!store.state.map.mapConfig.upRight) {
|
||||
// pointdata.directionCode = train.right ? '1' : '2';
|
||||
// }
|
||||
pointdata.coord = [train.stationTimeList[0].secondTime, this.getCoordYByElem(stations, kmRangeMap, train.stationTimeList[0], pointdata.directionCode, false)];
|
||||
/** 给服务对象添加服务名称和标记点*/
|
||||
opt.markPointData.push(this.__createMartPoint(pointdata));
|
||||
@ -170,10 +169,10 @@ class EqualDistanceParser {
|
||||
runPlanData[elem.serviceNumber][elem.tripNumber].sort((a, b) => {
|
||||
return parseInt(a.secondTime) - parseInt(b.secondTime);
|
||||
});
|
||||
let directionCode = elem.right ? '2' : '1';
|
||||
if (!store.state.map.mapConfig.upRight) {
|
||||
directionCode = elem.right ? '1' : '2';
|
||||
}
|
||||
const directionCode = elem.right ? '2' : '1';
|
||||
// if (!store.state.map.mapConfig.upRight) {
|
||||
// directionCode = elem.right ? '1' : '2';
|
||||
// }
|
||||
/** 如果此记录车组号的数据为第一条时,则打上标签*/
|
||||
if (runPlanData[elem.serviceNumber][elem.tripNumber].length <= 1) {
|
||||
const result = serie.markPoint.data.some(ele => ele.name == `(${elem.groupNumber})${elem.serviceNumber}${elem.tripNumber}`);
|
||||
@ -262,7 +261,6 @@ class EqualDistanceParser {
|
||||
} else if (directionCode === '2') {
|
||||
defaultValue += sign * this.getEdge() / 2;
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,8 @@ export default {
|
||||
mapId: mapId,
|
||||
simType:paramVO.type,
|
||||
project: this.projectCode,
|
||||
projectDevice:this.$route.query.projectDevice
|
||||
projectDevice:this.$route.query.projectDevice,
|
||||
type: this.$route.query.type
|
||||
};
|
||||
if (config) {
|
||||
if (config.client) { query.client = config.client; }
|
||||
|
@ -21,7 +21,7 @@ import { getSessionStorage } from '@/utils/auth';
|
||||
import { mapGetters } from 'vuex';
|
||||
import TerminalsPicture from './terminals/index';
|
||||
import SimulationMenu from './simulationMenu/simulationMenu';
|
||||
import { getSimulationInfoNew, destroySimulationByAdmin, exitSimulation } from '@/api/simulation';
|
||||
import { getSimulationInfoNew } from '@/api/simulation';
|
||||
import { loadMapDataById, loadRunPlanData } from '@/utils/loaddata';
|
||||
import { getByGroupStationList } from '@/api/jmap/map';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
@ -134,15 +134,18 @@ export default {
|
||||
},
|
||||
// 初始化
|
||||
initLoadData() {
|
||||
getSimulationInfoNew(this.group).then(resp => {
|
||||
getSimulationInfoNew(this.group).then(async resp => {
|
||||
if (resp && resp.data && !resp.data.dataError) {
|
||||
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan);
|
||||
this.$store.dispatch('training/setDomConfig', resp.data.paramVO && resp.data.paramVO.domConfig ? resp.data.paramVO.domConfig : {});
|
||||
this.$store.dispatch('map/setLinkSwitchMap', resp.data.linkSwitchMap || {});
|
||||
loadMapDataById(this.mapId, 'simulation');
|
||||
if (this.simType === 'METRO') {
|
||||
this.loadRunPlan();
|
||||
this.$store.dispatch('runPlan/clear');
|
||||
const respSl = await getByGroupStationList(this.group);
|
||||
this.$store.dispatch('runPlan/setStations', respSl.data);
|
||||
await loadRunPlanData(this.group);
|
||||
}
|
||||
await loadMapDataById(this.mapId, 'simulation');
|
||||
} else {
|
||||
this.endViewLoading();
|
||||
this.$messageBox('此地图数据正在维护中,无法运行!');
|
||||
@ -154,13 +157,6 @@ export default {
|
||||
this.$message.error('获取仿真信息失败!');
|
||||
});
|
||||
},
|
||||
loadRunPlan() {
|
||||
this.$store.dispatch('runPlan/clear');
|
||||
getByGroupStationList(this.group).then(resp => {
|
||||
this.$store.dispatch('runPlan/setStations', resp.data);
|
||||
loadRunPlanData(this.group);
|
||||
});
|
||||
},
|
||||
// 结束加载状态
|
||||
endViewLoading() {
|
||||
this.$nextTick(() => {
|
||||
|
@ -288,7 +288,13 @@ export default {
|
||||
},
|
||||
tripNumberModify(row) {
|
||||
if (row) {
|
||||
this.$refs.modifyService.doShow({serviceNumber:this.$store.state.runPlan.selected.serviceNumber, tripNumber:row.tripNumber});
|
||||
let serviceNumber;
|
||||
if (this.loadRunPlanId) {
|
||||
serviceNumber = this.$store.state.runPlan.draftSelected.serviceNumber;
|
||||
} else {
|
||||
serviceNumber = this.$store.state.runPlan.selected.serviceNumber;
|
||||
}
|
||||
this.$refs.modifyService.doShow({serviceNumber:serviceNumber, tripNumber:row.tripNumber});
|
||||
}
|
||||
},
|
||||
serviceNumberChange(row) {
|
||||
|
@ -405,7 +405,7 @@ export default {
|
||||
this.destroy();
|
||||
let startValue = 3600 + this.PlanParser.getTranslation();
|
||||
const offsetTime = 3600;
|
||||
const initTime = toTimeStamp(formatDuring(this.$store.state.socket.simulationTimeSync));
|
||||
const initTime = toTimeStamp(formatDuring(this.$store.state.socket.simulationTimeSync | 0));
|
||||
startValue = initTime - this.PlanParser.getTranslation();
|
||||
option.dataZoom[0].startValue = option.dataZoom[1].startValue = startValue - offsetTime;
|
||||
option.dataZoom[0].endValue = option.dataZoom[1].endValue = startValue + offsetTime;
|
||||
|
@ -1007,7 +1007,6 @@ export default {
|
||||
deviceCode: ''
|
||||
};
|
||||
memberMap[this.generationForm.systemType].push(memberDispatcher);
|
||||
}
|
||||
const memberNccDispatcher = {
|
||||
id: this.getMemberId(this.generationForm.systemType),
|
||||
name: '',
|
||||
@ -1022,6 +1021,7 @@ export default {
|
||||
deviceCode: ''
|
||||
};
|
||||
memberMap[this.generationForm.systemType].push(memberOccDispatcher);
|
||||
}
|
||||
this.stationList.forEach(station => {
|
||||
if (!station.depot) {
|
||||
const member = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex_box">
|
||||
<el-button type="primary" @click="create">{{ $t('map.createSwitch') }}</el-button>
|
||||
<el-button type="primary" @click="createSwitch">{{ $t('map.createSwitch') }}</el-button>
|
||||
<el-button type="error" @click="deleteSwitch">一键删除道岔</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@ -21,146 +21,36 @@ 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') { // 右侧关联关系为空 且 道岔区段
|
||||
const list = this.findSectionA(section.points[section.points.length - 1].x, section.points[section.points.length - 1].y, changeSectionList, section.code);
|
||||
let sectionB = {};
|
||||
let sectionC = {};
|
||||
if (list.length >= 2) {
|
||||
list.forEach(item => {
|
||||
let sectionEnd;
|
||||
if (this.handleResetPoint(item.points)) {
|
||||
sectionEnd = item.points.length == 2 ? item.points[item.points.length - 1] : item.points[1];
|
||||
} else {
|
||||
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;
|
||||
} else {
|
||||
sectionC = item;
|
||||
}
|
||||
});
|
||||
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[section.points.length - 1] : section.points[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
|
||||
},
|
||||
pos: 'N', // 默认状态定位
|
||||
// N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
throat: ''
|
||||
};
|
||||
const model = Object.assign(switchModel, data);
|
||||
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
|
||||
!swch && createArr.push(model); // 已有的道岔不在创建
|
||||
}
|
||||
}
|
||||
}
|
||||
if (section['typeModel'] && section['typeModel'] == 'end') { // 左侧关联关系为空 且 道岔区段
|
||||
const list = this.findSectionB(section.points[0].x, section.points[0].y, changeSectionList, section.code);
|
||||
let sectionB = {};
|
||||
let sectionC = {};
|
||||
if (list.length >= 2) {
|
||||
list.forEach(item => {
|
||||
let sectionStart;
|
||||
if (this.handleResetPoint(item.points)) {
|
||||
sectionStart = item.points.length == 2 ? item.points[0] : item.points[item.points.length - 2];
|
||||
} else {
|
||||
sectionStart = item.points.length == 2 ? item.points[item.points.length - 1] : item.points[1];
|
||||
}
|
||||
const dy = section.points[1].y - section.points[0].y;
|
||||
const dx = section.points[1].x - section.points[0].x;
|
||||
const startDx = sectionStart.x - section.points[0].x;
|
||||
const startDy = sectionStart.y - section.points[0].y;
|
||||
if ((sectionStart.y == section.points[0].y) || (sectionStart.x == section.points[0].x) ||
|
||||
(dy * startDx == dx * startDy)) { // 是否水平拿倒数第二个点判断
|
||||
sectionB = item;
|
||||
} else {
|
||||
sectionC = item;
|
||||
}
|
||||
});
|
||||
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 - 1];
|
||||
} else {
|
||||
intersection = section.points.length == 2 ? section.points[section.points.length - 1] : section.points[0];
|
||||
}
|
||||
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
|
||||
},
|
||||
pos: 'N', // 默认状态定位
|
||||
// N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
throat: ''
|
||||
};
|
||||
const model = Object.assign(switchModel, data);
|
||||
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
|
||||
!swch && createArr.push(model); // 已有的道岔不在创建
|
||||
}
|
||||
}
|
||||
// if (item['typeModel'] == 'start') { // 右侧关联关系为空 且 道岔区段
|
||||
// const section = item.A;
|
||||
// const sectionB = item.B;
|
||||
// const sectionC = item.C;
|
||||
// create() { // 一键生成道岔
|
||||
// const createArr = []; // 创建model列表
|
||||
// // const changeSectionLists = [];
|
||||
// // const changeSectionList = this.changeSectionsAttr(); // 找道岔中心点
|
||||
// const changeSectionList = this.changeSectionAttr(); // 找道岔中心点
|
||||
// changeSectionList.forEach(section => {
|
||||
// if (section['typeModel'] && section['typeModel'] == 'start') { // 右侧关联关系为空 且 道岔区段
|
||||
// const list = this.findSectionA(section.points[section.points.length - 1].x, section.points[section.points.length - 1].y, changeSectionList, section.code);
|
||||
// let sectionB = {};
|
||||
// let sectionC = {};
|
||||
// if (list.length >= 2) {
|
||||
// list.forEach(item => {
|
||||
// let sectionEnd;
|
||||
// if (this.handleResetPoint(item.points)) {
|
||||
// sectionEnd = item.points[1];
|
||||
// } else {
|
||||
// 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;
|
||||
// } else {
|
||||
// sectionC = item;
|
||||
// }
|
||||
// });
|
||||
// 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];
|
||||
// intersection = section.points[1];
|
||||
// } else {
|
||||
// intersection = section.points.length == 2 ? section.points[0] : section.points[section.points.length - 2];
|
||||
// }
|
||||
@ -187,25 +77,47 @@ export default {
|
||||
// x: skew.x,
|
||||
// y: skew.y
|
||||
// },
|
||||
// normalPosition: 1 // 默认状态定位
|
||||
// pos: 'N', // 默认状态定位
|
||||
// // N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
// throat: ''
|
||||
// };
|
||||
// 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['typeModel'] && section['typeModel'] == 'end') { // 左侧关联关系为空 且 道岔区段
|
||||
// const list = this.findSectionB(section.points[0].x, section.points[0].y, changeSectionList, section.code);
|
||||
// let sectionB = {};
|
||||
// let sectionC = {};
|
||||
// if (list.length === 2) {
|
||||
// list.forEach(item => {
|
||||
// let sectionStart;
|
||||
// if (this.handleResetPoint(item.points)) {
|
||||
// sectionStart = item.points.length == 2 ? item.points[0] : item.points[item.points.length - 2];
|
||||
// } else {
|
||||
// sectionStart = item.points[1];
|
||||
// }
|
||||
// const dy = section.points[1].y - section.points[0].y;
|
||||
// const dx = section.points[1].x - section.points[0].x;
|
||||
// const startDx = sectionStart.x - section.points[0].x;
|
||||
// const startDy = sectionStart.y - section.points[0].y;
|
||||
// if ((sectionStart.y == section.points[0].y) || (sectionStart.x == section.points[0].x) ||
|
||||
// (dy * startDx == dx * startDy)) { // 是否水平拿倒数第二个点判断
|
||||
// sectionB = item;
|
||||
// } else {
|
||||
// sectionC = item;
|
||||
// }
|
||||
// });
|
||||
// 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];
|
||||
// intersection = section.points.length == 2 ? section.points[0] : section.points[section.points.length - 1];
|
||||
// } else {
|
||||
// intersection = section.points[section.points.length - 1];
|
||||
// intersection = section.points.length == 2 ? section.points[section.points.length - 1] : section.points[0];
|
||||
// }
|
||||
// let skew;
|
||||
// if (this.handleResetPoint(sectionC.points)) {
|
||||
@ -230,39 +142,127 @@ export default {
|
||||
// x: skew.x,
|
||||
// y: skew.y
|
||||
// },
|
||||
// normalPosition: 1 // 默认状态定位
|
||||
// pos: 'N', // 默认状态定位
|
||||
// // N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
// throat: ''
|
||||
// };
|
||||
// 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'), {
|
||||
confirmButtonText: this.$t('tip.confirm'),
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type: 'warning'
|
||||
}).then((res) => {
|
||||
const modelsList = this.createSwitchSection(createArr, changeSectionList);
|
||||
modelsList.forEach(item => {
|
||||
createArr.push(item);
|
||||
});
|
||||
this.$emit('updateMapModel', createArr);
|
||||
}).catch((error) => {
|
||||
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];
|
||||
}
|
||||
}
|
||||
},
|
||||
// // 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'), {
|
||||
// confirmButtonText: this.$t('tip.confirm'),
|
||||
// cancelButtonText: this.$t('tip.cancel'),
|
||||
// type: 'warning'
|
||||
// }).then((res) => {
|
||||
// const modelsList = this.createSwitchSection(createArr, changeSectionList);
|
||||
// modelsList.forEach(item => {
|
||||
// createArr.push(item);
|
||||
// });
|
||||
// this.$emit('updateMapModel', createArr);
|
||||
// }).catch((error) => {
|
||||
// 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 = {};
|
||||
@ -379,40 +379,40 @@ export default {
|
||||
// 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 => {
|
||||
if (item.code != code) {
|
||||
if (this.handleResetPoint(item.points)) {
|
||||
if (item.points[0].x == pointX && item.points[0].y == pointY) {
|
||||
list.push(item);
|
||||
}
|
||||
} else {
|
||||
if (item.points[item.points.length - 1].x == pointX && item.points[item.points.length - 1].y == pointY) {
|
||||
list.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return list;
|
||||
},
|
||||
findSectionB(pointX, pointY, lists, code) {
|
||||
const list = [];
|
||||
lists.forEach(item => {
|
||||
if (item.code != code) {
|
||||
if (this.handleResetPoint(item.points)) {
|
||||
if (item.points[item.points.length - 1].x == pointX && item.points[item.points.length - 1].y == pointY) {
|
||||
list.push(item);
|
||||
}
|
||||
} else {
|
||||
if (item.points[0].x == pointX && item.points[0].y == pointY) {
|
||||
list.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return list;
|
||||
},
|
||||
// findSectionA(pointX, pointY, lists, code) {
|
||||
// const list = [];
|
||||
// lists.forEach(item => {
|
||||
// if (item.code != code) {
|
||||
// if (this.handleResetPoint(item.points)) {
|
||||
// if (item.points[0].x == pointX && item.points[0].y == pointY) {
|
||||
// list.push(item);
|
||||
// }
|
||||
// } else {
|
||||
// if (item.points[item.points.length - 1].x == pointX && item.points[item.points.length - 1].y == pointY) {
|
||||
// list.push(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// return list;
|
||||
// },
|
||||
// findSectionB(pointX, pointY, lists, code) {
|
||||
// const list = [];
|
||||
// lists.forEach(item => {
|
||||
// if (item.code != code) {
|
||||
// if (this.handleResetPoint(item.points)) {
|
||||
// if (item.points[item.points.length - 1].x == pointX && item.points[item.points.length - 1].y == pointY && list.findIndex(elem => elem.code === item.code) === -1) {
|
||||
// list.push(item);
|
||||
// }
|
||||
// } else {
|
||||
// if (item.points[0].x == pointX && item.points[0].y == pointY && list.findIndex(elem => elem.code === item.code) === -1) {
|
||||
// list.push(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// return list;
|
||||
// },
|
||||
findSwitchData(sectionACode, sectionBCode, sectionCCode) {
|
||||
var rtn = null;
|
||||
var switchList = this.switchList;
|
||||
@ -429,75 +429,239 @@ export default {
|
||||
return rtn;
|
||||
},
|
||||
// 重置坐标点
|
||||
handleResetPoint(points) {
|
||||
return points[points.length - 1].x >= points[points.length - 2].x;
|
||||
},
|
||||
// 修改区段属性
|
||||
changeSectionAttr() {
|
||||
const changeSectionList = []; // 改变的区段列表
|
||||
// handleResetPoint(points) {
|
||||
// return points[points.length - 1].x >= points[points.length - 2].x;
|
||||
// },
|
||||
findSwitchSection() {
|
||||
const pointMap = new Map();
|
||||
this.sectionList.forEach(section => {
|
||||
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.type == '03') && section.code != elem.code) {
|
||||
let twoSection, twoSectionEnd;
|
||||
if (this.handleResetPoint(elem.points)) {
|
||||
twoSection = elem.points[0];
|
||||
twoSectionEnd = elem.points[elem.points.length - 1];
|
||||
if (section.type === '01') {
|
||||
const startP = `${section.points[0].x}_${section.points[0].y}`;
|
||||
const endP = `${section.points[section.points.length - 1].x}_${section.points[section.points.length - 1].y}`;
|
||||
if (pointMap.get(startP)) {
|
||||
const value = pointMap.get(startP);
|
||||
value.count++;
|
||||
value.sections.push({ device: section, type: 'start' });
|
||||
} else {
|
||||
twoSection = elem.points[elem.points.length - 1];
|
||||
twoSectionEnd = elem.points[0];
|
||||
pointMap.set(startP, { count: 1, sections: [{ device: section, type: 'start' }] });
|
||||
}
|
||||
if (oneSection.x == twoSection.x && oneSection.y == twoSection.y) {
|
||||
countA++;
|
||||
if (countA >= 2) {
|
||||
// if (!this.checkAddListA(oneSection, section.code)) { // 右侧关系清空
|
||||
const sectionModel = deepAssign({}, section);
|
||||
sectionModel.rightSectionCode = '';
|
||||
sectionModel.sepTypeRight = '00'; // 分隔符
|
||||
sectionModel.type = '03';
|
||||
const list = this.findSectionA(sectionModel.points[sectionModel.points.length - 1].x, sectionModel.points[sectionModel.points.length - 1].y, this.sectionList, sectionModel.code);
|
||||
list.forEach(elem => {
|
||||
const sectionModelElem = deepAssign({}, elem);
|
||||
if (pointMap.get(endP)) {
|
||||
const value = pointMap.get(endP);
|
||||
value.count++;
|
||||
value.sections.push({ device: section, type: 'end' });
|
||||
} else {
|
||||
pointMap.set(endP, { count: 1, sections: [{device: section, type: 'end'}] });
|
||||
}
|
||||
}
|
||||
});
|
||||
const switchSectionGroups = [];
|
||||
pointMap.forEach((value, key) => {
|
||||
if (value.count === 3) {
|
||||
const switchSectionGroup = [];
|
||||
value.sections.forEach(item => {
|
||||
const sectionModelElem = deepAssign({}, item.device);
|
||||
sectionModelElem.type = '03';
|
||||
if (item.type === 'start') {
|
||||
sectionModelElem.rightSectionCode = '';
|
||||
sectionModelElem.sepTypeRight = '00';
|
||||
} else if (item.type === 'end') {
|
||||
sectionModelElem.leftSectionCode = '';
|
||||
sectionModelElem.sepTypeLeft = '00';
|
||||
sectionModelElem.type = '03';
|
||||
changeSectionList.push(sectionModelElem);
|
||||
}
|
||||
switchSectionGroup.push({ sectionModel:sectionModelElem, type: item.type });
|
||||
});
|
||||
sectionModel['typeModel'] = 'start';
|
||||
changeSectionList.push(sectionModel);
|
||||
// }
|
||||
}
|
||||
} else if (oneSectionStar.x == twoSectionEnd.x && oneSectionStar.y == twoSectionEnd.y) {
|
||||
countB++;
|
||||
if (countB >= 2) {
|
||||
// if (!this.checkAddListB(oneSectionStar, section.code)) { // 左侧关系清空
|
||||
const sectionModel = deepAssign({}, section);
|
||||
sectionModel.leftSectionCode = '';
|
||||
sectionModel.sepTypeLeft = '00';
|
||||
sectionModel.type = '03';
|
||||
const list = this.findSectionB(sectionModel.points[0].x, sectionModel.points[0].y, this.sectionList, sectionModel.code);
|
||||
list.forEach(elem => {
|
||||
const sectionModelElem = deepAssign({}, elem);
|
||||
sectionModelElem.rightSectionCode = '';
|
||||
sectionModelElem.sepTypeRight = '00'; // 分隔符
|
||||
sectionModelElem.type = '03';
|
||||
changeSectionList.push(sectionModelElem);
|
||||
});
|
||||
sectionModel['typeModel'] = 'end';
|
||||
changeSectionList.push(sectionModel);
|
||||
// }
|
||||
}
|
||||
}
|
||||
switchSectionGroups.push(switchSectionGroup);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return changeSectionList;
|
||||
return switchSectionGroups;
|
||||
},
|
||||
getAngle(x1, y1, x2, y2) {
|
||||
const dot = x1 * x2 + y1 * y2;
|
||||
const det = x1 * y2 + x2 * y1;
|
||||
const angle = Math.atan2(det, dot) / Math.PI * 180;
|
||||
return (angle + 360) % 360;
|
||||
},
|
||||
isLine(p1, p2, p) {
|
||||
const k1 = ((p2.y - p1.y) / (p2.x - p1.x)).toFixed(3);
|
||||
const k2 = ((p.y - p1.y) / (p.x - p1.x)).toFixed(3);
|
||||
const error = Math.abs(k2 - k1);
|
||||
return error - 0.001 < Number.EPSILON;
|
||||
},
|
||||
createSwitch() {
|
||||
const createArr = []; // 创建model列表
|
||||
const changeSectionList = [];
|
||||
const switchSectionGroups = this.findSwitchSection();
|
||||
switchSectionGroups.forEach(group => {
|
||||
let sectionA, sectionB, sectionC;
|
||||
let skew;
|
||||
const coreP = group[0].type === 'start' ? group[0].sectionModel.points[0] : group[0].sectionModel.points[group[0].sectionModel.points.length - 1];
|
||||
const p0 = group[0].type === 'start' ? group[0].sectionModel.points[1] : group[0].sectionModel.points[group[0].sectionModel.points.length - 2];
|
||||
const p1 = group[1].type === 'start' ? group[1].sectionModel.points[1] : group[1].sectionModel.points[group[1].sectionModel.points.length - 2];
|
||||
const p2 = group[2].type === 'start' ? group[2].sectionModel.points[1] : group[2].sectionModel.points[group[2].sectionModel.points.length - 2];
|
||||
if (this.isLine(p0, p1, coreP)) {
|
||||
sectionC = group[2].sectionModel;
|
||||
skew = p2;
|
||||
const angle = this.getAngle(p0.x - coreP.x, p0.y - coreP.y, p2.x - coreP.x, p2.y - coreP.y);
|
||||
if (angle > 90 && angle < 270) {
|
||||
sectionA = group[0].sectionModel;
|
||||
sectionB = group[1].sectionModel;
|
||||
} else {
|
||||
sectionA = group[1].sectionModel;
|
||||
sectionB = group[0].sectionModel;
|
||||
}
|
||||
// 特殊处理 大铁线路(B端水平, A、C端在同一条直线)
|
||||
if (p2.y === coreP.y) {
|
||||
sectionC = sectionB;
|
||||
sectionB = group[2].sectionModel;
|
||||
skew = angle > 90 && angle < 270 ? p1 : p0;
|
||||
}
|
||||
} else if (this.isLine(p1, p2, coreP)) {
|
||||
sectionC = group[0].sectionModel;
|
||||
skew = p0;
|
||||
const angle = this.getAngle(p1.x - coreP.x, p1.y - coreP.y, p0.x - coreP.x, p0.y - coreP.y);
|
||||
if (angle > 90 && angle < 270) {
|
||||
sectionA = group[1].sectionModel;
|
||||
sectionB = group[2].sectionModel;
|
||||
} else {
|
||||
sectionA = group[2].sectionModel;
|
||||
sectionB = group[1].sectionModel;
|
||||
}
|
||||
// 特殊处理 大铁线路(B端水平, A、C端在同一条直线)
|
||||
if (p0.y === coreP.y) {
|
||||
sectionC = sectionB;
|
||||
sectionB = group[0].sectionModel;
|
||||
skew = angle > 90 && angle < 270 ? p2 : p1;
|
||||
}
|
||||
} else if (this.isLine(p0, p2, coreP)) {
|
||||
sectionC = group[1].sectionModel;
|
||||
skew = p1;
|
||||
const angel = this.getAngle(p2.x - coreP.x, p2.y - coreP.y, p1.x - coreP.x, p1.y - coreP.y);
|
||||
if (angel > 90 && angel < 270) {
|
||||
sectionA = group[2].sectionModel;
|
||||
sectionB = group[0].sectionModel;
|
||||
} else {
|
||||
sectionA = group[0].sectionModel;
|
||||
sectionB = group[2].sectionModel;
|
||||
}
|
||||
// 特殊处理 大铁线路(B端水平, A、C端在同一条直线)
|
||||
if (p1.y === coreP.y) {
|
||||
sectionC = sectionB;
|
||||
sectionB = group[1].sectionModel;
|
||||
skew = angel > 90 && angel < 270 ? p0 : p2;
|
||||
}
|
||||
}
|
||||
if (sectionA && sectionB && sectionC) {
|
||||
changeSectionList.push(sectionA);
|
||||
changeSectionList.push(sectionB);
|
||||
changeSectionList.push(sectionC);
|
||||
const uname = 'W' + sectionA.name.replace('T', '');
|
||||
const switchModel = getModel('Switch');
|
||||
const data = {
|
||||
code: getUID('W', [...this.switchList, ...createArr]),
|
||||
name: uname,
|
||||
nameShow: true,
|
||||
timeoutShow: true,
|
||||
sectionACode: sectionA.code,
|
||||
sectionBCode: sectionB.code,
|
||||
sectionCCode: sectionC.code,
|
||||
turnTime: 3,
|
||||
intersection: {
|
||||
x: coreP.x,
|
||||
y: coreP.y
|
||||
},
|
||||
skew: {
|
||||
x: skew.x,
|
||||
y: skew.y
|
||||
},
|
||||
pos: 'N', // 默认状态定位
|
||||
// N-定位 R-反位 NO-无(失表) EX-挤叉
|
||||
throat: ''
|
||||
};
|
||||
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'), {
|
||||
confirmButtonText: this.$t('tip.confirm'),
|
||||
cancelButtonText: this.$t('tip.cancel'),
|
||||
type: 'warning'
|
||||
}).then((res) => {
|
||||
const modelsList = this.createSwitchSection(createArr, changeSectionList);
|
||||
modelsList.forEach(item => {
|
||||
createArr.push(item);
|
||||
});
|
||||
this.$emit('updateMapModel', createArr);
|
||||
}).catch(() => {
|
||||
this.$message( this.$t('tip.cancelGeneration'));
|
||||
});
|
||||
},
|
||||
// 修改区段属性
|
||||
// changeSectionAttr() {
|
||||
// const changeSectionList = []; // 改变的区段列表
|
||||
// this.sectionList.forEach(section => {
|
||||
// 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.type == '03') && section.code != elem.code) {
|
||||
// let twoSection, twoSectionEnd;
|
||||
// if (this.handleResetPoint(elem.points)) {
|
||||
// twoSection = elem.points[0];
|
||||
// twoSectionEnd = elem.points[elem.points.length - 1];
|
||||
// } else {
|
||||
// twoSection = elem.points[elem.points.length - 1];
|
||||
// twoSectionEnd = elem.points[0];
|
||||
// }
|
||||
// if (oneSection.x == twoSection.x && oneSection.y == twoSection.y) {
|
||||
// countA++;
|
||||
// if (countA === 2) {
|
||||
// // if (!this.checkAddListA(oneSection, section.code)) { // 右侧关系清空
|
||||
// const sectionModel = deepAssign({}, section);
|
||||
// sectionModel.rightSectionCode = '';
|
||||
// sectionModel.sepTypeRight = '00'; // 分隔符
|
||||
// sectionModel.type = '03';
|
||||
// const list = this.findSectionA(sectionModel.points[sectionModel.points.length - 1].x, sectionModel.points[sectionModel.points.length - 1].y, this.sectionList, sectionModel.code);
|
||||
// list.forEach(elem => {
|
||||
// const sectionModelElem = deepAssign({}, elem);
|
||||
// sectionModelElem.leftSectionCode = '';
|
||||
// sectionModelElem.sepTypeLeft = '00';
|
||||
// sectionModelElem.type = '03';
|
||||
// changeSectionList.push(sectionModelElem);
|
||||
// });
|
||||
// sectionModel['typeModel'] = 'start';
|
||||
// changeSectionList.push(sectionModel);
|
||||
// // }
|
||||
// }
|
||||
// } else if (oneSectionStar.x == twoSectionEnd.x && oneSectionStar.y == twoSectionEnd.y) {
|
||||
// countB++;
|
||||
// if (countB === 2) {
|
||||
// // if (!this.checkAddListB(oneSectionStar, section.code)) { // 左侧关系清空
|
||||
// const sectionModel = deepAssign({}, section);
|
||||
// sectionModel.leftSectionCode = '';
|
||||
// sectionModel.sepTypeLeft = '00';
|
||||
// sectionModel.type = '03';
|
||||
// const list = this.findSectionB(sectionModel.points[0].x, sectionModel.points[0].y, this.sectionList, sectionModel.code);
|
||||
// list.forEach(elem => {
|
||||
// const sectionModelElem = deepAssign({}, elem);
|
||||
// sectionModelElem.rightSectionCode = '';
|
||||
// sectionModelElem.sepTypeRight = '00'; // 分隔符
|
||||
// sectionModelElem.type = '03';
|
||||
// changeSectionList.push(sectionModelElem);
|
||||
// });
|
||||
// sectionModel['typeModel'] = 'end';
|
||||
// changeSectionList.push(sectionModel);
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// return changeSectionList;
|
||||
// },
|
||||
// checkAddListA(points, code) { // 判断是否添加list (暂时不用)
|
||||
// let flag = false;
|
||||
// this.sectionList.forEach(section => {
|
||||
|
@ -207,7 +207,7 @@ export default {
|
||||
getDeviceDetail(row.id).then(res=>{
|
||||
if (res.data) {
|
||||
let url = '';
|
||||
url = `${window.location.protocol}//${window.location.host}/cbtc/login?project=${row.project.toLowerCase().replace(/_/, '')}&projectDevice=${row.code}&type=${row.type}`;
|
||||
url = `${window.location.protocol}//${window.location.host}/cbtc/login?project=${row.project.toLowerCase().replaceAll('_', '')}&projectDevice=${row.code}&type=${row.type}`;
|
||||
this.url = url;
|
||||
this.$messageBox();
|
||||
this.$confirm(`登录路径:${url}`, '登录路径', {
|
||||
|
Loading…
Reference in New Issue
Block a user