29 lines
832 B
Vue
29 lines
832 B
Vue
<script setup lang="ts">
|
||
import { ref } from "vue"
|
||
import { controlSwitch } from "../api/platform"
|
||
|
||
defineProps<{ store: any; actions: any }>()
|
||
|
||
const channel = ref(1)
|
||
const result = ref("等待下发")
|
||
|
||
async function sendControl(action: number) {
|
||
const response = await controlSwitch(channel.value, action)
|
||
result.value = response.data.control_status
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<section class="panel">
|
||
<h2>控制指令</h2>
|
||
<div class="form-grid">
|
||
<label>开关通道<input v-model="channel" type="number" min="1" max="12" /></label>
|
||
</div>
|
||
<div class="actions">
|
||
<button class="primary" @click="sendControl(1)">合闸</button>
|
||
<button class="primary" @click="sendControl(0)">分闸</button>
|
||
</div>
|
||
<p>执行结果:{{ result }}</p>
|
||
</section>
|
||
</template>
|