调整车站显示坐标,信号机批量操作,调整逻辑代码

This commit is contained in:
zyy 2019-12-18 16:20:30 +08:00
parent 38c2bc4c55
commit c295f97819
8 changed files with 65 additions and 51 deletions

View File

@ -370,6 +370,8 @@ class SkinCode extends defaultStyle {
};
this[deviceType.ZcControl] = {
// 是否显示
visible:true,
text: {
fontSize: 11, // 字体大小
fontWeight: 'normal', // 字体粗细

View File

@ -10,7 +10,7 @@ export default class EMouse extends Group {
}
create() {
if (this.device && this.device.model.visible) {
const stationTextRect = this.device.stationText.getBoundingRect();
const stationTextRect = this.device.stationText.getBoundingRect().clone();
// const path = window.location.href;
// if (this.device.style.Station.kmPostShow || path.includes('/map/draw')) {
// const mileageTextRect = this.device.mileageText.getBoundingRect();

View File

@ -259,14 +259,14 @@ export default class Station extends Group {
getBoundingRect() {
if (this.model.visible) {
const rect = this.stationText.getBoundingRect();
// if (this.model.subheadDisplay) {
// const subheadText = this.subheadText.getBoundingRect();
// rect.union(subheadText);
// return rect;
// } else {
const rect = this.stationText.getBoundingRect().clone();
if (this.model.subheadDisplay) {
const subheadText = this.subheadText.getBoundingRect();
rect.union(subheadText);
return rect;
// }
} else {
return rect;
}
} else {
return new BoundingRect(0, 0, 0, 0);
}

View File

@ -3,11 +3,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.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6: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 {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -216,29 +216,23 @@ export default {
initCancelMenu() {
this.menuNormal = [];
this.stationList.forEach(station => {
if (station.code === station.concentrateStationCode) {
if (station.centralized) {
const node = {
label: station.name,
children: []
children: [{
code: station.code,
label: station.name,
handler: this.mapLocation
}]
};
this.stationList.forEach(elem => {
if (elem.visible) {
let next = elem;
while (next.code != next.concentrateStationCode || !next.concentrateStationCode) {
next = this.$store.getters['map/getDeviceByCode'](next.concentrateStationCode);
}
if (station.code == next.code) {
station.chargeStationCodeList.forEach(item => {
const stationModel = this.$store.getters['map/getDeviceByCode'](item);
node.children.push({
code: elem.code,
label: elem.name,
code: stationModel.code,
label: stationModel.name,
handler: this.mapLocation
});
}
}
});
this.menuNormal.push(node);
}
});

View File

@ -118,6 +118,7 @@ export default {
{ x: beg.x + triangle.getCos(offset * (i + 1)), y: beg.y + triangle.getSin(offset * (i + 1)) }
];
const param = this.addLogicalSection(model, points, counts + i, offset, i, lineLength);
param.lengthFact = Number(model.lengthFact) / num;
models.push(param);
this.addList.push(param);
}

View File

@ -17,11 +17,16 @@
<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-item label="左右偏移值" prop="number">
<el-input v-model="addModel.number" style="width: 178px;" />
</el-form-item>
</el-form>
<div class="flex_box">
<el-button type="primary" style="margin-right: 10px;" @click="editAll">构建信号机偏移量</el-button>
<el-button type="" style="margin: 0;" @click="questionList = []">{{ $t('map.clearHint') }}</el-button>
</div>
<div style="height: calc(100% - 46px);">
<div style="height: calc(100% - 90px);">
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-card v-if="questionList.length" class="box-card">
<div v-for="(item, index) in questionList" :key="index" class="text item">{{ item }}</div>
@ -91,6 +96,14 @@ export default {
position: { x: 0, y: 0 },
buttonPosition: { x: 0, y: 0 },
guidePosition: { x: 0, y: 0 }
},
addModel: {
number: 2
},
addRules: {
number: [
{ required: true, message: '请输入左右偏移量', trigger: 'blur', min: 0 }
]
}
};
},
@ -295,26 +308,30 @@ export default {
},
//
editAll() {
this.$refs['mark'].validate((valid) => {
if (valid) {
const models = [];
this.questionList = [];
this.signalList.forEach(item => {
const signalModel = deepAssign({}, item);
const section = this.findSection(signalModel);
if (section.code && item.sectionCode != section.code) {
item.sectionCode = section.code;
signalModel.sectionCode = section.code;
}
if (!section.code) {
this.questionList.push(`${item.name} 信号机位置可能不正确,请手动调试归属区段及偏移量.`);
}
signalModel.sectionOffset = 2;
signalModel.sectionOffset = this.addModel.number;
if (signalModel.right) {
if (section.lengthFact) {
signalModel.sectionOffset = Math.abs(Number(section.lengthFact) - 2);
signalModel.sectionOffset = Math.abs(Number(section.lengthFact) - this.addModel.number);
}
}
models.push(signalModel);
});
this.$emit('updateMapModel', models);
}
});
},
//
findSection(signal) {

View File

@ -551,8 +551,8 @@ export default {
sectiona.switchSection = true;
sectionb.switchSection = true;
sectionc.switchSection = true;
sectionb.sepTypeLeft = '00';
sectionb.sepTypeRight = '00';
// sectionb.sepTypeLeft = '00';
// sectionb.sepTypeRight = '00';
models.push(sectiona);
models.push(sectionb);
models.push(sectionc);