修改信号机构建关系逻辑,修改创建逻辑区段偏移量数据逻辑
This commit is contained in:
parent
72c4bd0bd0
commit
c1f41b4299
@ -94,7 +94,7 @@ export default {
|
||||
const list = [];
|
||||
if (val && val.length) {
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
list.push({ label: val[i].uniqueName, value: val[i].code });
|
||||
list.push({ label: val[i].name + '(' + val[i].code + ')', value: val[i].code });
|
||||
}
|
||||
this.queryForm.queryObject.signalCode.config.data = list;
|
||||
}
|
||||
@ -137,9 +137,10 @@ export default {
|
||||
const list = data.list;
|
||||
if (list) {
|
||||
list.map(elem => {
|
||||
that.$convertSpecifiedField(elem, that.mapList, 'id', 'name', ['mapId']);
|
||||
elem.code = elem.signalCode;
|
||||
elem.signalCode = that.formatName(elem.signalCode);
|
||||
that.$convertSpecifiedField(elem, that.mapList, 'id', 'name', ['mapId']);
|
||||
that.$convertSpecifiedField(elem, this.signalList, 'code', 'name', ['signalCode']);
|
||||
elem.signalCode = `${elem.signalCode}(${elem.code})`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ export default {
|
||||
});
|
||||
const lineLength = lengthFact / totalNum; // 均分逻辑区段偏移量
|
||||
this.tableData.forEach((ele, index) => {
|
||||
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength)];
|
||||
models = [...models, ...this.createLogicalSections(Number(ele.num), sectionPoints[index], sectionPoints[index + 1], this.editModel, counts, lineLength, totalNum)];
|
||||
allNotZeros = Number(ele.num) && allNotZeros;
|
||||
count += Number(ele.num);
|
||||
logicSectionNumList.push(Number(ele.num));
|
||||
@ -116,7 +116,7 @@ export default {
|
||||
row.num = 0;
|
||||
},
|
||||
// 创建逻辑区段
|
||||
createLogicalSections(num, beg, end, model, counts, lineLength) {
|
||||
createLogicalSections(num, beg, end, model, counts, lineLength, totalNum) {
|
||||
const models = [];
|
||||
const triangle = new JTriangle(beg, end);
|
||||
const offset = Math.sqrt(triangle.abspowz) / num;
|
||||
@ -125,15 +125,14 @@ export default {
|
||||
{ x: beg.x + triangle.getCos(offset * i), y: beg.y + triangle.getSin(offset * i) },
|
||||
{ x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) }
|
||||
];
|
||||
const param = this.addLogicalSection(model, points, counts + i, lineLength);
|
||||
param.lengthFact = Number(model.lengthFact) / num;
|
||||
const param = this.addLogicalSection(model, points, counts + i, lineLength, totalNum);
|
||||
models.push(param);
|
||||
this.addList.push(param);
|
||||
}
|
||||
return models;
|
||||
},
|
||||
// 逻辑区段模型
|
||||
addLogicalSection(model, points, index, lineLength) {
|
||||
addLogicalSection(model, points, index, lineLength, totalNum) {
|
||||
const data = {
|
||||
_type: 'Section',
|
||||
code: getUID('T', [...this.sectionList, ...this.addList]),
|
||||
@ -181,7 +180,7 @@ export default {
|
||||
kmRangeLeft: model.kmRangeLeft,
|
||||
region: model.region,
|
||||
logicSectionStartOffset: Math.floor(lineLength * index),
|
||||
logicSectionEndOffset: Math.floor(lineLength * (index + 1)),
|
||||
logicSectionEndOffset: index + 1 != totalNum ? Math.floor(lineLength * (index + 1)) : model.lengthFact,
|
||||
relevanceSectionList: []
|
||||
};
|
||||
if (this.isDelimiter) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
<create-signal ref="createSignal" :field="field" @signalSectionCode="signalSectionCode" @updateMapModel="updateMapModel" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="view-control" label="批量操作" name="three">
|
||||
<el-form ref="mark" label-width="130px" :model="addModel" size="mini" :rules="addRules">
|
||||
<el-form ref="mark" label-width="130px" :model="addModel" size="mini">
|
||||
<el-form-item label="左右偏移值" prop="number">
|
||||
<el-input v-model="addModel.number" style="width: 178px;" />
|
||||
</el-form-item>
|
||||
@ -99,11 +99,6 @@ export default {
|
||||
},
|
||||
addModel: {
|
||||
number: 2
|
||||
},
|
||||
addRules: {
|
||||
number: [
|
||||
{ required: true, message: '请输入左右偏移量', trigger: 'blur', min: 0 }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
@ -308,8 +303,7 @@ export default {
|
||||
},
|
||||
// 构建信号机偏移量
|
||||
editAll() {
|
||||
this.$refs['mark'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.addModel.number != '') {
|
||||
const models = [];
|
||||
this.questionList = [];
|
||||
this.signalList.forEach(item => {
|
||||
@ -328,22 +322,28 @@ export default {
|
||||
}
|
||||
}
|
||||
models.push(signalModel);
|
||||
if (this.editModel.code == signalModel.code) {
|
||||
this.editModel.sectionCode = signalModel.sectionCode;
|
||||
}
|
||||
});
|
||||
this.$emit('updateMapModel', models);
|
||||
this.$message.success('数据构建成功!');
|
||||
this.deviceSelect();
|
||||
|
||||
} else {
|
||||
this.$message('请输入偏移量');
|
||||
}
|
||||
});
|
||||
},
|
||||
// 寻找信号机关联区段
|
||||
findSection(signal) {
|
||||
// 01 向左 02 向右
|
||||
let model = {};
|
||||
this.sectionList.forEach(section => {
|
||||
if (!signal.right && section.type != '02') {
|
||||
if (!signal.right && section.type != '02' && section.type != '04') {
|
||||
if (section.points[0].x == signal.position.x && Math.abs(section.points[0].y - signal.position.y) <= 20) {
|
||||
model = section;
|
||||
}
|
||||
} else if (signal.right && section.type != '02') {
|
||||
} else if (signal.right && section.type != '02' && section.type != '04') {
|
||||
if (section.points[section.points.length - 1].x == signal.position.x && Math.abs(section.points[section.points.length - 1].y - signal.position.y) <= 20) {
|
||||
model = section;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user