From 5ff030dc40caafd56968e4c99bf006ef5262d607 Mon Sep 17 00:00:00 2001 From: "MJM_2025_05\\polly" Date: Tue, 30 Sep 2025 15:05:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20rtsp=20=E5=88=86=E9=A0=81=E4=B8=B2?= =?UTF-8?q?=E6=8E=A5=20API=20(query-alarm-log)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/alert/api.js | 4 +- src/apis/alert/index.js | 22 ++ src/config/cn.json | 14 +- src/config/tw.json | 14 +- src/config/us.json | 14 +- .../AlertQuery/AlertSearchTimeRange.vue | 97 ++++-- src/views/rtsp/Rtsp.vue | 314 +++++++++--------- 7 files changed, 258 insertions(+), 221 deletions(-) diff --git a/src/apis/alert/api.js b/src/apis/alert/api.js index f8f2bab..1c545c6 100644 --- a/src/apis/alert/api.js +++ b/src/apis/alert/api.js @@ -24,4 +24,6 @@ export const GET_ALERT_SCHEDULE_LIST_API = `api/Alarm/GetAlarmSchedule`; export const POST_ALERT_SCHEDULE = `api/Alarm/SaveAlarmSchedule`; export const DELETE_ALERT_SCHEDULE = `api/Alarm/DeleteAlarmSchedule`; -export const POST_ALERT_MQTT_REFRESH = `api/Alarm/MQTTRefresh`; \ No newline at end of file +export const POST_ALERT_MQTT_REFRESH = `api/Alarm/MQTTRefresh`; + +export const POST_QUERY_ALARM_LOG = `api/alarm/query-alarm-log`; // RTSP 分頁顯示告警 log diff --git a/src/apis/alert/index.js b/src/apis/alert/index.js index d2f19e3..f7fbd5b 100644 --- a/src/apis/alert/index.js +++ b/src/apis/alert/index.js @@ -21,6 +21,7 @@ import { POST_ALERT_SCHEDULE, DELETE_ALERT_SCHEDULE, POST_ALERT_MQTT_REFRESH, + POST_QUERY_ALARM_LOG, } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; @@ -236,3 +237,24 @@ export const postMQTTRefresh = async () => { code: res.code, }); }; + +/** + * 查詢裝置告警紀錄(支援起訖日) + * @param {{ id: number, start_date: string, end_date: string }} payload + * - id: main_id(裝置/攝影機/樓層主鍵等) + * - start_date: "YYYY-MM-DD" + * - end_date: "YYYY-MM-DD" + * @returns {Promise} apihandler 標準回傳(成功時回 data 陣列) + */ +export const postQueryAlarmLog = async ({ id, start_date, end_date }) => { + const res = await instance.post(POST_QUERY_ALARM_LOG, { + id, + start_date, + end_date, + }); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; diff --git a/src/config/cn.json b/src/config/cn.json index 2a98729..1023571 100644 --- a/src/config/cn.json +++ b/src/config/cn.json @@ -179,6 +179,7 @@ "normal": "已复归", "unacked": "未确认", "acked": "已确认", + "7days": "近7天", "30days": "近30天", "start_date": "起始日期", "end_date": "结束日期", @@ -424,18 +425,9 @@ }, "rtsp": { "title": "影像串流", - "start": "开始侦测", - "stop": "结束侦测", + "selectPath": "选择存储位置", "selectDevice": "选择设备", - "pleaseSelectDevice": "请先选择设备", - "selectPathFirst": "请先选择存储文件夹", - "startSuccess": "已开始侦测…", - "startFail": "开始侦测失败,请稍后再试", - "stopSuccess": "已请求结束侦测…", - "stopFail": "结束侦测失败,请稍后再试", - "noPermission": "未获得写入权限,请重新选择文件夹并授权", - "selectFolderSuccess": "已选择文件夹:{name}", - "selectFolderFail": "选择文件夹失败,请再试一次" + "normalQuery":"已复归查询" } } diff --git a/src/config/tw.json b/src/config/tw.json index 577485c..5b9f612 100644 --- a/src/config/tw.json +++ b/src/config/tw.json @@ -179,6 +179,7 @@ "normal": "已復歸", "unacked": "未確認", "acked": "已確認", + "7days": "近7天", "30days": "近30天", "start_date": "起始日期", "end_date": "結束日期", @@ -424,18 +425,7 @@ }, "rtsp": { "title": "影像串流", - "start": "開始偵測", - "stop": "結束偵測", - "selectPath": "選擇儲存位置", "selectDevice": "選擇設備", - "pleaseSelectDevice": "請先選擇設備", - "selectPathFirst": "請先選擇儲存資料夾", - "startSuccess": "已開始偵測…", - "startFail": "開始偵測失敗,請稍後再試", - "stopSuccess": "結束偵測", - "stopFail": "結束偵測失敗,請稍後再試", - "noPermission": "沒有取得寫入權限,請重新選擇資料夾並允許", - "selectFolderSuccess": "已選擇資料夾:{name}", - "selectFolderFail": "選擇資料夾失敗,請再試一次" + "normalQuery": "已復歸查詢" } } diff --git a/src/config/us.json b/src/config/us.json index 4f9d069..fea78e0 100644 --- a/src/config/us.json +++ b/src/config/us.json @@ -179,6 +179,7 @@ "normal": "Normal", "unacked": "Unacked", "acked": "Acked", + "7days": "Last 7 Days", "30days": "Last 30 Days", "start_date": "Start Date", "end_date": "End Date", @@ -424,18 +425,7 @@ }, "rtsp": { "title": "Video Stream", - "start": "Start Detection", - "stop": "Stop Detection", - "selectPath": "Select Folder", "selectDevice": "Select Device", - "pleaseSelectDevice": "Please select a device first", - "selectPathFirst": "Please select a folder first", - "startSuccess": "Detection started…", - "startFail": "Failed to start detection, please try again later", - "stopSuccess": "Detection stop requested…", - "stopFail": "Failed to stop detection, please try again later", - "noPermission": "No write permission. Please select a folder again and grant access", - "selectFolderSuccess": "Folder selected: {name}", - "selectFolderFail": "Failed to select folder, please try again" + "normalQuery": "Query normal records" } } diff --git a/src/views/alert/components/AlertQuery/AlertSearchTimeRange.vue b/src/views/alert/components/AlertQuery/AlertSearchTimeRange.vue index ce074d3..d4d19e5 100644 --- a/src/views/alert/components/AlertQuery/AlertSearchTimeRange.vue +++ b/src/views/alert/components/AlertQuery/AlertSearchTimeRange.vue @@ -1,16 +1,55 @@ diff --git a/src/views/rtsp/Rtsp.vue b/src/views/rtsp/Rtsp.vue index e8d5d26..da484bf 100644 --- a/src/views/rtsp/Rtsp.vue +++ b/src/views/rtsp/Rtsp.vue @@ -1,102 +1,29 @@ - - + +