123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699 |
- //
- // OOContactModel.swift
- // o2app
- //
- // Created by 刘振兴 on 2017/11/20.
- // Copyright © 2017年 zone. All rights reserved.
- //
- import Foundation
- import HandyJSON
- class OOControl : NSObject, NSCoding, DataModel{
-
- var allowDelete : Bool?
- var allowEdit : Bool?
-
- required override init() {
-
- }
-
- /**
- * NSCoding required initializer.
- * Fills the data from the passed decoder
- */
- @objc required init(coder aDecoder: NSCoder)
- {
- allowDelete = aDecoder.decodeObject(forKey: "allowDelete") as? Bool
- allowEdit = aDecoder.decodeObject(forKey: "allowEdit") as? Bool
-
- }
-
- /**
- * NSCoding required method.
- * Encodes mode properties into the decoder
- */
- @objc func encode(with aCoder: NSCoder)
- {
- if allowDelete != nil{
- aCoder.encode(allowDelete, forKey: "allowDelete")
- }
- if allowEdit != nil{
- aCoder.encode(allowEdit, forKey: "allowEdit")
- }
-
- }
-
- }
- // 面包屑导航对象
- struct ContactBreadcrumbBean {
- var key: String = ""
- var name: String = ""
- var level: Int = 0
- }
- // 选择器使用的对象
- //组织对象
- class O2UnitPickerItem: NSObject, DataModel {
-
- @objc open var id : String?
- @objc open var name : String?
- @objc open var unique : String?
- @objc open var distinguishedName : String?
- @objc open var typeList : [String]?
- @objc open var shortName : String?
- var level : Int?
- @objc open var levelName : String?
-
- override required init(){}
-
- func copyFromUnitModel(dept: OOUnitModel) {
- self.id = dept.id
- self.name = dept.name
- self.unique = dept.unique
- self.distinguishedName = dept.distinguishedName
- self.typeList = dept.typeList
- self.shortName = dept.shortName
- self.level = dept.level
- self.levelName = dept.levelName
- }
-
- }
- //身份对象
- class O2IdentityPickerItem: NSObject, DataModel {
-
- @objc open var id : String?
- @objc open var name : String?
- @objc open var unique : String?
- @objc open var distinguishedName : String?
- @objc open var person : String?
- @objc open var unit : String?
- @objc open var unitName : String?
- @objc open var personName : String?
- @objc open var personUnique : String?
- @objc open var personDn : String?
- var unitLevel : Int?
- @objc open var unitLevelName : String?
-
- override required init(){}
-
- func copyFromIdentityModel(identity: OOIdentityModel) {
- self.id = identity.id
- self.name = identity.name
- self.unique = identity.unique
- self.distinguishedName = identity.distinguishedName
- self.unit = identity.unit
- self.unitName = identity.unitName
- self.unitLevel = identity.unitLevel
- self.unitLevelName = identity.unitLevelName
- self.person = identity.person
- //person相关信息等获取用户信息后再填充
- }
- //更新用户相关的信息
- func updatePersonInfo(person: OOPersonModel) {
- self.person = person.id
- self.personUnique = person.unique
- self.personName = person.name
- self.personDn = person.distinguishedName
- }
-
- }
- //群组对象
- class O2GroupPickerItem: NSObject, DataModel {
-
- @objc open var id : String?
- @objc open var name : String?
- @objc open var unique : String?
- @objc open var distinguishedName : String?
-
- override required init(){}
-
- func copyFromGroupModel(group: OOGroupModel) {
- self.id = group.id
- self.name = group.name
- self.unique = group.unique
- self.distinguishedName = group.distinguishedName
- }
-
- }
- //人员对象
- class O2PersonPickerItem: NSObject, DataModel {
-
- @objc open var id : String?
- @objc open var name : String?
- @objc open var unique : String?
- @objc open var distinguishedName : String?
- @objc open var genderType : String?
- @objc open var employee : String?
- @objc open var mail : String?
- @objc open var weixin : String?
- @objc open var qq : String?
- @objc open var mobile : String?
- @objc open var officePhone : String?
-
- override required init(){}
-
- func copyFromPersonModel(person: OOPersonModel) {
- self.id = person.id
- self.distinguishedName = person.distinguishedName
- self.name = person.name
- self.unique = person.unique
- self.genderType = person.genderType
- self.employee = person.employee
- self.mail = person.mail
- self.weixin = person.weixin
- self.qq = person.qq
- self.mobile = person.mobile
- self.officePhone = person.officePhone
- }
- }
- // MARK: - Unit Model
- class OOUnitModel : NSObject, NSCoding, DataModel{
-
- @objc open var control : OOControl?
- @objc open var controllerList : [AnyObject]?
- @objc open var createTime : String?
- @objc open var desc : String?
- @objc open var descriptionField : String?
- @objc open var distinguishedName : String?
- @objc open var id : String?
- @objc open var inheritedControllerList : [AnyObject]?
- var level : Int?
- @objc open var levelName : String?
- @objc open var name : String?
- var orderNumber : Int?
- @objc open var pinyin : String?
- @objc open var pinyinInitial : String?
- @objc open var shortName : String?
- var subDirectIdentityCount : Int?
- var subDirectUnitCount : Int?
- @objc open var superior : String?
- @objc open var typeList : [String]?
- @objc open var unique : String?
- @objc open var updateTime : String?
- @objc open var woSubDirectIdentityList:[OOIdentityModel]?
-
- override required init(){}
-
- func mapping(mapper: HelpingMapper) {
- mapper <<< self.desc <-- "description"
- }
-
- /**
- * NSCoding required initializer.
- * Fills the data from the passed decoder
- */
- @objc required init(coder aDecoder: NSCoder)
- {
- control = aDecoder.decodeObject(forKey: "control") as? OOControl
- controllerList = aDecoder.decodeObject(forKey: "controllerList") as? [AnyObject]
- createTime = aDecoder.decodeObject(forKey: "createTime") as? String
- descriptionField = aDecoder.decodeObject(forKey: "description") as? String
- distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
- id = aDecoder.decodeObject(forKey: "id") as? String
- inheritedControllerList = aDecoder.decodeObject(forKey: "inheritedControllerList") as? [AnyObject]
- level = aDecoder.decodeObject(forKey: "level") as? Int
- levelName = aDecoder.decodeObject(forKey: "levelName") as? String
- name = aDecoder.decodeObject(forKey: "name") as? String
- orderNumber = aDecoder.decodeObject(forKey: "orderNumber") as? Int
- pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
- pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
- shortName = aDecoder.decodeObject(forKey: "shortName") as? String
- subDirectIdentityCount = aDecoder.decodeObject(forKey: "subDirectIdentityCount") as? Int
- subDirectUnitCount = aDecoder.decodeObject(forKey: "subDirectUnitCount") as? Int
- superior = aDecoder.decodeObject(forKey: "superior") as? String
- typeList = aDecoder.decodeObject(forKey: "typeList") as? [String]
- unique = aDecoder.decodeObject(forKey: "unique") as? String
- updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
- woSubDirectIdentityList = aDecoder.decodeObject(forKey: "woSubDirectIdentityList") as? [OOIdentityModel]
- }
-
- /**
- * NSCoding required method.
- * Encodes mode properties into the decoder
- */
- @objc func encode(with aCoder: NSCoder)
- {
- if control != nil{
- aCoder.encode(control, forKey: "control")
- }
- if controllerList != nil{
- aCoder.encode(controllerList, forKey: "controllerList")
- }
- if createTime != nil{
- aCoder.encode(createTime, forKey: "createTime")
- }
- if descriptionField != nil{
- aCoder.encode(descriptionField, forKey: "description")
- }
- if distinguishedName != nil{
- aCoder.encode(distinguishedName, forKey: "distinguishedName")
- }
- if id != nil{
- aCoder.encode(id, forKey: "id")
- }
- if inheritedControllerList != nil{
- aCoder.encode(inheritedControllerList, forKey: "inheritedControllerList")
- }
- if level != nil{
- aCoder.encode(level, forKey: "level")
- }
- if levelName != nil{
- aCoder.encode(levelName, forKey: "levelName")
- }
- if name != nil{
- aCoder.encode(name, forKey: "name")
- }
- if orderNumber != nil{
- aCoder.encode(orderNumber, forKey: "orderNumber")
- }
- if pinyin != nil{
- aCoder.encode(pinyin, forKey: "pinyin")
- }
- if pinyinInitial != nil{
- aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
- }
- if shortName != nil{
- aCoder.encode(shortName, forKey: "shortName")
- }
- if subDirectIdentityCount != nil{
- aCoder.encode(subDirectIdentityCount, forKey: "subDirectIdentityCount")
- }
- if subDirectUnitCount != nil{
- aCoder.encode(subDirectUnitCount, forKey: "subDirectUnitCount")
- }
- if superior != nil{
- aCoder.encode(superior, forKey: "superior")
- }
- if typeList != nil{
- aCoder.encode(typeList, forKey: "typeList")
- }
- if unique != nil{
- aCoder.encode(unique, forKey: "unique")
- }
- if updateTime != nil{
- aCoder.encode(updateTime, forKey: "updateTime")
- }
- if woSubDirectIdentityList != nil{
- aCoder.encode(woSubDirectIdentityList, forKey: "woSubDirectIdentityList")
- }
-
- }
-
- }
- class OOPersonDNModel: NSObject, NSCoding, DataModel {
- public override required init() {
- }
-
- @objc var personList:[String]?
-
-
- func encode(with aCoder: NSCoder) {
- if personList != nil{
- aCoder.encode(personList, forKey: "personList")
- }
- }
-
- required init?(coder aDecoder: NSCoder) {
- personList = aDecoder.decodeObject(forKey: "personList") as? [String]
- }
-
-
-
- }
- // MARK: - OO Person Model
- class OOPersonModel : NSObject, NSCoding, DataModel{
-
- var age : Int?
- @objc var changePasswordTime : String?
- @objc var controllerList : [String]?
- @objc var createTime : String?
- @objc var descriptionField : String?
- @objc var distinguishedName : String?
- @objc var employee : String?
- @objc var genderType : String?
- @objc var id : String?
- @objc var mail : String?
- @objc var mobile : String?
- @objc var name : String?
- @objc var officePhone : String?
- var orderNumber : Int?
- @objc var pinyin : String?
- @objc var pinyinInitial : String?
- @objc var qq : String?
- @objc var signature : String?
- @objc var superior : String?
- @objc var unique : String?
- @objc var updateTime : String?
- @objc var weixin : String?
- @objc var woIdentityList:[OOIdentityModel]?
- @objc var woGroupList:[OOGroupModel]?
- @objc var desc : String?
-
- public override required init() {
-
- }
-
- func mapping(mapper: HelpingMapper) {
- mapper <<< self.desc <-- "description"
- }
-
- /**
- * NSCoding required initializer.
- * Fills the data from the passed decoder
- */
- @objc required init(coder aDecoder: NSCoder)
- {
- age = aDecoder.decodeObject(forKey: "age") as? Int
- changePasswordTime = aDecoder.decodeObject(forKey: "changePasswordTime") as? String
- controllerList = aDecoder.decodeObject(forKey: "controllerList") as? [String]
- createTime = aDecoder.decodeObject(forKey: "createTime") as? String
- descriptionField = aDecoder.decodeObject(forKey: "description") as? String
- distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
- employee = aDecoder.decodeObject(forKey: "employee") as? String
- genderType = aDecoder.decodeObject(forKey: "genderType") as? String
- id = aDecoder.decodeObject(forKey: "id") as? String
- mail = aDecoder.decodeObject(forKey: "mail") as? String
- mobile = aDecoder.decodeObject(forKey: "mobile") as? String
- name = aDecoder.decodeObject(forKey: "name") as? String
- officePhone = aDecoder.decodeObject(forKey: "officePhone") as? String
- orderNumber = aDecoder.decodeObject(forKey: "orderNumber") as? Int
- pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
- pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
- qq = aDecoder.decodeObject(forKey: "qq") as? String
- signature = aDecoder.decodeObject(forKey: "signature") as? String
- superior = aDecoder.decodeObject(forKey: "superior") as? String
- unique = aDecoder.decodeObject(forKey: "unique") as? String
- updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
- weixin = aDecoder.decodeObject(forKey: "weixin") as? String
-
-
- }
-
- /**
- * NSCoding required method.
- * Encodes mode properties into the decoder
- */
- @objc func encode(with aCoder: NSCoder)
- {
- if age != nil{
- aCoder.encode(age, forKey: "age")
- }
- if changePasswordTime != nil{
- aCoder.encode(changePasswordTime, forKey: "changePasswordTime")
- }
- if controllerList != nil{
- aCoder.encode(controllerList, forKey: "controllerList")
- }
- if createTime != nil{
- aCoder.encode(createTime, forKey: "createTime")
- }
- if descriptionField != nil{
- aCoder.encode(descriptionField, forKey: "description")
- }
- if distinguishedName != nil{
- aCoder.encode(distinguishedName, forKey: "distinguishedName")
- }
- if employee != nil{
- aCoder.encode(employee, forKey: "employee")
- }
- if genderType != nil{
- aCoder.encode(genderType, forKey: "genderType")
- }
- if id != nil{
- aCoder.encode(id, forKey: "id")
- }
- if mail != nil{
- aCoder.encode(mail, forKey: "mail")
- }
- if mobile != nil{
- aCoder.encode(mobile, forKey: "mobile")
- }
- if name != nil{
- aCoder.encode(name, forKey: "name")
- }
- if officePhone != nil{
- aCoder.encode(officePhone, forKey: "officePhone")
- }
- if orderNumber != nil{
- aCoder.encode(orderNumber, forKey: "orderNumber")
- }
- if pinyin != nil{
- aCoder.encode(pinyin, forKey: "pinyin")
- }
- if pinyinInitial != nil{
- aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
- }
- if qq != nil{
- aCoder.encode(qq, forKey: "qq")
- }
- if signature != nil{
- aCoder.encode(signature, forKey: "signature")
- }
- if superior != nil{
- aCoder.encode(superior, forKey: "superior")
- }
- if unique != nil{
- aCoder.encode(unique, forKey: "unique")
- }
- if updateTime != nil{
- aCoder.encode(updateTime, forKey: "updateTime")
- }
- if weixin != nil{
- aCoder.encode(weixin, forKey: "weixin")
- }
-
- }
-
- }
- // MARK: - OO Identity Model
- class OOIdentityModel : NSObject, NSCoding, DataModel{
-
- @objc var createTime : String?
- @objc var descriptionField : String?
- @objc var distinguishedName : String?
- @objc var id : String?
- @objc var name : String?
- var orderNumber : Int?
- @objc var person : String?
- @objc var pinyin : String?
- @objc var pinyinInitial : String?
- @objc var unique : String?
- @objc var unit : String?
- var unitLevel : Int?
- @objc var unitLevelName : String?
- @objc var unitName : String?
- @objc var updateTime : String?
- @objc var woPerson : OOPersonModel?
- @objc var woUnit:OOUnitModel?
- @objc var desc : String?
- public override required init() {
-
- }
-
- override var description: String {
- return "\(self.name!)(\(self.unitName!))"
- }
-
- func mapping(mapper: HelpingMapper) {
- mapper <<< self.desc <-- "description"
- }
-
-
- /**
- * NSCoding required initializer.
- * Fills the data from the passed decoder
- */
- @objc required init(coder aDecoder: NSCoder)
- {
- createTime = aDecoder.decodeObject(forKey: "createTime") as? String
- descriptionField = aDecoder.decodeObject(forKey: "description") as? String
- distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
- id = aDecoder.decodeObject(forKey: "id") as? String
- name = aDecoder.decodeObject(forKey: "name") as? String
- orderNumber = aDecoder.decodeObject(forKey: "orderNumber") as? Int
- person = aDecoder.decodeObject(forKey: "person") as? String
- pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
- pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
- unique = aDecoder.decodeObject(forKey: "unique") as? String
- unit = aDecoder.decodeObject(forKey: "unit") as? String
- unitLevel = aDecoder.decodeObject(forKey: "unitLevel") as? Int
- unitLevelName = aDecoder.decodeObject(forKey: "unitLevelName") as? String
- unitName = aDecoder.decodeObject(forKey: "unitName") as? String
- updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
- woPerson = aDecoder.decodeObject(forKey: "woPerson") as? OOPersonModel
- woUnit = aDecoder.decodeObject(forKey: "woUnit") as? OOUnitModel
-
- }
-
- /**
- * NSCoding required method.
- * Encodes mode properties into the decoder
- */
- @objc func encode(with aCoder: NSCoder)
- {
- if createTime != nil{
- aCoder.encode(createTime, forKey: "createTime")
- }
- if descriptionField != nil{
- aCoder.encode(descriptionField, forKey: "description")
- }
- if distinguishedName != nil{
- aCoder.encode(distinguishedName, forKey: "distinguishedName")
- }
- if id != nil{
- aCoder.encode(id, forKey: "id")
- }
- if name != nil{
- aCoder.encode(name, forKey: "name")
- }
- if orderNumber != nil{
- aCoder.encode(orderNumber, forKey: "orderNumber")
- }
- if person != nil{
- aCoder.encode(person, forKey: "person")
- }
- if pinyin != nil{
- aCoder.encode(pinyin, forKey: "pinyin")
- }
- if pinyinInitial != nil{
- aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
- }
- if unique != nil{
- aCoder.encode(unique, forKey: "unique")
- }
- if unit != nil{
- aCoder.encode(unit, forKey: "unit")
- }
- if unitLevel != nil{
- aCoder.encode(unitLevel, forKey: "unitLevel")
- }
- if unitLevelName != nil{
- aCoder.encode(unitLevelName, forKey: "unitLevelName")
- }
- if unitName != nil{
- aCoder.encode(unitName, forKey: "unitName")
- }
- if updateTime != nil{
- aCoder.encode(updateTime, forKey: "updateTime")
- }
- if woPerson != nil{
- aCoder.encode(woPerson, forKey: "woPerson")
- }
-
- if woUnit != nil{
- aCoder.encode(woUnit, forKey: "woUnit")
- }
-
- }
-
- }
- // MARK: - OO Group Model
- class OOGroupModel : NSObject, NSCoding, DataModel{
-
- @objc var control : OOControl?
- @objc var createTime : String?
- @objc var descriptionField : String?
- @objc var distinguishedName : String?
- @objc var groupList : [String]?
- @objc var id : String?
- @objc var name : String?
- @objc var personList : [String]?
- @objc var pinyin : String?
- @objc var pinyinInitial : String?
- @objc var unique : String?
- @objc var updateTime : String?
- @objc var woGroupList:[OOGroupModel]?
- @objc var woPersonList:[OOPersonModel]?
- @objc var desc : String?
-
- public override required init() {
-
- }
-
- func mapping(mapper: HelpingMapper) {
- mapper <<< self.desc <-- "description"
- }
-
- /**
- * NSCoding required initializer.
- * Fills the data from the passed decoder
- */
- @objc required init(coder aDecoder: NSCoder)
- {
- control = aDecoder.decodeObject(forKey: "control") as? OOControl
- createTime = aDecoder.decodeObject(forKey: "createTime") as? String
- descriptionField = aDecoder.decodeObject(forKey: "description") as? String
- distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
- groupList = aDecoder.decodeObject(forKey: "groupList") as? [String]
- id = aDecoder.decodeObject(forKey: "id") as? String
- name = aDecoder.decodeObject(forKey: "name") as? String
- personList = aDecoder.decodeObject(forKey: "personList") as? [String]
- pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
- pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
- unique = aDecoder.decodeObject(forKey: "unique") as? String
- updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
-
- }
-
- /**
- * NSCoding required method.
- * Encodes mode properties into the decoder
- */
- @objc func encode(with aCoder: NSCoder)
- {
- if control != nil{
- aCoder.encode(control, forKey: "control")
- }
- if createTime != nil{
- aCoder.encode(createTime, forKey: "createTime")
- }
- if descriptionField != nil{
- aCoder.encode(descriptionField, forKey: "description")
- }
- if distinguishedName != nil{
- aCoder.encode(distinguishedName, forKey: "distinguishedName")
- }
- if groupList != nil{
- aCoder.encode(groupList, forKey: "groupList")
- }
- if id != nil{
- aCoder.encode(id, forKey: "id")
- }
- if name != nil{
- aCoder.encode(name, forKey: "name")
- }
- if personList != nil{
- aCoder.encode(personList, forKey: "personList")
- }
- if pinyin != nil{
- aCoder.encode(pinyin, forKey: "pinyin")
- }
- if pinyinInitial != nil{
- aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
- }
- if unique != nil{
- aCoder.encode(unique, forKey: "unique")
- }
- if updateTime != nil{
- aCoder.encode(updateTime, forKey: "updateTime")
- }
-
- }
-
- }
|