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

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', // 道岔边框颜色 borderColor: '#FE0000', // 道岔边框颜色
lossColor: '#FFFFFF', // 道岔失去颜色 lossColor: '#FFFFFF', // 道岔失去颜色
locateColor: '#00FF00', // 道岔定位颜色 locateColor: '#00FF00', // 道岔定位颜色
inversionColor: '#9C9D09', // 道岔反位颜色 inversionColor: '#EDBD65', // 道岔反位颜色
monolockLocationColor: '#ea282c', // 道岔单锁'定位'颜色 monolockLocationColor: '#ea282c', // 道岔单锁'定位'颜色
monolockInversionColor: '#ea282c', // 道岔单锁'反位'颜色 monolockInversionColor: '#ea282c', // 道岔单锁'反位'颜色
block: true, // 封锁名称 block: true, // 封锁名称

View File

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

View File

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

View File

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