|
|
|
<template>
|
|
|
|
<div class="container">
|
|
|
|
<div id="pwpg" class="pwpg" ref="pwpg"></div>
|
|
|
|
<QgePgd id="pwpgd" ref="hxpgd" @initPgd="initPgd" :pgd="pgd" :worker="getWorker" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
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 drawSb from './comps/sb'
|
|
|
|
import baifang from "./comps/baifang";
|
|
|
|
import {getPgd, getYcldw, shangLiao} from "@/api/zyjh";
|
|
|
|
import {getBzryList} from "@/api/sjzx/bzzGL";
|
|
|
|
import QgePgd from "@/views/zyjhzx/qgefkui/comps/QgePgd.vue";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PWanFKui',
|
|
|
|
components: {QgePgd},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
title: '切 割 作 业 反 馈',
|
|
|
|
width:0,
|
|
|
|
height:0,
|
|
|
|
stage:null,
|
|
|
|
layer:null,
|
|
|
|
sljhGroup:null,
|
|
|
|
pgdGroup:null,
|
|
|
|
drawGd:null,
|
|
|
|
dw:[],
|
|
|
|
pgd:[],
|
|
|
|
slGroup:null,
|
|
|
|
dw:[],
|
|
|
|
currentDw:null,
|
|
|
|
currentDwIndex:null,
|
|
|
|
currentWorker:null,
|
|
|
|
getCurrentWorker:null,
|
|
|
|
setWorkers:null,
|
|
|
|
workers:null,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.$socket.open()
|
|
|
|
this.wsSubscribe()
|
|
|
|
this.initKonvaStage();
|
|
|
|
},
|
|
|
|
created(){
|
|
|
|
window.addEventListener('resize', this.initKonvaStage)
|
|
|
|
},
|
|
|
|
sockets:{},
|
|
|
|
methods: {
|
|
|
|
wsSubscribe(){
|
|
|
|
this.sockets.subscribe('qgComplete', 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.initDw()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.sockets.subscribe('zyjhzx', data => {
|
|
|
|
if (this.zt===data.zt){
|
|
|
|
const tmpArr=[{
|
|
|
|
id:data.zyjh.id,
|
|
|
|
qgfkry:data.zyjh.qgry
|
|
|
|
}]
|
|
|
|
this.$refs.pwpgd.paigong0(tmpArr)
|
|
|
|
}else{
|
|
|
|
this.$message.error(`工单号错误:${data.gdh}`)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
initPgd(pgd = {}) {
|
|
|
|
const group = this.drawGd(pgd)
|
|
|
|
this.pgdGroup.add(group)
|
|
|
|
},
|
|
|
|
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() {
|
|
|
|
const that = this
|
|
|
|
getYcldw({type:'llj'}).then(res => {
|
|
|
|
const {container, dw} = drawDw(this.width, this.height, that.initDwInfo)
|
|
|
|
const {bgGroup,group} = container()
|
|
|
|
|
|
|
|
this.layer.add(bgGroup)
|
|
|
|
|
|
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
|
|
const item = res.data[i]
|
|
|
|
const dwGroup = dw(i, item)
|
|
|
|
group.add(dwGroup)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getWorker(){
|
|
|
|
return this.getCurrentWorker()
|
|
|
|
},
|
|
|
|
initWorkers() {
|
|
|
|
const that = this
|
|
|
|
getBzryList({resourcesCode: '4KB002'}).then(res => {
|
|
|
|
const {container,person,getCurrentWorker}=workers(this.width,this.height)
|
|
|
|
this.getCurrentWorker=getCurrentWorker
|
|
|
|
const {bgGroup,group}=container()
|
|
|
|
this.layer.add(bgGroup)
|
|
|
|
this.workers=res.data
|
|
|
|
|
|
|
|
this.setWorkers(res.data)
|
|
|
|
const that=this
|
|
|
|
for (let i=0;i<res.data.length;i++){
|
|
|
|
const item=res.data[i]
|
|
|
|
const worker=person(i,item)
|
|
|
|
worker.on('click touchstart',function (){
|
|
|
|
that.currentWorker=item
|
|
|
|
that.$refs.hxpgd.initData(that.currentWorker.userCode,'61')
|
|
|
|
})
|
|
|
|
group.add(worker)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
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.initWorkers()
|
|
|
|
|
|
|
|
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 = drawSb(this.width, this.height)
|
|
|
|
this.layer.add(csdGroup)
|
|
|
|
|
|
|
|
this.initBaiFang()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#pwpgd {
|
|
|
|
width: 67%;
|
|
|
|
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>
|