122 lines
3.9 KiB
Plaintext
122 lines
3.9 KiB
Plaintext
<view class="subdevices-page">
|
||
<!-- 页面头部 -->
|
||
<view class="page-header">
|
||
<view class="device-info">
|
||
<view class="device-name">{{device.name}}</view>
|
||
<view class="device-meta">
|
||
<text class="subdevice-count">子设备: {{subDevices.length}}个</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 加载状态 -->
|
||
<block wx:if="{{loading}}">
|
||
<view class="loading-container">
|
||
<t-skeleton theme="paragraph" loading />
|
||
<t-skeleton theme="paragraph" loading />
|
||
<t-skeleton theme="paragraph" loading />
|
||
</view>
|
||
</block>
|
||
|
||
<!-- 错误状态 -->
|
||
<block wx:elif="{{loadError}}">
|
||
<view class="error-container">
|
||
<t-empty icon="error-circle" description="加载失败,请下拉刷新重试" />
|
||
</view>
|
||
</block>
|
||
|
||
<!-- 子设备列表 -->
|
||
<block wx:elif="{{subDevices.length > 0}}">
|
||
<view class="subdevices-list">
|
||
<view
|
||
wx:for="{{subDevices}}"
|
||
wx:key="id"
|
||
class="subdevice-card">
|
||
<view class="card-header">
|
||
<view class="subdevice-info">
|
||
<view class="subdevice-name">{{item.name}}</view>
|
||
<view class="subdevice-meta">
|
||
<text class="subdevice-status">
|
||
状态: <text class="status-badge status-{{item.status}}">{{item.statusText}}</text>
|
||
</text>
|
||
</view>
|
||
</view>
|
||
<view class="usage-info">
|
||
<text class="usage-count">{{item.usage_count || 0}}次</text>
|
||
<text class="usage-label">使用</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view wx:if="{{item.description}}" class="subdevice-desc">
|
||
<text>{{item.description}}</text>
|
||
</view>
|
||
|
||
<view class="card-actions">
|
||
<t-button
|
||
size="small"
|
||
variant="outline"
|
||
bind:tap="viewMaintenance"
|
||
data-subdevice="{{item}}">
|
||
保养记录
|
||
</t-button>
|
||
<t-button
|
||
size="small"
|
||
variant="outline"
|
||
bind:tap="addMaintenance"
|
||
data-subdevice="{{item}}">
|
||
添加保养
|
||
</t-button>
|
||
<t-button
|
||
size="small"
|
||
variant="outline"
|
||
bind:tap="showStatusDialog"
|
||
data-subdevice="{{item}}">
|
||
更改状态
|
||
</t-button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</block>
|
||
|
||
<!-- 空状态 -->
|
||
<block wx:else>
|
||
<view class="empty-container">
|
||
<t-empty icon="device" description="暂无子设备" />
|
||
</view>
|
||
</block>
|
||
|
||
|
||
<!-- 状态更改对话框 -->
|
||
<view class="dialog-mask" wx:if="{{statusDialogVisible}}" bindtap="closeStatusDialog">
|
||
<view class="dialog-container" catchtap="">
|
||
<view class="dialog-header">
|
||
<text class="dialog-title">更改子设备状态</text>
|
||
<text class="dialog-close" bindtap="closeStatusDialog">×</text>
|
||
</view>
|
||
|
||
<view class="dialog-body">
|
||
<view class="status-current">
|
||
<text>当前状态:{{currentSubDeviceForStatus ? deviceStatusMap[currentSubDeviceForStatus.status] : '未知'}}</text>
|
||
</view>
|
||
|
||
<view class="status-options">
|
||
<view
|
||
wx:for="{{statusOptions}}"
|
||
wx:key="value"
|
||
class="status-option {{selectedStatus === item.value ? 'selected' : ''}}"
|
||
catchtap="selectStatus"
|
||
data-status="{{item.value}}">
|
||
<text class="status-dot" style="background-color: {{item.color}}"></text>
|
||
<text class="status-label">{{item.label}}</text>
|
||
<text class="status-check" wx:if="{{selectedStatus === item.value}}">✓</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="dialog-footer">
|
||
<button class="dialog-btn cancel-btn" bindtap="closeStatusDialog">取消</button>
|
||
<button class="dialog-btn confirm-btn" bindtap="confirmStatusChange">确定</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view> |