Suzhou-SafetyToolsWarning-WX/pages/index/index.wxml

120 lines
4.1 KiB
Plaintext
Raw Normal View History

2025-11-07 14:54:09 +08:00
<!--pages/index/index.wxml-->
<view class="container">
<!-- 顶部统计卡片 -->
<view class="stats-section">
<view class="stats-card">
<view class="stat-item">
<view class="stat-value">{{totalDevices}}</view>
<view class="stat-label">设备总数</view>
</view>
<view class="stat-item">
<view class="stat-value warning">{{warningDevices}}</view>
<view class="stat-label">预警设备</view>
</view>
<view class="stat-item">
<view class="stat-value danger">{{expiredDevices}}</view>
<view class="stat-label">已到期</view>
</view>
</view>
</view>
<!-- 预警提醒 -->
<view class="warning-section">
<view class="section-header">
<view class="section-title">
<t-icon name="error-circle" size="40rpx" color="#FF6B00" />
<text>预警提醒</text>
</view>
<view class="section-more" bindtap="goToWarning">
<text>查看全部</text>
<t-icon name="chevron-right" size="32rpx" />
</view>
</view>
<view class="warning-list" wx:if="{{warningList.length > 0}}">
<view class="warning-item" wx:for="{{warningList}}" wx:key="id" bindtap="goToDeviceDetail" data-id="{{item.id}}">
<view class="warning-icon">
<t-icon name="time" size="40rpx" color="#FF6B00" />
</view>
<view class="warning-content">
<view class="warning-title">{{item.deviceName}}</view>
<view class="warning-desc">{{item.deviceCode}} | {{item.useUnit}}</view>
<view class="warning-time">距离检验到期还有 {{item.daysLeft}} 天</view>
</view>
<view class="warning-tag">
<t-tag theme="warning" size="small">{{item.warningLevel}}</t-tag>
</view>
</view>
</view>
<t-empty wx:else icon="notification" description="暂无预警信息" />
</view>
<!-- 快捷入口 -->
<view class="quick-actions">
<view class="section-header">
<view class="section-title">
<t-icon name="app" size="40rpx" color="#0052D9" />
<text>快捷入口</text>
</view>
</view>
<view class="action-grid">
<view class="action-item" bindtap="goToDeviceList">
<view class="action-icon" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
<t-icon name="view-list" size="48rpx" color="#fff" />
</view>
<view class="action-label">设备台账</view>
</view>
<view class="action-item" bindtap="goToAddDevice">
<view class="action-icon" style="background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);">
<t-icon name="add" size="48rpx" color="#fff" />
</view>
<view class="action-label">添加设备</view>
</view>
<view class="action-item" bindtap="goToStatistics">
<view class="action-icon" style="background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);">
<t-icon name="chart-bar" size="48rpx" color="#fff" />
</view>
<view class="action-label">统计分析</view>
</view>
<view class="action-item" bindtap="scanCode">
<view class="action-icon" style="background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);">
<t-icon name="scan" size="48rpx" color="#fff" />
</view>
<view class="action-label">扫码查询</view>
</view>
</view>
</view>
<!-- 最近操作 -->
<view class="recent-section">
<view class="section-header">
<view class="section-title">
<t-icon name="time" size="40rpx" color="#0052D9" />
<text>最近操作</text>
</view>
</view>
<t-cell-group wx:if="{{recentList.length > 0}}">
<t-cell
wx:for="{{recentList}}"
wx:key="id"
title="{{item.deviceName}}"
description="{{item.operation}} · {{item.time}}"
hover
bindtap="goToDeviceDetail"
data-id="{{item.deviceId}}"
>
<t-icon slot="left-icon" name="{{item.icon}}" size="40rpx" />
</t-cell>
</t-cell-group>
<t-empty wx:else icon="history" description="暂无操作记录" />
</view>
</view>