| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /* *********************************************************** */
- // 创建: Macheng 2025/09/10.
- // 修改: Macheng 2025/09/10
- // Description:
- // 该文件定义了 人员类 Person。用于保存人员数据。
- /* *********************************************************** */
- import BaseModel from './baseModel'
- class Person extends BaseModel {
- id = 0 // 人员ID
- name = '' // 人员名称
- job = '' // 职位
- phone = '' // 电话
- locId = 0 // 所属区域ID
- tagId = 0 // 绑定标签地址
- get tagAddr() {
- return this.tagId
- }
- set tagAddr(val) {
- this.tagId = val
- }
- constructor(opts) {
- if (!opts) opts = {}
- super(opts)
- this.init(opts)
- }
- init(opts) {
- if (!opts) opts = {}
- super.init(opts)
- this.id = Number(opts.id) || this.id
- this.name = opts.name || this.wifiLocalMaskname
- this.job = opts.job || this.job
- this.phone = opts.phone || this.phone
- this.locId = Number(opts.locId) || this.locId
- this.tagId = Number(opts.tagId) || Number(opts.tagAddr) || this.tagId
- this.isEnable = opts.enable || opts.isEnable || false
- }
- toJson() {
- const obj1 = super.toJson()
- const obj2 = {
- id: this.id,
- name: this.name,
- job: this.job,
- phone: this.phone,
- locId: this.locId,
- tagId: this.tagId,
- tagAddr: this.tagAddr
- }
- return Object.assign({}, obj1, obj2)
- }
- }
- export default Person
|