修改道岔生成逻辑
This commit is contained in:
parent
103e8c9c49
commit
5793355e20
@ -3,10 +3,10 @@ export function getBaseUrl() {
|
|||||||
let BASE_API;
|
let BASE_API;
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// BASE_API = 'https://joylink.club/jlcloud';
|
// 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.3.5:9000'; // 袁琪
|
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||||
BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||||
} else {
|
} else {
|
||||||
BASE_API = process.env.VUE_APP_BASE_API;
|
BASE_API = process.env.VUE_APP_BASE_API;
|
||||||
|
@ -169,8 +169,10 @@ export default {
|
|||||||
this.linkList.forEach(link => {
|
this.linkList.forEach(link => {
|
||||||
if (link && link.leftFdCode && link.leftSdCode) { // 左侧同时都有关联link
|
if (link && link.leftFdCode && link.leftSdCode) { // 左侧同时都有关联link
|
||||||
linkObj[`${link.code}`] = { name: '', num: 0 };
|
linkObj[`${link.code}`] = { name: '', num: 0 };
|
||||||
|
linkObj[`${link.leftSdCode}`] = { name: '', num: 0 };
|
||||||
} else if (link && link.rightFdCode && link.rightSdCode) { // 右侧同时都有关联link
|
} else if (link && link.rightFdCode && link.rightSdCode) { // 右侧同时都有关联link
|
||||||
linkObj[`${link.code}`] = { name: '', num: 0 };
|
linkObj[`${link.code}`] = { name: '', num: 0 };
|
||||||
|
linkObj[`${link.rightSdCode}`] = { name: '', num: 0 };
|
||||||
} else if (link && link.leftFdCode && !link.leftSdCode && link.rightFdCode && !link.rightSdCode) { // 左右正向link关联,侧向link不关联检测
|
} else if (link && link.leftFdCode && !link.leftSdCode && link.rightFdCode && !link.rightSdCode) { // 左右正向link关联,侧向link不关联检测
|
||||||
linkObj[`${link.code}`] = { name: '', num: 0 };
|
linkObj[`${link.code}`] = { name: '', num: 0 };
|
||||||
}
|
}
|
||||||
@ -277,8 +279,9 @@ export default {
|
|||||||
createArr.push(item);
|
createArr.push(item);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
console.log(linkObj, item, sectionC, linkObj[sectionC.linkCode]);
|
||||||
this.questionList.push(`${this.$t('map.section')}${linkObj[sectionA.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
|
this.questionList.push(`${this.$t('map.section')}${linkObj[sectionA.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
|
||||||
this.questionList.push(`${this.$t('map.section')}${linkObj[sectionC.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
|
// this.questionList.push(`${this.$t('map.section')}${linkObj[sectionC.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
|
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
|
||||||
|
@ -382,7 +382,7 @@ export default {
|
|||||||
{ prop: 'namePosition.x', firstLevel: 'namePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
{ prop: 'namePosition.x', firstLevel: 'namePosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '25px' },
|
||||||
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
|
||||||
] },
|
] },
|
||||||
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList, disabled: true },
|
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList },
|
||||||
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
|
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
|
||||||
|
|
||||||
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isSwitchSectionShow }, // 1
|
{ prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isSwitchSectionShow }, // 1
|
||||||
|
@ -162,135 +162,94 @@ export default {
|
|||||||
this.editModel = deepAssign(this.editModel, selected);
|
this.editModel = deepAssign(this.editModel, selected);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
findSectionA(pointX, pointY) {
|
||||||
|
const list = [];
|
||||||
|
this.sectionList.forEach(item => {
|
||||||
|
if (item.point[0].x == pointX && item.point[0].y == pointY) {
|
||||||
|
list.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
},
|
||||||
|
findSectionB(pointX, pointY) {
|
||||||
|
const list = [];
|
||||||
|
this.sectionList.forEach(item => {
|
||||||
|
if (item.point[item.point.length - 1].x == pointX && item.point[item.point.length - 1].y == pointY) {
|
||||||
|
list.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
},
|
||||||
create() { // 一键生成道岔
|
create() { // 一键生成道岔
|
||||||
this.questionList = []; // 有问题区段列表
|
// this.questionList = []; // 有问题区段列表
|
||||||
const models = [];
|
// const models = [];
|
||||||
const linkObj = {};
|
const createArr = []; // 创建model列表
|
||||||
this.linkList.forEach(link => {
|
|
||||||
if (link && link.leftFdCode && link.leftSdCode) { // 左侧同时都有关联link
|
|
||||||
linkObj[`${link.code}`] = { name: '', num: 0 };
|
|
||||||
} else if (link && link.rightFdCode && link.rightSdCode) { // 右侧同时都有关联link
|
|
||||||
linkObj[`${link.code}`] = { name: '', num: 0 };
|
|
||||||
} else if (link && link.leftFdCode && !link.leftSdCode && link.rightFdCode && !link.rightSdCode) { // 左右正向link关联,侧向link不关联检测
|
|
||||||
linkObj[`${link.code}`] = { name: '', num: 0 };
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.sectionList.forEach(section => {
|
this.sectionList.forEach(section => {
|
||||||
for (const link in linkObj) {
|
if (!section.rightSectionCode && section.type == '03') { // 右侧关联关系为空 且 道岔区段
|
||||||
if (section.linkCode == link) {
|
const list = this.findSectionA(section.point[section.point.length - 1].x, section.point[section.point.length - 1].y);
|
||||||
linkObj[link].num++;
|
let sectionB = {};
|
||||||
linkObj[link].name = section.name;
|
let sectionC = {};
|
||||||
}
|
list.forEach(item => {
|
||||||
}
|
if (item.point[1].y == section.point[section.point.length - 1].y) { // 是否水平拿第二个点判断
|
||||||
const uname = 'switch_' + section.name.replace('section_', '');
|
sectionB = item;
|
||||||
const link = this.findLinkData(section.linkCode);
|
|
||||||
if (link && link.leftFdCode && link.leftSdCode) {
|
|
||||||
const node = this.findLinkData(link.leftSdCode); // 寻找 侧段link
|
|
||||||
if (node) {
|
|
||||||
const lFdSection = this.findSectionDataByLinkCodeAndPoint(link.leftFdCode, section.points[0]);
|
|
||||||
const lSdSection = this.findSectionDataByLinkCodeAndPoint(link.leftSdCode, section.points[0]);
|
|
||||||
|
|
||||||
if (lFdSection && lSdSection) {
|
|
||||||
const model = {
|
|
||||||
_type: 'Switch',
|
|
||||||
code: getUID('Switch'),
|
|
||||||
name: uname,
|
|
||||||
nameShow: true,
|
|
||||||
timeoutShow: true,
|
|
||||||
sectionACode: section.code,
|
|
||||||
sectionBCode: lFdSection.code,
|
|
||||||
sectionCCode: lSdSection.code,
|
|
||||||
namePosition: { x: 0, y: 0 },
|
|
||||||
turnTime: 3,
|
|
||||||
tp: { x: 0, y: 0 },
|
|
||||||
lp: {
|
|
||||||
x: lFdSection.points[lFdSection.points.length - 1].x,
|
|
||||||
y: lFdSection.points[lFdSection.points.length - 1].y
|
|
||||||
},
|
|
||||||
rp: {
|
|
||||||
x: lSdSection.points[lSdSection.points.length - 2].x,
|
|
||||||
y: lSdSection.points[lSdSection.points.length - 2].y
|
|
||||||
},
|
|
||||||
intersection: {
|
|
||||||
x: section.points[0].x,
|
|
||||||
y: section.points[0].y
|
|
||||||
},
|
|
||||||
skew: {
|
|
||||||
x: lSdSection.points[lSdSection.points.length - 2].x,
|
|
||||||
y: lSdSection.points[lSdSection.points.length - 2].y
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
|
|
||||||
!swch && models.push(model); // 已有的道岔不在创建
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (link && link.rightFdCode && link.rightSdCode) {
|
|
||||||
const node = this.findLinkData(link.rightSdCode);
|
|
||||||
if (node) {
|
|
||||||
const rFdSection = this.findSectionDataByLinkCodeAndPoint(link.rightFdCode, section.points[section.points.length - 1]);
|
|
||||||
const rSdSection = this.findSectionDataByLinkCodeAndPoint(link.rightSdCode, section.points[section.points.length - 1]);
|
|
||||||
if (rFdSection && rSdSection) {
|
|
||||||
const model = {
|
|
||||||
_type: 'Switch',
|
|
||||||
code: getUID('Switch'),
|
|
||||||
name: uname,
|
|
||||||
nameShow: true,
|
|
||||||
timeoutShow: true,
|
|
||||||
sectionACode: section.code,
|
|
||||||
sectionBCode: rFdSection.code,
|
|
||||||
sectionCCode: rSdSection.code,
|
|
||||||
namePosition: { x: 0, y: 0 },
|
|
||||||
turnTime: 3,
|
|
||||||
tp: { x: 0, y: 0 },
|
|
||||||
lp: {
|
|
||||||
x: rFdSection.points[0].x,
|
|
||||||
y: rFdSection.points[0].y
|
|
||||||
},
|
|
||||||
rp: {
|
|
||||||
x: rSdSection.points[1].x,
|
|
||||||
y: rSdSection.points[1].y
|
|
||||||
},
|
|
||||||
intersection: {
|
|
||||||
x: section.points[section.points.length - 1].x,
|
|
||||||
y: section.points[section.points.length - 1].y
|
|
||||||
},
|
|
||||||
skew: {
|
|
||||||
x: rSdSection.points[1].x,
|
|
||||||
y: rSdSection.points[1].y
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
|
|
||||||
!swch && models.push(model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const createArr = [];
|
|
||||||
models.forEach((item) => {
|
|
||||||
const sectionA = this.$store.getters['map/getDeviceByCode'](item.sectionACode);
|
|
||||||
// const sectionB = this.$store.getters['map/getDeviceByCode'](item.sectionBCode);
|
|
||||||
const sectionC = this.$store.getters['map/getDeviceByCode'](item.sectionCCode);
|
|
||||||
if (linkObj[sectionA.linkCode] && linkObj[sectionC.linkCode]) {
|
|
||||||
if (linkObj[sectionA.linkCode].num > 1 && linkObj[sectionC.linkCode].num > 1 ) {
|
|
||||||
createArr.push(item);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.questionList.push(`${this.$t('map.section')}${linkObj[sectionA.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
|
sectionC = item;
|
||||||
this.questionList.push(`${this.$t('map.section')}${linkObj[sectionC.linkCode].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const uname = 'switch_' + section.name.replace('section_', '');
|
||||||
|
const model = {
|
||||||
|
_type: 'Switch',
|
||||||
|
code: getUID('Switch'),
|
||||||
|
name: uname,
|
||||||
|
nameShow: true,
|
||||||
|
timeoutShow: true,
|
||||||
|
sectionACode: section.code,
|
||||||
|
sectionBCode: sectionB.code,
|
||||||
|
sectionCCode: sectionC.code,
|
||||||
|
namePosition: { x: 0, y: 0 },
|
||||||
|
turnTime: 3,
|
||||||
|
tp: { x: 0, y: 0 }
|
||||||
|
};
|
||||||
|
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
|
||||||
|
!swch && createArr.push(model); // 已有的道岔不在创建
|
||||||
|
}
|
||||||
|
if (!section.leftSectionCode && section.type == '03') { // 左侧关联关系为空 且 道岔区段
|
||||||
|
const list = this.findSectionB(section.point[0].x, section.point[0].y);
|
||||||
|
let sectionB = {};
|
||||||
|
let sectionC = {};
|
||||||
|
list.forEach(item => {
|
||||||
|
if (item.point[item.point.length - 2].y == section.point[0].y) { // 是否水平拿倒数第二个点判断
|
||||||
|
sectionB = item;
|
||||||
|
} else {
|
||||||
|
sectionC = item;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const uname = 'switch_' + section.name.replace('section_', '');
|
||||||
|
const model = {
|
||||||
|
_type: 'Switch',
|
||||||
|
code: getUID('Switch'),
|
||||||
|
name: uname,
|
||||||
|
nameShow: true,
|
||||||
|
timeoutShow: true,
|
||||||
|
sectionACode: section.code,
|
||||||
|
sectionBCode: sectionB.code,
|
||||||
|
sectionCCode: sectionC.code,
|
||||||
|
namePosition: { x: 0, y: 0 },
|
||||||
|
turnTime: 3,
|
||||||
|
tp: { x: 0, y: 0 }
|
||||||
|
};
|
||||||
|
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
|
||||||
|
!swch && createArr.push(model); // 已有的道岔不在创建
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(createArr, '生成的道岔');
|
||||||
|
|
||||||
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
|
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
|
||||||
confirmButtonText: this.$t('tip.confirm'),
|
confirmButtonText: this.$t('tip.confirm'),
|
||||||
cancelButtonText: this.$t('tip.cancel'),
|
cancelButtonText: this.$t('tip.cancel'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
for (const link in linkObj) {
|
|
||||||
if (linkObj[link].num == 1) {
|
|
||||||
this.questionList.push(`${this.$t('map.section')}${linkObj[link].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const models = this.createSwitchSection(createArr);
|
const models = this.createSwitchSection(createArr);
|
||||||
models.forEach(item => {
|
models.forEach(item => {
|
||||||
createArr.push(item);
|
createArr.push(item);
|
||||||
@ -309,6 +268,8 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
const data = Object.assign({_type: 'Switch'}, this.editModel);
|
const data = Object.assign({_type: 'Switch'}, this.editModel);
|
||||||
this.$emit('updateMapModel', data);
|
this.$emit('updateMapModel', data);
|
||||||
|
} else {
|
||||||
|
this.$message('还有属性未填写,修改未生效!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -333,31 +294,20 @@ export default {
|
|||||||
handleDelete(selected) {
|
handleDelete(selected) {
|
||||||
const models = [];
|
const models = [];
|
||||||
this.sectionList.forEach(elem => {
|
this.sectionList.forEach(elem => {
|
||||||
if (elem.type == '03' && elem.relSwitchCode == selected.code) {
|
if (elem.type == '04' && elem.relSwitchCode == selected.code) { // 删除道岔计轴区段
|
||||||
models.push(deepAssign({ _type: 'Section', code: elem.code }, { _dispose: true }));
|
models.push(deepAssign({ _type: 'Section', code: elem.code }, { _dispose: true }));
|
||||||
}
|
}
|
||||||
if (elem.relSwitchCode == selected.code && elem.type != '03') {
|
if (elem.relSwitchCode == selected.code && elem.type == '03') { // 删除道岔区段关联关系
|
||||||
elem.relSwitchCode = '';
|
const section = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.code));
|
||||||
elem.isSwitchSection = false;
|
section.relSwitchCode = '';
|
||||||
models.push(elem);
|
section.parentCode = '';
|
||||||
|
section.isSwitchSection = false;
|
||||||
|
models.push(section);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
models.push(deepAssign(selected, { _dispose: true }));
|
models.push(deepAssign(selected, { _dispose: true }));
|
||||||
this.$emit('updateMapModel', models);
|
this.$emit('updateMapModel', models);
|
||||||
},
|
},
|
||||||
findLinkData(code) {
|
|
||||||
var rtn = null;
|
|
||||||
var linkList = this.linkList;
|
|
||||||
if (linkList && linkList.length) {
|
|
||||||
for (var i = 0; i < linkList.length; ++i) {
|
|
||||||
if (code === linkList[i].code) {
|
|
||||||
rtn = linkList[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
},
|
|
||||||
findSectionDataByLinkCodeAndPoint(code, point) {
|
findSectionDataByLinkCodeAndPoint(code, point) {
|
||||||
var rtn = null;
|
var rtn = null;
|
||||||
var sectionList = this.sectionList;
|
var sectionList = this.sectionList;
|
||||||
@ -389,34 +339,48 @@ export default {
|
|||||||
}
|
}
|
||||||
return rtn;
|
return rtn;
|
||||||
},
|
},
|
||||||
// 一键删除道岔区段
|
// 一键生成道岔计轴区段
|
||||||
removeSwitchSection() {
|
|
||||||
const models = [];
|
|
||||||
if (this.sectionList && this.sectionList.length) {
|
|
||||||
this.sectionList.forEach(elem => {
|
|
||||||
// 删除 道岔区段/ 恢复道岔绑定关系
|
|
||||||
if (elem.type === '03' && !elem.parentCode) {
|
|
||||||
models.push(deepAssign({ _type: 'Section', code: elem.code }, { _dispose: true }));
|
|
||||||
}
|
|
||||||
if (elem.relSwitchCode) {
|
|
||||||
elem.relSwitchCode = '';
|
|
||||||
elem.isSwitchSection = false;
|
|
||||||
models.push(elem);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.$emit('updateMapModel', models);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 一键生成道岔区段
|
|
||||||
createSwitchSection(list) {
|
createSwitchSection(list) {
|
||||||
const models = [];
|
const models = [];
|
||||||
if (list && list.length && this.sectionList && this.sectionList.length) {
|
if (list && list.length && this.sectionList && this.sectionList.length) {
|
||||||
|
const sectionList = [];
|
||||||
list.forEach(elem => {
|
list.forEach(elem => {
|
||||||
|
const sectionb = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionBCode));
|
||||||
|
const sectiona = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionACode));
|
||||||
|
const sectionc = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionCCode));
|
||||||
|
if (sectiona && sectionb && sectionc) {
|
||||||
|
const uid = getUID('Section');
|
||||||
|
elem['uid'] = uid;
|
||||||
|
list.forEach(ele => {
|
||||||
|
const sectiona1 = deepAssign({}, this.$store.getters['map/getDeviceByCode'](ele.sectionACode));
|
||||||
|
const sectionb1 = deepAssign({}, this.$store.getters['map/getDeviceByCode'](ele.sectionBCode));
|
||||||
|
if (sectionb.points[0] == sectionb1.points[sectionb1.points.length - 1]) {
|
||||||
|
sectionList.push(elem);
|
||||||
|
}
|
||||||
|
if (sectiona1.points[0] == sectiona.points[sectiona.points.length - 1]) {
|
||||||
|
sectionList.push(elem);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sectiona.parentCode = uid;
|
||||||
|
sectionb.parentCode = uid;
|
||||||
|
sectionc.parentCode = uid;
|
||||||
|
sectiona.relSwitchCode = elem.code;
|
||||||
|
sectionb.relSwitchCode = elem.code;
|
||||||
|
sectionc.relSwitchCode = elem.code;
|
||||||
|
sectiona.isSwitchSection = true;
|
||||||
|
sectionb.isSwitchSection = true;
|
||||||
|
sectionc.isSwitchSection = true;
|
||||||
|
models.push(sectiona);
|
||||||
|
models.push(sectionb);
|
||||||
|
models.push(sectionc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(sectionList, '生成道岔计轴区段');
|
||||||
|
sectionList.forEach(elem => {
|
||||||
const sectiona = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionACode));
|
const sectiona = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionACode));
|
||||||
const sectionb = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionBCode));
|
const sectionb = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionBCode));
|
||||||
const sectionc = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionCCode));
|
const sectionc = deepAssign({}, this.$store.getters['map/getDeviceByCode'](elem.sectionCCode));
|
||||||
if (sectiona && sectionb && sectionc) {
|
if (sectiona && sectionb && sectionc) {
|
||||||
const uid = getUID('Section');
|
|
||||||
let point = {
|
let point = {
|
||||||
x: sectiona.points[sectiona.points.length - 1].x,
|
x: sectiona.points[sectiona.points.length - 1].x,
|
||||||
y: sectiona.points[sectiona.points.length - 1].y
|
y: sectiona.points[sectiona.points.length - 1].y
|
||||||
@ -426,9 +390,9 @@ export default {
|
|||||||
}
|
}
|
||||||
models.push({
|
models.push({
|
||||||
_type: 'Section',
|
_type: 'Section',
|
||||||
code: uid,
|
code: elem.uid,
|
||||||
name: sectiona.name || sectionb.name || sectionc.name,
|
name: sectiona.name,
|
||||||
type: '03',
|
type: '04',
|
||||||
axleShow: false,
|
axleShow: false,
|
||||||
namePosition: point,
|
namePosition: point,
|
||||||
isStandTrack: false,
|
isStandTrack: false,
|
||||||
@ -457,21 +421,9 @@ export default {
|
|||||||
parentCode: '',
|
parentCode: '',
|
||||||
stationCode: sectiona.stationCode,
|
stationCode: sectiona.stationCode,
|
||||||
trainPosType: sectiona.trainPosType,
|
trainPosType: sectiona.trainPosType,
|
||||||
isCurve: false,
|
isCurve: false
|
||||||
linkCode: '0'
|
|
||||||
});
|
});
|
||||||
sectiona.parentCode = uid;
|
|
||||||
sectiona.relSwitchCode = elem.code;
|
|
||||||
sectiona.isSwitchSection = true;
|
|
||||||
sectionb.parentCode = uid;
|
|
||||||
sectionb.relSwitchCode = elem.code;
|
|
||||||
sectionb.isSwitchSection = true;
|
|
||||||
sectionc.parentCode = uid;
|
|
||||||
sectionc.relSwitchCode = elem.code;
|
|
||||||
sectionc.isSwitchSection = true;
|
|
||||||
models.push(sectiona);
|
|
||||||
models.push(sectionb);
|
|
||||||
models.push(sectionc);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user