|
|
|
<template>
|
|
|
|
<div class="container">
|
|
|
|
<div id="pwpg" class="pwpg" ref="pwpg"></div>
|
|
|
|
<PWanPgd id="pwbgd" ref="pwpgd" @initPgd="initPgd" :pgd="pgd" :workers="workers" :dw="dw" @pgdClick="pgdClick"/>
|
|
|
|
<ZyjhSelectComp id="selectComp" ref="selRef" @initWorkers="initWorkers"/>
|
|
|
|
<TipsComp />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import PWanPgd from "./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 baifang from "./comps/baifang";
|
|
|
|
import drawCsd from './comps/csd'
|
|
|
|
import { getYcldw} from "@/api/zyjh";
|
|
|
|
import {getBzryList} from "@/api/sjzx/bzzGL";
|
|
|
|
import ZyjhSelectComp from "@/views/zyjhzx/components/SelectComp.vue";
|
|
|
|
import TipsComp from "@/views/zyjhzx/components/TipsComp.vue";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name:'PWanFKui',
|
|
|
|
components: {TipsComp, ZyjhSelectComp, PWanPgd},
|
|
|
|
data(){
|
|
|
|
return {
|
|
|
|
title:'抛 丸 作 业 报 工',
|
|
|
|
width:0,
|
|
|
|
height:0,
|
|
|
|
stage:null,
|
|
|
|
layer:null,
|
|
|
|
pgdGroup:null,
|
|
|
|
drawGd:null,
|
|
|
|
dw:[],
|
|
|
|
pgd:[],
|
|
|
|
currentDw:'',
|
|
|
|
currentDwIndex:'',
|
|
|
|
currentWorker:null,
|
|
|
|
setWorkers:null,
|
|
|
|
workers:null,
|
|
|
|
slGroup:null,
|
|
|
|
dwGroup:null,
|
|
|
|
workerGroup:null,
|
|
|
|
person:null,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.$socket.open()
|
|
|
|
this.wsSubscribe()
|
|
|
|
this.initKonvaStage();
|
|
|
|
},
|
|
|
|
created(){
|
|
|
|
window.addEventListener('resize', this.initKonvaStage)
|
|
|
|
},
|
|
|
|
sockets:{},
|
|
|
|
methods:{
|
|
|
|
wsSubscribe(){
|
|
|
|
this.sockets.subscribe('pwComplete', data => {
|
|
|
|
if (this.currentDw&&this.currentDw.id===data.dwId) {
|
|
|
|
if (this.slGroup){
|
|
|
|
this.slGroup.destroyChildren()
|
|
|
|
}
|
|
|
|
for (let i = 0; i < this.dw[this.currentDwIndex].list.length; i++) {
|
|
|
|
const item=this.dw[this.currentDwIndex].list[i]
|
|
|
|
if (item.czbh===data.czbh&&item.pl===data.pl&&item.tlth===data.tlth){
|
|
|
|
this.dw[this.currentDwIndex].list.splice(i,1)
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.drawBaiFang(this.dw[this.currentDwIndex].list)
|
|
|
|
this.$refs.pwpgd.initData(this.currentWorker.userCode,'31')
|
|
|
|
this.initDw()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
initPgd(pgd={}){
|
|
|
|
const group=this.drawGd(pgd)
|
|
|
|
this.pgdGroup.add(group)
|
|
|
|
},
|
|
|
|
pgdClick(option){
|
|
|
|
let index=-1
|
|
|
|
let dw=null
|
|
|
|
for (const item of this.dw) {
|
|
|
|
index+=1
|
|
|
|
if (item.id===option.slycldw){
|
|
|
|
dw=item
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.dwGroup.children[index].selected()
|
|
|
|
|
|
|
|
this.initDwInfo(index,dw)
|
|
|
|
const that=this
|
|
|
|
this.slGroup.children.forEach(item=>{
|
|
|
|
const data=item.getAttr('item')
|
|
|
|
if (data.czbh===option.dcCh&&data.pl===option.dcPl&&data.fd===option.dcFd&&data.tlth===option.tzbh){
|
|
|
|
const imageObj = new Image();
|
|
|
|
imageObj.src = require('@/assets/pwan/gbSelectBg.png');
|
|
|
|
imageObj.onload = function () {
|
|
|
|
const shape = new Konva.Image({
|
|
|
|
x: 10,
|
|
|
|
y: 0,
|
|
|
|
offsetY:5,
|
|
|
|
width: that.width*0.25-20,
|
|
|
|
height:50,
|
|
|
|
image: this,
|
|
|
|
});
|
|
|
|
item.add(shape)
|
|
|
|
shape.zIndex(0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
initDwInfo(index,dw){
|
|
|
|
if (this.slGroup){
|
|
|
|
this.slGroup.destroyChildren()
|
|
|
|
}
|
|
|
|
this.canSl=true
|
|
|
|
this.currentDw=dw
|
|
|
|
this.currentDwIndex=index
|
|
|
|
!!dw&&this.drawBaiFang(dw.list)
|
|
|
|
},
|
|
|
|
initBaiFang(){
|
|
|
|
const {slGroup,handler,bgGroup:slBgGroup}= baifang({width:this.width,height:this.height})
|
|
|
|
this.slGroup=slGroup
|
|
|
|
this.layer.add(slBgGroup)
|
|
|
|
this.drawBaiFang=handler
|
|
|
|
},
|
|
|
|
initDw(){
|
|
|
|
if (this.dwGroup){
|
|
|
|
this.dwGroup.destroyChildren()
|
|
|
|
}
|
|
|
|
const that=this
|
|
|
|
getYcldw({type:'ycl'}).then(res=>{
|
|
|
|
const {container,dw}=drawDw(this.width,this.height,that.initDwInfo)
|
|
|
|
const group=container()
|
|
|
|
this.dwGroup=group
|
|
|
|
this.layer.add(group)
|
|
|
|
|
|
|
|
this.dw=res.data
|
|
|
|
for (let i=0;i<res.data.length;i++){
|
|
|
|
const item=res.data[i]
|
|
|
|
const dwGroup=dw(i,item)
|
|
|
|
group.add(dwGroup)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
initWorkers(bzType){
|
|
|
|
const that=this
|
|
|
|
if (this.workerGroup){
|
|
|
|
this.workerGroup.destroyChildren()
|
|
|
|
}else{
|
|
|
|
const {container,person}=workers(this.width,this.height)
|
|
|
|
this.person=person
|
|
|
|
const {bgGroup,group}=container()
|
|
|
|
this.workerGroup=group
|
|
|
|
this.layer.add(bgGroup)
|
|
|
|
}
|
|
|
|
getBzryList({zyq:this.$route.query.zyq,zt:bzType}).then(res=>{
|
|
|
|
this.workers=res.data
|
|
|
|
|
|
|
|
that.setWorkers(res.data)
|
|
|
|
for (let i=0;i<res.data.length;i++){
|
|
|
|
const item=res.data[i]
|
|
|
|
const worker=this.person(i,item)
|
|
|
|
worker.on('click touchstart',function (){
|
|
|
|
that.currentWorker=item
|
|
|
|
that.$refs.pwpgd.initData(that.currentWorker.userCode,'31')
|
|
|
|
})
|
|
|
|
this.workerGroup.add(worker)
|
|
|
|
worker.zIndex(1)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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)
|
|
|
|
this.layer.add(titel)
|
|
|
|
|
|
|
|
this.initDw()
|
|
|
|
|
|
|
|
const {container:pgdContainer,drawGd,setWorkers}=drawPgd(this.width,this.height)
|
|
|
|
this.setWorkers=setWorkers
|
|
|
|
this.drawGd=drawGd
|
|
|
|
this.pgdGroup=pgdContainer()
|
|
|
|
this.layer.add(this.pgdGroup)
|
|
|
|
|
|
|
|
const csdGroup=drawCsd(this.width,this.height)
|
|
|
|
this.layer.add(csdGroup)
|
|
|
|
|
|
|
|
this.initWorkers(this.$refs.selRef.getData().bzType)
|
|
|
|
|
|
|
|
this.initBaiFang()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#selectComp {
|
|
|
|
width:50%;
|
|
|
|
height: auto;
|
|
|
|
position: absolute;
|
|
|
|
top:10px;
|
|
|
|
left:20px;
|
|
|
|
border: none;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
#pwbgd {
|
|
|
|
width:55%;
|
|
|
|
height: auto;
|
|
|
|
position: absolute;
|
|
|
|
top:45px;
|
|
|
|
left:20px;
|
|
|
|
border: none;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pwpg {
|
|
|
|
overflow: hidden;
|
|
|
|
width: 100%;
|
|
|
|
height: 100vh;
|
|
|
|
aspect-ratio: 16/9;
|
|
|
|
}
|
|
|
|
|
|
|
|
.container{
|
|
|
|
background: #ddd;
|
|
|
|
}
|
|
|
|
</style>
|