/* *********************************************************** */ // 创建: Macheng 2025/09/13. // 修改: Macheng 2025/09/13 // Description: // 该文件定义了考勤记录类 Attend。用于保存单挑考勤数据。 /* *********************************************************** */ import BaseModel from './baseModel' import AttendItem from './attendItem' class Attend extends BaseModel { tm = 0 // 时间 projId = 0 // 项目ID locId = 0 // 区域ID items = [] // 考勤项列表 constructor(opts) { if (!opts) opts = {} super(opts) this.init(opts) } init(opts) { if (!opts) opts = {} super.init(opts) this.tm = Number(opts.tm) || this.tm this.projId = Number(opts.projId) || this.projId this.locId = Number(opts.locId) || this.locId this.items = (opts.items || []).map(item => { const t = new AttendItem(item) t.tm = this.tm t.projId = this.projId t.locId = this.locId t.parent = this return t }) this.isEnable = opts.enable || opts.isEnable || false } toJson() { const obj1 = super.toJson() const obj2 = { tm: this.tm, projId: this.projId, locId: this.locId, items: this.items.map(item => item.toJson()) } return Object.assign({}, obj1, obj2) } } export default Attend