OOMeetingInforItemCell.swift 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // OOMeetingInforItemCell.swift
  3. // o2app
  4. //
  5. // Created by 刘振兴 on 2018/1/4.
  6. // Copyright © 2018年 zone. All rights reserved.
  7. //
  8. import UIKit
  9. import JTCalendar
  10. class OOMeetingInforItemCell: UITableViewCell,Configurable {
  11. @IBOutlet weak var statusImageView: UIImageView!
  12. @IBOutlet weak var timeInternal: UILabel!
  13. @IBOutlet weak var titleLabel: UILabel!
  14. @IBOutlet weak var meetingroomLabel: UILabel!
  15. @IBOutlet weak var meetingPersonsLabel: UILabel!
  16. @IBOutlet weak var authorLabel: UILabel!
  17. private let dateHelper = JTDateHelper()
  18. var viewModel:OOMeetingMainViewModel?
  19. override func awakeFromNib() {
  20. super.awakeFromNib()
  21. // Initialization code
  22. }
  23. override func setSelected(_ selected: Bool, animated: Bool) {
  24. super.setSelected(selected, animated: animated)
  25. // Configure the view for the selected state
  26. }
  27. func config(withItem item: Any?) {
  28. guard let model = item as? OOMeetingInfo else {
  29. return
  30. }
  31. //时间段
  32. let startTime = Date.date( model.startTime ?? "", formatter: "yyyy-MM-dd HH:mm:ss")
  33. let endTime = Date.date(model.completedTime ?? "", formatter: "yyyy-MM-dd HH:mm:ss")
  34. if startTime != nil && endTime != nil {
  35. let formatter = DateFormatter()
  36. formatter.dateFormat = "HH:mm"
  37. let sTime = formatter.string(from: startTime!)
  38. let eTime = formatter.string(from: endTime!)
  39. timeInternal.text = "\(sTime)-\(eTime)"
  40. }
  41. // status: completed processing wait
  42. if model.status == "wait" {
  43. self.statusImageView.image = #imageLiteral(resourceName: "icon_weikaishi")
  44. self.timeInternal.textColor = UIColor(hex: "#4FB2E3")
  45. } else if model.status == "processing" {
  46. self.statusImageView.image = #imageLiteral(resourceName: "icon_jinxingzhong")
  47. self.timeInternal.textColor = UIColor(hex: "#62C493")
  48. }else {
  49. self.statusImageView.image = #imageLiteral(resourceName: "pic_jieshu")
  50. self.timeInternal.textColor = UIColor(hex: "#999999")
  51. }
  52. titleLabel.text = model.subject
  53. viewModel?.loadMeetingRoomById(model.room!, completed: { (roomResult) in
  54. guard let itemRoom = roomResult else{
  55. self.meetingroomLabel.text = "未知会议室"
  56. return
  57. }
  58. self.meetingroomLabel.text = itemRoom.name
  59. })
  60. let persons = model.invitePersonList?.map({ (p) -> String in
  61. return String(p.split(separator: "@")[0])
  62. }).joined(separator: ",")
  63. meetingPersonsLabel.text = persons
  64. authorLabel.text = String(model.applicant!.split(separator: "@")[0])
  65. }
  66. }