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

560 lines
12 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>
2020-05-08 18:06:33 +08:00
</el-button-group>
</div>
2020-05-08 18:06:33 +08:00
<div class="menudown" v-show = "modelcontrolview">
<el-button-group>
2020-05-08 18:06:33 +08:00
<el-button type="primary" @click="back">初始化</el-button>
2020-04-30 18:19:32 +08:00
<el-button type="primary" @click="alldisper">{{disperreset}}</el-button>
<!-- <el-button type="primary" @click="beforeclick">上一个</el-button>
<el-button type="primary" @click="startstop">暂停</el-button>
<el-button type="primary" @click="nextclick">下一个</el-button> -->
2020-05-08 18:06:33 +08:00
<el-button type="primary" @click="dispersed">{{devicestats}}</el-button>
<el-button type="primary" @click="selectdevice">返回继电器柜</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>
2020-05-08 18:06:33 +08:00
</div>
2020-05-08 18:06:33 +08:00
<div class="jlmap3dstats" >
<div class="modeldiv" v-show="showa1700">
<div class="statusdiv">JWJXC-1700</div>
<div class="statusdiv">状态:{{statsa1700}}</div>
<div class="statusdiv" @click="switcha1700">{{texta1700}}</div>
</div>
2020-05-08 18:06:33 +08:00
<div class="modeldiv" v-show="showb1700">
<div class="statusdiv">JWJXC-1700</div>
<div class="statusdiv">状态:{{statsb1700}}</div>
<div class="statusdiv" @click="switchb1700">{{textb1700}}</div>
</div>
2020-05-08 18:06:33 +08:00
<div class="modeldiv" v-show="showc1700">
<div class="statusdiv">JWJXC-1700</div>
<div class="statusdiv">状态:{{statsc1700}}</div>
<div class="statusdiv" @click="switchc1700">{{textc1700}}</div>
</div >
<div class="modeldiv" v-show="showh125">
<div class="statusdiv">JZJXC-H18</div>
<div class="statusdiv">状态:{{statsh18}}</div>
<div class="statusdiv" @click="switchh18">{{texth18}}</div>
</div>
2020-05-08 18:06:33 +08:00
<div class="modeldiv" v-show="showh18">
<div class="statusdiv">JWJXC-H125</div>
<div class="statusdiv">状态:{{statsh125}}</div>
<div class="statusdiv" @click="switch1000">{{texth125}}</div>
2020-01-07 10:51:19 +08:00
</div>
2020-05-08 18:06:33 +08:00
<div class="modeldiv" v-show="show135">
<div class="statusdiv">JYJXC-135</div>
<div class="statusdiv">状态:{{stats135}}</div>
<div class="statusdiv" @click="switch480">{{text135}}</div>
</div>
2020-05-08 18:06:33 +08:00
</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.params.deviceid,
2019-12-05 16:04:36 +08:00
jl3d: null,
devicelist:[],
2019-12-13 15:57:38 +08:00
msgshow:false,
devicename:"",
devicemsg:"",
2020-05-08 18:06:33 +08:00
devicestats:"分步拆解",
2020-04-30 18:19:32 +08:00
disperreset:"整体拆解",
2020-01-07 10:41:21 +08:00
statsa1700:"off",
statsb1700:"off",
statsc1700:"off",
statsh125:"off",
statsh18:"off",
stats135:"off",
2020-01-07 10:41:21 +08:00
texta1700:"关",
textb1700:"关",
textc1700:"关",
texth125:"关",
texth18:"关",
text135:"关",
2020-01-07 10:41:21 +08:00
ona1700:false,
onb1700:false,
onc1700:false,
onh125:false,
onh18:false,
on135:false,
2020-05-08 18:06:33 +08:00
showa1700:true,
showb1700:true,
showc1700:true,
showh125:true,
showh18:true,
show135:true,
modelcontrolview: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){
2020-05-08 18:06:33 +08:00
this.devicestats = "分步拆解";
2020-04-30 18:19:32 +08:00
this.disperreset = "整体拆解";
}
if(newVal == true){
2020-05-08 18:06:33 +08:00
this.devicestats = "分步复位";
2020-04-30 18:19:32 +08:00
this.disperreset = "整体复位";
}
}
}
},
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) {
2020-04-30 18:19:32 +08:00
this.jl3d.disperdevice1();
},
2020-05-08 18:06:33 +08:00
updatemenulist(devicelist,modelcode) {
this.devicelist = devicelist;
2020-05-08 18:06:33 +08:00
if(modelcode){
if(modelcode == "all"){
this.showa1700 = true;
this.showb1700 = true;
this.showc1700 = true;
this.showh125 = true;
this.showh18 = true;
this.show135 = true;
this.modelcontrolview = false;
}
if(modelcode == "jdq1"){
this.showa1700 = true;
this.showb1700 = false;
this.showc1700 = false;
this.showh125 = false;
this.showh18 = false;
this.show135 = false;
this.modelcontrolview = true;
}
console.log(modelcode);
if(modelcode == "jdq2"){
this.showa1700 = false;
this.showb1700 = true;
this.showc1700 = false;
this.showh125 = false;
this.showh18 = false;
this.show135 = false;
this.modelcontrolview = true;
}
if(modelcode == "jdq3"){
this.showa1700 = false;
this.showb1700 = false;
this.showc1700 = true;
this.showh125 = false;
this.showh18 = false;
this.show135 = false;
this.modelcontrolview = true;
}
if(modelcode == "jdq4"){
this.showa1700 = false;
this.showb1700 = false;
this.showc1700 = false;
this.showh125 = true;
this.showh18 = false;
this.show135 = false;
this.modelcontrolview = true;
}
if(modelcode == "jdq5"){
this.showa1700 = false;
this.showb1700 = false;
this.showc1700 = false;
this.showh125 = false;
this.showh18 = true;
this.show135 = false;
this.modelcontrolview = true;
}
if(modelcode == "jdq6"){
this.showa1700 = false;
this.showb1700 = false;
this.showc1700 = false;
this.showh125 = false;
this.showh18 = false;
this.show135 = true;
this.modelcontrolview = true;
}
}
},
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);
}
}
2020-01-07 10:51:19 +08:00
if(data[3].on != this.onh18){
2020-01-07 10:41:21 +08:00
if(data[3].on == true){
2020-01-07 10:51:19 +08:00
this.texth18 = "开";
this.statsh18 = "on";
this.onh18 = 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){
2020-01-07 10:51:19 +08:00
this.texth18 = "关";
this.statsh18 = "off";
this.onh18 = false;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(1,3);
}
}
2020-01-07 10:51:19 +08:00
if(data[4].on != this.onh125){
2020-01-07 10:41:21 +08:00
if(data[4].on == true){
this.texth125 = "开";
this.statsh125 = "on";
this.onh125 = 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.texth125 = "关";
this.statsh125 = "off";
this.onh125 = false;
2020-01-07 10:41:21 +08:00
this.jl3d.upmodelaction(1,4);
}
}
if(data[5].on != this.on135){
2020-01-07 10:41:21 +08:00
if(data[5].on == true){
this.text135 = "开";
this.stats135 = "on";
this.on135 = 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.text135 = "关";
this.stats135 = "off";
this.on135 = 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);
}
},
2020-01-07 10:51:19 +08:00
switchh18(){
if(this.statsh18 == "off"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(0,3);
2020-01-07 10:51:19 +08:00
}else if(this.statsh18 == "on"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(1,3);
}
},
2020-01-07 10:51:19 +08:00
switch1000(){
if(this.statsh125 == "off"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(0,4);
}else if(this.statsh125 == "on"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(1,4);
}
},
switch480(){
if(this.stats135 == "off"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(0,5);
}else if(this.stats135 == "on"){
2020-01-07 10:41:21 +08:00
this.jl3d.sendmsg(1,5);
}
},
2020-04-30 18:19:32 +08:00
alldisper(){
this.jl3d.disperdevice2();
},
// startstop(changedata) {
// this.jl3d.buttoncontrol("startstop");
// },
// nextclick(changedata) {
// this.jl3d.buttoncontrol("next");
// },
// beforeclick(changedata) {
// this.jl3d.buttoncontrol("before");
// },
back() {
this.jl3d.resetmodel();
// move3();
// 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-05-08 18:06:33 +08:00
/* width: 60%; */
height: 10%;
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%; */
}
2020-05-08 18:06:33 +08:00
.modeldiv{
float:left;
2020-05-08 18:06:33 +08:00
/* width:16.66%; */
height:100%;
text-align: center;
}
.statusdiv{
/* float:left; */
/* top:50%; */
width:150px;
height:33%;
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;
}
#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>