attendItem.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* *********************************************************** */
  2. // 创建: Macheng 2025/09/13.
  3. // 修改: Macheng 2025/09/13
  4. // Description:
  5. // 该文件定义了 考勤单项 AttendItem。用于保存单人考勤数据。
  6. /* *********************************************************** */
  7. import BaseModel from './baseModel'
  8. class AttendItem extends BaseModel {
  9. id = 0 // 人员ID
  10. name = '' // 人员名称
  11. job = '' // 职位
  12. phone = '' // 电话
  13. tagId = 0 // 绑定标签地址
  14. rssi = 0 // 信号强度
  15. confirm = 0 // 0:缺岗,1:到岗
  16. tm = 0
  17. projId = 0
  18. locId = 0
  19. parent = null
  20. get isOnline() {
  21. return this.rssi != 0
  22. }
  23. constructor(opts) {
  24. if (!opts) opts = {}
  25. super(opts)
  26. this.init(opts)
  27. }
  28. init(opts) {
  29. if (!opts) opts = {}
  30. super.init(opts)
  31. this.id = Number(opts.id) || this.id
  32. this.name = opts.name || this.wifiLocalMaskname
  33. this.job = opts.job || this.job
  34. this.phone = opts.phone || this.phone
  35. this.tagId = Number(opts.tagId) || Number(opts.tagAddr) || this.tagId
  36. this.rssi = Number(opts.rssi) || this.rssi
  37. this.confirm = Number(opts.confirm) || this.confirm
  38. this.isEnable = opts.enable || opts.isEnable || false
  39. }
  40. toJson() {
  41. const obj1 = super.toJson()
  42. const obj2 = {
  43. id: this.id,
  44. name: this.name,
  45. job: this.job,
  46. phone: this.phone,
  47. tagId: this.tagId,
  48. tagAddr: this.tagAddr,
  49. rssi: this.rssi,
  50. confirm: this.confirm,
  51. }
  52. return Object.assign({}, obj1, obj2)
  53. }
  54. }
  55. export default AttendItem