1.修复上料后选中垛位不显示选中状态的问题

2.修复倒剁bug
master
董哲奇 5 months ago
parent 410ba59ccc
commit 066bc376e8

@ -97,7 +97,7 @@ Object.keys(filters).forEach(key => {
}) })
Vue.use(new VueSocketIO({ Vue.use(new VueSocketIO({
debug: true, debug: false,
connection: process.env.VUE_APP_WEBSOCKET, // connection: process.env.VUE_APP_WEBSOCKET, //
options: { autoConnect:false,path: "",transports: ['websocket', 'xhr-polling', 'jsonp-polling'], } //Optional options options: { autoConnect:false,path: "",transports: ['websocket', 'xhr-polling', 'jsonp-polling'], } //Optional options
})) }))

@ -78,7 +78,7 @@ const baifang=function (option={}) {
if(_index===0){ if(_index===0){
_index=this.getAttr('index') _index=this.getAttr('index')
} }
this.zIndex(4) this.zIndex(slList.length-1)
const {y:thisY}=this.absolutePosition() const {y:thisY}=this.absolutePosition()
const dir=thisY-this.startPos.y>0?-40:40 const dir=thisY-this.startPos.y>0?-40:40
@ -95,6 +95,7 @@ const baifang=function (option={}) {
if (thisY>=thatY&&thisY<=thatY+40&&moveDir!==dir){ if (thisY>=thatY&&thisY<=thatY+40&&moveDir!==dir){
child.setAttr('moveDir',dir); child.setAttr('moveDir',dir);
_index+=dir>0?1:-1 _index+=dir>0?1:-1
child.move({ child.move({
y:dir y:dir
}) })
@ -102,7 +103,7 @@ const baifang=function (option={}) {
if (movedIndex===-1){ if (movedIndex===-1){
movedList.push(child) movedList.push(child)
}else { }else {
slList.splice(movedIndex, 1); movedList.splice(movedIndex, 1);
movedList.push(child) movedList.push(child)
} }
this.startPos={ this.startPos={
@ -128,11 +129,11 @@ const baifang=function (option={}) {
duo:item.dwId, duo:item.dwId,
movedList:mList movedList:mList
} }
console.log(_index)
// const element = slList.splice(index-1, 1)[0]; // const element = slList.splice(index-1, 1)[0];
// slList.splice(_index-1, 0, element); // slList.splice(_index-1, 0, element);
// this.setAttr('index',_index) // this.setAttr('index',_index)
// _index=0 // _index=0
// handler(slList)
daoduo(data).then(res=>{ daoduo(data).then(res=>{
if (res.success){ if (res.success){
const element = slList.splice(index-1, 1)[0]; const element = slList.splice(index-1, 1)[0];
@ -208,6 +209,7 @@ const baifang=function (option={}) {
} }
function handler(slList){ function handler(slList){
console.log(slList)
slGroup.destroyChildren() slGroup.destroyChildren()
for (let i = 1; i <= slList.length; i++) { for (let i = 1; i <= slList.length; i++) {
const item=slList[i-1] const item=slList[i-1]

@ -1,5 +1,7 @@
import Konva from "konva"; import Konva from "konva";
let selectIndex=null
const liliao=function (width,height,dw,callback) { const liliao=function (width,height,dw,callback) {
const _width=width*0.4,_height=height*0.715 const _width=width*0.4,_height=height*0.715
@ -54,10 +56,6 @@ const liliao=function (width,height,dw,callback) {
let selectedShape=null; let selectedShape=null;
const getSelectedShape=function (){
return selectedShape;
}
const duowei=function (index,item){ const duowei=function (index,item){
const alignSize=3 const alignSize=3
const width=((_width-60)/alignSize),height=208 const width=((_width-60)/alignSize),height=208
@ -80,6 +78,7 @@ const liliao=function (width,height,dw,callback) {
selectedShape=selectShape selectedShape=selectShape
selectedShape.show() selectedShape.show()
currentDw=item currentDw=item
selectIndex=index
callback(index,dw[index]) callback(index,dw[index])
}) })
@ -116,6 +115,9 @@ const liliao=function (width,height,dw,callback) {
group.add(shape) group.add(shape)
shape.zIndex(0) shape.zIndex(0)
setSelectShape(shape) setSelectShape(shape)
if (selectIndex===index){
shape.show()
}
} }
const text=new Konva.Text({ const text=new Konva.Text({
@ -135,7 +137,7 @@ const liliao=function (width,height,dw,callback) {
} }
return { return {
container,duowei,getCurrentDw,getSelectedShape container,duowei,getCurrentDw
} }
} }

@ -36,7 +36,6 @@ export default {
sljhGroup:null, sljhGroup:null,
drawBaiFang:null, drawBaiFang:null,
ycldwGroup:null, ycldwGroup:null,
getSelectedShape:null,
canSl:false, canSl:false,
workerGroup:null, workerGroup:null,
getCurrentWorker:null, getCurrentWorker:null,
@ -498,9 +497,8 @@ export default {
this.ycldwGroup.destroyChildren() this.ycldwGroup.destroyChildren()
} }
this.dw=res.data this.dw=res.data
const {container,getCurrentDw,getSelectedShape}= liliao(this.width,this.height,this.dw,this.initDwInfo) const {container,getCurrentDw}= liliao(this.width,this.height,this.dw,this.initDwInfo)
const group=container() const group=container()
this.getSelectedShape=getSelectedShape
this.ycldwGroup=group this.ycldwGroup=group
this.layer.add(group) this.layer.add(group)
}) })
@ -541,7 +539,7 @@ export default {
const {group}=initSearch() const {group}=initSearch()
this.layer.add(group) this.layer.add(group)
this.search(this.$refs.sliaoSearch.getQueryParam()) //this.search(this.$refs.sliaoSearch.getQueryParam())
const {layer:sljhLayer,group:sljhGroup}=sljh(this.width,this.height) const {layer:sljhLayer,group:sljhGroup}=sljh(this.width,this.height)
this.sljhGroup=sljhGroup this.sljhGroup=sljhGroup

Loading…
Cancel
Save