调整区段计算
This commit is contained in:
parent
48ca2388cb
commit
057b627c0d
@ -144,6 +144,7 @@ export function deepClone(item) {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 对象深拷贝并赋值
|
||||||
export function deepAssign(obj, item) {
|
export function deepAssign(obj, item) {
|
||||||
const target = item.constructor === Array ? [] : {}; // 判断复制的目标是数组还是对象
|
const target = item.constructor === Array ? [] : {}; // 判断复制的目标是数组还是对象
|
||||||
for (const keys in item) {
|
for (const keys in item) {
|
||||||
|
@ -234,9 +234,6 @@ export default {
|
|||||||
rightStopPointOffset: [
|
rightStopPointOffset: [
|
||||||
{ required: true, message: this.$t('rules.rightStopPointOffset'), trigger: 'blur' }
|
{ required: true, message: this.$t('rules.rightStopPointOffset'), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
// destinationCode: [
|
|
||||||
// { required: true, message: this.$t('rules.destinationCode'), trigger: 'blur' }
|
|
||||||
// ],
|
|
||||||
'destinationCodePoint.x': [
|
'destinationCodePoint.x': [
|
||||||
{ required: true, message: this.$t('rules.destinationCodePointX'), trigger: 'blur' }
|
{ required: true, message: this.$t('rules.destinationCodePointX'), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
@ -403,7 +400,7 @@ export default {
|
|||||||
this.editModel = deepAssign(this.editModel, selected);
|
this.editModel = deepAssign(this.editModel, selected);
|
||||||
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
|
this.editModel.logicSectionNum = selected.type === '01' ? selected.logicSectionNum : [0];
|
||||||
this.editModel.points = JSON.parse(JSON.stringify(selected.points));
|
this.editModel.points = JSON.parse(JSON.stringify(selected.points));
|
||||||
this.editModel.lengthFact = selected.lengthFact || 0;
|
this.editModel.lengthFact = selected.lengthFact || 0; // 过滤非正常数值
|
||||||
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
|
this.oldPoint = JSON.parse(JSON.stringify(selected.points));
|
||||||
this.oldLeftSectionCode = selected.leftSectionCode;
|
this.oldLeftSectionCode = selected.leftSectionCode;
|
||||||
this.oldRightSectionCode = selected.rightSectionCode;
|
this.oldRightSectionCode = selected.rightSectionCode;
|
||||||
@ -488,7 +485,7 @@ export default {
|
|||||||
if (section.parentCode === model.code) {
|
if (section.parentCode === model.code) {
|
||||||
const copySection = deepAssign({}, section);
|
const copySection = deepAssign({}, section);
|
||||||
copySection.logicSectionShow = model.logicSectionShow;
|
copySection.logicSectionShow = model.logicSectionShow;
|
||||||
// copySection.lengthFact = (Number(model.lengthFact) / model.logicSectionCodeList.length).toFixed(3);
|
// copySection.lengthFact = (Number(model.lengthFact) / model.logicSectionCodeList.length).toFixed(3); // 容易变成正无穷 或者 NaN
|
||||||
copySection.stationCode = model.stationCode; // 给元素 子逻辑区段设置 设备集中站
|
copySection.stationCode = model.stationCode; // 给元素 子逻辑区段设置 设备集中站
|
||||||
models.push(copySection);
|
models.push(copySection);
|
||||||
} else if (model.code !== section.code && (section.type === '01' || section.type === '03')) {
|
} else if (model.code !== section.code && (section.type === '01' || section.type === '03')) {
|
||||||
|
@ -81,7 +81,10 @@ export default {
|
|||||||
this.tableData.forEach((ele, index) => {
|
this.tableData.forEach((ele, index) => {
|
||||||
totalNum += Number(ele.num);
|
totalNum += Number(ele.num);
|
||||||
});
|
});
|
||||||
const lineLength = lengthFact / totalNum; // 均分逻辑区段偏移量
|
let lineLength = 0; // 默认实际长度为0
|
||||||
|
if (totalNum) {
|
||||||
|
lineLength = lengthFact / totalNum; // 均分逻辑区段偏移量
|
||||||
|
}
|
||||||
this.tableData.forEach((ele, index) => {
|
this.tableData.forEach((ele, index) => {
|
||||||
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength, totalNum)];
|
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength, totalNum)];
|
||||||
allNotZeros = Number(ele.num) && allNotZeros;
|
allNotZeros = Number(ele.num) && allNotZeros;
|
||||||
@ -173,7 +176,7 @@ export default {
|
|||||||
trainPosType: model.trainPosType,
|
trainPosType: model.trainPosType,
|
||||||
points: points,
|
points: points,
|
||||||
curve: false,
|
curve: false,
|
||||||
lengthFact: lineLength.toFixed(3),
|
lengthFact: lineLength ? lineLength.toFixed(3) : lineLength,
|
||||||
trainWindowCode: '',
|
trainWindowCode: '',
|
||||||
kmRangeRight: model.kmRangeRight,
|
kmRangeRight: model.kmRangeRight,
|
||||||
kmRangeLeft: model.kmRangeLeft,
|
kmRangeLeft: model.kmRangeLeft,
|
||||||
|
Loading…
Reference in New Issue
Block a user