| | |
| | | <el-collapse-item title="堆垛机" name="2"> |
| | | <div style="overflow-x: auto;white-space: nowrap;"> |
| | | <el-card v-for="(stacker, index) in stackers" :key="index" class="box-card" shadow="hover"> |
| | | <el-switch v-model="stacker.isConn" :inactive-text="`${stacker.text}`"></el-switch> |
| | | <el-switch disabled v-model="stacker.isConn" :inactive-text="`${stacker.text}`"></el-switch> |
| | | </el-card> |
| | | </div> |
| | | </el-collapse-item> |
| | | |
| | | <el-collapse-item title="输送线" name="3"> |
| | | <el-card v-for="(conveyor, index) in conveyors" :key="index" class="box-card" shadow="hover"> |
| | | <el-switch v-model="conveyor.isConn" :inactive-text="`${conveyor.text}`"></el-switch> |
| | | <el-switch disabled v-model="conveyor.isConn" :inactive-text="`${conveyor.text}`"></el-switch> |
| | | </el-card> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { ref, reactive } from 'vue'; |
| | | import { Vue2 } from 'vue-demi'; |
| | | import { ref, reactive, onMounted } from 'vue'; |
| | | import { listStatus } from '/@/api/wcs/wcsPlc'; |
| | | import { signalR } from './signalR'; |
| | | |
| | | |
| | | const state = ref<any>({}); |
| | | const stackers = ref<any>({}); |
| | |
| | | conveyors.value = res.data.result.listPlc.filter(s => s.type == 1 || s.type == 4); |
| | | }; |
| | | 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); |
| | |
| | | |
| | | .grid-container-line { |
| | | display: grid; |
| | | grid-template-columns: repeat(51, 1fr); /* 自适应列宽 */ |
| | | grid-template-rows: 1fr; /* 自适应行高 */ |
| | | grid-template-columns: repeat(51, 1fr); |
| | | /* 自适应列宽 */ |
| | | grid-template-rows: 1fr; |
| | | /* 自适应行高 */ |
| | | gap: 0; |
| | | margin-top: 25px; |
| | | width: 100%; /* 宽度自适应 */ |
| | | height: 1fr; /* 高度自适应 */ |
| | | width: 100%; |
| | | /* 宽度自适应 */ |
| | | height: 1fr; |
| | | /* 高度自适应 */ |
| | | } |
| | | |
| | | .grid-item-line { |
| | |
| | | } |
| | | |
| | | .grid-container { |
| | | margin-top: 10px; |
| | | width: 100%; |
| | | display: grid; |
| | | grid-template-columns: repeat(51, 1fr); |
| | |
| | | /* 每行高度 */ |
| | | gap: 0px; |
| | | /* Gap between cells */ |
| | | margin-top: -20px |
| | | } |
| | | |
| | | .grid-item { |
| | | background-color: #9c9c9c; |
| | | border: 1px solid #797777; |
| | | text-align: center; |
| | | line-height: 1.4vw; /* 行高 */ |
| | | width: 100%; /* 自适应宽度 */ |
| | | height: 100%; /* 自适应高度 */ |
| | | line-height: 1.4vw; |
| | | /* 行高 */ |
| | | width: 100%; |
| | | /* 自适应宽度 */ |
| | | height: 100%; |
| | | /* 自适应高度 */ |
| | | color: #fff; |
| | | font-size: 0.7vw; |
| | | } |