/* *********************************************************** */ // 创建: Macheng 2020/07/31. // 修改: Macheng 2020/07/31 // Description: // 该文件定义了系统配置参数类。实时监控和后台管理的配置都放到这里。 /* *********************************************************** */ import BaseModel from './baseModel' import MainTypeDef from './mainTypeDef' class SysCfgView extends BaseModel { webTitle = 'ScenLoc-View' // WEB标题 logoBase64 = '' // LOGO的BASE64编码 owner = '上海迅见自动化有限公司' // 右下角运营商名称 enableCopyright = 1 // 显示版权 scheduleInterval = 1000 // 实时数据更新周期(单位:毫秒) hideMenus = [] // 隐藏的菜单 hideTabs = [] // 隐藏的标签 extUrlTitle = '' // 外链标题 extUrlContent = '' // 外链URL extUrlEnable = 0 // 外链启用 constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) this.webTitle = opts.webTitle || this.webTitle this.logoBase64 = opts.logoBase64 || this.logoBase64 this.owner = opts.owner this.enableCopyright = Number(opts.enableCopyright) this.scheduleInterval = Number(opts.scheduleInterval) || Number(this.scheduleInterval) this.hideMenus = opts.hideMenus || this.hideMenus this.hideTabs = opts.hideTabs || this.hideTabs this.extUrlTitle = opts.extUrlTitle || this.extUrlTitle this.extUrlContent = opts.extUrlContent || this.extUrlContent this.extUrlEnable = Number(opts.extUrlEnable) } toJson() { const obj1 = super.toJson() const obj2 = { webTitle: this.webTitle, logoBase64: this.logoBase64, owner: this.owner, enableCopyright: this.enableCopyright, scheduleInterval: this.scheduleInterval, hideMenus: this.hideMenus, hideTabs: this.hideTabs, extUrlTitle: this.extUrlTitle, extUrlContent: this.extUrlContent, extUrlEnable: this.extUrlEnable } return Object.assign({}, obj1, obj2) } } class SysCfgAlarm extends BaseModel { alarmHRLimMin = 30 // 心率报警下限 alarmHRLimMax = 180 // 心率报警上限 alarmHRLimSpan = 50 // 5分钟心率波动范围限制 alarmHREnable = 0 // 启用心率报警 alarmDropEnable = 0 // 启用跌落报警 alarmTagLowPowEnable = 0 // 启用标签低电报警 alarmAncOffPowEnable = 0 // 启用基站掉电报警 alarmAncLowPowEnable = 0 // 启用基站低电报警 alarmLimitNumEnable = 0 // 启用区域超限报警 alarmClusterEnable = 0 // 启用聚集度报警 constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) this.alarmHRLimMin = Number(opts.alarmHRLimMin) || Number(this.alarmHRLimMin) this.alarmHRLimMax = Number(opts.alarmHRLimMax) || Number(this.alarmHRLimMax) this.alarmHRLimSpan = Number(opts.alarmHRLimSpan) || Number(this.alarmHRLimSpan) this.alarmHREnable = Number(opts.alarmHREnable) this.alarmDropEnable = Number(opts.alarmDropEnable) this.alarmTagLowPowEnable = Number(opts.alarmTagLowPowEnable) this.alarmAncOffPowEnable = Number(opts.alarmAncOffPowEnable) this.alarmAncLowPowEnable = Number(opts.alarmAncLowPowEnable) this.alarmLimitNumEnable = Number(opts.alarmLimitNumEnable) this.alarmClusterEnable = Number(opts.alarmClusterEnable) } toJson() { const obj1 = super.toJson() const obj2 = { alarmHRLimMin: this.alarmHRLimMin, alarmHRLimMax: this.alarmHRLimMax, alarmHRLimSpan: this.alarmHRLimSpan, alarmHREnable: this.alarmHREnable, alarmDropEnable: this.alarmDropEnable, alarmTagLowPowEnable: this.alarmTagLowPowEnable, alarmAncOffPowEnable: this.alarmAncOffPowEnable, alarmAncLowPowEnable: this.alarmAncLowPowEnable, alarmLimitNumEnable: this.alarmLimitNumEnable, alarmClusterEnable: this.alarmClusterEnable } return Object.assign({}, obj1, obj2) } } class SysCfgCalc extends BaseModel { tagDistUseKalman = 0 // 标签测距采用卡尔曼滤波 tagDistKalmanQ = 0.2 // 标签测距卡尔曼滤波Q tagDistKalmanR = 2.5 // 标签测距卡尔曼滤波R tagDistRemainMs = 10000 // 标签测距存留周期 tagDistForecastMs = 1000 // 标签测距预测周期 tagDistSpeed = 2 // 标签测距限定速率 tagDistMeasureDiff = 4 // 标签测距容许误差 tagPosUseKalman = 0 // 标签位置采用卡尔曼滤波 tagPosKalmanQ = 0.2 // 标签位置卡尔曼滤波Q tagPosKalmanR = 0.5 // 标签位置卡尔曼滤波R tagPosKalmanTO = 10000 // 标签位置卡尔曼超时 tagPosDShakeDx = 0.05 // 标签位置消抖dx tagPosDShakeDy = 0.05 // 标签位置消抖dy tagPosDShakeDz = 0.05 // 标签位置消抖dz tagPosSliderWin = 0 // 标签位置平移窗口 tagPosUse4Anc = 0 // 是否4基站优化 tagPosLimDist = 3 // 标签位置限幅距离 tagPosFloorLimDist = 1.5 // 标签层级限幅距离 tagPosCalcInterval = 500 // 标签位置计算周期(ms) tagPosOfflineJudge = 10 // 标签位置离线判定(s) tagPosOfflineRemain = 30 // 标签位置离线存留(s) frameEnableLog = 0 // 是否记录报文 logCalc = 0 // 计算日志 logCalcTagAddr = 0 // 计算限定标签 enGlobalAtlas = 0 // 启用全局地图 globalAtlasId = 0 // 全局地图ID clusterRadius = 0 // 聚合半径 clusterAlarm1Limit = 0 // 聚合报警1低限 clusterAlarm2Limit = 0 // 聚合报警2低限 clusterAlarm3Limit = 0 // 聚合报警3低限 clusterHoldTime = 0 //聚合报警维持时间 constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) this.tagDistUseKalman = Number(opts.tagDistUseKalman) || Number(this.tagDistUseKalman) this.tagDistKalmanQ = Number(opts.tagDistKalmanQ) || Number(this.tagDistKalmanQ) this.tagDistKalmanR = Number(opts.tagDistKalmanR) || Number(this.tagDistKalmanR) this.tagDistRemainMs = Number(opts.tagDistRemainMs) || Number(this.tagDistRemainMs) this.tagDistForecastMs = Number(opts.tagDistForecastMs) || Number(this.tagDistForecastMs) this.tagDistSpeed = Number(opts.tagDistSpeed) || Number(this.tagDistSpeed) this.tagDistMeasureDiff = Number(opts.tagDistMeasureDiff) || Number(this.tagDistMeasureDiff) this.tagPosUseKalman = Number(opts.tagPosUseKalman) || Number(this.tagPosUseKalman) this.tagPosKalmanQ = Number(opts.tagPosKalmanQ) || Number(this.tagPosKalmanQ) this.tagPosKalmanR = Number(opts.tagPosKalmanR) || Number(this.tagPosKalmanR) this.tagPosKalmanTO = Number(opts.tagPosKalmanTO) || Number(this.tagPosKalmanTO) this.tagPosDShakeDx = Number(opts.tagPosDShakeDx) || Number(this.tagPosDShakeDx) this.tagPosDShakeDy = Number(opts.tagPosDShakeDy) || Number(this.tagPosDShakeDy) this.tagPosDShakeDz = Number(opts.tagPosDShakeDz) || Number(this.tagPosDShakeDz) this.tagPosSliderWin = Number(opts.tagPosSliderWin) || Number(this.tagPosSliderWin) this.tagPosUse4Anc = Number(opts.tagPosUse4Anc) || Number(this.tagPosUse4Anc) this.tagPosLimDist = Number(opts.tagPosLimDist) || Number(this.tagPosLimDist) this.tagPosFloorLimDist = Number(opts.tagPosFloorLimDist) || Number(this.tagPosFloorLimDist) this.tagPosCalcInterval = Number(opts.tagPosCalcInterval) || Number(this.tagPosCalcInterval) this.tagPosOfflineJudge = Number(opts.tagPosOfflineJudge) || Number(this.tagPosOfflineJudge) this.tagPosOfflineRemain = Number(opts.tagPosOfflineRemain) || Number(this.tagPosOfflineRemain) this.frameEnableLog = Number(opts.frameEnableLog) || Number(this.frameEnableLog) this.logCalc = Number(opts.logCalc) || Number(this.logCalc) this.logCalcTagAddr = Number(opts.logCalcTagAddr) || Number(this.logCalcTagAddr) this.enGlobalAtlas = Number(opts.enGlobalAtlas) || Number(this.enGlobalAtlas) this.globalAtlasId = Number(opts.globalAtlasId) || Number(this.globalAtlasId) this.clusterRadius = Number(opts.clusterRadius) || Number(this.clusterRadius) this.clusterAlarm1Limit = Number(opts.clusterAlarm1Limit) || Number(this.clusterAlarm1Limit) this.clusterAlarm2Limit = Number(opts.clusterAlarm2Limit) || Number(this.clusterAlarm2Limit) this.clusterAlarm3Limit = Number(opts.clusterAlarm3Limit) || Number(this.clusterAlarm3Limit) this.clusterHoldTime = Number(opts.clusterHoldTime) || Number(this.clusterHoldTime) } toJson() { const obj1 = super.toJson() const obj2 = { tagDistUseKalman: this.tagDistUseKalman, tagDistKalmanQ: this.tagDistKalmanQ, tagDistKalmanR: this.tagDistKalmanR, tagDistRemainMs: this.tagDistRemainMs, tagDistForecastMs: this.tagDistForecastMs, tagDistSpeed: this.tagDistSpeed, tagDistMeasureDiff: this.tagDistMeasureDiff, tagPosUseKalman: this.tagPosUseKalman, tagPosKalmanQ: this.tagPosKalmanQ, tagPosKalmanR: this.tagPosKalmanR, tagPosKalmanTO: this.tagPosKalmanTO, tagPosDShakeDx: this.tagPosDShakeDx, tagPosDShakeDy: this.tagPosDShakeDy, tagPosDShakeDz: this.tagPosDShakeDz, tagPosSliderWin: this.tagPosSliderWin, tagPosUse4Anc: this.tagPosUse4Anc, tagPosLimDist: this.tagPosLimDist, tagPosFloorLimDist: this.tagPosFloorLimDist, tagPosCalcInterval: this.tagPosCalcInterval, tagPosOfflineJudge: this.tagPosOfflineJudge, tagPosOfflineRemain: this.tagPosOfflineRemain, frameEnableLog: this.frameEnableLog, logCalc: this.logCalc, enGlobalAtlas: this.enGlobalAtlas, globalAtlasId: this.globalAtlasId, clusterRadius: this.clusterRadius, clusterAlarm1Limit: this.clusterAlarm1Limit, clusterAlarm2Limit: this.clusterAlarm2Limit, clusterAlarm3Limit: this.clusterAlarm3Limit, clusterHoldTime: this.clusterHoldTime } return Object.assign({}, obj1, obj2) } } class SysCfgHttpsender extends BaseModel { interval = 30 // 发送间隔时间(s) script = '' // 发送脚本 runState = 0 // 运行状态 0:启用,1:停用 constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) this.interval = Number(opts.interval) || Number(this.interval) this.script = opts.script || this.script this.runState = Number(opts.runState) || Number(this.runState) } toJson() { const obj1 = super.toJson() const obj2 = { interval: this.interval, script: this.script, runState: this.runState } return Object.assign({}, obj1, obj2) } } class SysCfgDb extends BaseModel { hisDbSaveEnable = 0 // 启用保存历史数据 hisDbSaveInterval = 0 // 历史数据保存间隔 constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) this.hisDbSaveEnable = Number(opts.hisDbSaveEnable) || 0; this.hisDbSaveInterval = Number(opts.hisDbSaveInterval) || 0; } toJson() { const obj1 = super.toJson() const obj2 = { hisDbSaveEnable: this.hisDbSaveEnable, hisDbSaveInterval: this.hisDbSaveInterval } return Object.assign({}, obj1, obj2) } } class SysCfgSign extends BaseModel { vecMainTypeDef = [] // 标记的用途列表 constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) this.vecMainTypeDef = [] if (opts['vecMainTypeDef']) { let vecMainTypeDef = [] if (opts['vecMainTypeDef'] instanceof Array) { vecMainTypeDef = opts['vecMainTypeDef'] } else if (opts['vecMainTypeDef'] instanceof String) { vecMainTypeDef = JSON.parse(opts['vecMainTypeDef']) } for (const v of vecMainTypeDef) { const f = new MainTypeDef(v) this.vecMainTypeDef.push(f) } } } toJson() { const vecMainTypeDef = [] for (const v of this.vecMainTypeDef) { vecMainTypeDef.push(v.toJson()) } const obj1 = super.toJson() const obj2 = { vecMainTypeDef: vecMainTypeDef } return Object.assign({}, obj1, obj2) } } class SysCfg extends BaseModel { sysCfgView = new SysCfgView() sysCfgAlarm = new SysCfgAlarm() sysCfgCalc = new SysCfgCalc() sysCfgHttpsender = new SysCfgHttpsender() sysCfgDb = new SysCfgDb() sysCfgSign = new SysCfgSign() constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) if (opts['sysCfgView']) { this.sysCfgView.init(JSON.parse(opts['sysCfgView'])) } if (opts['sysCfgAlarm']) { this.sysCfgAlarm.init(JSON.parse(opts['sysCfgAlarm'])) } if (opts['sysCfgCalc']) { this.sysCfgCalc.init(JSON.parse(opts['sysCfgCalc'])) } if (opts['sysCfgHttpsender']) { this.sysCfgHttpsender.init(JSON.parse(opts['sysCfgHttpsender'])) } if (opts['sysCfgDb']) { this.sysCfgDb.init(JSON.parse(opts['sysCfgDb'])) } if (opts['sysCfgSign']) { this.sysCfgSign.init(JSON.parse(opts['sysCfgSign'])) } } toJson() { const obj1 = super.toJson() const obj2 = { sysCfgView: this.sysCfgView.toJson(), sysCfgAlarm: this.sysCfgAlarm.toJson(), sysCfgCalc: this.sysCfgCalc.toJson(), sysCfgHttpsender: this.sysCfgHttpsender.toJson(), sysCfgDb: this.sysCfgDb.toJson(), sysCfgSign: this.sysCfgSign.toJson() } return Object.assign({}, obj1, obj2) } } export default SysCfg