|
|
|
@ -5,9 +5,8 @@ import { VXETable } from 'vxe-table'
|
|
|
|
|
const baifang=function (option={}) {
|
|
|
|
|
const width=option.width,height=option.height,slList=option.dw,image=require('@/assets/gb.png')
|
|
|
|
|
const _width=width*0.364,_height=height*0.712
|
|
|
|
|
const container=function (){
|
|
|
|
|
const x=width*0.30+30,y=260
|
|
|
|
|
|
|
|
|
|
const x=width*0.30+30,y=260
|
|
|
|
|
const bg=function (){
|
|
|
|
|
const group=new Konva.Group({
|
|
|
|
|
x:x,
|
|
|
|
|
y:y,
|
|
|
|
@ -25,36 +24,32 @@ const baifang=function (option={}) {
|
|
|
|
|
height:_height,
|
|
|
|
|
image: this,
|
|
|
|
|
});
|
|
|
|
|
group.add(shape)
|
|
|
|
|
bgGroup.add(shape)
|
|
|
|
|
shape.zIndex(0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const selectObj = new Image();
|
|
|
|
|
selectObj.src = require('@/assets/pwan/gbSelectBg.png');
|
|
|
|
|
selectObj.onload = function () {
|
|
|
|
|
const shape = new Konva.Image({
|
|
|
|
|
x: 0,
|
|
|
|
|
y: 0,
|
|
|
|
|
width: _width,
|
|
|
|
|
height:_height,
|
|
|
|
|
image: this,
|
|
|
|
|
visible:false
|
|
|
|
|
});
|
|
|
|
|
group.add(shape)
|
|
|
|
|
shape.zIndex(0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return group
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const container=function (){
|
|
|
|
|
return new Konva.Group({
|
|
|
|
|
x:0,
|
|
|
|
|
y:0,
|
|
|
|
|
width:_width,
|
|
|
|
|
height:_height
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bgGroup=bg();
|
|
|
|
|
const slGroup=container()
|
|
|
|
|
bgGroup.add(slGroup)
|
|
|
|
|
slGroup.zIndex(1)
|
|
|
|
|
|
|
|
|
|
const thatHeight=height
|
|
|
|
|
const gangban=function (index,item){
|
|
|
|
|
const group=new Konva.Group({
|
|
|
|
|
x:0,
|
|
|
|
|
y:thatHeight-310-index*40,
|
|
|
|
|
draggable:true
|
|
|
|
|
// draggable:true
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
group.setAttr('index',index)
|
|
|
|
@ -70,82 +65,10 @@ const baifang=function (option={}) {
|
|
|
|
|
})
|
|
|
|
|
let _index=0
|
|
|
|
|
let touchingFlag=false;
|
|
|
|
|
group.on('mousedown touchstart',function (evt){
|
|
|
|
|
const layer=evt.currentTarget.parent.parent
|
|
|
|
|
touchingFlag=true
|
|
|
|
|
const {x,y}=evt.evt
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
const moving=this.isDragging()
|
|
|
|
|
if (!moving){
|
|
|
|
|
if (touchingFlag){
|
|
|
|
|
this.draggable(false)
|
|
|
|
|
|
|
|
|
|
const tmpGroup=this.clone()
|
|
|
|
|
tmpGroup.x(x-10)
|
|
|
|
|
tmpGroup.y(y-10)
|
|
|
|
|
layer.add(tmpGroup)
|
|
|
|
|
tmpGroup.draggable(true)
|
|
|
|
|
tmpGroup.dragBoundFunc(function (pos){
|
|
|
|
|
return{...pos}
|
|
|
|
|
})
|
|
|
|
|
tmpGroup.startDrag()
|
|
|
|
|
|
|
|
|
|
const that=this
|
|
|
|
|
tmpGroup.on('dragend',function (){
|
|
|
|
|
const {x:thisX,y:thisY}=this.absolutePosition()
|
|
|
|
|
for (const item of layer.children) {
|
|
|
|
|
if(item.attrs.id==='csd'){
|
|
|
|
|
const {x,y}=item.absolutePosition()
|
|
|
|
|
const worker=JSON.parse(window.localStorage.getItem('worker'))
|
|
|
|
|
if ((thisX>=x&&thisY>=y)&&!!worker){
|
|
|
|
|
const info=this.getAttr('item')
|
|
|
|
|
const zyjh=JSON.parse(window.localStorage.getItem('zyjh'))
|
|
|
|
|
if (!zyjh){
|
|
|
|
|
VXETable.modal.message({content: '请先选择待反馈的派工单', status: 'warning'})
|
|
|
|
|
this.remove()
|
|
|
|
|
that.visible(true)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
zx({
|
|
|
|
|
field:'pwfkrq',
|
|
|
|
|
zxZtName:'PWFK',
|
|
|
|
|
list:[{
|
|
|
|
|
id:zyjh.id,
|
|
|
|
|
pwfkry: worker.userCode
|
|
|
|
|
}],
|
|
|
|
|
ycldwInfo:info
|
|
|
|
|
}).then(res=>{
|
|
|
|
|
if (res.success){
|
|
|
|
|
window.localStorage.removeItem('zyjh')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.scaleX(0.7)
|
|
|
|
|
const image=this.find('Image')[0]
|
|
|
|
|
image.x(5)
|
|
|
|
|
image.y(800)
|
|
|
|
|
image.scaleX(0.90)
|
|
|
|
|
image.moveTo(item.children[0].children[0])
|
|
|
|
|
// this.moveTo(item.children[0].children[0])
|
|
|
|
|
image.zIndex(2)
|
|
|
|
|
image.setAttr('_ad','sdf')
|
|
|
|
|
this.remove()
|
|
|
|
|
that.remove()
|
|
|
|
|
}else{
|
|
|
|
|
this.remove()
|
|
|
|
|
that.visible(true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.visible(false)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},500)
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
group.on('mouseup touchend',function (){
|
|
|
|
|
touchingFlag=false
|
|
|
|
|
this.stopDrag()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
group.on('dragstart',function (){
|
|
|
|
@ -262,7 +185,6 @@ const baifang=function (option={}) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handler(slList){
|
|
|
|
|
console.log(slList)
|
|
|
|
|
for (let i = 1; i <= slList.length; i++) {
|
|
|
|
|
const item=slList[i-1]
|
|
|
|
|
const _group=gangban(i,item,item.length)
|
|
|
|
@ -270,10 +192,8 @@ const baifang=function (option={}) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handler(slList)
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
container,slGroup,handler
|
|
|
|
|
container,slGroup,handler,bgGroup
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|