Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f7b97d34
authored
Feb 11, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码评审】IoT:设备配置的评审
parent
107ee7be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
27 deletions
+26
-27
src/views/iot/device/device/detail/DeviceDetailConfig.vue
+26
-27
No files found.
src/views/iot/device/device/detail/DeviceDetailConfig.vue
View file @
f7b97d34
<!-- 设备配置 -->
<
template
>
<
template
>
<div>
<div>
<el-alert
<el-alert
title=
"
IoT平台支持远程更新设备的配置文件(SON格式),您可以在下方编辑配置模板,对设备的系统参数、网络参数等进行远程配置,通过批量更新对设备进行批量远程维护和管理
。"
title=
"
支持远程更新设备的配置文件(JSON 格式),可以在下方编辑配置模板,对设备的系统参数、网络参数等进行远程配置。配置完成后,需点击「下发」按钮,设备即可进行远程配置
。"
type=
"info"
type=
"info"
show-icon
show-icon
class=
"my-4"
class=
"my-4"
description=
"如需编辑文件,请点击下方编辑按钮"
description=
"如需编辑文件,请点击下方编辑按钮"
/>
/>
<!-- JSON 编辑器:读模式 -->
<Vue3Jsoneditor
<Vue3Jsoneditor
ref=
"editor"
ref=
"editor"
v-if=
"isEditing"
v-if=
"isEditing"
...
@@ -17,6 +19,7 @@
...
@@ -17,6 +19,7 @@
currentMode=
"code"
currentMode=
"code"
@
error=
"onError"
@
error=
"onError"
/>
/>
<!-- JSON 编辑器:写模式 -->
<Vue3Jsoneditor
<Vue3Jsoneditor
ref=
"editor"
ref=
"editor"
v-else
v-else
...
@@ -35,49 +38,45 @@
...
@@ -35,49 +38,45 @@
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
computed
}
from
'vue'
;
import
{
ref
,
computed
}
from
'vue'
import
Vue3Jsoneditor
from
'v3-jsoneditor/src/Vue3Jsoneditor.vue'
;
import
Vue3Jsoneditor
from
'v3-jsoneditor/src/Vue3Jsoneditor.vue'
// 定义设备配置的状态
const
deviceConfig
=
ref
({
const
deviceConfig
=
ref
({
"name"
:
"dyla1n"
name
:
'dyla1n'
});
})
// 定义设备配置 TODO @dylan:从后端读取
const
isEditing
=
ref
(
false
)
// 编辑状态
// 编辑状态
const
isEditing
=
ref
(
false
);
// JSON 编辑器的选项
const
editorOptions
=
computed
(()
=>
({
const
editorOptions
=
computed
(()
=>
({
mainMenuBar
:
false
,
mainMenuBar
:
false
,
navigationBar
:
false
,
navigationBar
:
false
,
statusBar
:
false
,
statusBar
:
false
}))
;
}))
// JSON 编辑器的选项
/
/ 启用编辑模式的函数
/
** 启用编辑模式的函数 */
const
enableEdit
=
()
=>
{
const
enableEdit
=
()
=>
{
isEditing
.
value
=
true
;
isEditing
.
value
=
true
}
;
}
/
/ 取消编辑的函数
/
** 取消编辑的函数 */
const
cancelEdit
=
()
=>
{
const
cancelEdit
=
()
=>
{
isEditing
.
value
=
false
;
isEditing
.
value
=
false
// 逻辑代码
// 逻辑代码
console
.
log
(
'取消编辑'
)
;
console
.
log
(
'取消编辑'
)
}
;
}
/
/ 保存配置的函数
/
** 保存配置的函数 */
const
saveConfig
=
()
=>
{
const
saveConfig
=
()
=>
{
isEditing
.
value
=
false
;
isEditing
.
value
=
false
// 逻辑代码
// 逻辑代码
console
.
log
(
'保存配置'
)
;
console
.
log
(
'保存配置'
)
}
;
}
/
/ 处理 JSON 编辑器错误的函数
/
** 处理 JSON 编辑器错误的函数 */
const
onError
=
(
e
:
any
)
=>
{
const
onError
=
(
e
:
any
)
=>
{
console
.
log
(
'onError'
,
e
)
;
console
.
log
(
'onError'
,
e
)
}
;
}
</
script
>
</
script
>
<!-- TODO dylan:建议使用 unocss 替代哈,AI 模型友好 -->
<
style
scoped
>
<
style
scoped
>
.button-group
{
.button-group
{
display
:
flex
;
display
:
flex
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment