sign.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* *********************************************************** */
  2. // 创建: Macheng 2019/09/05.
  3. // 修改: Macheng 2019/09/05
  4. // Description:
  5. // 该文件定义了标记类Sign。用于保存报警数据。
  6. /* *********************************************************** */
  7. import BaseModel from './baseModel'
  8. class Sign extends BaseModel {
  9. id = 0 // 编号
  10. lat = 0 // 纬度
  11. lng = 0 // 经度
  12. mainType = 0 // 类型
  13. mode = 0 // 模式
  14. nmManage = '' // 主管单位名称
  15. nmOwn = '' // 权属单位名称
  16. nmMaintain = '' // 养护单位名称
  17. grid = '' // 所属单元网格
  18. status = 0 // 状态 0:完好,1:预设,2:维护,3:废弃
  19. recorderId = 0 // 记录员Id
  20. recorderName = '' // 记录员名称
  21. phone = '' // 联系电话
  22. mat = '' // 材质
  23. spec = '' // 规格
  24. createTime = '' // 创建时间
  25. memo = '' // 备注
  26. constructor(opts) {
  27. if (!opts) opts = {}
  28. super(opts)
  29. this.init(opts)
  30. }
  31. init(opts) {
  32. if (!opts) opts = {}
  33. super.init(opts)
  34. this.id = Number(opts['id']) || 0
  35. this.lat = Number(opts['lat']) || 0
  36. this.lng = Number(opts['lng']) || 0
  37. this.mainType = Number(opts['mainType']) || 0
  38. this.mode = Number(opts['mode']) || 0
  39. this.nmManage = opts['nmManage'] || ''
  40. this.nmOwn = opts['nmOwn'] || ''
  41. this.nmMaintain = opts['nmMaintain'] || ''
  42. this.grid = opts['grid'] || ''
  43. this.status = Number(opts['status']) || 0
  44. this.recorderId = Number(opts['recorderId']) || 0
  45. this.recorderName = opts['recorderName'] || ''
  46. this.phone = opts['phone'] || ''
  47. this.mat = opts['mat'] || ''
  48. this.spec = opts['spec'] || ''
  49. this.createTime = opts['createTime'] || ''
  50. this.memo = opts['memo'] || ''
  51. }
  52. get x() {
  53. return this.lng
  54. }
  55. get y() {
  56. return this.lat
  57. }
  58. toJson() {
  59. const obj1 = super.toJson()
  60. const obj2 = {
  61. id: this.id,
  62. lat: this.lat,
  63. lng: this.lng,
  64. mainType: this.mainType,
  65. mode: this.mode,
  66. nmManage: this.nmManage,
  67. nmOwn: this.nmOwn,
  68. nmMaintain: this.nmMaintain,
  69. grid: this.grid,
  70. status: this.status,
  71. recorderId: this.recorderId,
  72. recorderName: this.recorderName,
  73. phone: this.phone,
  74. mat: this.mat,
  75. spec: this.spec,
  76. createTime: this.createTime,
  77. memo: this.memo
  78. }
  79. return Object.assign({}, obj1, obj2)
  80. }
  81. }
  82. export default Sign