优化界面
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
:key="parent.id"
|
||||
:value="parent.id"
|
||||
>
|
||||
{{ parent.name }}
|
||||
{{ parent.display_name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -204,12 +204,26 @@ export default {
|
||||
if (currentType === 'pig_pen_controller' || currentType === 'feed_mill_controller') {
|
||||
// 控制器的上级是中继设备
|
||||
return this.devices.filter(device => device.type === 'relay')
|
||||
.map(relay => ({
|
||||
...relay,
|
||||
display_name: relay.name
|
||||
}));
|
||||
} else if (currentType === 'fan' || currentType === 'water_curtain') {
|
||||
// 设备的上级是控制器
|
||||
return this.devices.filter(device =>
|
||||
device.type === 'pig_pen_controller' || device.type === 'feed_mill_controller')
|
||||
// 找到所有控制器设备,并添加其上级中继设备的名称作为前缀
|
||||
const controllers = this.devices.filter(device =>
|
||||
device.type === 'pig_pen_controller' || device.type === 'feed_mill_controller');
|
||||
|
||||
return controllers.map(controller => {
|
||||
// 查找控制器的上级中继设备
|
||||
const relay = this.devices.find(device => device.id === controller.parent_id);
|
||||
return {
|
||||
...controller,
|
||||
display_name: relay ? `${relay.name} - ${controller.name}` : controller.name
|
||||
};
|
||||
});
|
||||
}
|
||||
return []
|
||||
return [];
|
||||
},
|
||||
|
||||
// 加载设备列表
|
||||
|
||||
Reference in New Issue
Block a user