OOFormModels.swift 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //
  2. // OOFormModels.swift
  3. // o2app
  4. //
  5. // Created by 刘振兴 on 2018/1/25.
  6. // Copyright © 2018年 zone. All rights reserved.
  7. //
  8. import UIKit
  9. import HandyJSON
  10. enum OOFormComponentType {
  11. case textItem
  12. case dateItem
  13. case dateIntervalItem
  14. case segueItem
  15. }
  16. enum OOFormItemStatus {
  17. case read
  18. case edit
  19. }
  20. open class OOFormBaseModel:NSObject{
  21. var titleName:String?
  22. var key:String?
  23. var callbackValue:Any?
  24. var componentType:OOFormComponentType?
  25. var itemStatus:OOFormItemStatus?
  26. public override init() {
  27. super.init()
  28. }
  29. convenience init(titleName name:String,key:String,componentType:OOFormComponentType,itemStatus:OOFormItemStatus) {
  30. self.init()
  31. self.titleName = name
  32. self.key = key
  33. self.componentType = componentType
  34. self.itemStatus = itemStatus
  35. }
  36. }
  37. class OOFormDateIntervalModel:OOFormBaseModel{
  38. var value1:Any?
  39. var value2:Any?
  40. override init() {
  41. }
  42. }
  43. class OOFormSegueItemModel:OOFormBaseModel {
  44. var segueIdentifier:String?
  45. var destVCClass:AnyClass?
  46. override init() {
  47. }
  48. }
  49. // MARK:- 选择调用代理
  50. protocol OOCommonBackResultDelegate {
  51. func backResult(_ vcIdentifiter:String,_ result:Any?)
  52. }
  53. class OOMeetingFormBean:HandyJSON {
  54. required init() {
  55. }
  56. @objc var subject:String?
  57. @objc var summary:String?
  58. @objc var room:String?
  59. @objc var startTime:String?
  60. @objc var completedTime:String?
  61. @objc var invitePersonList:[String] = []
  62. public init(meetingForm:OOMeetingForm){
  63. self.subject = meetingForm.subject
  64. self.summary = meetingForm.summary
  65. self.room = meetingForm.room
  66. self.invitePersonList = meetingForm.invitePersonList
  67. self.startTime = "\(meetingForm.meetingDate.toString("yyyy-MM-dd")) \(meetingForm.startTime.toString("HH:mm:ss"))"
  68. self.completedTime = "\(meetingForm.meetingDate.toString("yyyy-MM-dd")) \(meetingForm.completedTime.toString("HH:mm:ss"))"
  69. }
  70. public func checkFormValues() -> Bool {
  71. if subject == nil {
  72. return false
  73. }
  74. if room == nil {
  75. return false
  76. }
  77. if startTime == nil {
  78. return false
  79. }
  80. if completedTime == nil {
  81. return false
  82. }
  83. if invitePersonList.isEmpty {
  84. return false
  85. }
  86. return true
  87. }
  88. }
  89. class OOMeetingForm:HandyJSON {
  90. @objc var subject:String?
  91. @objc var room:String?
  92. @objc var roomName:String?
  93. var meetingDate:Date = Date()
  94. var startTime:Date = Date()
  95. var completedTime:Date = Date()
  96. var invitePersonList:[String] = []
  97. @objc var summary:String?
  98. required init(){
  99. }
  100. }