diff --git a/src/api/zyjh.js b/src/api/zyjh.js index c3d9e26..91e05fc 100644 --- a/src/api/zyjh.js +++ b/src/api/zyjh.js @@ -112,6 +112,14 @@ export const getPgd=function(data){ }) } +export const shangLiaos=function(data){ + return request({ + url: '/zyjh/sls', + method: 'post', + data: data + }) +} + export const shangLiao=function(data){ return request({ url: '/zyjh/sl', diff --git a/src/views/zyjhzx/components/TipsComp.vue b/src/views/zyjhzx/components/TipsComp.vue index 0fffce3..3d94153 100644 --- a/src/views/zyjhzx/components/TipsComp.vue +++ b/src/views/zyjhzx/components/TipsComp.vue @@ -50,7 +50,7 @@ export default { // },10000) // } let msg - if (data.success&&data.data.deviceId===this.deviceId){ + if (data?.success&&data?.data?.deviceId===this.deviceId){ msg=`处理成功` } diff --git a/src/views/zyjhzx/sliao/comps/baifang.js b/src/views/zyjhzx/sliao/comps/baifang.js index bda07ec..d296af6 100644 --- a/src/views/zyjhzx/sliao/comps/baifang.js +++ b/src/views/zyjhzx/sliao/comps/baifang.js @@ -209,7 +209,6 @@ const baifang=function (option={}) { } function handler(slList){ - console.log(slList) slGroup.destroyChildren() for (let i = 1; i <= slList.length; i++) { const item=slList[i-1] diff --git a/src/views/zyjhzx/sliao/comps/liliao.js b/src/views/zyjhzx/sliao/comps/liliao.js index 83fdc66..a623340 100644 --- a/src/views/zyjhzx/sliao/comps/liliao.js +++ b/src/views/zyjhzx/sliao/comps/liliao.js @@ -55,6 +55,14 @@ const liliao=function (width,height,dw,callback) { } let selectedShape=null; + const getSelectShape=function (){ + return selectedShape + } + + const nonSelectShape=function (){ + selectedShape.hide() + selectedShape=null + } const duowei=function (index,item){ const alignSize=3 @@ -116,6 +124,7 @@ const liliao=function (width,height,dw,callback) { shape.zIndex(0) setSelectShape(shape) if (selectIndex===index){ + selectedShape=shape shape.show() } } @@ -137,7 +146,7 @@ const liliao=function (width,height,dw,callback) { } return { - container,duowei,getCurrentDw + container,duowei,getCurrentDw,getSelectShape,nonSelectShape } } diff --git a/src/views/zyjhzx/sliao/index.vue b/src/views/zyjhzx/sliao/index.vue index 3de10fb..e763eec 100644 --- a/src/views/zyjhzx/sliao/index.vue +++ b/src/views/zyjhzx/sliao/index.vue @@ -17,7 +17,7 @@ import workers from "@/views/zyjhzx/sliao/comps/person"; import SliaoSearch from "@/views/zyjhzx/components/SliaoSearch.vue"; import liliao from "@/views/zyjhzx/sliao/comps/liliao"; import baifang from "@/views/zyjhzx/sliao/comps/baifang"; -import {dict, getBzryByBz, getSljhPgd, getYcldw, shangLiao} from "@/api/zyjh"; +import {dict, getBzryByBz, getSljhPgd, getYcldw, shangLiao, shangLiaos} from "@/api/zyjh"; import {getBzryList} from "@/api/sjzx/bzzGL"; import TipsComp from "@/views/zyjhzx/components/TipsComp.vue"; import ZyjhSelectComp from "@/views/zyjhzx/components/SelectComp.vue"; @@ -50,6 +50,11 @@ export default { msg:null, tipsId:null, llist:[], + selectedJh:[], + plslflag:false, + plslList:[], + getSelectShape:null, + nonSelectShape:null, } }, mounted() { @@ -143,6 +148,10 @@ export default { }, wsSubscribe(){ this.sockets.subscribe('slComplete', data => { + if(this.plslflag){ + this.plslList.push(data) + return + } console.log(data) if (this.currentDw&&this.currentDw.id===data.dwId) { if (this.slGroup){ @@ -177,7 +186,63 @@ export default { this.canSl=true this.currentDw=dw this.currentDwIndex=index - !!dw&&this.drawBaiFang(dw.list) + if (this.selectedJh.length>0){ + this.plslflag=true + const jh=[] + this.selectedJh.forEach(item=>{ + const data={ + ydjh:item, + ydid:item.id, + dwId:dw.id, + ceng:dw.list.length+1, + czbh:item.dcCh, + pl:item.dcPl, + fd:item.dcFd, + kw:item.kw, + zl:item.zl, + tlth:item.tzbh, + wph:item.wpxh, + wpgg:item.wpgg, + sljhrq:item.sljhrq, + qgjhrq:item.qgjhrq, + wlh:item.slwlh, + lph:item.sllph, + nbsbm:item.nbsbm, + bfr:this.getCurrentWorker()?.userCode, + type:'YCL' + } + jh.push(data) + }) + + shangLiaos(jh).then(res=>{ + this.selectedJh=[] + this.plslflag=false + if (!res.success){ + this.drawSljhItem(this.sljhItemList.r('0:200')) + return; + } + if (this.slGroup){ + this.slGroup.destroyChildren() + } + for (const data of this.plslList) { + if (this.currentDw&&this.currentDw.id===data.dwId) { + this.dw[this.currentDwIndex].list.push(data) + }else { + this.dw[data.dwId].list.push(data) + } + this.sljhItemList.forEach((sljh,index)=>{ + if(data.czbh===sljh.dcCh&&data.pl===sljh.dcPl&&data.tlth===sljh.tzbh){ + this.$delete(this.sljhItemList, index); + } + }) + this.drawSljhItem(this.sljhItemList.r('0:200')) + } + this.drawBaiFang(this.dw[this.currentDwIndex].list) + this.initYcldw(); + }) + }else{ + !!dw&&this.drawBaiFang(dw.list) + } }, initBaiFang(){ const {slGroup,handler,bgGroup:slBgGroup}= baifang({width:this.width,height:this.height}) @@ -206,6 +271,48 @@ export default { }) qyGroup.setAttr('index',i) qyGroup.setAttr('item',item) + + let selectShape=null + let selectedShape=null; + const setSelectShape=function (shape){ + selectShape=shape + } + + const _that=this + qyGroup.on('click touchstart',function (){ + if (_that.currentDw){ + _that.currentDw=null + _that.currentDwIndex=null + _that.nonSelectShape() + } + + if (selectedShape){ + selectedShape.hide() + selectedShape=null + _that.selectedJh=_that.selectedJh.filter(it=>it.dcCh!==item.dcCh&&it.dcPl!==item.dcPl&&it.tzbh!==item.tzbh) + return; + } + selectedShape=selectShape + selectedShape.show() + _that.selectedJh.push(item) + }) + + const selectObj = new Image(); + selectObj.src = require('@/assets/sliao/selected.png'); + selectObj.onload = function () { + const shape = new Konva.Image({ + x: itemWith-itemWith*0.30, + y: 4, + width: itemWith*0.25, + height:itemWith*0.25, + image: this, + visible:false + }); + qyGroup.add(shape) + shape.zIndex(0) + setSelectShape(shape) + } + this.sljhGroup.add(qyGroup) const imageObj = new Image(); @@ -534,8 +641,10 @@ export default { this.ycldwGroup.destroyChildren() } this.dw=res.data - const {container,getCurrentDw}= liliao(this.width,this.height,this.dw,this.initDwInfo) + const {container,getCurrentDw,getSelectShape,nonSelectShape}= liliao(this.width,this.height,this.dw,this.initDwInfo) const group=container() + this.getSelectShape=getSelectShape + this.nonSelectShape=nonSelectShape this.ycldwGroup=group this.layer.add(group) })