地图绘制 现地配置 增加 可切换显示的车站 字段

This commit is contained in:
joylink_cuiweidong 2021-07-29 11:08:36 +08:00
parent 11700cb81f
commit ab96efb1c6
4 changed files with 100 additions and 33 deletions

View File

@ -472,7 +472,7 @@ class SkinCode extends defaultStyle {
borderColor: '#FE0000', // 道岔边框颜色
lossColor: '#FFFFFF', // 道岔失去颜色
locateColor: '#00FF00', // 道岔定位颜色
inversionColor: '#9C9D09', // 道岔反位颜色
inversionColor: '#EDBD65', // 道岔反位颜色
monolockLocationColor: '#ea282c', // 道岔单锁'定位'颜色
monolockInversionColor: '#ea282c', // 道岔单锁'反位'颜色
block: true, // 封锁名称

View File

@ -74,7 +74,8 @@ export default {
val && this.$store.dispatch('config/updateMenuBar');
},
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel) && this.$store.state.training.prdType == '02') {
// && this.$store.state.training.prdType == '02'
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)) {
this.popDoShow(this.$store.state.menuOperation.menuPosition);
} else {
this.popDoClose();
@ -118,30 +119,69 @@ export default {
},
initMenu() {
this.menuNormal = [];
this.$store.state.map.map.stationList.forEach(station => {
if (station.relStationCodeList && station.relStationCodeList.length) {
const node = {
label: station.name,
children: []
};
const relStationCodeList = [...station.relStationCodeList];
relStationCodeList.push(station.code);
relStationCodeList.sort((a, b) => {
if (this.$store.state.training.prdType == '02') {
this.$store.state.map.map.stationList.forEach(station => {
if (station.relStationCodeList && station.relStationCodeList.length) {
const node = {
label: station.name,
children: []
};
const relStationCodeList = [...station.relStationCodeList];
relStationCodeList.push(station.code);
relStationCodeList.sort((a, b) => {
const stationA = this.$store.getters['map/getDeviceByCode'](a);
const stationB = this.$store.getters['map/getDeviceByCode'](b);
return stationA.kmRange - stationB.kmRange;
});
relStationCodeList.forEach(item => {
const next = this.$store.getters['map/getDeviceByCode'](item);
node.children.push({
code: next.code,
label: next.name,
handler: this.mapLocation
});
});
this.menuNormal.push(node);
}
});
} else if (this.$store.state.training.prdType == '01') {
const roleDeviceCode = this.$store.state.training.roleDeviceCode;
const displayList = this.$store.state.map.map.displayList;
const display = displayList.find(each=>{
return each.stationCodeList.includes(roleDeviceCode);
});
if (display) {
const codeList = [...display.switchStationCodeList];
let relStationCodeList = [];
codeList.sort((a, b) => {
const stationA = this.$store.getters['map/getDeviceByCode'](a);
const stationB = this.$store.getters['map/getDeviceByCode'](b);
if (stationA.relStationCodeList && stationA.relStationCodeList.length > 0 && relStationCodeList.length <= 0) {
relStationCodeList = [...stationA.relStationCodeList];
relStationCodeList.push(stationA.code);
}
return stationA.kmRange - stationB.kmRange;
});
relStationCodeList.forEach(item => {
const next = this.$store.getters['map/getDeviceByCode'](item);
node.children.push({
code: next.code,
label: next.name,
handler: this.mapLocation
});
const currentStation = this.$store.getters['map/getDeviceByCode'](roleDeviceCode);
const currentNode = {label: currentStation.name, children: []};
codeList.forEach(code=>{
let node;
const station = this.$store.getters['map/getDeviceByCode'](code);
if (station.depot) {
return;
}
if (relStationCodeList.includes(code)) {
currentNode.children.push({label: station.name, code: station.code, handler: this.mapLocation});
if (currentNode.children.length == relStationCodeList.length) {
this.menuNormal.push(currentNode);
}
} else {
node = {label: station.name, code: station.code, handler: this.mapLocation};
this.menuNormal.push(node);
}
});
this.menuNormal.push(node);
}
});
}
this.menu = [...this.menuNormal];
},
popDoClose() {

View File

@ -71,7 +71,7 @@ export default {
for (const key in mapDevice) {
list.push(mapDevice[key]);
}
this.$store.dispatch('training/setRoleDeviceCode', station.code);
this.$jlmap.updateShowStation(list, showStationCode);
this.setCenter(showStationCode);
}

View File

@ -42,9 +42,20 @@
/>
</el-select>
</div>
<div style="margin-top:10px">
<span>可切换显示的车站</span>
<el-select v-model="addModel.switchStationCodeList" size="mini" style="width:200px;" multiple placeholder="请选择">
<el-option
v-for="item in stationList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</div>
<div class="content-box-list" style="margin-top: 10px;">
<div class="title-box">设备列表</div>
<div class="list-box">
<div class="list-box" style="height:400px;overflow:auto">
<div v-for="nor in addModel.elementList" :key="nor.code" class="list-content">
<div class="name">{{ getDeviceName(nor) }}</div>
<div class="close" @click="delList(nor, addModel.elementList)"><i class="el-icon-close" /></div>
@ -55,7 +66,7 @@
</el-card>
<div style="display: table; margin-left: 90px; margin-top: 12px; margin-bottom: 20px;">
<el-button type="primary" size="small" @click="generateData">按集中站生成并保存</el-button>
<el-button type="primary" size="small" @click="save">保存</el-button>
<el-button type="primary" size="small" :loading="dataLoading" @click="save">保存</el-button>
<el-button type="primary" size="small" @click="back">返回</el-button>
</div>
</el-scrollbar>
@ -82,6 +93,7 @@ export default {
tableData: [],
addModel: {
stationCodeList: [],
switchStationCodeList:[],
elementList: []
},
list: [],
@ -89,7 +101,8 @@ export default {
cardMode: 'generate',
index: '',
isPreview: true,
loading: false
loading: false,
dataLoading:false
};
},
computed: {
@ -181,12 +194,16 @@ export default {
},
updateOverlab() {
if (this.index || this.index == 0) {
this.clearData();
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
} else {
this.tableData.splice(this.index, 1, this.addModel);
return;
}
this.clearData();
if (!this.addModel.switchStationCodeList.length) {
this.$messageBox('请选择可切换显示的车站!');
return;
}
this.tableData.splice(this.index, 1, this.addModel);
}
},
//
@ -208,9 +225,13 @@ export default {
displayList: this.tableData,
mapId: this.$route.params.mapId
};
this.dataLoading = true;
saveMap(Object.assign(map, param)).then(response => {
this.$message.success('保存现地配置成功');
this.dataLoading = false;
this.cancelOverlab();
}).catch(() => {
this.dataLoading = false;
this.$messageBox('保存现地配置失败');
});
},
@ -220,25 +241,30 @@ export default {
generateOverlab() { //
if (!this.addModel.stationCodeList.length) {
this.$messageBox('请选择车站!');
} else {
this.tableData.push(this.addModel);
this.clearData();
return;
}
if (!this.addModel.switchStationCodeList.length) {
this.$messageBox('请选择可切换显示的车站!');
return;
}
this.tableData.push(this.addModel);
this.clearData();
},
clear() {
this.addModel = { stationCodeList: [], elementList: [] };
this.addModel = { stationCodeList: [], elementList: [], switchStationCodeList:[] };
},
clearData() {
this.addModel = { stationCodeList: [], elementList: [] };
this.addModel = { stationCodeList: [], elementList: [], switchStationCodeList:[] };
this.index = '';
this.cardMode = 'generate';
},
generateData() {
this.loading = true;
this.tableData = [];
// switchStationCodeList:[...item.switchStationCodeList, item.code]
this.stationList.forEach(item => {
if (item.centralized) {
this.tableData.push({stationCodeList: [...item.chargeStationCodeList, item.code], elementList: [...item.chargeStationCodeList, item.code]});
this.tableData.push({stationCodeList: [...item.chargeStationCodeList, item.code], elementList: [...item.chargeStationCodeList, item.code], switchStationCodeList:[...item.chargeStationCodeList, item.code]});
}
});
@ -265,6 +291,7 @@ export default {
saveMap(Object.assign(map, param)).then(response => {
this.loading = false;
this.$message.success('保存现地配置成功');
this.cancelOverlab();
}).catch(() => {
this.loading = false;
this.$messageBox('保存现地配置失败');