<template>
|
<el-row :gutter="10">
|
<el-col :span="12">
|
<el-collapse v-model="activeNames">
|
<el-collapse-item title="仓库一层" name="1">
|
<el-card class="box-card" shadow="hover">
|
<el-text style="margin-right: 15px;">1号穿梭车</el-text>
|
<el-text style="margin-right: 15px;">电量:{{carDL1}}</el-text>
|
<el-button @click="write('ShuttleCar', '1', '41093', '1')">复位</el-button>
|
<el-button @click="write('ShuttleCar', '1', '41096', '1')">正向寻码</el-button>
|
<el-button @click="write('ShuttleCar', '1', '41096', '2')">反向寻码</el-button>
|
|
</el-card>
|
<el-card class="box-card" shadow="hover">
|
<el-text style="margin-right: 15px;">2号穿梭车</el-text>
|
<el-text style="margin-right: 15px;">电量:{{carDL2}}</el-text>
|
<el-button @click="write('ShuttleCar', '2', '41093', '1')">复位</el-button>
|
<el-button @click="write('ShuttleCar', '2', '41096', '1')">正向寻码</el-button>
|
<el-button @click="write('ShuttleCar', '2', '41096', '2')">反向寻码</el-button>
|
</el-card>
|
</el-collapse-item>
|
</el-collapse>
|
</el-col>
|
|
<el-col :span="12">
|
<el-collapse v-model="activeNames2">
|
<el-collapse-item title="仓库二层" name="2">
|
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
|
<el-text style="margin-right: 15px;">卷帘门2</el-text>
|
<el-button @click="writeUp('Shutter', '2')">打开</el-button>
|
<el-button @click="writeDown('Shutter', '2')">关闭</el-button>
|
</el-card>
|
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
|
<el-text style="margin-right: 15px;">卷帘门3</el-text>
|
<el-button @click="writeUp('Shutter', '3')">打开</el-button>
|
<el-button @click="writeDown('Shutter', '3')">关闭</el-button>
|
</el-card>
|
</el-collapse-item>
|
</el-collapse>
|
</el-col>
|
|
</el-row>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
import { listStatus, listPosition } from '/@/api/wcs/wcsPlc';
|
import { WriteStartStop,GetCarDL } from '/@/api/wcs/wcsDevice';
|
import { ElMessage } from "element-plus";
|
|
const carDL1= ref<any>({});
|
carDL1.value="获取中..";
|
const carDL2= ref<any>({});
|
carDL2.value="获取中..";
|
const activeNames = ref(['1'])
|
const activeNames2 = ref(['2'])
|
const state = ref<any>({});
|
const handleQuery = async () => {
|
var resCar = await GetCarDL();
|
if (resCar.data.result._dicList && resCar.data.result._dicList.length > 0) {
|
resCar.data.result._dicList.forEach(car => {
|
const name = Object.keys(car)[0];
|
if(name=="穿梭车1"){
|
carDL1.value=car[name]+"%";
|
}
|
if(name=="穿梭车2"){
|
carDL2.value=car[name]+"%";
|
}
|
});
|
}
|
};
|
handleQuery();
|
|
|
const write = async (type: string, no: string, layer: string, FuncName: string) => {
|
|
var data = {
|
Type: type,
|
No: no,
|
Layer: layer,
|
FuncName: FuncName
|
};
|
var res = await WriteStartStop(data);
|
console.log(res.data.result);
|
// ElMessage.success(res.data.result);
|
}
|
const writeDown = async (type: string, layer: string) => {
|
|
var data = {
|
Type: type,
|
Layer: layer,
|
FuncName: "Down"
|
}
|
var res = await WriteStartStop(data);
|
}
|
const writeUp = async (type: string, layer: string) => {
|
|
var data = {
|
Type: type,
|
Layer: layer,
|
FuncName: "Up"
|
}
|
var res = await WriteStartStop(data);
|
}
|
|
</script>
|
|
<style scoped>
|
.layout-parent>div:first-child {
|
flex-direction: row;
|
}
|
</style>
|