You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
3.9 KiB

9 months ago
<template>
<div class="container">
<div id="pwpg" class="pwpg" ref="pwpg"></div>
<PWanPgd id="pwpgd" ref="pwpgd" @initPgd="initPgd" :worker="getWorker" :workers="workers"/>
<ZyjhSelectComp id="selectComp" ref="selRef" @initWorkers="initWorkers"/>
<TipsComp />
<Drawer ref="drawer"/>
9 months ago
</div>
</template>
<script>
import PWanPgd from "@/views/zyjhzx/pwanpgong/comps/PwanPgd.vue";
import container from "./comps/container";
import drawTitle from './comps/title'
import workers from "./comps/person";
import drawDw from './comps/dw'
import drawPgd from './comps/pgd'
import {getBzryList} from "@/api/sjzx/bzzGL";
import {dict, getYcldw, shangLiao} from "@/api/zyjh";
import ZyjhSelectComp from "@/views/zyjhzx/components/SelectComp.vue";
import TipsComp from "@/views/zyjhzx/components/TipsComp.vue";
import Drawer from "@/views/zyjhzx/components/Drawer.vue";
9 months ago
export default {
name:'PWanPGong',
components: {Drawer, TipsComp, ZyjhSelectComp, PWanPgd},
9 months ago
data(){
return {
title:'抛 丸 作 业 派 工',
width:0,
height:0,
stage:null,
layer:null,
pgdGroup:null,
drawGd:null,
getCurrentWorker:null,
setWorkers:null,
workers:null,
tlt:null,
zt:'21',
workerGroup:null,
person:null,
deviceId:null,
9 months ago
}
},
mounted() {
this.$socket.open()
9 months ago
this.initKonvaStage();
},
created(){
this.deviceId=this.$route.query.deviceId||''
window.addEventListener('resize', this.initKonvaStage)
},
sockets:{},
9 months ago
methods:{
initPgd(pgd={}){
const group=this.drawGd(pgd)
this.pgdGroup.add(group)
},
initDw(){
getYcldw({type:'ycl'}).then(res=>{
const {container,dw}=drawDw(this.width,this.height)
const {bgGroup,group}=container()
this.layer.add(bgGroup)
9 months ago
for (let i=0;i<res.data.length;i++){
const item=res.data[i]
9 months ago
const dwGroup=dw(i,item)
group.add(dwGroup)
}
})
},
getWorker(){
return this.getCurrentWorker()
},
initWorkers(bzType){
if (this.workerGroup){
this.workerGroup.destroyChildren()
}else{
const {container,person,getCurrentWorker}=workers(this.width,this.height)
this.getCurrentWorker=getCurrentWorker
this.person=person
const {layer,group}=container()
this.workerGroup=group
this.stage.add(layer)
}
this.workerGroup.x(0)
this.workerGroup.y(0)
getBzryList({zyq:this.$route.query.zyq,zt:bzType}).then(res=>{
this.workers=res.data
this.$refs.pwpgd.setWorkers(this.workers)
for (let i=0;i<res.data.length;i++){
const item=res.data[i]
const worker=this.person(i,item)
this.workerGroup.add(worker)
9 months ago
}
})
},
initKonvaStage(){
this.width=this.$refs.pwpg.clientWidth
this.height=this.$refs.pwpg.clientHeight
const {stage,layer}=container(this.width,this.height,'pwpg')
this.stage=stage
this.layer=layer
const titel=drawTitle(this.width,this.height,this.title)
const that=this
titel.on('click touch',function (){
console.log(111)
that.$refs.drawer.show()
})
9 months ago
this.layer.add(titel)
this.initDw()
const {container:pgdContainer,drawGd,setWorkers}=drawPgd(this.width,this.height)
this.setWorkers=setWorkers
9 months ago
this.drawGd=drawGd
this.pgdGroup=pgdContainer()
this.layer.add(this.pgdGroup)
this.initWorkers(this.$refs.selRef.getData().bzType)
9 months ago
},
}
}
</script>
<style>
#selectComp {
width:30%;
height: auto;
position: absolute;
top:10px;
left:20px;
border: none;
margin: 0;
}
9 months ago
#pwpgd {
width:50%;
height: auto;
position: absolute;
top:200px;
9 months ago
left:20px;
border: none;
margin: 0;
}
#pwpg {
overflow: hidden;
width: 100%;
height: 100vh;
aspect-ratio: 16/9;
}
.container{
background: #ddd;
height: 100vh;
9 months ago
}
</style>