rt-sim-training-client/src/views/jlmap3d/maintainer/jl3dmaintainer.vue

372 lines
8.9 KiB
Vue
Raw Normal View History

2020-05-19 16:49:56 +08:00
<template>
<div class="jalmap3ddiv">
2020-07-30 15:08:17 +08:00
<div class="jl3dmap3dMaintainerSelect" v-show="selectShow">
<div class="maintainerSelectButton" style="left:33%" @click="initNormal">通号检修模式</div>
<div class="maintainerSelectButton" style="right:33%" @click="initVR">通号检修模式(VR)</div>
</div>
2020-05-19 16:49:56 +08:00
<div class="display-draft">
<el-button-group>
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
2020-05-22 15:56:40 +08:00
<Devicefault-List
v-show="faultlistshow"
:devicelist="devicelist"
@selectdevice="selectdevice"
>
</Devicefault-List>
2020-07-30 15:08:17 +08:00
2020-05-22 15:56:40 +08:00
<Fault-Device
v-show="deviceShow"
ref = "faultdevice"
@closedevice3dview ="devicemodel"
/>
2020-05-19 16:49:56 +08:00
2020-07-30 15:08:17 +08:00
2020-05-19 16:49:56 +08:00
<div id="testjlmap3d" class="jlmap3ddraw">
<canvas id="canvastexture" />
</div>
2020-05-22 15:56:40 +08:00
<div class="msg" v-show ="msgshow">
<div class="msgtext">
{{controlmsg}}
</div>
</div>
<div id="jl3droom" class="roombutton" @click="showroom"></div>
2020-06-02 16:57:38 +08:00
2020-05-19 16:49:56 +08:00
</div>
</template>
<script>
// import Vue from 'vue';
// import localStore from 'storejs';
// import { mapGetters } from 'vuex';
//
// // import ShowProperty from '@/views/jlmap3d/show/property';
//
// import { simulationNotify, setTrainingCbtcInitTime } from '@/api/simulation';
//
// import { UrlConfig } from '@/router/index';
import { JLmap3dMaintainer } from '@/jlmap3d/jl3dmaintainer/jlmap3dmaintainer.js';
2020-06-02 16:57:38 +08:00
2020-05-22 15:56:40 +08:00
import DevicefaultList from '@/views/jlmap3d/maintainer/component/devicefaultlist';
import FaultDevice from '@/views/jlmap3d/maintainer/component/faultdevice';
2020-05-19 16:49:56 +08:00
import Jlmap3dConfig from '@/views/jlmap3d/simulation/show/configmenu';
import { ProjectIcon } from '@/scripts/ProjectConfig';
2020-07-30 15:08:17 +08:00
import bgPsdImg from '@/assets/bg_psd.png';
2020-05-19 16:49:56 +08:00
// import Jlmap3dMsg from '@/views/jlmap3d/show/msg';
var train;
export default {
name: 'Jl3dMaintainer',
components: {
2020-05-22 15:56:40 +08:00
DevicefaultList,
2020-06-02 16:57:38 +08:00
FaultDevice,
2020-05-19 16:49:56 +08:00
// Jlmap3dMsg
// ShowProperty
},
data() {
return {
training: {
id: '',
name: '',
remarks: ''
},
mapdata: null,
jlmap3d: null,
selectmodel: null,
mapid:null,
group:null,
2020-05-22 15:56:40 +08:00
token:null,
2020-07-30 15:08:17 +08:00
selectShow:true,
2020-05-22 15:56:40 +08:00
faultlistshow:true,
devicelist:[],
deviceShow:true,
msgshow:false,
controlmsg:"",
2020-06-02 16:57:38 +08:00
2020-05-19 16:49:56 +08:00
};
},
beforeDestroy() {
// console.log("destroy");
if (this.jlmap3d) {
this.jlmap3d.webwork.postMessage('off');
this.jlmap3d.webwork.terminate();
console.log("www");
this.jlmap3d.jsonwebworknew.terminate();
2020-05-19 16:49:56 +08:00
this.jlmap3d.dispose();
this.jlmap3d = null;
// this.$destroy();
}
},
created() {
2020-07-01 12:11:19 +08:00
// document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
2020-05-19 16:49:56 +08:00
},
mounted() {
2020-05-22 15:56:40 +08:00
window.updatefault = this.updatefault;
window.resetfaultlist = this.resetfaultlist;
window.deletefault = this.deletefault;
window.warningmsg = this.warningmsg;
2020-05-19 16:49:56 +08:00
this.getParams();
// console.log("");
},
methods: {
getParams:function() {
var routerParams = this.$route.query.group;
this.mapid = this.$route.query.mapId;
this.group = this.$route.query.group;
this.token = this.$route.query.token;
},
2020-07-30 15:08:17 +08:00
2020-05-19 16:49:56 +08:00
show: function (skinCode, group) {
if (this.jlmap3d == null) {
2020-07-30 15:08:17 +08:00
this.initNormal(skinCode, group);
2020-05-19 16:49:56 +08:00
} else {
// this.jlmap3d.restart();
this.jlmap3d.eventon();
this.jlmap3d.animateon();
}
},
2020-07-30 15:08:17 +08:00
initNormal: function () {
this.selectShow = false;
this.deviceShow = false;
// this.deviceShow = true;
// this.faultlistshow = true;
2020-05-19 16:49:56 +08:00
const mapdata = this.$store.getters['map/map'];
const dom = document.getElementById('app');
const project = this.$route.query.project;
// console.log(project);
2020-07-30 15:08:17 +08:00
2020-05-19 16:49:56 +08:00
if (project) {
2020-07-30 15:08:17 +08:00
this.jlmap3d = new JLmap3dMaintainer(dom, mapdata, this.mapid, this.$store, this.group, project);
2020-05-19 16:49:56 +08:00
} else {
2020-07-30 15:08:17 +08:00
this.jlmap3d = new JLmap3dMaintainer(dom, mapdata, this.mapid, this.$store, this.group, '');
2020-05-19 16:49:56 +08:00
}
this.jlmap3d.eventon();
},
2020-07-30 15:08:17 +08:00
initVR:function (skinCode, group) {
const routeData = this.$router.resolve({
path:'/jlmap3d/maintainervr',
query:{
mapid:this.mapid,
group:this.group,
token:this.token,
noPreLogout: true
}
});
window.open(routeData.href);
},
2020-05-19 16:49:56 +08:00
raystand() {
this.jlmap3d.rayswitch('stand');
},
raytrain() {
this.jlmap3d.rayswitch('train');
},
raysection() {
this.jlmap3d.rayswitch('section');
},
raysignal() {
this.jlmap3d.rayswitch('signal');
},
rayswitch() {
this.jlmap3d.rayswitch('switch');
},
railmove() {
this.jlmap3d.camerarailmove();
},
showstationmsg(showtype) {
this.jlmap3d.showstationmsg(showtype);
},
showtrainmsg(showtype) {
this.jlmap3d.showtrainmsg(showtype);
},
2020-05-22 15:56:40 +08:00
resetfaultlist(){
this.devicelist = [];
2020-05-19 16:49:56 +08:00
},
2020-05-22 15:56:40 +08:00
updatefault(fault) {
this.devicelist.push(fault);
2020-05-19 16:49:56 +08:00
},
2020-05-22 15:56:40 +08:00
deletefault(code){
for(let i=0,leni=this.devicelist.length;i<leni;i++){
if(code == this.devicelist[i].code){
this.devicelist.splice(i,1);
break;
2020-05-19 16:49:56 +08:00
}
2020-05-22 15:56:40 +08:00
}
},
devicemodel(){
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
},
selectdevice(divicedata){
this.deviceShow = true;
// console.log(divicedata);
2020-05-22 15:56:40 +08:00
this.$refs.faultdevice.showmodel(divicedata);
2020-05-19 16:49:56 +08:00
},
2020-05-22 15:56:40 +08:00
warningmsg(nowmsg){
this.controlmsg = nowmsg;
this.msgshow = true;
setTimeout(this.warningmsgoff,3000);
},
warningmsgoff(){
this.msgshow = false;
},
showroom(){
this.deviceShow = true;
this.$refs.faultdevice.showroom();
},
2020-05-19 16:49:56 +08:00
back() {
this.$emit('back');
2020-06-02 16:57:38 +08:00
this.isswitch = false;
},
2020-05-19 16:49:56 +08:00
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.display-card {
z-index: 9;
display: inline;
position: absolute;
top: 17px;
float: left;
left: 160px;
height: 32px;
}
.display-card .el-row {
line-height: 32px !important;
}
.display-score {
background-color: black;
display: -moz-inline-box;
display: inline-block;
text-align: left;
/* border: 1px solid lightskyblue; */
/* width: 100px; */
height: 32px;
line-height: 24px;
border-radius: 4px;
padding-left: 2px;
margin-left: 10px;
font-family: "Microsoft" !important;
font-size: 18px !important;
color: #fff;
}
.display-draft {
/* z-index: 1000; */
position: absolute;
float: right;
right: 40px;
bottom: 28px;
}
#testjlmap3d {
}
.jalmap3ddiv {
position:absolute;
width: 100%;
height: 100%;
2020-05-22 15:56:40 +08:00
z-index: 2;
2020-05-19 16:49:56 +08:00
}
2020-07-30 15:08:17 +08:00
.jl3dmap3dMaintainerSelect{
position:absolute;
width: 100%;
height: 100%;
z-index: 35;
background-image:url("/static/texture/bg.jpg");
// background-repeat:no-repeat;
background-size:100%;
}
.maintainerSelectButton{
position:absolute;
width: 200px;
height: 100px;
position:absolute;
top:49%;
text-align: center;
font-size: 20px;
line-height:100px;
background-image:url("/static/texture/scene.png");
background-repeat:no-repeat;
background-size:100%;
}
2020-05-19 16:49:56 +08:00
.jlmap3ddraw {
float: left;
left: 0;
//left:20%;
width: 100%;
height: 100%;
position:absolute;
z-index: -1;
}
2020-05-22 15:56:40 +08:00
.msg{
width:40%;
// height:50px;
left:30%;
top:10%;
text-align: center;
position:absolute;
z-index:5;
}
.msgtext{
width:100%;
// height:50px;
border-radius:5px;
background:#C0C0C0;
color:#FFFFFF;
font-size: 40px;
}
.roombutton{
width:50px;
height:50px;
position: absolute;
2020-07-03 16:29:07 +08:00
right:185px;
top:5px;
z-index:30;
background-image:url("/static/texture/room.png");
background-repeat:no-repeat;
background-size:100%;
}
2020-05-19 16:49:56 +08:00
#canvastexture {
position: absolute;
float: left;
left: 0;
z-index: -12;
}
2020-06-02 16:57:38 +08:00
2020-05-19 16:49:56 +08:00
</style>