rt-sim-training-client/src/views/jlmap3d/devicetrain/jl3ddevicetrain.vue

166 lines
3.1 KiB
Vue
Raw Normal View History

2019-12-05 16:04:36 +08:00
<template>
<div class="jl3ddevice">
2019-12-05 16:04:36 +08:00
<div id="jl3d" class="jl3ddraw">
</div>
<Jl3ddevicetrain-Menu :devicelist="devicelist" @sdevice="sdevice" >
</Jl3ddevicetrain-Menu>
<div class="menutop">
<el-button-group>
<el-button type="primary" @click="selectdevice">选择设备</el-button>
<el-button type="primary" @click="dispersed">{{devicestats}}</el-button>
</el-button-group>
</div>
<div class="menudown">
<el-button-group>
<el-button type="primary" @click="back">退出</el-button>
</el-button-group>
</div>
<div id="testjlmap3d" class="jlmap3ddraw">
<canvas id="canvastexture" />
</div>
</div>
2019-12-05 16:04:36 +08:00
</template>
<script>
import Vue from 'vue';
import { Jl3ddevice } from '@/jlmap3d/jl3ddevicetrain/jl3ddevicetrain.js';
import Jl3ddevicetrainMenu from '@/views/jlmap3d/devicetrain/component/devicetrainmenu';
2019-12-05 16:04:36 +08:00
export default {
name: 'devicetrain',
2019-12-05 16:04:36 +08:00
components: {
Jl3ddevicetrainMenu
2019-12-05 16:04:36 +08:00
},
data() {
return {
jl3d: null,
devicelist:[],
devicestats:"设备分解",
2019-12-05 16:04:36 +08:00
}
},
watch: {
// '$store.state.socket.device.code': {
// handler: function (newVal, oldVal) {
// if (newVal != oldVal) {
// this.jl3d.selectmodel(this.$store.state.socket.device);
//
// }
// }
// },
// '$store.state.socket.device': {
// deep: true,
// handler: function (newVal, oldVal) {
// if (newVal.code == oldVal.code) {
// this.jl3d.updateaction(newVal);
// } else {
//
// }
//
// }
// },
'jl3d.animastats': {
handler: function (newVal, oldVal) {
if (newVal != oldVal) {
if(newVal == false){
this.devicestats = "设备分解";
}
if(newVal == true){
this.devicestats = "设备归位";
}
console.log(newVal);
}
}
},
2019-12-05 16:04:36 +08:00
},
computed: {
code() {
return this.$route.query.code;
}
},
mounted() {
window.updatemenulist = this.updatemenulist;
this.init();
2019-12-05 16:04:36 +08:00
},
beforeDestroy() {
},
methods: {
init: function () {
2019-12-05 16:04:36 +08:00
// let mapdata = this.$store.state.socket.device;
let dom = document.getElementById('jl3d');
this.jl3d = new Jl3ddevice(dom);
},
sdevice(changedata) {
this.jl3d.updateselect(changedata);
},
selectdevice(device) {
this.jl3d.backselect();
},
dispersed(device) {
this.jl3d.disperdevice();
},
updatemenulist(devicelist) {
console.log(devicelist);
this.devicelist = devicelist;
},
back(changedata) {
window.close();
2019-12-05 16:04:36 +08:00
},
}
}
</script>
<style scoped>
/* #jl3d {
width: 937px;
height: 937px;
} */
.jl3ddraw {
position: absolute;
float: left;
top:0;
2019-12-05 16:04:36 +08:00
/* left: 0; */
width: 80%;
height: 100%;
/* z-index: 1500; */
2019-12-05 16:04:36 +08:00
}
#canvastexture {
position: absolute;
float: left;
left: 0;
z-index: -12;
}
#testjlmap3d {
}
.jlmap3ddraw {
float: left;
left: 0;
width: 100%;
height: 100%;
position:absolute;
z-index: -1;
}
.menutop{
top:0;
right:20%;
position:absolute;
}
.menudown{
bottom:0;
right:20%;
position:absolute;
}
#canvastexture {
position: absolute;
float: left;
left: 0;
z-index: -12;
}
2019-12-05 16:04:36 +08:00
</style>