【代码评审】IoT:设备配置的评审

This commit is contained in:
YunaiV 2025-02-11 09:54:18 +08:00
parent 107ee7bebf
commit f7b97d344e

View File

@ -1,13 +1,15 @@
<!-- 设备配置 -->
<template>
<div>
<el-alert
title="IoT平台支持远程更新设备的配置文件(SON格式)可以在下方编辑配置模板,对设备的系统参数、网络参数等进行远程配置,通过批量更新对设备进行批量远程维护和管理。"
title="支持远程更新设备的配置文件(JSON 格式),可以在下方编辑配置模板,对设备的系统参数、网络参数等进行远程配置。配置完成后,需点击「下发」按钮,设备即可进行远程配置。"
type="info"
show-icon
class="my-4"
description="如需编辑文件,请点击下方编辑按钮"
/>
<!-- JSON 编辑器读模式 -->
<Vue3Jsoneditor
ref="editor"
v-if="isEditing"
@ -17,6 +19,7 @@
currentMode="code"
@error="onError"
/>
<!-- JSON 编辑器写模式 -->
<Vue3Jsoneditor
ref="editor"
v-else
@ -35,53 +38,49 @@
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue';
import Vue3Jsoneditor from 'v3-jsoneditor/src/Vue3Jsoneditor.vue';
import { ref, computed } from 'vue'
import Vue3Jsoneditor from 'v3-jsoneditor/src/Vue3Jsoneditor.vue'
//
const deviceConfig = ref({
"name": "dyla1n"
});
//
const isEditing = ref(false);
// JSON
name: 'dyla1n'
}) // TODO @dylan
const isEditing = ref(false) //
const editorOptions = computed(() => ({
mainMenuBar: false,
navigationBar: false,
statusBar: false,
}));
statusBar: false
})) // JSON
//
/** 启用编辑模式的函数 */
const enableEdit = () => {
isEditing.value = true;
};
isEditing.value = true
}
//
/** 取消编辑的函数 */
const cancelEdit = () => {
isEditing.value = false;
isEditing.value = false
//
console.log('取消编辑');
};
console.log('取消编辑')
}
//
/** 保存配置的函数 */
const saveConfig = () => {
isEditing.value = false;
isEditing.value = false
//
console.log('保存配置');
};
console.log('保存配置')
}
// JSON
/** 处理 JSON 编辑器错误的函数 */
const onError = (e: any) => {
console.log('onError', e);
};
console.log('onError', e)
}
</script>
<!-- TODO dylan建议使用 unocss 替代哈AI 模型友好 -->
<style scoped>
.button-group {
display: flex;
justify-content: center;
margin-top: 20px;
}
</style>
</style>