This commit is contained in:
zyy 2019-09-03 14:38:11 +08:00
commit 8c69b7afd0
12 changed files with 118 additions and 117 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 MiB

After

Width:  |  Height:  |  Size: 13 MiB

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,7 @@ export default class CircularLamp extends Group {
this.offsetY = 0; this.offsetY = 0;
this.dragging = false; this.dragging = false;
this.create(); this.create();
this.setStatus(this.model);
} }
create() { create() {
@ -48,7 +49,7 @@ export default class CircularLamp extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return; return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
@ -64,4 +65,11 @@ export default class CircularLamp extends Group {
this.dragging = false; this.dragging = false;
} }
} }
setStatus(model) {
if (model.switch === 'on') {
this.lamp.setStyle('fill', '#D8FCF2');
} else {
this.lamp.setStyle('fill', '#332C22');
}
}
} }

View File

@ -13,12 +13,13 @@ export default class key extends Group {
this.event = device.event; this.event = device.event;
this.offsetX = 0; this.offsetX = 0;
this.offsetY = 0; this.offsetY = 0;
this.dragging = false;
this.create(); this.create();
} }
create() { create() {
const model = this.model; const model = this.model;
this.imageBg = new Image({ this.keyImage = new Image({
zlevel: this.zlevel, zlevel: this.zlevel,
z: model.z, z: model.z,
draggable: false, draggable: false,
@ -30,15 +31,15 @@ export default class key extends Group {
height: 932 height: 932
} }
}); });
this.add(this.imageBg); this.add(this.keyImage);
this.transformScale(); this.transformScale();
} }
/** 缩放按钮 */ /** 缩放按钮 */
transformScale() { transformScale() {
this.imageBg.origin = [this.model.point.x, this.model.point.y]; this.keyImage.origin = [this.model.point.x, this.model.point.y];
this.imageBg.scale =[this.model.width/314, this.model.width/314]; this.keyImage.scale =[this.model.width/314, this.model.width/314];
this.imageBg.dirty(); this.keyImage.dirty();
} }
getRotateColor() { getRotateColor() {
@ -55,18 +56,33 @@ export default class key extends Group {
return keyPic; return keyPic;
} }
} }
onclick() {
if (!this.keyImage.draggable) {
switch (this.model.status) {
case 'off': {
this.keyImage.setStyle({image: keyPicOn});
this.model.status='on';
break;
}
case 'on': {
this.keyImage.setStyle({image: keyPic});
this.model.status='off';
break;
}
}
}
}
setStatus(model) { setStatus(model) {
switch (model.status) { switch (model.status) {
case 'on': { case 'on': {
// 开放 // 开放
this.imageBg.setStyle({image: keyPicOn}); this.keyImage.setStyle({image: keyPicOn});
this.model.status='on'; this.model.status='on';
break; break;
} }
case 'off': { case 'off': {
// 关闭 // 关闭
this.imageBg.setStyle({image: keyPic}); this.keyImage.setStyle({image: keyPic});
this.model.status='off'; this.model.status='off';
break; break;
} }
@ -74,7 +90,7 @@ export default class key extends Group {
} }
setDraggable() { setDraggable() {
this.imageBg.attr('draggable', true); this.keyImage.attr('draggable', true);
this.createMouseEvent(); this.createMouseEvent();
} }
createMouseEvent() { createMouseEvent() {
@ -87,10 +103,11 @@ export default class key extends Group {
this.event.disable(); this.event.disable();
if (e.which == 3) { if (e.which == 3) {
store.dispatch('ibp/setUpdateDeviceData', this.model); store.dispatch('ibp/setUpdateDeviceData', this.model);
return; return;
} }
this.offsetX = e.offsetX; this.offsetX = e.offsetX;
this.offsetY = e.offsetY; this.offsetY = e.offsetY;
this.dragging = true;
} }
mousemove(e) { mousemove(e) {
@ -98,7 +115,10 @@ export default class key extends Group {
mouseup(e) { mouseup(e) {
this.event.enable(); this.event.enable();
this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX); if (this.dragging) {
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY); this.model.point.x = this.model.point.x + (e.offsetX - this.offsetX);
this.model.point.y = this.model.point.y + (e.offsetY - this.offsetY);
this.dragging = false;
}
} }
} }

View File

@ -32,6 +32,7 @@ class TransformHandle {
view.transform = this.transform; view.transform = this.transform;
view.decomposeTransform(); view.decomposeTransform();
this.revisibleView(view); this.revisibleView(view);
view.transform = '';
} }
} }

View File

@ -24,7 +24,7 @@ class Jlmap {
this.skinCode = ''; this.skinCode = '';
// 皮肤风格 // 皮肤风格
this.style = this.loadStyle(); this.style = {};
// 设备数据 // 设备数据
this.mapDevice = {}; this.mapDevice = {};
@ -80,11 +80,12 @@ class Jlmap {
this.$options.scaleRate = map.skinVO.scaling || 1; this.$options.scaleRate = map.skinVO.scaling || 1;
this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0; this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0;
this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0; this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0;
// 更新视图大小
this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });
} }
// 解析地图数据 // 更新视图大小
this.$painter.updateTransform({ scaleRate: this.$options.scaleRate, offsetX: this.$options.offsetX, offsetY: this.$options.offsetY });
// 解析后的数据
this.mapDevice = mapDevice; this.mapDevice = mapDevice;
// 加载对应皮肤 // 加载对应皮肤

View File

@ -33,7 +33,6 @@ class TransformHandle {
view.decomposeTransform(); view.decomposeTransform();
this.revisibleView(view); this.revisibleView(view);
} }
// return view;
} }
// 处理所有视图缩放/平移 // 处理所有视图缩放/平移

View File

@ -169,7 +169,7 @@
}, },
methods: { methods: {
createDataModel(model) { createDataModel(model) {
const newModel = modelFactory(model.type, model); const newModel = modelFactory(model._type, model);
this.$store.dispatch('ibp/updateIbpDevices', newModel); this.$store.dispatch('ibp/updateIbpDevices', newModel);
}, },
deleteDataModel(model) { deleteDataModel(model) {

View File

@ -14,6 +14,14 @@ import { mapGetters } from 'vuex';
export default { export default {
name: 'Ibp', name: 'Ibp',
props: {
size: {
type: Object,
default() {
return null;
}
}
},
data() { data() {
return { return {
width: this.$store.state.config.width, width: this.$store.state.config.width,
@ -31,19 +39,10 @@ export default {
} }
}, },
showBackButton: true, showBackButton: true,
initZrender: false,
initTime: '', initTime: '',
started: false started: false
}; };
}, },
props: {
size: {
type: Object,
default() {
return null;
}
}
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'canvasWidth', 'canvasWidth',
@ -55,14 +54,10 @@ export default {
}, },
watch: { watch: {
'$store.state.config.canvasSizeCount': function (val) { '$store.state.config.canvasSizeCount': function (val) {
if (this.initZrender) { this.reSize();
this.resetSize();
}
}, },
'$store.state.app.windowSizeCount': function() { '$store.state.app.windowSizeCount': function() {
const width = this.size ? this.size.width : this.$store.state.app.width; this.setWindowSize();
const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height});
}, },
'$store.state.training.initTime': function (initTime) { '$store.state.training.initTime': function (initTime) {
this.initTime = initTime; this.initTime = initTime;
@ -70,12 +65,12 @@ export default {
this.initClockTime(initTime); this.initClockTime(initTime);
} }
}, },
'$store.state.training.started': function (started) { '$store.state.training.started': function (started) {
this.started = started; this.started = started;
if (this.$ibp){ if (this.$ibp) {
this.setClockStart(started); this.setClockStart(started);
} }
} }
}, },
mounted() { mounted() {
this.setWindowSize(); this.setWindowSize();
@ -86,7 +81,7 @@ export default {
} }
}, },
methods: { methods: {
show: function () { show () {
document.getElementById(this.ibpId).oncontextmenu = function (e) { document.getElementById(this.ibpId).oncontextmenu = function (e) {
return false; return false;
}; };
@ -116,30 +111,10 @@ export default {
window.document.oncontextmenu = function () { window.document.oncontextmenu = function () {
return false; return false;
}; };
this.initZrender = true;
}, },
setMap(data) { setMap(data) {
this.$ibp.setMap(ibpData, data); this.$ibp.setMap(ibpData, data);
}, },
resetSize() {
this.$nextTick(() => {
this.width = this.$store.state.config.width;
this.height = this.$store.state.config.height;
this.$ibp && this.$ibp.resize({ width: this.width, height: this.height });
});
},
setWindowSize() {
this.$nextTick(() => {
const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height });
});
},
back() {
this.$emit('hideIbp');
},
// //
onSelected(em) { onSelected(em) {
this.$emit('onSelect', em); this.$emit('onSelect', em);
@ -157,10 +132,28 @@ export default {
initClockTime(initTime) { initClockTime(initTime) {
this.$ibp.initClockTime(initTime); this.$ibp.initClockTime(initTime);
}, },
// //
setClockStart(started) { setClockStart(started) {
this.$ibp.setClockStart(started); this.$ibp.setClockStart(started);
} },
reSize() {
this.$nextTick(() => {
this.width = this.$store.state.config.width;
this.height = this.$store.state.config.height;
this.$ibp && this.$ibp.resize({ width: this.width, height: this.height });
});
},
setWindowSize() {
this.$nextTick(() => {
const width = this.size ? this.size.width : this.$store.state.app.width;
const height = this.size ? this.size.height :this.$store.state.app.height;
this.$store.dispatch('config/resize', { width: width, height: height });
});
},
back() {
this.$emit('hideIbp');
}
} }
}; };
</script> </script>
@ -171,9 +164,4 @@ export default {
right: 20px; right: 20px;
bottom: 15px; bottom: 15px;
} }
.ibp-canvas{
/*background-image: url('../../assets/ibp_images/ibp_bg.png');*/
/*background-repeat:repeat;*/
/*background-size: 4096px 2048px;*/
}
</style> </style>

View File

@ -285,8 +285,6 @@ export default {
this.$store.dispatch('training/end', TrainingMode.NORMAL); this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); // this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
console.log(this.skinCode);
if (this.skinCode) { if (this.skinCode) {
// 01 02 '' // 01 02 ''
const resp = await this.getUserRole(); const resp = await this.getUserRole();

View File

@ -2,7 +2,7 @@
<div> <div>
<div class="display-draft"> <div class="display-draft">
<el-button-group> <el-button-group>
<el-button v-if="isIBP" @click="jumpIbp">IBP盘</el-button> <el-button v-if="isIBP" type="warning" @click="jumpIbp">IBP盘</el-button>
<el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button> <el-button v-if="isDriver" type="jumpjlmap3d" @click="jumpjlmap3d">司机视角</el-button>
<template v-if="isAdmin"> <template v-if="isAdmin">
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">按计划行车</el-button> <el-button type="success" :disabled="isDisable" @click="selectBeginTime">按计划行车</el-button>

View File

@ -26,7 +26,7 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="delDispatch(nor, index)" @click="handleDelUser(dispatchList, nor, index)"
/> />
</li> </li>
</ul> </ul>
@ -42,7 +42,7 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="delEquipment(nor, index)" @click="handleDelEquipment(nor, index)"
/> />
<div style="float: right; margin-right: 15px;"> <div style="float: right; margin-right: 15px;">
<el-select <el-select
@ -82,7 +82,7 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="delAdmin(nor, index)" @click="handleDelUser(adminList, nor, index)"
/> />
</li> </li>
</ul> </ul>
@ -98,7 +98,7 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="delSignal(nor, index)" @click="handleDelUser(signalList, nor, index)"
/> />
</li> </li>
</ul> </ul>
@ -116,7 +116,7 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="delDriver(nor, index)" @click="handleDelUser(driverList, nor, index)"
/> />
</li> </li>
</ul> </ul>
@ -132,7 +132,7 @@
<i <i
v-if="userId == roomInfo.creatorId" v-if="userId == roomInfo.creatorId"
class="el-icon-close delPerson" class="el-icon-close delPerson"
@click="delIBP(nor, index)" @click="handleDelUser(ibpList, nor, index)"
/> />
</li> </li>
</ul> </ul>
@ -223,14 +223,15 @@
<script> <script>
import { getJoinTrainCode, deljointTrainRoom, putUserRoles, postRoomDetail, getJointTrainRoomUserList, putJointTrainingExit, startJointTraining, putJointTrainingSimulation, putJointTrainingSimulationEntrance } from '@/api/chat'; import { getJoinTrainCode, deljointTrainRoom, putUserRoles, postRoomDetail, getJointTrainRoomUserList, putJointTrainingExit, startJointTraining, putJointTrainingSimulation, putJointTrainingSimulationEntrance } from '@/api/chat';
import trainChat from './trainChat';
import AddPerson from './addPerson';
import QrCode from '@/components/QrCode';
import { getStationList } from '@/api/runplan'; import { getStationList } from '@/api/runplan';
import TreeOperateMenu from './operateMenu'; import { launchFullscreen } from '@/utils/screen';
import { DeviceMenu } from '@/scripts/ConstDic'; import { DeviceMenu } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login'; import { checkLoginLine } from '@/api/login';
import { getPublishMapInfo } from '@/api/jmap/map'; import { getPublishMapInfo } from '@/api/jmap/map';
import trainChat from './trainChat';
import AddPerson from './addPerson';
import QrCode from '@/components/QrCode';
import TreeOperateMenu from './operateMenu';
export default { export default {
name: 'TrainRoom', name: 'TrainRoom',
@ -359,6 +360,7 @@ export default {
const rest = await getPublishMapInfo(param.mapId); const rest = await getPublishMapInfo(param.mapId);
const query = { skinCode: rest.data.skinCode, mapId: param.mapId, group: param.group }; const query = { skinCode: rest.data.skinCode, mapId: param.mapId, group: param.group };
this.$router.push({ path: `/jointTraining`, query: query }); this.$router.push({ path: `/jointTraining`, query: query });
launchFullscreen();
} }
this.$store.dispatch('socket/setJointRoomInfo'); // this.$store.dispatch('socket/setJointRoomInfo'); //
}, },
@ -389,6 +391,7 @@ export default {
const rest = await getPublishMapInfo(this.mapId); const rest = await getPublishMapInfo(this.mapId);
const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.$route.query.group }; const query = { skinCode: rest.data.skinCode, mapId: this.mapId, group: this.$route.query.group };
this.$router.push({ path: `/jointTraining`, query: query }); this.$router.push({ path: `/jointTraining`, query: query });
launchFullscreen();
}, },
// 线/线 // 线/线
addPeopleList(obj) { addPeopleList(obj) {
@ -658,6 +661,18 @@ export default {
}); });
}); });
}, },
//
addingRoles(name, title) {
this.listName = name;
const treeList = [];
this.treeData.forEach(item => {
if (!item.select) {
delete item.select;
treeList.push(item);
}
});
this.$refs.addPerson.doShow(title, treeList);
},
// Admin Instructor Dispatcher Attendant Audience Driver Repair // Admin Instructor Dispatcher Attendant Audience Driver Repair
async handleDispatch(list) { async handleDispatch(list) {
const arr = []; const arr = [];
@ -711,18 +726,6 @@ export default {
} }
} }
}, },
//
addingRoles(name, title) {
this.listName = name;
const treeList = [];
this.treeData.forEach(item => {
if (!item.select) {
delete item.select;
treeList.push(item);
}
});
this.$refs.addPerson.doShow(title, treeList);
},
handleUserList(list) { handleUserList(list) {
this.treeData.forEach(item => { this.treeData.forEach(item => {
list.forEach(nor => { list.forEach(nor => {
@ -732,12 +735,11 @@ export default {
}); });
}); });
}, },
// handleDelUser(list, item, index) {
delDispatch(item, index) { list.splice(index, 1);
this.dispatchList.splice(index, 1);
this.handleProperty(item); this.handleProperty(item);
}, },
delEquipment(item, index) { handleDelEquipment(item, index) {
this.equipmentList.splice(index, 1); this.equipmentList.splice(index, 1);
this.stationList.forEach(item => { this.stationList.forEach(item => {
item.disabled = false; item.disabled = false;
@ -749,22 +751,6 @@ export default {
}); });
this.handleProperty(item); this.handleProperty(item);
}, },
delAdmin(item, index) {
this.adminList.splice(index, 1);
this.handleProperty(item);
},
delDriver(item, index) {
this.driverList.splice(index, 1);
this.handleProperty(item);
},
delSignal(item, index) {
this.signalList.splice(index, 1);
this.handleProperty(item);
},
delIBP(item, index) {
this.ibpList.splice(index, 1);
this.handleProperty(item);
},
handleProperty(item) { handleProperty(item) {
const treeIndex = this.treeData.findIndex(nor => nor.id == item.id); const treeIndex = this.treeData.findIndex(nor => nor.id == item.id);
if (treeIndex > -1) { if (treeIndex > -1) {