From 2cc22f4f7e99e9c1b1d51034f6d61a965b1f2833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=93=B2=E5=A5=87?= <13840175730@139.com> Date: Sat, 7 Sep 2024 17:29:32 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AE=8C=E5=96=84=E6=8A=9B=E4=B8=B8=E5=8F=8D?= =?UTF-8?q?=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/pwan/gbSelectBg.png | Bin 0 -> 3268 bytes src/views/zyjhzx/pwanfkui/comps/PwanPgd.vue | 11 +++- src/views/zyjhzx/pwanfkui/comps/baifang.js | 65 ++++++++++++++++---- src/views/zyjhzx/pwanfkui/comps/csd.js | 2 +- src/views/zyjhzx/pwanfkui/comps/dw.js | 32 +++++++++- src/views/zyjhzx/pwanfkui/comps/person.js | 5 +- src/views/zyjhzx/pwanfkui/comps/pgd.js | 19 +++++- src/views/zyjhzx/pwanfkui/comps/pgdTable.js | 30 +++++++-- src/views/zyjhzx/pwanfkui/index.vue | 48 ++++++++++++--- src/views/zyjhzx/pwanpgong/comps/pgd.js | 20 +++++- src/views/zyjhzx/pwanpgong/index.vue | 9 ++- src/views/zyjhzx/sliao/comps/liliao.js | 30 +++++++++ src/views/zyjhzx/sliao/index.vue | 2 +- 13 files changed, 232 insertions(+), 41 deletions(-) create mode 100644 src/assets/pwan/gbSelectBg.png diff --git a/src/assets/pwan/gbSelectBg.png b/src/assets/pwan/gbSelectBg.png new file mode 100644 index 0000000000000000000000000000000000000000..0cb78786258ea3bd83e2d733c805248cec6ecf0f GIT binary patch literal 3268 zcmcInc~Fx_6#o(fhH&IlIVuMEG(Z6X$Cg0k3}-loJAg$HJg9(BP)Zo{(999Viw0K02ict}fZp2XC?SHkiGs#Zg?t8!Yd%u0V`7t<< zugx%IU>K(D>*E=UVYHoKoZJa(r0m?)rm!Izb8}?>s=Z#*&N)P?k92OqcgHlJc$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/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() }