diff --git a/src/App.vue b/src/App.vue index d8a5f84..8980e20 100644 --- a/src/App.vue +++ b/src/App.vue @@ -34,27 +34,27 @@ onMounted(() => { connect(sseBase + '/admin-api/warehousealarm/alarm-records/subscribe') // 添加演示报警,用于查看效果 - setTimeout(() => { - addAlarm({ - alarm_id: 'ALM20260708143000', - alarm_level: '2', - alarm_level_name: '报警', - alarm_time: '2026-07-08 14:30:00', - description: '仓库#3 温湿度传感器触发高温报警', - cameraId: '2', - pic: 'https://picsum.photos/400/300?random=1', - sensor_data: [ - { - sensor_code: 'st_001', - sensor_name: '温湿度传感器', - data: [ - { name: '温度', value: 38.5, sensor_threshold: 30, unit: '°C' }, - { name: '湿度', value: 65.2, sensor_threshold: 80, unit: '%' }, - ], - }, - ], - }) - }, 2000) + // setTimeout(() => { + // addAlarm({ + // alarm_id: 'ALM20260708143000', + // alarm_level: '2', + // alarm_level_name: '报警', + // alarm_time: '2026-07-08 14:30:00', + // description: '仓库#3 温湿度传感器触发高温报警', + // cameraId: '2', + // pic: 'https://picsum.photos/400/300?random=1', + // sensor_data: [ + // { + // sensor_code: 'st_001', + // sensor_name: '温湿度传感器', + // data: [ + // { name: '温度', value: 38.5, sensor_threshold: 30, unit: '°C' }, + // { name: '湿度', value: 65.2, sensor_threshold: 80, unit: '%' }, + // ], + // }, + // ], + // }) + // }, 2000) }) + + diff --git a/src/views/Home/Index.vue b/src/views/Home/Index.vue index a070751..dcbde0c 100644 --- a/src/views/Home/Index.vue +++ b/src/views/Home/Index.vue @@ -1,546 +1,328 @@ + - +.nav-bar a { text-decoration: none; display: block; width: 90%; } +.nav-btn:hover { background: rgba(10,255,255,0.2) !important; border-color: #0affff !important; box-shadow: 0 0 20px rgba(10,255,255,0.15); transform: scale(1.02); } +.nav-icon { margin-right: 4px; font-size: 14px; } + +.dark-table { background: transparent !important; } +.dark-table :deep(.el-table__row), .dark-table :deep(tr) { background: transparent !important; } +.dark-table :deep(td) { background: transparent !important; color: rgba(136,221,255,0.7) !important; border-bottom: 1px solid rgba(10,255,255,0.04) !important; font-size: 11px !important; padding: 3px 0 !important; } +.dark-table :deep(th.el-table__cell) { background: transparent !important; color: #0affff !important; border-bottom: 1px solid rgba(10,255,255,0.08) !important; font-size: 11px !important; padding: 3px 0 !important; } +.dark-table :deep(.el-table__inner-wrapper::before) { background: transparent !important; } +.dark-table :deep(.el-table--striped .el-table__body tr.el-table__row--striped td) { background: rgba(10,255,255,0.02) !important; } + \ No newline at end of file diff --git a/src/views/Home/api-docs.md b/src/views/Home/api-docs.md new file mode 100644 index 0000000..49d04da --- /dev/null +++ b/src/views/Home/api-docs.md @@ -0,0 +1,165 @@ +# 首页接口文档 + +## 1. 设备在线率统计 + +**接口**: `GET /warehousealarm/device-latest-data/online-rate` + +**返回**: +```json +{ + "code": 200, + "data": { + "onlineCount": 830, + "offlineCount": 170 + } +} +``` + +--- + +## 2. 各区域温度 + +**接口**: `GET /warehousealarm/device-latest-data/temperature-by-zone` + +**返回**: +```json +{ + "code": 200, + "data": [ + { "zone": "A区", "value": 22.5 }, + { "zone": "B区", "value": 24.1 }, + { "zone": "C区", "value": 19.8 }, + { "zone": "D区", "value": 21.3 }, + { "zone": "E区", "value": 23.6 }, + { "zone": "F区", "value": 20.2 } + ] +} +``` + +--- + +## 3. 各区域湿度 + +**接口**: `GET /warehousealarm/device-latest-data/humidity-by-zone` + +**返回**: +```json +{ + "code": 200, + "data": [ + { "zone": "A区", "value": 65 }, + { "zone": "B区", "value": 72 }, + { "zone": "C区", "value": 58 }, + { "zone": "D区", "value": 61 }, + { "zone": "E区", "value": 68 }, + { "zone": "F区", "value": 55 } + ] +} +``` + +--- + +## 4. 传感器总览(各类型报警/正常数) + +**接口**: `GET /warehousealarm/device-latest-data/sensor-overview` + +**返回**: +```json +{ + "code": 200, + "data": [ + { "name": "温湿度传感器", "alarm": 3, "normal": 47 }, + { "name": "烟雾传感器", "alarm": 1, "normal": 29 }, + { "name": "水浸传感器", "alarm": 2, "normal": 18 }, + { "name": "倾斜传感器", "alarm": 0, "normal": 12 }, + { "name": "报警灯", "alarm": 5, "normal": 15 }, + { "name": "边缘服务器", "alarm": 0, "normal": 8 } + ] +} +``` + +--- + +## 5. 报警类型分布(饼图) + +**接口**: `GET /warehousealarm/alarm-records/stats/by-type` + +**返回**: +```json +{ + "code": 200, + "data": [ + { "name": "温度告警", "value": 45 }, + { "name": "烟雾告警", "value": 28 }, + { "name": "水浸告警", "value": 18 }, + { "name": "倾斜告警", "value": 9 } + ] +} +``` + +--- + +## 6. 报警时长统计 + +**接口**: `GET /warehousealarm/alarm-records/stats/duration-by-type` + +**返回**: +```json +{ + "code": 200, + "data": [ + { "name": "温度", "value": 32 }, + { "name": "烟雾", "value": 18 }, + { "name": "水浸", "value": 25 }, + { "name": "倾斜", "value": 12 } + ] +} +``` + +--- + +## 7. 报警记录列表 + +**接口**: `GET /warehousealarm/alarm-records/page` + +**参数**: +| 参数 | 类型 | 必填 | 说明 | +|------|------|------|------| +| pageNo | int | 否 | 页码,默认1 | +| pageSize | int | 否 | 每页条数,默认6 | +| status | int | 否 | 状态筛选,1=待处理 | + +**返回**: +```json +{ + "code": 200, + "data": { + "list": [ + { + "triggerTime": "03-25 14:14", + "deviceName": "B区-设备037", + "ruleName": "网络异常告警", + "message": "网络异常" + } + ], + "total": 100 + } +} +``` + +--- + +## 8. 相机列表 + +**接口**: `GET /logistics/camera/list` + +**返回**: +```json +{ + "code": 200, + "data": [ + { "id": 1, "name": "摄像头-01" }, + { "id": 2, "name": "摄像头-02" } + ] +} +``` diff --git a/src/views/logistics/cameraPlayback/index.vue b/src/views/logistics/cameraPlayback/index.vue index 91900a8..436bcf2 100644 --- a/src/views/logistics/cameraPlayback/index.vue +++ b/src/views/logistics/cameraPlayback/index.vue @@ -41,7 +41,7 @@ end-placeholder="结束" value-format="YYYY-MM-DD HH:mm:ss" size="small" - style="width:100%" + style="width:95%" @change="onRangeChange" /> @@ -52,24 +52,24 @@
- +
-

请选择相机

+

请选择相机并开始回放

- + - - + + - + - + @@ -79,14 +79,11 @@
- - -
- +
@@ -100,7 +97,7 @@
-
+
@@ -116,15 +113,18 @@ diff --git a/src/views/warehousealarm/alarmrecords/AlarmRecordsForm.vue b/src/views/warehousealarm/alarmrecords/AlarmRecordsForm.vue index aa6dea1..c94a7e8 100644 --- a/src/views/warehousealarm/alarmrecords/AlarmRecordsForm.vue +++ b/src/views/warehousealarm/alarmrecords/AlarmRecordsForm.vue @@ -8,10 +8,10 @@ v-loading="formLoading" > - + - + - + import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { AlarmRecordsApi, AlarmRecordsVO } from '@/api/warehousealarm/alarmrecords' +import { useUserStore } from '@/store/modules/user' /** 报警记录 表单 */ defineOptions({ name: 'AlarmRecordsForm' }) const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 +const userStore = useUserStore() const dialogVisible = ref(false) // 弹窗的是否展示 const dialogTitle = ref('') // 弹窗的标题 @@ -94,6 +96,8 @@ const open = async (type: string, id?: number) => { formLoading.value = false } } + // 设置 handler 为当前用户 ID + formData.value.handler = userStore.getUser.id } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 diff --git a/src/views/warehousealarm/alarmrecords/index.vue b/src/views/warehousealarm/alarmrecords/index.vue index 6058770..202d174 100644 --- a/src/views/warehousealarm/alarmrecords/index.vue +++ b/src/views/warehousealarm/alarmrecords/index.vue @@ -113,7 +113,7 @@ - + - + /> --> - - - + @@ -167,6 +170,24 @@ + + + + + +