alarm.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* *********************************************************** */
  2. // 创建: Macheng 2019/09/05.
  3. // 修改: Macheng 2019/09/05
  4. // Description:
  5. // 该文件定义了报警类Alarm。用于保存报警数据。
  6. /* *********************************************************** */
  7. import BaseModel from './baseModel'
  8. class Alarm extends BaseModel {
  9. id = 0 // 报警编号
  10. beginTime = 0 // 报警起始时间
  11. endTime = 0 // 报警结束时间
  12. srcType = 0 // 报警源类型 0:标签, 1:基站
  13. srcId = 0 // 报警源ID 当srcType==0时表示标签的地址,当srcType==0时表示基站的地址
  14. buildingId = 0 // 报警所在建筑ID
  15. buildingName = '' // 报警所在建筑名称
  16. floorId = 0 // 报警所在层级 ID
  17. floorName = '' // 报警所在层级名称
  18. areaId = 0 // 报警所在区域ID
  19. areaName = '' // 报警所在区域名称
  20. x = 0 // 报警所在坐标X
  21. y = 0 // 报警所在坐标Y
  22. z = 0 // 报警所在坐标Z
  23. type = 0 // 报警类型
  24. //报警发生人员相关信息(现场)
  25. playerId = 0 // 报警人员ID,当srcType==0时有效
  26. playerName = '' // 报警人员名称
  27. majorName = '' // 报警人员专业名称
  28. depId = 0 // 报警人员部门ID
  29. depName = '' // 报警人员部门名称
  30. //报警确认人员相关信息(监控)
  31. confirmTime = 0 // 报警确认时间
  32. confirmPlayerId = 0 // 报警确认人员ID
  33. confirmPlayerName = '' // 报警确认人员名称
  34. confirmMajorName = '' // 报警确认人员专业名称
  35. confirmDepId = 0 // 报警确认人员部门ID
  36. confirmDepName = '' // 报警确认人员部门名称
  37. constructor(opts) {
  38. if (!opts) opts = {}
  39. super(opts)
  40. this.init(opts)
  41. }
  42. init(opts) {
  43. if (!opts) opts = {}
  44. super.init(opts)
  45. this.id = Number(opts['id']) || 0
  46. this.beginTime = Number(opts['beginTime']) || 0
  47. this.endTime = Number(opts['endTime']) || 0
  48. this.srcType = Number(opts['srcType']) || 0
  49. this.srcId = Number(opts['srcId']) || 0
  50. this.buildingId = Number(opts['buildingId']) || 0
  51. this.buildingName = opts['buildingName'] || ''
  52. this.floorId = Number(opts['floorId']) || 0
  53. this.floorName = opts['floorName'] || ''
  54. this.areaId = Number(opts['areaId']) || 0
  55. this.areaName = opts['areaName'] || ''
  56. this.x = Number(opts['x']) || 0
  57. this.y = Number(opts['y']) || 0
  58. this.z = Number(opts['z']) || 0
  59. this.type = Number(opts['type']) || 0
  60. this.playerId = Number(opts['playerId']) || 0
  61. this.playerName = opts['playerName'] || ''
  62. this.majorName = opts['majorName'] || ''
  63. this.depId = Number(opts['depId']) || 0
  64. this.depName = opts['depName'] || ''
  65. this.confirmTime = Number(opts['confirmTime']) || 0
  66. this.confirmPlayerId = Number(opts['confirmPlayerId']) || 0
  67. this.confirmPlayerName = opts['confirmPlayerName'] || ''
  68. this.confirmMajorName = opts['confirmMajorName'] || ''
  69. this.confirmDepId = Number(opts['confirmDepId']) || 0
  70. this.confirmDepName = opts['confirmDepName'] || ''
  71. }
  72. toJson() {
  73. const obj1 = super.toJson()
  74. const obj2 = {
  75. id: this.id,
  76. beginTime: this.beginTime,
  77. endTime: this.endTime,
  78. srcType: this.srcType,
  79. srcId: this.srcId,
  80. buildingId: this.buildingId,
  81. buildingName: this.buildingName,
  82. floorId: this.floorId,
  83. floorName: this.floorName,
  84. areaId: this.areaId,
  85. areaName: this.areaName,
  86. x: this.x,
  87. y: this.y,
  88. z: this.z,
  89. type: this.type,
  90. playerId: this.playerId,
  91. playerName: this.playerName,
  92. majorName: this.majorName,
  93. depId: this.depId,
  94. depName: this.depName,
  95. confirmTime: this.confirmTime,
  96. confirmPlayerId: this.confirmPlayerId,
  97. confirmPlayerName: this.confirmPlayerName,
  98. confirmMajorName: this.confirmMajorName,
  99. confirmDepId: this.confirmDepId,
  100. confirmDepName: this.confirmDepName
  101. }
  102. return Object.assign({}, obj1, obj2)
  103. }
  104. }
  105. export default Alarm