diff --git a/src/api/AlertMock.ts b/src/api/AlertMock.ts new file mode 100644 index 0000000..44471ee --- /dev/null +++ b/src/api/AlertMock.ts @@ -0,0 +1,11 @@ +import { api } from 'src/boot/axios'; + +const alertUriBase = '/api/alert/mock'; + +export function mockAlertSet(data: { lineId: number; alertType: string }) { + return api.post(`${alertUriBase}/set`, data); +} + +export function mockAlertClear() { + return api.post(`${alertUriBase}/clear`); +} diff --git a/src/components/errrorMessageBox.vue b/src/components/alarm/alarmInfoDialog.vue similarity index 90% rename from src/components/errrorMessageBox.vue rename to src/components/alarm/alarmInfoDialog.vue index 057c780..d9eaea5 100644 --- a/src/components/errrorMessageBox.vue +++ b/src/components/alarm/alarmInfoDialog.vue @@ -51,7 +51,7 @@ diff --git a/src/drawApp/lineApp.ts b/src/drawApp/lineApp.ts index eafde08..2fbfd16 100644 --- a/src/drawApp/lineApp.ts +++ b/src/drawApp/lineApp.ts @@ -61,6 +61,8 @@ import { ContextMenu } from 'src/jl-graphic/ui/ContextMenu'; import { MenuItemOptions } from 'src/jl-graphic/ui/Menu'; import { LogicSectionTemplate } from 'src/graphics/logicSection/LogicSection'; import { LogicSectionData } from './graphics/LogicSectionInteraction'; +import { alert } from 'src/protos/alertInfo'; +import { useLineNetStore } from 'src/stores/line-net-store'; // const QuickJumpMenu = new ContextMenu({ // name: '快捷跳转', @@ -244,6 +246,14 @@ export async function loadLineDatas(app: GraphicApp) { return states; }, }); + const lineNetStore = useLineNetStore(); + msgBroker.subscribe({ + destination: '/queue/xian/ncc/alert', + messageHandle: (message: Uint8Array) => { + const storage = alert.NccAlertInfoMessage.deserialize(message); + lineNetStore.setAlarmInfo(storage.messages as []); + }, + }); } else { app.loadGraphic([]); } diff --git a/src/drawApp/lineNetApp.ts b/src/drawApp/lineNetApp.ts index 9376286..b398cac 100644 --- a/src/drawApp/lineNetApp.ts +++ b/src/drawApp/lineNetApp.ts @@ -132,13 +132,13 @@ export async function loadLineNetDatas(app: GraphicApp) { return states; }, }); - /* msgBroker.subscribe({ + msgBroker.subscribe({ destination: '/queue/xian/ncc/alert', messageHandle: (message: Uint8Array) => { const storage = alert.NccAlertInfoMessage.deserialize(message); lineNetStore.setAlarmInfo(storage.messages as []); }, - }); */ + }); } else { app.loadGraphic([]); } diff --git a/src/pages/LineMonitorPage.vue b/src/pages/LineMonitorPage.vue index 255c966..37b99f6 100644 --- a/src/pages/LineMonitorPage.vue +++ b/src/pages/LineMonitorPage.vue @@ -3,6 +3,18 @@ {{ mapName }} + + + + + 设置模拟故障 + + + 取消模拟故障 + + + + @@ -12,6 +24,31 @@
+ + + + +
设置模拟故障
+ + + + + +
+
+
+ diff --git a/src/protos/alertInfo.ts b/src/protos/alertInfo.ts index 8960c7e..038cc4d 100644 --- a/src/protos/alertInfo.ts +++ b/src/protos/alertInfo.ts @@ -81,8 +81,7 @@ export namespace alert { alert_time?: string; info?: string; alert_tip_id?: number; - device_info?: string; - reason?: string; + mock?: boolean; }) { super(); pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); @@ -102,11 +101,8 @@ export namespace alert { if ("alert_tip_id" in data && data.alert_tip_id != undefined) { this.alert_tip_id = data.alert_tip_id; } - if ("device_info" in data && data.device_info != undefined) { - this.device_info = data.device_info; - } - if ("reason" in data && data.reason != undefined) { - this.reason = data.reason; + if ("mock" in data && data.mock != undefined) { + this.mock = data.mock; } } } @@ -140,26 +136,19 @@ export namespace alert { set alert_tip_id(value: number) { pb_1.Message.setField(this, 5, value); } - get device_info() { - return pb_1.Message.getFieldWithDefault(this, 6, "") as string; + get mock() { + return pb_1.Message.getFieldWithDefault(this, 6, false) as boolean; } - set device_info(value: string) { + set mock(value: boolean) { pb_1.Message.setField(this, 6, value); } - get reason() { - return pb_1.Message.getFieldWithDefault(this, 7, "") as string; - } - set reason(value: string) { - pb_1.Message.setField(this, 7, value); - } static fromObject(data: { id?: string; level?: string; alert_time?: string; info?: string; alert_tip_id?: number; - device_info?: string; - reason?: string; + mock?: boolean; }): Message { const message = new Message({}); if (data.id != null) { @@ -177,11 +166,8 @@ export namespace alert { if (data.alert_tip_id != null) { message.alert_tip_id = data.alert_tip_id; } - if (data.device_info != null) { - message.device_info = data.device_info; - } - if (data.reason != null) { - message.reason = data.reason; + if (data.mock != null) { + message.mock = data.mock; } return message; } @@ -192,8 +178,7 @@ export namespace alert { alert_time?: string; info?: string; alert_tip_id?: number; - device_info?: string; - reason?: string; + mock?: boolean; } = {}; if (this.id != null) { data.id = this.id; @@ -210,11 +195,8 @@ export namespace alert { if (this.alert_tip_id != null) { data.alert_tip_id = this.alert_tip_id; } - if (this.device_info != null) { - data.device_info = this.device_info; - } - if (this.reason != null) { - data.reason = this.reason; + if (this.mock != null) { + data.mock = this.mock; } return data; } @@ -232,10 +214,8 @@ export namespace alert { writer.writeString(4, this.info); if (this.alert_tip_id != 0) writer.writeInt32(5, this.alert_tip_id); - if (this.device_info.length) - writer.writeString(6, this.device_info); - if (this.reason.length) - writer.writeString(7, this.reason); + if (this.mock != false) + writer.writeBool(6, this.mock); if (!w) return writer.getResultBuffer(); } @@ -261,10 +241,7 @@ export namespace alert { message.alert_tip_id = reader.readInt32(); break; case 6: - message.device_info = reader.readString(); - break; - case 7: - message.reason = reader.readString(); + message.mock = reader.readBool(); break; default: reader.skipField(); }