| | |
| | | adjustedRectsa.value = data.waitingGlass[0].map(rect => { |
| | | let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta; |
| | | if (rect.angle === 90) { |
| | | adjustedWidth = rect.height * 0.4; |
| | | adjustedHeight = rect.width * 0.4; |
| | | adjustedWidtha = rect.height; |
| | | adjustedHeighta = rect.width; |
| | | } else { |
| | | adjustedWidth = rect.width * 0.4; |
| | | adjustedHeight = rect.height * 0.4; |
| | | adjustedWidth = rect.width * 0.27; |
| | | adjustedHeight = rect.height * 0.2; |
| | | adjustedWidtha = rect.width; |
| | | adjustedHeighta = rect.height; |
| | | } else { |
| | | adjustedWidth = rect.height * 0.27; |
| | | adjustedHeight = rect.width * 0.2; |
| | | adjustedWidtha = rect.height; |
| | | adjustedHeighta = rect.width; |
| | | } |
| | | return { |
| | | ...rect, |
| | | x: rect.xCoordinate * 0.4, |
| | | y: rect.yCoordinate * 0.4, |
| | | x: rect.yCoordinate * 0.27, |
| | | y: rect.xCoordinate * 0.2, |
| | | width: adjustedWidth, |
| | | height: adjustedHeight, |
| | | widtha: adjustedWidtha, |
| | |
| | | adjustedRectsb.value = data.outGlass[0].map(rect => { |
| | | let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta; |
| | | if (rect.angle === 90) { |
| | | adjustedWidth = rect.height * 0.4; |
| | | adjustedHeight = rect.width * 0.4; |
| | | adjustedWidtha = rect.height; |
| | | adjustedHeighta = rect.width; |
| | | } else { |
| | | adjustedWidth = rect.width * 0.4; |
| | | adjustedHeight = rect.height * 0.4; |
| | | adjustedWidtha = rect.width; |
| | | adjustedHeighta = rect.height; |
| | | } else { |
| | | adjustedWidth = rect.height * 0.4; |
| | | adjustedHeight = rect.width * 0.4; |
| | | adjustedWidtha = rect.height; |
| | | adjustedHeighta = rect.width; |
| | | } |
| | | return { |
| | | ...rect, // 复制原始对象的其他属性 |
| | | x: rect.xCoordinate * 0.4, |
| | | y: rect.yCoordinate * 0.4, |
| | | x: rect.yCoordinate * 0.4, |
| | | y: rect.xCoordinate * 0.4, |
| | | width: adjustedWidth, |
| | | height: adjustedHeight, |
| | | widtha: adjustedWidtha, |
| | |
| | | onMounted(() => { |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | function getRectColor(state) { |
| | | switch (state) { |
| | | case 0: |
| | | return '#f8e3c5'; |
| | | case 1: |
| | | return '#d1edc4'; |
| | | case -1: |
| | | return '#dedfe0'; |
| | | } |
| | | } |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | |
| | | <div v-if="adjustedRectsa.length > 0"> |
| | | <div style="text-align: center;">流程卡: {{ adjustedRectsa[0].flowCardId }}</div> |
| | | <el-scrollbar height="550px"> |
| | | <div style="position: relative;width: 100%;height: 100%;"> |
| | | <div style="position: relative;width: 1400px;"> |
| | | <div |
| | | v-for="(rect, index) in adjustedRectsa" |
| | | :key="index" |
| | | class="rect" |
| | | :style="{ position: 'absolute', top: `${rect.y}px`, left: `${rect.x}px`, |
| | | width: `${rect.width}px`, height: `${rect.height}px`, |
| | | backgroundColor: rect.state === 0 ? '#dedfe0' : '#d1edc4' }"> |
| | | backgroundColor: getRectColor(rect.state) }"> |
| | | <div class="centered-text"> |
| | | <div>{{ rect.glassId }}</div> |
| | | <div style="margin-top: 50px;margin-left: -85px;">{{ rect.widtha }}*{{ rect.heighta }}</div> |