IHSeviceListCell.swift 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // IHSeviceListCell.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2019/12/19.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class IHSeviceListCell: UITableViewCell {
  10. weak var delegate : IHServiceCellDelegate?
  11. var alarm: AlarmData?{
  12. didSet{
  13. if let name = self.alarm?.name,let roomNumber = self.alarm?.roomNumber,let content = self.alarm?.content ,let type = self.alarm?.type,let floor = self.alarm?.floor{
  14. var devType = ""
  15. if type == "0"{
  16. devType = "Lights-"
  17. }else if type == "1"{
  18. devType = " Circadian light-"
  19. }else if type == "2"{
  20. devType = "Sensor-"
  21. }else if type == "3"{
  22. devType = " Air purifier-"
  23. }
  24. nameLabel.text = devType + name
  25. contentLabel.text = content
  26. roomNumberLabel.text = floor + "-" + roomNumber
  27. }
  28. }
  29. }
  30. @IBOutlet weak var nameLabel: UILabel!
  31. @IBOutlet weak var roomNumberLabel: UILabel!
  32. @IBOutlet weak var contentLabel: UILabel!
  33. var tableView:UITableView?
  34. @IBOutlet weak var ihContentView: UIView!
  35. override func awakeFromNib() {
  36. super.awakeFromNib()
  37. // Initialization code
  38. ihContentView.allRoundShadow()
  39. }
  40. override func setSelected(_ selected: Bool, animated: Bool) {
  41. super.setSelected(selected, animated: animated)
  42. // Configure the view for the selected state
  43. }
  44. @IBAction func detailAction(_ sender: Any) {
  45. if let delegate = delegate {
  46. delegate.seeDetails(for: (tableView?.indexPath(for: self))!)
  47. }
  48. }
  49. @IBAction func repairAction(_ sender: Any) {
  50. if let delegate = delegate {
  51. delegate.repairEquipment!(for: (tableView?.indexPath(for: self))!)
  52. }
  53. }
  54. @IBAction func deleteAction(_ sender: Any) {
  55. if let delegate = delegate {
  56. delegate.deleteEquipment(for: (tableView?.indexPath(for: self))!)
  57. }
  58. }
  59. }