From 5d32cc38216aef0ef636e1db4359460137c2d521 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 4 Feb 2025 17:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91IoT=EF=BC=9Aplugin=20=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/iot/plugin/detail/index.vue | 16 ++++++++++++---- src/views/iot/plugin/index.vue | 6 ++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/views/iot/plugin/detail/index.vue b/src/views/iot/plugin/detail/index.vue index b5f69e6d..f91e19d5 100644 --- a/src/views/iot/plugin/detail/index.vue +++ b/src/views/iot/plugin/detail/index.vue @@ -33,13 +33,19 @@ + 上传插件包 + + + + + import { PluginInfoApi, PluginInfoVO } from '@/api/iot/plugininfo' import { useRoute } from 'vue-router' -import { ref, onMounted } from 'vue' +import { onMounted, ref } from 'vue' import PluginImportForm from './PluginImportForm.vue' const message = useMessage() @@ -70,6 +76,7 @@ const pluginInfo = ref({ config: '', script: '' }) +// TODO @haohao:这里可以改成 pluginInfo.id > 0 去判断,然后 handleStatusChange disable 按钮 const isInitialLoad = ref(true) // 初始化标志位 onMounted(() => { @@ -81,9 +88,9 @@ onMounted(() => { } }) +/** 获取插件详情 */ const getPluginInfo = async (id: number) => { - const data = await PluginInfoApi.getPluginInfo(id) - pluginInfo.value = data + pluginInfo.value = await PluginInfoApi.getPluginInfo(id) } /** 处理状态变更 */ @@ -100,7 +107,8 @@ const handleStatusChange = async (status: number) => { status }) message.success('更新状态成功') - getPluginInfo(Number(pluginInfo.value.id)) + // 获取详情 + await getPluginInfo(pluginInfo.value.id) } catch (error) { pluginInfo.value.status = status === 1 ? 0 : 1 message.error('更新状态失败') diff --git a/src/views/iot/plugin/index.vue b/src/views/iot/plugin/index.vue index aae5c589..fb0d1270 100644 --- a/src/views/iot/plugin/index.vue +++ b/src/views/iot/plugin/index.vue @@ -1,3 +1,4 @@ +