export enum AlarmStatus { unaccept = 'unaccept', // 未受理 unprocessed = 'unprocessed', // 未处理 processing = 'processing', // 处理中 finished = 'finished', // 已完结 } export enum AlarmType { real = 'real', // 真实预警(有效) danger = 'danger', // 隐患 testing = 'testing', // 测试 inspect = 'inspect', // 巡检 useless = 'useless', // 无效 } export enum EventStatus { alarm = 'alarm', // 预警 recovery = 'recovery', // 恢复 normal = 'normal', // 一般事件 } export enum EventCategory { sense = 'sense', // 感知事件 capture = 'capture', // 抓拍 task = 'task', // 布控任务 other = 'other', // 其他 } // ------------ 预警时间线相关 ----------- // eslint-disable-next-line export namespace Notification { export enum ContactSource { // 联系人 UNKNOWN = 'unknown', // 设备联系人 DEVICE = 'device', // 分组联系人 GROUP = 'group', // 任务联系人 TASK = 'task', // 自定义 CUSTOM = 'custom', // 项目联系人 MERCHANT = 'merchant', // 房间联系人 ROOM = 'room', // 楼层联系人 FLOOR = 'floor', // 建筑联系人 BUILDING = 'building', // 区域联系人 AREA = 'area', // 房间负责人 ROOMPRINCIPAL = 'roomPrincipal', // 楼层负责人 FLOORPRINCIPAL = 'floorPrincipal', // 建筑负责人 BUILDINGPRINCIPAL = 'buildingPrincipal', // 区域负责人 AREAPRINCIPAL = 'areaPrincipal', // 在岗值勤人员 ONDUTYOFFICER = 'onDutyOfficer', // 全部值勤人员 ALLOFFICER = 'allOfficer', // 部署人员 DEPLOY = 'deploy', // ...待补充 } export enum Type { SMS = 'sms', VOCIE = 'voice', APP = 'app', EMAIL = 'email', } export enum Status { SENDING = 'sending', SUCCESS = 'success', FAIL = 'fail', } } export enum Source { WEB = 'web', APP = 'app', SYSTEM = 'system', } enum SceneType { VIDEO = 'video', IMAGE = 'image', } export enum AlarmTimelineType { // 未知 UNKNOWN = 'unknown', // 通知timeline NOTIFICATION = 'notification', // 处理timeline PROCESS = 'process', // 受理timeline ACCEPT = 'accept', // 完结timeline FINISH = 'finish', // 事件timeline EVENT = 'event', // 补充信息timeline SUPPLEMENT = 'supplement', // 人工客服致电 CALL = 'ticket:call', // 工单处理意见 COMMENT = 'ticket:comment', ALL = '', } interface IHandleData { // 处理人, 系统处理则为null userId: string | null; // 处理来源, 如果为`system`则userId为null source: Source; } // eslint-disable-next-line export namespace AlarmTimelineData { // 处理数据 export interface IProcessData extends IHandleData { // 预警处理类型 type: string; // 预警处理原因 reason: string; // 预警处理意见 comment: string; // 预警处理现场 scenes: { type: SceneType; url: string }[]; // 预警处理备注 remark: string | null; // 预警处理来源 source: Source; } // 受理数据 export interface IAcceptionData extends IHandleData {} // 完结数据 export interface IFinishedData extends IHandleData { // 完结报告 report: string; // 完结图片 scenes: { type: SceneType; url: string }[]; } // 通知数据 export interface INotificationData { // 通知类型 type: Notification.Type; notificationIds: string[]; // 通知对象数组 notifications: { // 预警通知级别 multilevel: number; // 通知时间 updatedTime: number; // 联系人姓名 name: string; // 联系方式 contact: string; // 联系人来源 source: Notification.ContactSource; // 通知状态 status: Notification.Status; // 身份 position: string; // 通话时长 秒 duration: number; }[]; } // 事件分类枚举 enum Category { SENSE = 'sense', TASK = 'task', OTHER = 'other', } // 事件状态枚举 enum Status { // 预警状态 ALARM = 'alarm', // 恢复状态 RECOVERY = 'recovery', // 一般状态 NORMAL = 'normal', } // 事件数据 export interface IEventData { eventId: string; // 事件类型 type: string; // 事件分类 category: Category; // 事件状态 status: Status; // 事件元信息 metadata: object; } // 补充信息数据 export interface ISupplementData extends IHandleData { // 补充信息 information: string; // 补充图片 scenes: { type: SceneType; url: string }[]; } } export type AlarmTimelineData = | AlarmTimelineData.IAcceptionData | AlarmTimelineData.IEventData | AlarmTimelineData.IAcceptionData | AlarmTimelineData.IProcessData | AlarmTimelineData.IFinishedData | AlarmTimelineData.INotificationData | AlarmTimelineData.ISupplementData; export interface AlarmTimelineItem { occuredTime: number; type: AlarmTimelineType; data: AlarmTimelineData; user?: any; } export enum Category { SENSE = 'sense', TASK = 'task', CAPTURE = 'capture', OTHER = 'other', } export enum Status { ALARM = 'alarm', RECOVERY = 'recovery', NORMAL = 'normal', } export interface EventMetaData { cameraDeviceIds: string[]; // 传感数据 sensorData: object; // 传感器数值描述(非布尔非枚举类型时存在此字段) sensorValueDescription?: string; alarmId: number | string; // 抓拍对象 capture: { // 抓拍类型 type: number; // 抓拍图片 imageUrl: string; // 抓拍图片对应的全景图片 sceneUrl: string; // 抓拍时间, 单位: ms captureTime: number; // 属性 attribute: object; // 当前抓拍图片的抓拍id captureId: string; // 当前图片对应的唯一faceID faceId: string; // 当前图片所聚类的personID personId: string; // 抓拍图在全景图中的坐标 position: object; // 用户自定义的抓拍区域 ruleRegion: object; }; // 预警时间 alarmTime: number; // 相似度 confidence: number; // Camera相关的字段存在此字段(暂时用来判断是sensor预警还是task预警) task?: { // 布控id id: string; depict: string; // 布控名称 name: string; // 布控类型 type: number; alarmAcceptUserInfo: { // 灵思的用户id id: string; }[]; }; repo: { // 告警对应的布控库 id: string; // 告警对应的布控库名称 name: string; }; // 布控人员信息 register: { // 布控库中的register_id/person_id id: string; // 布控姓名 name: string; // 布控性别 gender: string; // 布控底片 imageUrl: string; // 布控对象电话 phone: string; // 布控人身份证号码 idCard: string; }; // 社区上报数据 reporter: { contact: string; name: string; }; space: string; videos: string[]; images: string[]; description: string; } export interface AlarmEvent { id: string; type: string; timestamp: number; category: EventCategory; status: EventStatus; metadata: EventMetaData; } export interface CameraData { cid: string; address: string; id: number; lat: number; lng: number; coverImg?: string; flvUrl: string; m3u8Url: string; status: 0 | 1; sn: string; } export interface DeviceContacts { name: string; id: string; contact: string; } export interface Alarm { id: string; name: string; merchantId: string; status: AlarmStatus; lnglat: [number, number]; subStatus: string; type: AlarmType; location: string; rule: { id: string; actionType: string; name: string; }; device: { sn: string; name: string; category: string; contacts: Array<{ name: string; contact: string; }>; }; devices: { id: string; // 设备id sourceId: string; // 设备sourceId sn: string; // 设备sn name: string; // 设备名称 subsystem: string; }[]; space: { spaceIds: Array; names: Array<{ id: string; name: string; }>; }; spaceIds: Array; triggerEvent: AlarmEvent; createdTime: number; updatedTime: number; // card: { event: { name: string; type: string; code: string; description: string; }; type: string; }; // 关联的摄像机 cameras: Array; contacts?: Array; } export interface Device { id: string; domain: string; // 所属项目 merchantId: string; // 设备网络状态 false: 离线;true: 正常 networkStatus: boolean; // 设备状态 status: DeviceStatus; location: string; // 部署信息 deployment: Partial; subsystem: { name: string; sourceId: string; sn?: string; // 设备类型 type: string; // 设备型号 category: string; updatedTime: number; }; acceptance?: { time: number; status: string; user: { id: string; nickname: string; }; }; }