diff --git a/src/assets/sb/xc1.png b/src/assets/sb/xc1.png new file mode 100644 index 0000000..0b836d3 Binary files /dev/null and b/src/assets/sb/xc1.png differ diff --git a/src/assets/sb/xc2.png b/src/assets/sb/xc2.png new file mode 100644 index 0000000..b1ad43a Binary files /dev/null and b/src/assets/sb/xc2.png differ diff --git a/src/views/zyjhzx/hxianfkui/comps/HxianPgd.vue b/src/views/zyjhzx/hxianfkui/comps/HxianPgd.vue index 9d1752a..69332b6 100644 --- a/src/views/zyjhzx/hxianfkui/comps/HxianPgd.vue +++ b/src/views/zyjhzx/hxianfkui/comps/HxianPgd.vue @@ -15,6 +15,10 @@ export default { type:Function, default:function (){} }, + getSelectSbbm:{ + type:Function, + default:function (){} + }, workers:{ type:Array, default:[] @@ -37,6 +41,12 @@ export default { if (this.deviceId!==data.msg.deviceId&&data.msg.actionType!=='开始报工'){ return } + const sbbm=this.$props.getSelectSbbm() + if (!sbbm){ + this.$message.warning('请选择设备') + this.$refs.hxPgd.clearCheckboxRow() + return + } //工单号尾号长度 const djhWhLengh=4 const tmpList=this.list.filter(item=>item.djh===data.msg.orderNumber||item.djh.slice(-djhWhLengh)===data.msg.orderNumber) @@ -52,7 +62,8 @@ export default { const tmpArr=[{ id:item.id, hxfkry:this.$props.worker().userCode, - zt:item.zt + zt:item.zt, + hxsb:sbbm }] this.baogong(tmpArr,item) errorFlag=false @@ -125,6 +136,12 @@ export default { }) }, fankgui(worker) { + const sbbm=this.$props.getSelectSbbm() + if (!sbbm){ + this.$message.warning('请选择设备') + this.$refs.hxPgd.clearCheckboxRow() + return + } VXETable.modal.confirm('您确定报工吗?').then(async res => { if (res === 'confirm') { const list = this.$refs.hxPgd.getCheckboxRecords() @@ -133,7 +150,8 @@ export default { const data = { id: item.id, hxfkry: worker.userCode, - zt:item.zt + zt:item.zt, + hxsb:sbbm } tmpArr.push(data) let ycldwInfo=null @@ -157,7 +175,6 @@ export default { this.initData(this.$props.worker().userCode, '51') } }) - }, initData(worker,zt){ getDw({type:'llj'}).then(res=>{ diff --git a/src/views/zyjhzx/hxianfkui/comps/sb.js b/src/views/zyjhzx/hxianfkui/comps/sb.js index 13dab91..868c2e0 100644 --- a/src/views/zyjhzx/hxianfkui/comps/sb.js +++ b/src/views/zyjhzx/hxianfkui/comps/sb.js @@ -24,18 +24,86 @@ export default function (width,height){ shape.zIndex(0) } - const text=new Konva.Text({ - x: 0, - y: 0, - width: _width, - height:_height, - fill:'white', - text:'划线设备', - align:'center', - verticalAlign:'middle', - }) + const sbList=[ + {name:"划线设备1",sbbm:'1'}, + {name:"划线设备2",sbbm:'2'}, + {name:"划线设备3",sbbm:'3'}, + {name:"划线设备4",sbbm:'4'}, + ] + let selectedShape=null; + let selectSbbm=null; + const getSelectSbbm=function (){ + return selectSbbm + } + sbList.forEach((item,index)=>{ + const sbGroup=new Konva.Group({ + x: 5, + y: 5+index*_height/4-10, + width: _width-10, + height:_height/4-10, + }) + + sbGroup.on('click touchstart',function (){ + selected() + }) - container.add(text) + 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.15, + y: 10, + width: _width*0.12, + height:_width*0.12, + image: this, + visible:false + }); + sbGroup.add(shape) + setSelectShape(shape) + } + + function selected(){ + if (selectedShape){ + selectedShape.hide() + if (selectedShape===selectShape){ + selectedShape=null + return + } + } + selectSbbm=item.sbbm + selectedShape=selectShape + selectedShape.show() + } + + const sb = new Image(); + sb.src = require('@/assets/sb/xc2.png'); + sb.onload = function () { + const shape = new Konva.Image({ + x: 0, + y: 0, + width: _width-10, + height:_height/4-10, + image: this, + }); + const text=new Konva.Text({ + x: 0, + y: 0, + width: _width/4, + height:_height/8-40, + fill:'white', + text:item.name, + align:'center', + verticalAlign:'middle', + }) + sbGroup.add(text) + sbGroup.add(shape) + container.add(sbGroup) + } + }) - return container + return {container,getSelectSbbm} } diff --git a/src/views/zyjhzx/hxianfkui/index.vue b/src/views/zyjhzx/hxianfkui/index.vue index 9c6f82e..f7c400f 100644 --- a/src/views/zyjhzx/hxianfkui/index.vue +++ b/src/views/zyjhzx/hxianfkui/index.vue @@ -1,7 +1,7 @@