diff --git a/src/assets/pwan/gbSelectBg.png b/src/assets/pwan/gbSelectBg.png
new file mode 100644
index 0000000..0cb7878
Binary files /dev/null and b/src/assets/pwan/gbSelectBg.png differ
diff --git a/src/views/zyjhzx/pwanfkui/comps/PwanPgd.vue b/src/views/zyjhzx/pwanfkui/comps/PwanPgd.vue
index b2c8d51..81c317a 100644
--- a/src/views/zyjhzx/pwanfkui/comps/PwanPgd.vue
+++ b/src/views/zyjhzx/pwanfkui/comps/PwanPgd.vue
@@ -7,13 +7,21 @@ import paoWanPgdConfig from './pgdTable'
import {getPgd} from "@/api/zyjh";
export default {
name:'PwanPgd',
+ props:{
+ workers:{
+ type:Array,
+ default:[]
+ }
+ },
data(){
return{
gridOptions:{},
+ setExt:null,
}
},
created(){
- const {options,columns}=paoWanPgdConfig()
+ const {options,columns,setExt}=paoWanPgdConfig()
+ this.setExt=setExt
this.gridOptions=options
this.gridOptions.columns=columns
},
@@ -21,6 +29,7 @@ export default {
initData(worker,zt){
getPgd({user:worker,zt:zt,field:'pwry'}).then(res=>{
this.gridOptions.data=res.data
+ this.setExt('workers',this.$props.workers)
})
},
cellClick({row}){
diff --git a/src/views/zyjhzx/pwanfkui/comps/baifang.js b/src/views/zyjhzx/pwanfkui/comps/baifang.js
index 1165274..34dba20 100644
--- a/src/views/zyjhzx/pwanfkui/comps/baifang.js
+++ b/src/views/zyjhzx/pwanfkui/comps/baifang.js
@@ -1,5 +1,6 @@
import Konva from "konva";
-import {shangLiao} from "@/api/zyjh";
+import {zx} from "@/api/zyjh";
+import { VXETable } from 'vxe-table'
const baifang=function (option={}) {
const width=option.width,height=option.height,slList=option.dw,image=require('@/assets/gb.png')
@@ -28,6 +29,21 @@ const baifang=function (option={}) {
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
}
@@ -42,6 +58,7 @@ const baifang=function (option={}) {
})
group.setAttr('index',index)
+ group.setAttr('item',item)
slGroup.add(group)
const {x}=group.absolutePosition()
@@ -55,7 +72,6 @@ const baifang=function (option={}) {
let touchingFlag=false;
group.on('mousedown touchstart',function (evt){
const layer=evt.currentTarget.parent.parent
- console.log(layer)
touchingFlag=true
const {x,y}=evt.evt
setTimeout(()=>{
@@ -80,24 +96,47 @@ const baifang=function (option={}) {
for (const item of layer.children) {
if(item.attrs.id==='csd'){
const {x,y}=item.absolutePosition()
- if (thisX>=x&&thisY>=y){
- this.x(41)
- this.y(800)
- // this.rotate(-90)
- this.scaleX(0.5)
- console.log(item.children[0])
- this.moveTo(item.children[0].children[0])
- this.zIndex(1)
+ 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)
}
}
}
- //const {x,y}=that.slGroup.absolutePosition()
-
})
-
this.visible(false)
}
}
diff --git a/src/views/zyjhzx/pwanfkui/comps/csd.js b/src/views/zyjhzx/pwanfkui/comps/csd.js
index 4668239..1eda187 100644
--- a/src/views/zyjhzx/pwanfkui/comps/csd.js
+++ b/src/views/zyjhzx/pwanfkui/comps/csd.js
@@ -106,7 +106,7 @@ export default function (width,height){
csdGroup.to({
x: 0,
- y: -700,
+ y: -876,
duration: 20, //持续时间
onFinish() {
csdGroup.remove()
diff --git a/src/views/zyjhzx/pwanfkui/comps/dw.js b/src/views/zyjhzx/pwanfkui/comps/dw.js
index 62c2b80..1392440 100644
--- a/src/views/zyjhzx/pwanfkui/comps/dw.js
+++ b/src/views/zyjhzx/pwanfkui/comps/dw.js
@@ -30,6 +30,7 @@ export default function (width,height,callback){
return group
}
+ let selectedShape=null;
const dw=function (index,item=[]){
const alignSize=2
@@ -42,7 +43,16 @@ export default function (width,height,callback){
height:height
})
group.on('click touchstart',function (){
- callback(index,item.list)
+ if (selectedShape){
+ selectedShape.hide()
+ if (selectedShape===selectShape){
+ selectedShape=null
+ return
+ }
+ }
+ selectedShape=selectShape
+ selectedShape.show()
+ callback(index,item)
})
const bgObj = new Image();
@@ -60,6 +70,26 @@ export default function (width,height,callback){
shape.zIndex(0)
}
+ const selectObj = new Image();
+ selectObj.src = require('@/assets/sliao/selected.png');
+ let selectShape=null
+ const setSelectShape=function (shape){
+ selectShape=shape
+ }
+ selectObj.onload = function () {
+ const shape = new Konva.Image({
+ x: width-width*0.31,
+ y: 4,
+ width: width*0.25,
+ height:width*0.25,
+ image: this,
+ visible:false
+ });
+ group.add(shape)
+ shape.zIndex(0)
+ setSelectShape(shape)
+ }
+
const text=new Konva.Text({
x:0,
y:0,
diff --git a/src/views/zyjhzx/pwanfkui/comps/person.js b/src/views/zyjhzx/pwanfkui/comps/person.js
index 6ccd51d..956a94a 100644
--- a/src/views/zyjhzx/pwanfkui/comps/person.js
+++ b/src/views/zyjhzx/pwanfkui/comps/person.js
@@ -87,6 +87,7 @@ export default function (width,height){
group.on('click touchstart',function (){
currentWork=persons
+ window.localStorage.setItem('worker',JSON.stringify(currentWork))
if (selectedShape){
selectedShape.hide()
if (selectedShape===selectShape){
@@ -131,9 +132,9 @@ export default function (width,height){
const text=new Konva.Text({
x:0,
- y:62,
+ y:height,
width:width,
- height:height,
+ height:height*0.1,
text: persons.userName,
align: 'center',
verticalAlign:'middle',
diff --git a/src/views/zyjhzx/pwanfkui/comps/pgd.js b/src/views/zyjhzx/pwanfkui/comps/pgd.js
index cc0c6e0..63412cc 100644
--- a/src/views/zyjhzx/pwanfkui/comps/pgd.js
+++ b/src/views/zyjhzx/pwanfkui/comps/pgd.js
@@ -28,8 +28,22 @@ export default function (width,height){
return group
}
+ let workers=[]
+ const setWorkers=function (persons){
+ workers=persons
+ }
+
+ const formatWorker=function (code){
+ for (const item of workers) {
+ if(item.userCode===code){
+ return item.userName
+ }
+ }
+ }
+
const drawGd=function (data){
// this.layer.destroyChildren();
+ window.localStorage.setItem('zyjh',JSON.stringify(data))
const group=new Konva.Group({
x:13,
@@ -108,7 +122,6 @@ export default function (width,height){
group0.add(group7)
const group8=drawQz(data)
group0.add(group8)
- console.log(data)
generateQRCode(data.gdh,group0)
return group
}
@@ -280,7 +293,7 @@ export default function (width,height){
width:(_width-60)/2,
height:30,
fill:'#fff',
- text:data.pwry,
+ text:formatWorker(data.pwry),
fontSize:18,
align:'center',
verticalAlign:'middle'
@@ -486,6 +499,6 @@ export default function (width,height){
}
return {
- container,drawGd
+ container,drawGd,setWorkers
}
}
diff --git a/src/views/zyjhzx/pwanfkui/comps/pgdTable.js b/src/views/zyjhzx/pwanfkui/comps/pgdTable.js
index e6b16ac..0e597f1 100644
--- a/src/views/zyjhzx/pwanfkui/comps/pgdTable.js
+++ b/src/views/zyjhzx/pwanfkui/comps/pgdTable.js
@@ -11,12 +11,31 @@ export default function () {
scrollY:{enable:true},
data:[]
}
+ const ext={}
+ const setExt=function (key,value){
+ ext[key]=value
+ }
const gdhFormat=function ({cellValue}){
if (cellValue){
return 'PW'+cellValue
}
return ''
}
+ const nameFormat=function ({cellValue}){
+ const workers=ext.workers
+ for (const item of workers) {
+ if(item.userCode===cellValue){
+ return item.userName
+ }
+ }
+ }
+ const ztFormat=function ({cellValue}){
+ return ztEnmu[cellValue]
+ }
+ const ztEnmu={
+ '31':'派工',
+ '32':'反馈'
+ }
const columns = [
{ type: 'checkbox', width: 40 },
{ type: 'seq',title:'序号', width: 60 },
@@ -30,15 +49,16 @@ export default function () {
{field: '', title: '规格', width: 100},
{field: '', title: '炉批号', width: 100},
{field: 'tzbh', title: '套料图号', width: 100},
- {field: '', title: '接收人', width: 80},
- {field: '', title: '接收时间', width: 100},
- {field: '', title: '反馈人', width: 80},
- {field: '', title: '反馈时间', width: 100},
- {field: '', title: '状态', width: 60},
+ {field: 'pwry', title: '接收人', width: 80,formatter:nameFormat},
+ {field: 'pwpgrq', title: '接收时间', width: 100},
+ {field: 'pwfkr', title: '反馈人', width: 80,formatter:nameFormat},
+ {field: 'pwfkrq', title: '反馈时间', width: 100},
+ {field: 'zt', title: '状态', width: 60,formatter:ztFormat},
]
return {
options,
columns,
+ setExt
}
}
diff --git a/src/views/zyjhzx/pwanfkui/index.vue b/src/views/zyjhzx/pwanfkui/index.vue
index 3ae9a99..5ae08bd 100644
--- a/src/views/zyjhzx/pwanfkui/index.vue
+++ b/src/views/zyjhzx/pwanfkui/index.vue
@@ -1,7 +1,7 @@
@@ -14,8 +14,7 @@ import drawDw from './comps/dw'
import drawPgd from './comps/pgd'
import baifang from "./comps/baifang";
import drawCsd from './comps/csd'
-import {getPgd, getYcldw} from "@/api/zyjh";
-import liliao from "@/views/zyjhzx/sliao/comps/liliao";
+import { getYcldw} from "@/api/zyjh";
import {getBzryList} from "@/api/sjzx/bzzGL";
export default {
@@ -32,27 +31,56 @@ export default {
drawGd:null,
dw:[],
pgd:[],
+ currentDw:'',
+ currentDwIndex:'',
currentWorker:null,
+ setWorkers:null,
+ workers:null,
+ slGroup:null,
}
},
mounted() {
+ this.$socket.open()
+ this.wsSubscribe()
this.initKonvaStage();
},
+ sockets:{},
created(){
window.addEventListener('resize', this.initKonvaStage)
},
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]
+ console.log(123)
+ console.log(item.czbh===data.czbh&&item.pl===data.pl&&item.tlth===data.tlth)
+ if (item.czbh===data.czbh&&item.pl===data.pl&&item.tlth===data.tlth){
+ this.dw[this.currentDwIndex].list.splice(i,1)
+ console.log(this.dw[this.currentDwIndex].list)
+ break
+ }
+ }
+ this.drawBaiFang(this.dw[this.currentDwIndex].list)
+ }
+ })
+ },
initPgd(pgd={}){
const group=this.drawGd(pgd)
this.pgdGroup.add(group)
},
- initBaiFang(index,list){
+ initBaiFang(index,dw){
if (this.slGroup){
this.slGroup.destroyChildren()
}
this.canSl=true
+ this.currentDw=dw
this.currentDwIndex=index
- const {slGroup,handler}= baifang({width:this.width,height:this.height,dw:list})
+ const {slGroup,handler}= baifang({width:this.width,height:this.height,dw:dw.list})
this.slGroup=slGroup
this.drawBaiFang=handler
this.layer.add(slGroup)
@@ -65,6 +93,7 @@ export default {
this.layer.add(group)
+ this.dw=res.data
for (let i=0;i {
- if (this.currentDw&&this.currentDwIndex&&this.currentDw.id===data.dwId) {
+ if (this.currentDw&&this.currentDw.id===data.dwId) {
if (this.slGroup){
this.slGroup.destroyChildren()
}