<template>
|
<div class="button-example">
|
<div class="button-row">
|
<el-button type="success" class="elevatorbtn" @click="startElevator()">
|
<span class="text">
|
启动
|
</span>
|
</el-button>
|
<el-button type="danger" class="elevatorbtn" @click="stopElevator()">
|
<span class="text">
|
停止
|
</span>
|
</el-button>
|
<el-button type="warning" class="elevatorbtn" @click="ResetElevator()">
|
<span class="text">
|
复位
|
</span>
|
</el-button>
|
<el-button type="primary" class="elevatorbtn" @click="initialzationElevator()">
|
<span class="text">
|
初始化
|
</span>
|
</el-button>
|
</div>
|
</div>
|
</template>
|
<script>
|
export default {
|
data() {
|
return {
|
show: false
|
}
|
},
|
methods: {
|
startElevator() {
|
this.http.post(`http://localhost:9291/api/Elevator/startElevator`)
|
.then((x) => {
|
if (!x.status) {
|
this.$message.error(x.message)
|
} else {
|
console.log(x);
|
this.show = false
|
this.$Message.success('启动成功')
|
$vue.refresh();
|
}
|
})
|
},
|
stopElevator() {
|
this.http.post(`http://localhost:9291/api/Elevator/stopElevator`)
|
.then((x) => {
|
if (!x.status) {
|
this.$message.error(x.message)
|
} else {
|
console.log(x);
|
this.show = false
|
this.$Message.success('停止成功')
|
$vue.refresh();
|
}
|
})
|
},
|
ResetElevator() {
|
this.http.post(`http://localhost:9291/api/Elevator/ResetElevator`)
|
.then((x) => {
|
if (!x.status) {
|
this.$message.error(x.message)
|
} else {
|
console.log(x);
|
this.show = false
|
this.$Message.success('复位成功')
|
$vue.refresh();
|
}
|
})
|
},
|
initialzationElevator() {
|
this.http.post(`http://localhost:9291/api/Elevator/initialization`)
|
.then((x) => {
|
if (!x.status) {
|
this.$message.error(x.message)
|
} else {
|
console.log(x);
|
this.show = false
|
this.$Message.success('初始化成功')
|
$vue.refresh();
|
}
|
})
|
}
|
}
|
}
|
</script>
|
<style>
|
.elevatorbtn {
|
width: 13rem;
|
height: 7rem;
|
margin-right: 30px;
|
}
|
|
.text {
|
font-size: 50px;
|
}
|
|
.button-example {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
padding-top: 17rem;
|
}
|
</style>
|