From b55ba4003dad34b6c6b72615cfe7b962decf31d2 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Fri, 11 Apr 2025 17:35:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E9=A0=81=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/alert/api.js | 6 +- src/apis/alert/index.js | 75 +++++++------- src/components/alarm/AlarmCards.vue | 66 +++++++------ src/components/customUI/SearchSelect.vue | 18 ++-- src/config/cn.json | 11 ++- src/config/tw.json | 11 ++- src/config/us.json | 9 +- .../components/AlertQuery/AlertQuery.vue | 99 +++++-------------- .../components/AlertQuery/AlertSearch.vue | 3 +- .../AlertQuery/AlertSearchNormalBtns.vue | 10 +- .../AlertQuery/AlertSearchTimeRange.vue | 30 +++--- .../AlertQuery/AlertSearchTypesButton.vue | 30 +++--- .../components/AlertQuery/AlertTable.vue | 47 ++------- .../components/AlertQuery/AlertTableModal.vue | 38 +++---- .../AlertSetting/AlertOutliersTable.vue | 55 +++++++---- .../AlertOutliersTableAddModal.vue | 4 +- .../components/AlertSetting/AlertSetting.vue | 2 +- .../dashboard/components/DashboardSysCard.vue | 2 - 18 files changed, 232 insertions(+), 284 deletions(-) diff --git a/src/apis/alert/api.js b/src/apis/alert/api.js index 0573240..b82e6f8 100644 --- a/src/apis/alert/api.js +++ b/src/apis/alert/api.js @@ -1,5 +1,6 @@ export const POST_ACK_API = `/obix/alarm`; export const GET_ALERT_FORMID_API = `/Alert/AlertList`; +export const GET_ALERT_LOG_API = `api/Alarm/GetAlarmLog`; export const POST_OPERATION_RECORD_API = `/operation/SavOpeRecord`; export const GET_ALERT_SUB_LIST_API = `api/Device/GetMainSub`; @@ -9,6 +10,7 @@ export const GET_ALERT_MEMBER = `api/Alarm/GetAlarmMember`; export const POST_ALERT_MEMBER = `api/Alarm/SaveAlarmMember`; export const DELETE_ALERT_MEMBER = `api/Alarm/DeleteAlarmMember`; export const GET_NOTICE_LIST_API = `api/Alarm/GetNotice`; +export const GET_SHOW_ALERT_API = `api/Alarm/GetShowAlarm`; // 取得告警顯示清單 export const GET_OUTLIERS_LIST_API = `api/Alarm/GetAlarmSetting`; export const GET_OUTLIERS_DEVLIST_API = `api/Alarm/GetDevList`; // 取得設備 @@ -19,4 +21,6 @@ export const GET_FACTOR_API = `api/Alarm/GetFactor`; // 刪除 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`; \ No newline at end of file +export const DELETE_ALERT_SCHEDULE = `api/Alarm/DeleteAlarmSchedule`; + +export const POST_ALERT_MQTT_REFRESH = `api/Alarm/MQTTRefresh`; \ No newline at end of file diff --git a/src/apis/alert/index.js b/src/apis/alert/index.js index 95d2015..0d54384 100644 --- a/src/apis/alert/index.js +++ b/src/apis/alert/index.js @@ -1,6 +1,7 @@ import { POST_ACK_API, GET_ALERT_FORMID_API, + GET_ALERT_LOG_API, POST_OPERATION_RECORD_API, GET_ALERT_SUB_LIST_API, GET_OUTLIERS_LIST_API, @@ -14,40 +15,14 @@ import { POST_ALERT_MEMBER, DELETE_ALERT_MEMBER, GET_NOTICE_LIST_API, + GET_SHOW_ALERT_API, GET_ALERT_SCHEDULE_LIST_API, POST_ALERT_SCHEDULE, DELETE_ALERT_SCHEDULE, + POST_ALERT_MQTT_REFRESH } from "./api"; import instance from "@/util/request"; import apihandler from "@/util/apihandler"; -import axios from "axios"; - -export const postChgAck = async (uuid) => { - try { - const data = - ''; - const res = await axios.post(`${POST_ACK_API}/${uuid}/ack`, data, { - headers: { - "Content-Type": "text/plain", - }, - }); - - // 解析XML錯誤信息 - const parser = new DOMParser(); - const xmlDoc = parser.parseFromString(res.data, "text/xml"); - const errElement = xmlDoc.querySelector("err"); - - if (errElement) { - console.error("Error in acknowledging alarm"); - return { isSuccess: false, msg: `Error in acknowledging alarm` }; - } - - return { isSuccess: true }; - } catch (error) { - console.error("Error in acknowledging alarm:", error); - return { isSuccess: false, msg: "Error in acknowledging alarm" }; - } -}; export const getAlertFormId = async (uuid) => { const res = await instance.post(GET_ALERT_FORMID_API, uuid); @@ -57,6 +32,24 @@ export const getAlertFormId = async (uuid) => { }); }; +export const getAlertLog = async ({ + Start_date, + End_date, + isRecovery, + device_name_tag, +}) => { + const res = await instance.post(GET_ALERT_LOG_API, { + Start_date, + End_date, + isRecovery, + device_name_tag, + }); + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + export const postOperationRecord = async (formData) => { const res = await instance.post(POST_OPERATION_RECORD_API, formData); @@ -66,11 +59,9 @@ export const postOperationRecord = async (formData) => { }); }; -export const getAlertSubList = async ( - building_guid -) => { +export const getAlertSubList = async (building_guid) => { const res = await instance.post(GET_ALERT_SUB_LIST_API, { - building_guid + building_guid, }); return apihandler(res.code, res.data, { @@ -186,6 +177,15 @@ export const delOutliersSetting = async (Id) => { }); }; +export const getShowAlarm = async () => { + const res = await instance.post(GET_SHOW_ALERT_API); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; + export const getAlarmScheduleList = async () => { const res = await instance.post(GET_ALERT_SCHEDULE_LIST_API, {}); @@ -215,4 +215,13 @@ export const deleteAlarmSchedule = async (id) => { console.error("API request failed", error); return { isSuccess: false, msg: "API request failed" }; } -}; \ No newline at end of file +}; + +export const postMQTTRefresh = async () => { + const res = await instance.post(POST_ALERT_MQTT_REFRESH); + + return apihandler(res.code, res.data, { + msg: res.msg, + code: res.code, + }); +}; diff --git a/src/components/alarm/AlarmCards.vue b/src/components/alarm/AlarmCards.vue index 01e2d92..f675f44 100644 --- a/src/components/alarm/AlarmCards.vue +++ b/src/components/alarm/AlarmCards.vue @@ -1,25 +1,41 @@