diff --git a/src/components/home/warning.vue b/src/components/home/warning.vue
index 4a5db95..67b7e16 100644
--- a/src/components/home/warning.vue
+++ b/src/components/home/warning.vue
@@ -1,9 +1,31 @@
@@ -17,7 +39,15 @@ function goToWarningList() {
-
+
+ 暂无异常警告
+
+
@@ -47,4 +77,11 @@ function goToWarningList() {
.card-body {
padding: 12px 16px;
}
+
+.empty-tip {
+ font-size: 14px;
+ color: #999999;
+ text-align: center;
+ padding: 16px 0;
+}
diff --git a/src/components/home/warning_list.vue b/src/components/home/warning_list.vue
index af1cd8c..d6a0110 100644
--- a/src/components/home/warning_list.vue
+++ b/src/components/home/warning_list.vue
@@ -1,16 +1,85 @@
+
+
-
+
-
- 钢轮温度过高
-
+
+
+ {{ title }}
+
+
+ {{ levelText }}
+
+
- 徐工XS65H #01 钢轮温度达90°C,超过國值85°C
+ {{ desc }}
- 10分钟前
+ {{ timeText }}
@@ -33,28 +102,74 @@
border-radius: 50%;
background-color: #fff2e8;
margin-right: 12px;
+ flex-shrink: 0;
+}
+
+.warning-icon.level-0 {
+ background-color: #e8f3ff;
+}
+
+.warning-icon.level-1 {
+ background-color: #fff2e8;
+}
+
+.warning-icon.level-2 {
+ background-color: #ffece8;
}
.warning-info {
flex: 1;
+ min-width: 0;
display: flex;
flex-direction: column;
+ padding-right: 8px;
+}
+
+.warning-title-row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ margin-bottom: 4px;
}
.warning-title {
font-size: 18px;
font-weight: bold;
color: #333333;
- margin-bottom: 4px;
+}
+
+.warning-level {
+ font-size: 12px;
+ padding: 2px 6px;
+ border-radius: 4px;
+}
+
+.warning-level.level-0 {
+ color: #3b82f6;
+ background-color: #e8f3ff;
+}
+
+.warning-level.level-1 {
+ color: #f59e0b;
+ background-color: #fff2e8;
+}
+
+.warning-level.level-2 {
+ color: #ef4444;
+ background-color: #ffece8;
}
.warning-desc {
font-size: 14px;
color: #999999;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
.warning-time {
font-size: 14px;
color: #cccccc;
+ flex-shrink: 0;
}
diff --git a/src/components/warning/filter.vue b/src/components/warning/filter.vue
index 3ba174f..dec5207 100644
--- a/src/components/warning/filter.vue
+++ b/src/components/warning/filter.vue
@@ -1,11 +1,16 @@
-
+
-
+
-
-
+
+
@@ -69,7 +79,7 @@ const unhandledCount = ref(3)
.tabs {
display: flex;
- gap: 12px;
+ gap: 8px;
margin-bottom: 16px;
}
@@ -77,7 +87,7 @@ const unhandledCount = ref(3)
flex: 1;
background-color: #f5f5f5;
border-radius: 8px;
- padding: 12px 0;
+ padding: 10px 0;
text-align: center;
}
@@ -86,7 +96,7 @@ const unhandledCount = ref(3)
}
.tab-text {
- font-size: 18px;
+ font-size: 14px;
color: #333;
}
diff --git a/src/components/warning/item.vue b/src/components/warning/item.vue
index b410a71..54add38 100644
--- a/src/components/warning/item.vue
+++ b/src/components/warning/item.vue
@@ -5,18 +5,24 @@ const props = defineProps<{
deviceName: string
tags: string[]
time: string
- trigger: string
status?: '未处理' | '已处理'
index: number
+ warningId?: number
}>()
function goToDetail() {
+ if (props.warningId) {
+ uni.navigateTo({
+ url: `/pages/warning/detail/index?id=${props.warningId}`,
+ })
+ return
+ }
+
const key = `warning_${Date.now()}`
storage.set(key, {
deviceName: props.deviceName,
tags: props.tags,
time: props.time,
- trigger: props.trigger,
status: props.status || '未处理',
})
uni.navigateTo({
@@ -37,7 +43,7 @@ function goToDetail() {
-
+
{{ tag }}
@@ -47,9 +53,6 @@ function goToDetail() {
{{ time }}
-
- {{ trigger }}
-
@@ -112,9 +115,4 @@ function goToDetail() {
display: block;
margin-bottom: 8px;
}
-
-.trigger {
- font-size: 18px;
- color: #666;
-}
diff --git a/src/pages/warning/detail/index.vue b/src/pages/warning/detail/index.vue
index dadb351..756c1b6 100644
--- a/src/pages/warning/detail/index.vue
+++ b/src/pages/warning/detail/index.vue
@@ -1,4 +1,8 @@
@@ -29,17 +118,26 @@ const warnings = [
-
+
+
+ 暂无异常警告
+
@@ -63,4 +161,11 @@ const warnings = [
flex-direction: column;
gap: 12px;
}
+
+.empty-tip {
+ font-size: 14px;
+ color: #999;
+ text-align: center;
+ padding: 24px 0;
+}
diff --git a/src/service/index.ts b/src/service/index.ts
index fe7d8f2..1b12167 100644
--- a/src/service/index.ts
+++ b/src/service/index.ts
@@ -31,7 +31,7 @@ const expectedColumns: Record = {
project: ['id', 'project_name', 'stake_range', 'total_area', 'status', 'created_at', 'updated_at'],
work_record: ['id', 'project_id', 'start_time', 'end_time', 'compaction_area', 'pass_count', 'created_at'],
rtk_track: ['id', 'work_record_id', 'latitude', 'longitude', 'speed', 'heading', 'steel_wheel_temp', 'compaction_value', 'created_at'],
- warning_record: ['id', 'project_id', 'device_name', 'exception_type', 'occurred_at', 'site_description', 'disposal_record', 'disposal_type', 'is_read', 'created_at'],
+ warning_record: ['id', 'project_id', 'device_name', 'exception_type', 'exception_level', 'occurred_at', 'site_description', 'disposal_record', 'disposal_type', 'is_read', 'created_at'],
history_report: ['id', 'project_id', 'report_name', 'device_id', 'construction_area', 'start_time', 'end_time', 'duration', 'compaction_area', 'pass_count', 'qualified_rate', 'avg_speed', 'avg_paving_temp', 'avg_compaction', 'exception_count', 'created_at'],
}
diff --git a/src/service/seed.ts b/src/service/seed.ts
index 887fb69..67cbdee 100644
--- a/src/service/seed.ts
+++ b/src/service/seed.ts
@@ -107,7 +107,9 @@ async function seedRtkTrack() {
/**
* 插入告警记录假数据(3条)
- * 字段:project_id / device_name / exception_type(0数据中断 1高温异常 2定位异常)
+ * 字段:project_id / device_name
+ * exception_type(0数据中断 1高温异常 2定位异常)
+ * exception_level(0提醒 1警告 2严重)
* occurred_at / site_description / disposal_record
* disposal_type(0未处理 1现场恢复 2需要保修) / is_read
*/
@@ -117,6 +119,7 @@ async function seedWarningRecord() {
project_id: 1,
device_name: 'XS-65H',
exception_type: 0,
+ exception_level: 1,
occurred_at: '2026-09-10 09:15:00',
site_description: '设备上报数据中断超过 30 秒',
disposal_record: '',
@@ -127,6 +130,7 @@ async function seedWarningRecord() {
project_id: 2,
device_name: 'XS-65H',
exception_type: 1,
+ exception_level: 2,
occurred_at: '2026-09-09 10:20:00',
site_description: '钢轮温度超过安全阈值',
disposal_record: '现场降温后恢复作业',
@@ -137,6 +141,7 @@ async function seedWarningRecord() {
project_id: 1,
device_name: 'RTK-01',
exception_type: 2,
+ exception_level: 0,
occurred_at: '2026-09-10 14:05:00',
site_description: 'RTK 定位信号丢失,无法获取有效坐标',
disposal_record: '设备故障,已登记报修',
diff --git a/src/service/warningRecord.ts b/src/service/warningRecord.ts
index e214e7d..a885ce4 100644
--- a/src/service/warningRecord.ts
+++ b/src/service/warningRecord.ts
@@ -8,6 +8,7 @@ export const warningRecordTableSql = `CREATE TABLE IF NOT EXISTS warning_record
project_id INTEGER,
device_name TEXT,
exception_type INTEGER,
+ exception_level INTEGER DEFAULT 0,
occurred_at DATETIME,
site_description TEXT,
disposal_record TEXT,
@@ -22,6 +23,7 @@ export interface WarningRecord {
project_id: number // 所属项目 ID,关联 project.id
device_name?: string // 设备名称
exception_type?: 0 | 1 | 2 // 异常类型,0:数据中断,1:高温异常,2:定位异常
+ exception_level?: 0 | 1 | 2 // 异常级别,0:提醒,1:警告,2:严重
occurred_at?: string // 发生时间
site_description?: string // 现场描述
disposal_record?: string // 现场处置记录