OOAttandanceTotalItemCell.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // OOAttandanceTotalItemCell.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2018/5/23.
  6. // Copyright © 2018年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class OOAttandanceTotalItemCell: UITableViewCell,Configurable {
  10. @IBOutlet weak var iconLabel: UILabel!
  11. @IBOutlet weak var checkinDateLabel: UILabel!
  12. @IBOutlet weak var startTimeLabel: UILabel!
  13. @IBOutlet weak var endTimeLabel: UILabel!
  14. override func awakeFromNib() {
  15. super.awakeFromNib()
  16. iconLabel.layer.cornerRadius = 10
  17. iconLabel.layer.masksToBounds = true
  18. }
  19. override func setSelected(_ selected: Bool, animated: Bool) {
  20. super.setSelected(selected, animated: animated)
  21. // Configure the view for the selected state
  22. }
  23. func config(withItem item: Any?) {
  24. guard let model = item as? OOAttandanceCheckinTotal else {
  25. return
  26. }
  27. checkinDateLabel.text = model.recordDateString
  28. startTimeLabel.text = model.onDutyTime
  29. endTimeLabel.text = model.offDutyTime
  30. if model.isLate == true {
  31. self.iconLabel.text = "迟"
  32. self.iconLabel.backgroundColor = UIColor(hex: "#F5A623")
  33. }else if model.isLeaveEarlier == true {
  34. self.iconLabel.text = "早"
  35. self.iconLabel.backgroundColor = UIColor(hex: "#AC71E3")
  36. }else if model.isGetSelfHolidays == true {
  37. self.iconLabel.text = "假"
  38. self.iconLabel.backgroundColor = UIColor(hex: "#4FB2E3")
  39. }else {
  40. self.iconLabel.text = "正"
  41. self.iconLabel.backgroundColor = UIColor(hex: "#FB4747")
  42. }
  43. }
  44. }