SendGroupBCell.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // SendGroupBCell.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/4.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "SendGroupBCell.h"
  9. #import "AddressBookGroupsModel.h"
  10. @interface SendGroupBCell()
  11. @property (nonatomic, strong) AddressBookGroupsModel *model;
  12. @property (nonatomic, strong) NSIndexPath *index;
  13. @property (nonatomic, strong) Department *departModel;
  14. @end
  15. @implementation SendGroupBCell
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. [self.selectbuton setCurrentButtonHotSize:CGSizeZero];
  19. }
  20. - (void)loadDataModel:(AddressBookGroupsModel *)model WithIndex:(nonnull NSIndexPath *)index{
  21. self.model = model;
  22. self.index = index;
  23. if (model.hadSelected) {
  24. self.selectbuton.selected = YES;
  25. }else{
  26. self.selectbuton.selected = NO;
  27. }
  28. self.nameLab.text = model.GroupName;
  29. if (ISEmptyString(model.GroupName)) {
  30. self.nameLab.text = model.Name;
  31. }
  32. self.rightImgeView.hidden = (model.hasSon == 1)? NO: YES;
  33. }
  34. // 选择抄送人
  35. - (void)loadDataModelDepartment:(Department *)model WithIndex:(NSIndexPath *)index{
  36. self.departModel = model;
  37. self.index = index;
  38. self.selectbuton.selected = model.hadSelected;
  39. // if (model.hadSelected) {
  40. // self.selectbuton.selected = YES;
  41. // }else{
  42. // self.selectbuton.selected = NO;
  43. // }
  44. if (!ISEmptyString(model.Name)) {
  45. self.nameLab.text = model.Name;
  46. }
  47. if (!ISEmptyString(model.GroupName)) {
  48. self.nameLab.text = model.GroupName;
  49. }
  50. self.rightImgeView.hidden = (model.hasSon == 1)? NO: YES;
  51. }
  52. - (void)setDataModel:(MailModel *)model
  53. {
  54. self.nameLab.text = model.Name;
  55. self.selectbuton.selected = model.IsSelect;
  56. self.rightImgeView.hidden = NO;
  57. }
  58. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  59. [super setSelected:selected animated:animated];
  60. // Configure the view for the selected state
  61. }
  62. //- (IBAction)button:(UIButton *)sender {
  63. // self.selectbuton.selected = !self.selectbuton.selected;
  64. // if (self.selectbuton.selected == YES) {
  65. // if ([self.delegate respondsToSelector:@selector(selectAddressBookGroups: WithIndex:)]) {
  66. // [self.delegate selectAddressBookGroups:self.model WithIndex:self.index];
  67. // }
  68. //
  69. // if ([self.delegate respondsToSelector:@selector(selectDepartment:WithIndex:)]) {
  70. // [self.delegate selectDepartment:self.departModel WithIndex:self.index];
  71. // }
  72. //
  73. // }else{
  74. // if ([self.delegate respondsToSelector:@selector(noSelectAddressBookGroups:WithIndex:)]) {
  75. // [self.delegate noSelectAddressBookGroups:self.model WithIndex:self.index];
  76. // }
  77. // if ([self.delegate respondsToSelector:@selector(noSelectDepartment:WithIndex:)]) {
  78. // [self.delegate noSelectDepartment:self.departModel WithIndex:self.index];
  79. // }
  80. // }
  81. //}
  82. - (AddressBookGroupsModel *)model{
  83. if (!_model) {
  84. _model = [[AddressBookGroupsModel alloc]init];
  85. }
  86. return _model;
  87. }
  88. - (NSIndexPath *)index{
  89. if (!_index) {
  90. _index = [[NSIndexPath alloc] init];
  91. }
  92. return _index;
  93. }
  94. - (Department *)departModel{
  95. if (!_departModel) {
  96. _departModel = [[Department alloc]init];
  97. }
  98. return _departModel;
  99. }
  100. @end