| | |
| | | > |
| | | <div v-if="drawerLocNoData!=null"> |
| | | <div style="margin: 10px;"> |
| | | <div style="margin-top: 5px;">排:{{drawerLocNoData.row}}</div> |
| | | <div style="margin-top: 5px;">列:{{drawerLocNoData.bay}}</div> |
| | | <div style="margin-top: 5px;">层:{{drawerLocNoData.lev}}</div> |
| | | <!-- <div style="margin-top: 5px;">排:{{drawerLocNoData.row}}</div>--> |
| | | <!-- <div style="margin-top: 5px;">列:{{drawerLocNoData.bay}}</div>--> |
| | | <!-- <div style="margin-top: 5px;">层:{{drawerLocNoData.lev}}</div>--> |
| | | <div style="margin-top: 5px;">库位号:{{drawerLocNoData.locNo}}</div> |
| | | <div style="margin-top: 5px;">库位状态:{{drawerLocNoData.locSts}}</div> |
| | | </div> |
| | |
| | | let pixiStaMap = new Map(); |
| | | let objectsContainer; |
| | | let objectsContainer3; |
| | | let tracksGraphics; |
| | | let mapRoot; |
| | | let mapContentSize = { width: 0, height: 0 }; |
| | | let graphics0; |
| | |
| | | objectsContainer = new PIXI.Container(); |
| | | mapRoot.addChild(objectsContainer); |
| | | |
| | | tracksGraphics = new PIXI.Graphics(); |
| | | mapRoot.addChild(tracksGraphics); |
| | | |
| | | // 创建一个容器来管理大批量的显示对象 |
| | | objectsContainer3 = new PIXI.Container(); |
| | | mapRoot.addChild(objectsContainer3); |
| | |
| | | pixiStageList = [map.length]//初始化列表 |
| | | pixiStaMap = new Map();//重置 |
| | | objectsContainer.removeChildren() |
| | | if (tracksGraphics) { tracksGraphics.clear(); } |
| | | map.forEach((item,index) => { |
| | | pixiStageList[index] = [item.length] |
| | | for (let idx = 0; idx < item.length; idx++) { |
| | |
| | | const contentW = Math.max(0, maxX - minX); |
| | | const contentH = Math.max(0, maxY - minY); |
| | | mapContentSize = { width: contentW, height: contentH }; |
| | | this.drawTracks(map); |
| | | this.applyMapTransform(true); |
| | | } |
| | | this.map = map; |
| | | }, |
| | | isTrackCell(cell) { |
| | | if (!cell) { return false; } |
| | | const type = cell.type ? String(cell.type).toLowerCase() : ''; |
| | | if (type === 'track' || type === 'crn' || type === 'dualcrn' || type === 'rgv') { return true; } |
| | | if (cell.trackSiteNo != null) { return true; } |
| | | const v = parseInt(cell.value, 10); |
| | | if (v === 3 || v === 9) { return true; } |
| | | if (cell.value != null) { |
| | | try { |
| | | const obj = (typeof cell.value === 'string') ? JSON.parse(cell.value) : cell.value; |
| | | if (obj && (obj.trackSiteNo != null || (obj.deviceNo != null && (type === 'crn' || type === 'dualcrn' || type === 'rgv')))) { |
| | | return true; |
| | | } |
| | | } catch (e) {} |
| | | } |
| | | return false; |
| | | }, |
| | | drawTracks(map) { |
| | | if (!tracksGraphics || !Array.isArray(map)) { return; } |
| | | tracksGraphics.clear(); |
| | | const railColor = 0x6c727a; |
| | | const railWidth = Math.max(1, Math.round(Math.min(width, height) * 0.08)); |
| | | tracksGraphics.lineStyle(railWidth, railColor, 1); |
| | | |
| | | for (let r = 0; r < map.length; r++) { |
| | | const row = map[r]; |
| | | if (!Array.isArray(row)) { continue; } |
| | | for (let c = 0; c < row.length; c++) { |
| | | const cell = row[c]; |
| | | if (!this.isTrackCell(cell)) { continue; } |
| | | const cx = c * width + width / 2; |
| | | const cy = r * height + height / 2; |
| | | const up = (r - 1 >= 0 && Array.isArray(map[r - 1])) ? map[r - 1][c] : null; |
| | | const right = (c + 1 < row.length) ? row[c + 1] : null; |
| | | const down = (r + 1 < map.length && Array.isArray(map[r + 1])) ? map[r + 1][c] : null; |
| | | const left = (c - 1 >= 0) ? row[c - 1] : null; |
| | | const hasN = this.isTrackCell(up); |
| | | const hasE = this.isTrackCell(right); |
| | | const hasS = this.isTrackCell(down); |
| | | const hasW = this.isTrackCell(left); |
| | | const seg = Math.min(width, height) * 0.5; |
| | | let drew = false; |
| | | if (hasN) { tracksGraphics.moveTo(cx, cy); tracksGraphics.lineTo(cx, cy - seg); drew = true; } |
| | | if (hasE) { tracksGraphics.moveTo(cx, cy); tracksGraphics.lineTo(cx + seg, cy); drew = true; } |
| | | if (hasS) { tracksGraphics.moveTo(cx, cy); tracksGraphics.lineTo(cx, cy + seg); drew = true; } |
| | | if (hasW) { tracksGraphics.moveTo(cx, cy); tracksGraphics.lineTo(cx - seg, cy); drew = true; } |
| | | if (!drew) { |
| | | tracksGraphics.moveTo(cx - seg * 0.4, cy); |
| | | tracksGraphics.lineTo(cx + seg * 0.4, cy); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | parseRotation(value) { |
| | | const num = parseInt(value, 10); |
| | |
| | | sprite = new PIXI.Sprite(graphics0); |
| | | } |
| | | sprite.position.set(x, y); |
| | | const type = item && item.type ? String(item.type).toLowerCase() : ''; |
| | | const numVal = parseInt(value, 10); |
| | | const isTrackCell = numVal === 3 || numVal === 9 || type === 'track' || type === 'crn' || type === 'dualcrn' || type === 'rgv'; |
| | | if (!isTrackCell) { |
| | | sprite.interactive = true; // 必须要设置才能接收事件 |
| | | sprite.buttonMode = true; // 让光标在hover时变为手型指针 |
| | | |
| | | sprite.on('pointerdown', (e) => { |
| | | pointerDownEvent(e) |
| | | }) |
| | | } |
| | | |
| | | return sprite; |
| | | } |