调整:代码修改

This commit is contained in:
fan 2019-08-12 13:40:34 +08:00
parent 9623c98994
commit 0b5cfcc9a7
5 changed files with 114 additions and 69 deletions

View File

@ -28,6 +28,6 @@ export default class TrainBodyBox extends Group {
this.add(this.trainBodyBox);
}
setColor(key, color) {
this.train.setStyle(key, color);
this.trainBodyBox.setStyle(key, color);
}
}

View File

@ -75,42 +75,39 @@ export default {
},
initMenu() {
this.menuNormal = [];
let resultCode = this.$route.path.indexOf("/display");
if(resultCode === -1){
this.stationList.forEach(station => {
if (station.code === station.concentrateStationCode) {
let node = {
label: station.name,
children: []
}
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) {
node.children.push({
code: elem.code,
label: elem.name,
handler: this.mapLocation,
});
}
}
})
this.menuNormal.push(node);
}
});
}
// this.stationList.forEach(station => {
// if (station.code === station.concentrateStationCode) {
// let node = {
// label: station.name,
// children: []
// }
//
// 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) {
// node.children.push({
// code: elem.code,
// label: elem.name,
// handler: this.mapLocation,
// });
// }
// }
// })
//
// this.menuNormal.push(node);
// }
// });
if (this.isScreen) {
this.menu = [...this.menuScreen];
}
else {
this.menu = [...this.menuNormal];
}
// else {
// this.menu = [...this.menuNormal];
// }
},
doShow(point) {
this.clickEvent();

View File

@ -77,40 +77,40 @@ export default {
},
initMenu() {
this.menuNormal = [];
this.stationList.forEach(station => {
if (station.code === station.concentrateStationCode) {
let node = {
label: station.name,
children: []
}
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) {
node.children.push({
code: elem.code,
label: elem.name,
handler: this.mapLocation,
});
}
}
})
this.menuNormal.push(node);
}
});
// this.stationList.forEach(station => {
// if (station.code === station.concentrateStationCode) {
// let node = {
// label: station.name,
// children: []
// }
//
// 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) {
// node.children.push({
// code: elem.code,
// label: elem.name,
// handler: this.mapLocation,
// });
// }
// }
// })
//
// this.menuNormal.push(node);
// }
// });
if (this.isScreen) {
this.menu = [...this.menuScreen];
}
else {
this.menu = [...this.menuNormal];
}
// else {
// this.menu = [...this.menuNormal];
// }
},
doShow(point) {
this.clickEvent();

View File

@ -243,7 +243,6 @@ export default {
x: em.clientX,
y: em.clientY
};
var menu = getDeviceMenuByDeviceType('Cancel');
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });

View File

@ -16,6 +16,7 @@ import PopMenu from '@/components/PopMenu';
import MapEdit from './edit';
import MapSaveAs from './saveAs';
import MapPublish from './publish';
import { mapGetters } from 'vuex';
export default {
name: 'MapOperateMenu',
@ -42,7 +43,7 @@ export default {
data() {
return {
menuShow: false,
menu: [
menuMap: [
{
label: this.$t('map.updateObj'),
handler: this.updateObj
@ -87,14 +88,25 @@ export default {
label: this.$t('map.jlmap3d'),
handler: this.jlmap3d
}
]
],
menuNormal:[],
menu: []
};
},
computed: {
...mapGetters('map', [
'stationList'
]),
},
watch: {
'$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Map)) {
this.menu = [ ...this.menuMap]
this.doShow(this.$store.state.menuOperation.menuPosition);
} else {
} else if(this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Cancel)){
this.initCancelMenu();
this.doShow(this.$store.state.menuOperation.menuPosition);
}else {
this.doClose();
}
}
@ -187,7 +199,44 @@ export default {
},
refresh() {
this.$emit('refresh');
}
},
initCancelMenu() {
this.menuNormal = [];
this.stationList.forEach(station => {
if (station.code === station.concentrateStationCode) {
let node = {
label: station.name,
children: []
};
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) {
node.children.push({
code: elem.code,
label: elem.name,
handler: this.mapLocation,
});
}
}
});
this.menuNormal.push(node);
}
});
this.menu = [ ...this.menuNormal ]
},
mapLocation(item) {
if (item) {
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: item.code });
this.doClose();
}
},
}
};
</script>