Files
urbanLifeline/江西城市生命线-可交互原型/frontend/src/views/HazardView.vue

181 lines
4.6 KiB
Vue
Raw Normal View History

2025-12-12 18:32:14 +08:00
<template>
<div class="hazard-view">
<header class="page-header">
<h1>隐患识别</h1>
<p>智能识别城市生命线潜在安全隐患提供预警和处置建议</p>
</header>
<div class="stats-section">
<div class="stat-card" v-for="stat in stats" :key="stat.label">
<div class="stat-value" :style="{ color: stat.color }">{{ stat.value }}</div>
<div class="stat-label">{{ stat.label }}</div>
</div>
</div>
<div class="hazard-list">
<div class="list-header">
<h2>隐患列表</h2>
<el-button type="primary" size="small">
<el-icon><Plus /></el-icon>
上报隐患
</el-button>
</div>
<div class="hazard-table">
<div class="table-header">
<span class="col-type">类型</span>
<span class="col-desc">描述</span>
<span class="col-location">位置</span>
<span class="col-level">等级</span>
<span class="col-status">状态</span>
<span class="col-action">操作</span>
</div>
<div v-for="item in hazardList" :key="item.id" class="table-row">
<span class="col-type">{{ item.type }}</span>
<span class="col-desc">{{ item.description }}</span>
<span class="col-location">{{ item.location }}</span>
<span class="col-level">
<el-tag :type="getLevelType(item.level)" size="small">{{ item.level }}</el-tag>
</span>
<span class="col-status">
<el-tag :type="getStatusType(item.status)" size="small">{{ item.status }}</el-tag>
</span>
<span class="col-action">
<el-button type="primary" link size="small">查看</el-button>
<el-button type="primary" link size="small">处理</el-button>
</span>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { Plus } from '@element-plus/icons-vue'
const stats = [
{ label: '待处理隐患', value: 12, color: '#ef4444' },
{ label: '处理中', value: 8, color: '#f59e0b' },
{ label: '本月已处理', value: 45, color: '#10b981' },
{ label: '累计识别', value: 328, color: '#7c3aed' }
]
const hazardList = ref([
{ id: 1, type: '供水管网', description: '管道老化存在渗漏风险', location: '红谷滩区丰和大道', level: '高', status: '待处理' },
{ id: 2, type: '燃气管道', description: '阀门锈蚀需要更换', location: '东湖区八一大道', level: '中', status: '处理中' },
{ id: 3, type: '电力设施', description: '变压器负荷过高', location: '西湖区朝阳路', level: '高', status: '待处理' },
{ id: 4, type: '排水系统', description: '雨水井堵塞', location: '青山湖区北京路', level: '低', status: '已处理' }
])
const getLevelType = (level) => {
const map = { '高': 'danger', '中': 'warning', '低': 'info' }
return map[level] || 'info'
}
const getStatusType = (status) => {
const map = { '待处理': 'danger', '处理中': 'warning', '已处理': 'success' }
return map[status] || 'info'
}
</script>
<style lang="scss" scoped>
.hazard-view {
padding: 32px 48px;
height: 100%;
overflow-y: auto;
}
.page-header {
margin-bottom: 32px;
h1 {
font-size: 24px;
color: #1f2937;
margin-bottom: 8px;
}
p {
color: #6b7280;
font-size: 14px;
}
}
.stats-section {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 32px;
.stat-card {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
padding: 24px;
text-align: center;
.stat-value {
font-size: 32px;
font-weight: 600;
margin-bottom: 8px;
}
.stat-label {
color: #6b7280;
font-size: 14px;
}
}
}
.hazard-list {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
padding: 24px;
.list-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
h2 {
font-size: 18px;
color: #1f2937;
}
}
}
.hazard-table {
.table-header, .table-row {
display: grid;
grid-template-columns: 100px 1fr 180px 80px 80px 120px;
gap: 16px;
padding: 12px 16px;
align-items: center;
}
.table-header {
background: #f9fafb;
border-radius: 8px;
font-weight: 500;
color: #6b7280;
font-size: 13px;
}
.table-row {
border-bottom: 1px solid #f3f4f6;
font-size: 14px;
color: #374151;
&:last-child {
border-bottom: none;
}
&:hover {
background: #f9fafb;
}
}
}
</style>