1. 优化前端显示
2. 优化日志输出
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.3d7f01fe.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index.fd8bdce3.css">
|
||||
<script type="module" crossorigin src="/assets/index.a5284bc3.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index.af933240.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -131,11 +131,11 @@
|
||||
<select id="parentId" v-model="deviceForm.parent_id">
|
||||
<option value="">请选择上级设备</option>
|
||||
<option
|
||||
v-for="parent in getParentDevices(deviceForm.type)"
|
||||
v-for="parent in getParentDevicesWithDisplayName(deviceForm.type)"
|
||||
:key="parent.id"
|
||||
:value="parent.id"
|
||||
>
|
||||
{{ parent.name }}
|
||||
{{ parent.display_name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -241,6 +241,33 @@ export default {
|
||||
return []
|
||||
},
|
||||
|
||||
// 获取带显示名称的上级设备选项
|
||||
getParentDevicesWithDisplayName(currentType) {
|
||||
const parents = this.getParentDevices(currentType);
|
||||
|
||||
if (currentType === 'pig_pen_controller' || currentType === 'feed_mill_controller') {
|
||||
// 控制器的上级是中继设备,直接返回中继设备列表,显示设备名称
|
||||
return parents.map(relay => ({
|
||||
...relay,
|
||||
display_name: relay.name
|
||||
}));
|
||||
} else if (currentType === 'fan' || currentType === 'water_curtain') {
|
||||
// 设备的上级是控制器,需要构建"中继设备名 - 区域主控名"格式的显示名称
|
||||
return parents.map(controller => {
|
||||
// 查找控制器的上级中继设备
|
||||
const relay = this.devices.find(device => device.id === controller.parent_id);
|
||||
const relayName = relay ? relay.name : '未知中继';
|
||||
|
||||
return {
|
||||
...controller,
|
||||
display_name: `${relayName} - ${controller.name}`
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
|
||||
// 加载设备列表
|
||||
async loadDevices() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user