前端默认展开设备列表
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
frontend/dist/index.html
vendored
4
frontend/dist/index.html
vendored
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>猪场管理系统</title>
|
||||
<script type="module" crossorigin src="/assets/index.2015effd.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index.7f062720.css">
|
||||
<script type="module" crossorigin src="/assets/index.40048162.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index.4965a25a.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -289,6 +289,8 @@ export default {
|
||||
|
||||
if (response.ok && data.code === 0) {
|
||||
this.devices = data.data.devices
|
||||
// 默认展开所有节点
|
||||
this.expandAllNodes()
|
||||
} else {
|
||||
console.error('获取设备列表失败:', data.message)
|
||||
}
|
||||
@@ -297,6 +299,23 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 展开所有节点
|
||||
expandAllNodes() {
|
||||
// 清空当前展开的节点
|
||||
this.expandedNodes.clear()
|
||||
|
||||
// 展开所有中继设备节点
|
||||
this.relayDevices.forEach(relay => {
|
||||
this.expandedNodes.add(relay.id)
|
||||
|
||||
// 展开所有控制器设备节点
|
||||
const controllers = this.getControllerDevices(relay.id)
|
||||
controllers.forEach(controller => {
|
||||
this.expandedNodes.add(controller.id)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 打开添加设备模态框
|
||||
openAddDeviceModal() {
|
||||
this.editingDevice = null
|
||||
|
||||
Reference in New Issue
Block a user