| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { ref, reactive } from 'vue'; |
| | | import { ref, reactive,onMounted } from 'vue'; |
| | | import { listStatus } from '/@/api/wcs/wcsPlc'; |
| | | import { signalR } from './signalR'; |
| | | |
| | | const state = ref<any>({}); |
| | | const stackers = ref<any>({}); |
| | |
| | | }; |
| | | handleQuery(); |
| | | |
| | | //连接signalR 监听变更 |
| | | onMounted(async () => { |
| | | signalR.off('PublicPlcConn'); |
| | | signalR.on('PublicPlcConn', (data: any) => { |
| | | console.log(data) |
| | | if (data.type === 0) { |
| | | // 替换 stackers 中的相应项 |
| | | const index = stackers.value.findIndex(item => item.id === data.id); |
| | | if (index !== -1) { |
| | | stackers.value[index] = data; |
| | | } |
| | | } else if (data.type === 1 || data.type === 4) { |
| | | // 替换 conveyors 中的相应项 |
| | | const index = conveyors.value.findIndex(item => item.id === data.id); |
| | | if (index !== -1) { |
| | | conveyors.value[index] = data; |
| | | } |
| | | } |
| | | console.log(stackers.value[0].isConn) |
| | | }); |
| | | }); |
| | | |
| | | const activeName = ['1', '2', '3']; |
| | | const value1 = ref(false); |
| | | const value2 = ref(false); |