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

456 lines
9.2 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>
2019-12-13 15:57:38 +08:00
<div class="showmsg" v-show="msgshow">
<div class="msgtop">
{{devicename}}
</div>
<div class="msgdown">
{{devicemsg}}
</div>
</div>
<div class="jlmap3dstats">
2020-01-07 10:41:21 +08:00
<div class="statusdiv">JWJXC-1700
</div>
<div class="statusdiv">JWJXC-1700
</div>
<div class="statusdiv">JWJXC-1700
</div>
<div class="statusdiv">JPJXC-1000
</div>
<div class="statusdiv">JZJXC-H18
</div>
<div class="statusdiv">JPJXC-480
</div>
2020-01-07 10:41:21 +08:00
<div class="statusdiv">状态:{{statsa1700}}
</div>
<div class="statusdiv">状态:{{statsb1700}}
</div>
<div class="statusdiv">状态:{{statsc1700}}
</div>
<div class="statusdiv">状态:{{stats1000}}
</div>
<div class="statusdiv">状态:{{statsh18}}
</div>
<div class="statusdiv">状态:{{stats480}}
</div>
2020-01-07 10:41:21 +08:00
<div class="statusdiv" @click="switcha1700">{{texta1700}}
</div>
<div class="statusdiv" @click="switchb1700">{{textb1700}}
</div>
<div class="statusdiv" @click="switchc1700">{{textc1700}}
</div>
<div class="statusdiv" @click="switch1000">{{text1000}}
</div>
<div class="statusdiv" @click="switchh18">{{texth18}}
</div>
<div class="statusdiv" @click="switch480">{{text480}}
</div>
</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 {
device: this.$route.query.device,
2019-12-05 16:04:36 +08:00
jl3d: null,
devicelist:[],
2019-12-13 15:57:38 +08:00
msgshow:false,
devicename:"",
devicemsg:"",
devicestats:"设备分解",
2020-01-07 10:41:21 +08:00
statsa1700:"off",
statsb1700:"off",
statsc1700:"off",
stats1000:"off",
statsh18:"off",
stats480:"off",
2020-01-07 10:41:21 +08:00
texta1700:"关",
textb1700:"关",
textc1700:"关",
text1000:"关",
texth18:"关",
text480:"关",
2020-01-07 10:41:21 +08:00
ona1700:false,
onb1700:false,
onc1700:false,
on1000:false,
onh18:false,
on480:false,
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 = "设备归位";
}
}
}
},
2019-12-05 16:04:36 +08:00
},
computed: {
code() {
return this.$route.query.code;
}
},
mounted() {
window.updatemenulist = this.updatemenulist;
2019-12-13 15:57:38 +08:00
window.updatemsg = this.updatemsg;
window.upjdqstats = this.upjdqstats;
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,this.device);
},
sdevice(changedata) {
this.jl3d.updateselect(changedata);
},
selectdevice(device) {
this.jl3d.backselect();
},
dispersed(device) {
this.jl3d.disperdevice();
},
updatemenulist(devicelist) {
this.devicelist = devicelist;
},
2019-12-13 15:57:38 +08:00
updatemsg(name,text) {
// console.log(name);
// console.log(text);
if(name){
this.msgshow = true;
this.devicename = name;
this.devicemsg = text;
}else{
this.msgshow = false;
}
},
upjdqstats(data){
// console.log(data[0].on);
2020-01-07 10:41:21 +08:00
if(data[0].on != this.ona1700){
if(data[0].on == true){
2020-01-07 10:41:21 +08:00
this.texta1700 = "开";
this.statsa1700 = "on";
this.ona1700 = true;
this.jl3d.upmodelaction(0,0);
}
if(data[0].on == false){
2020-01-07 10:41:21 +08:00
this.texta1700 = "关";
this.statsa1700 = "off";
this.ona1700 = false;
this.jl3d.upmodelaction(1,0);
}
}
2020-01-07 10:41:21 +08:00
if(data[1].on != this.onb1700){
if(data[1].on == true){
2020-01-07 10:41:21 +08:00
this.textb1700 = "开";
this.statsb1700 = "on";
this.onb1700 = true;
this.jl3d.upmodelaction(0,1);
}
if(data[1].on == false){
this.textb1700 = "关";
this.statsb1700 = "off";
this.onb1700 = false;
this.jl3d.upmodelaction(1,1);
}
}
if(data[2].on != this.onc1700){
if(data[2].on == true){
this.textc1700 = "开";
this.statsc1700 = "on";
this.onc1700 = true;
this.jl3d.upmodelaction(0,2);
}
if(data[2].on == false){
this.textc1700 = "关";
this.statsc1700 = "off";
this.onc1700 = false;
this.jl3d.upmodelaction(1,2);
}
}
if(data[3].on != this.on1000){
if(data[3].on == true){
this.text1000 = "开";
this.stats1000 = "on";
this.on1000 = true;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(0,3);
}
2020-01-07 10:41:21 +08:00
if(data[3].on == false){
this.text1000 = "关";
this.stats1000 = "off";
this.on1000 = false;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(1,3);
}
}
2020-01-07 10:41:21 +08:00
if(data[4].on != this.onh18){
if(data[4].on == true){
this.texth18 = "开";
this.statsh18 = "on";
this.onh18 = true;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(0,4);
}
2020-01-07 10:41:21 +08:00
if(data[4].on == false){
this.texth18 = "关";
this.statsh18 = "off";
this.onh18 = false;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(1,4);
}
}
2020-01-07 10:41:21 +08:00
if(data[5].on != this.on480){
if(data[5].on == true){
this.text480 = "开";
this.stats480 = "on";
this.on480 = true;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(0,5);
}
2020-01-07 10:41:21 +08:00
if(data[5].on == false){
this.text480 = "关";
this.stats480 = "off";
this.on480 = false;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(1,5);
}
}
},
2020-01-07 10:41:21 +08:00
switcha1700(){
if(this.statsa1700 == "off"){
this.jl3d.sendmsg(0,0);
2020-01-07 10:41:21 +08:00
}else if(this.statsa1700 == "on"){
this.jl3d.sendmsg(1,0);
}
},
2020-01-07 10:41:21 +08:00
switchb1700(){
if(this.statsb1700 == "off"){
this.jl3d.sendmsg(0,1);
}else if(this.statsb1700 == "on"){
this.jl3d.sendmsg(1,1);
}
},
switchc1700(){
if(this.statsc1700 == "off"){
this.jl3d.sendmsg(0,2);
}else if(this.statsc1700 == "on"){
this.jl3d.sendmsg(1,2);
}
},
switch1000(){
if(this.stats1000 == "off"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(0,3);
}else if(this.stats1000 == "on"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(1,3);
}
},
switchh18(){
if(this.statsh18 == "off"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(0,4);
}else if(this.statsh18 == "on"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(1,4);
}
},
switch480(){
if(this.stats480 == "off"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(0,5);
}else if(this.stats480 == "on"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(1,5);
}
},
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
}
2019-12-13 15:57:38 +08:00
.showmsg{
position: absolute;
float:left;
left:0;
bottom:0;
width: 20%;
height: 40%;
z-index: 10;
background-image:url("/static/texture/showmsg.png");
background-repeat: no-repeat;
background-size: 100%;
}
2019-12-05 16:04:36 +08:00
.jlmap3dstats{
position: absolute;
float:left;
/* left:10px; */
/* top:20px; */
2020-01-07 10:41:21 +08:00
width: 60%;
/* height: 20%; */
z-index: 10;
background-color: #409EFF;
border-radius: 4px;
color: #FFFFFF
/* background-image:url("/static/texture/menu.png"); */
/* background-repeat: no-repeat; */
/* background-size: 100%; */
}
.statusdiv{
float:left;
top:50%;
2020-01-07 10:41:21 +08:00
width:16.6%;
/* height:30%; */
font-size: 20px;
border: 1px solid white;
text-align: center;
cursor:pointer;
}
2019-12-13 15:57:38 +08:00
.msgtop{
text-align: center;
width: 90%;
height:10%;
position: absolute;
top:10%;
font-size:30px;
color:#FFFFFF;
}
.msgdown{
position: absolute;
top:20%;
left:5%;
width: 90%;
height:80%;
font-size:20px;
color:#FFFFFF;
word-wrap:break-word;
letter-spacing:2px;
}
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>