feat: UI rewrite R4-R5 (17 pages)
- R4: equipment+project+QR+notice (8) - R5: pshgl drain user management (9) All pages: consistent design system
This commit is contained in:
@@ -10,14 +10,21 @@ import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
/** 搜索关键词 */
|
||||
const searchText = ref('')
|
||||
|
||||
/** 当前激活的 Tab */
|
||||
const activeTab = ref(0)
|
||||
|
||||
/** 模拟监测设备数据 */
|
||||
const mockEquipments = [
|
||||
interface Equipment {
|
||||
id: number
|
||||
name: string
|
||||
type: string
|
||||
typeLabel: string
|
||||
status: 'normal' | 'alarm' | 'offline'
|
||||
location: string
|
||||
lastData: string
|
||||
updateTime: string
|
||||
}
|
||||
|
||||
const mockEquipments: Equipment[] = [
|
||||
{ id: 1, name: '流量监测仪 A-01', type: 'flow_meter', typeLabel: '流量计', status: 'normal', location: '城北供水管网1号节点', lastData: '125.6 m³/h', updateTime: '2025-06-15 08:30' },
|
||||
{ id: 2, name: '压力传感器 P-03', type: 'pressure_sensor', typeLabel: '压力传感器', status: 'alarm', location: '高新区主管网3号泵站', lastData: '0.85 MPa', updateTime: '2025-06-15 08:25' },
|
||||
{ id: 3, name: '水质监测仪 W-07', type: 'water_quality', typeLabel: '水质监测仪', status: 'normal', location: '老城区饮用水源口', lastData: 'pH 7.2 / 浊度 0.5NTU', updateTime: '2025-06-15 08:28' },
|
||||
@@ -28,24 +35,15 @@ const mockEquipments = [
|
||||
{ id: 8, name: '液位计 L-05', type: 'liquid_level', typeLabel: '液位计', status: 'offline', location: '北区污水井5号', lastData: '1.8 m', updateTime: '2025-06-14 18:00' },
|
||||
]
|
||||
|
||||
/** 状态映射 */
|
||||
const statusMap: Record<string, string> = {
|
||||
normal: '正常',
|
||||
alarm: '报警',
|
||||
offline: '离线',
|
||||
const statusCfg: Record<string, { label: string; color: string; bg: string }> = {
|
||||
normal: { label: '正常', color: '#07C160', bg: '#E8F8EF' },
|
||||
alarm: { label: '报警', color: '#EE0A24', bg: '#FDECEC' },
|
||||
offline: { label: '离线', color: '#969799', bg: '#F2F3F5' },
|
||||
}
|
||||
|
||||
const statusColorMap: Record<string, string> = {
|
||||
normal: 'success',
|
||||
alarm: 'danger',
|
||||
offline: '#999',
|
||||
}
|
||||
|
||||
/** 类型 Tab 映射 */
|
||||
const typeTabs = ['全部', '流量计', '压力传感器', '水质监测仪', '液位计']
|
||||
const typeKeys = ['', 'flow_meter', 'pressure_sensor', 'water_quality', 'liquid_level']
|
||||
|
||||
/** 筛选后的列表 */
|
||||
const filteredEquipments = computed(() => {
|
||||
let list = mockEquipments
|
||||
if (searchText.value) {
|
||||
@@ -62,22 +60,23 @@ const filteredEquipments = computed(() => {
|
||||
return list
|
||||
})
|
||||
|
||||
/** 跳转设备详情 */
|
||||
function goEquipmentInfo(id: number) {
|
||||
router.push(`/equipmentInfo?id=${id}`)
|
||||
}
|
||||
|
||||
/** 跳转地图监控 */
|
||||
function goMapMonitoring() {
|
||||
router.push('/mapMonitoring')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="equipment-page">
|
||||
<div class="page">
|
||||
<!-- NavBar -->
|
||||
<van-nav-bar
|
||||
title="监测设备"
|
||||
left-arrow fixed placeholder
|
||||
left-arrow
|
||||
fixed
|
||||
placeholder
|
||||
@click-left="router.back()"
|
||||
>
|
||||
<template #right>
|
||||
@@ -85,85 +84,210 @@ function goMapMonitoring() {
|
||||
</template>
|
||||
</van-nav-bar>
|
||||
|
||||
<van-search v-model="searchText" placeholder="搜索设备名称、类型、位置" shape="round" />
|
||||
<!-- Search -->
|
||||
<van-search
|
||||
v-model="searchText"
|
||||
placeholder="搜索设备名称、类型、位置"
|
||||
shape="round"
|
||||
class="search-bar"
|
||||
/>
|
||||
|
||||
<van-tabs v-model:active="activeTab" sticky scrollspy>
|
||||
<!-- Type Tabs -->
|
||||
<van-tabs v-model:active="activeTab" sticky swipeable class="tabs-bar">
|
||||
<van-tab v-for="(tab, idx) in typeTabs" :key="idx" :title="tab" />
|
||||
</van-tabs>
|
||||
|
||||
<div class="equipment-list">
|
||||
<!-- Equipment List -->
|
||||
<div class="content">
|
||||
<van-empty v-if="filteredEquipments.length === 0" description="暂无监测设备" />
|
||||
<van-card
|
||||
|
||||
<div
|
||||
v-for="equip in filteredEquipments"
|
||||
:key="equip.id"
|
||||
:title="equip.name"
|
||||
:desc="`类型: ${equip.typeLabel}`"
|
||||
class="equip-card"
|
||||
@click="goEquipmentInfo(equip.id)"
|
||||
>
|
||||
<template #tags>
|
||||
<van-tag :color="statusColorMap[equip.status]" text-color="#fff" size="medium" v-if="equip.status !== 'normal'">
|
||||
{{ statusMap[equip.status] }}
|
||||
</van-tag>
|
||||
<van-tag type="success" size="medium" v-else>
|
||||
{{ statusMap[equip.status] }}
|
||||
</van-tag>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="equipment-meta">
|
||||
<span class="meta-location">{{ equip.location }}</span>
|
||||
<span class="meta-data">最新数据: {{ equip.lastData }}</span>
|
||||
<span class="meta-time">更新时间: {{ equip.updateTime }}</span>
|
||||
<!-- Blue accent bar -->
|
||||
<div class="card-accent" />
|
||||
|
||||
<div class="card-body">
|
||||
<div class="card-header">
|
||||
<span class="card-title">{{ equip.name }}</span>
|
||||
<span
|
||||
class="status-tag"
|
||||
:style="{ color: statusCfg[equip.status].color, background: statusCfg[equip.status].bg }"
|
||||
>
|
||||
{{ statusCfg[equip.status].label }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</van-card>
|
||||
|
||||
<div class="card-info">
|
||||
<div class="info-row">
|
||||
<van-icon name="label-o" size="14" color="#969799" />
|
||||
<span>{{ equip.typeLabel }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<van-icon name="location-o" size="14" color="#969799" />
|
||||
<span>{{ equip.location }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<div class="data-block">
|
||||
<span class="data-label">最新数据</span>
|
||||
<span class="data-value">{{ equip.lastData }}</span>
|
||||
</div>
|
||||
<span class="update-time">{{ equip.updateTime }}</span>
|
||||
</div>
|
||||
|
||||
<van-icon name="arrow" color="#C8C9CC" class="card-arrow" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.equipment-page {
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: var(--color-bg-page);
|
||||
background: #F4F7F8;
|
||||
}
|
||||
|
||||
:deep(.van-nav-bar) {
|
||||
background: var(--color-primary);
|
||||
--van-nav-bar-title-text-color: #fff;
|
||||
--van-nav-bar-text-color: #fff;
|
||||
--van-nav-bar-icon-color: #fff;
|
||||
// ── NavBar ──
|
||||
:deep(.van-nav-bar) {
|
||||
background: #1E74FF;
|
||||
--van-nav-bar-title-text-color: #fff;
|
||||
--van-nav-bar-text-color: #fff;
|
||||
--van-nav-bar-icon-color: #fff;
|
||||
}
|
||||
|
||||
// ── Search ──
|
||||
.search-bar {
|
||||
:deep(.van-search__content) {
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.equipment-list {
|
||||
padding: 0 8px;
|
||||
|
||||
:deep(.van-card) {
|
||||
margin: 8px;
|
||||
border-radius: 10px;
|
||||
background: var(--color-bg-card);
|
||||
}
|
||||
|
||||
:deep(.van-tag) {
|
||||
margin-right: 4px;
|
||||
// ── Tabs ──
|
||||
.tabs-bar {
|
||||
:deep(.van-tabs__nav) {
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.equipment-meta {
|
||||
// ── Content ──
|
||||
.content {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
// ── Card ──
|
||||
.equip-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-secondary);
|
||||
position: relative;
|
||||
margin-bottom: 10px;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: transform 0.15s, box-shadow 0.15s;
|
||||
|
||||
.meta-location {
|
||||
color: var(--color-text-regular);
|
||||
&:active {
|
||||
transform: scale(0.985);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.card-accent {
|
||||
width: 4px;
|
||||
flex-shrink: 0;
|
||||
background: #1E74FF;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
flex: 1;
|
||||
padding: 14px 16px 14px 14px;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.card-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #323233;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.meta-data {
|
||||
.status-tag {
|
||||
flex-shrink: 0;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.meta-time {
|
||||
color: var(--color-text-placeholder);
|
||||
.card-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 13px;
|
||||
color: #646566;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #F2F3F5;
|
||||
|
||||
.data-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.data-label {
|
||||
font-size: 11px;
|
||||
color: #969799;
|
||||
}
|
||||
|
||||
.data-value {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #323233;
|
||||
}
|
||||
|
||||
.update-time {
|
||||
font-size: 11px;
|
||||
color: #C8C9CC;
|
||||
}
|
||||
}
|
||||
|
||||
.card-arrow {
|
||||
position: absolute;
|
||||
right: 16px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user