53 lines
1.9 KiB
Plaintext
53 lines
1.9 KiB
Plaintext
<view class="device-page">
|
|
<view class="device-container">
|
|
<!-- 设备列表 -->
|
|
<block wx:if="{{devices.length > 0}}">
|
|
<t-collapse value="{{activeDevices}}" expandMutex="{{false}}" bind:change="handleCollapseChange">
|
|
<t-collapse-panel
|
|
wx:for="{{devices}}"
|
|
wx:key="device_id"
|
|
wx:for-item="device"
|
|
value="{{index}}"
|
|
header="{{device.device_name}}"
|
|
header-right-content="{{device.sub_devices.length || 0}}个子设备"
|
|
t-class="device-panel">
|
|
|
|
<!-- 设备图标 -->
|
|
<view slot="header-icon" class="device-icon">
|
|
<t-icon name="device" size="48rpx" />
|
|
</view>
|
|
|
|
<!-- 子设备列表 -->
|
|
<block wx:if="{{device.sub_devices && device.sub_devices.length > 0}}">
|
|
<t-cell
|
|
wx:for="{{device.sub_devices}}"
|
|
wx:key="id"
|
|
wx:for-item="subDevice"
|
|
title="{{device.device_name}}-{{subDevice.name}}"
|
|
description="子设备"
|
|
hover
|
|
t-class="sub-device-cell"
|
|
bordered>
|
|
<!-- 状态标签和保养记录按钮 -->
|
|
<view slot="note" class="note-container">
|
|
<t-tag
|
|
theme="{{subDevice.status === 0 ? 'success' : (subDevice.status === 1 ? 'primary' : 'warning')}}"
|
|
variant="light"
|
|
size="small">
|
|
{{subDevice.statusText}}
|
|
</t-tag>
|
|
</view>
|
|
</t-cell>
|
|
</block>
|
|
|
|
<!-- 无子设备时的提示 -->
|
|
<t-empty wx:else description="暂无子设备" />
|
|
</t-collapse-panel>
|
|
</t-collapse>
|
|
</block>
|
|
|
|
<!-- 无设备时的提示 -->
|
|
<t-empty wx:else icon="device" description="暂无设备数据" />
|
|
</view>
|
|
</view>
|