// // SendGroupBCell.m // smartRhino // // Created by tederen on 2019/11/4. // Copyright © 2019 tederen. All rights reserved. // #import "SendGroupBCell.h" #import "AddressBookGroupsModel.h" @interface SendGroupBCell() @property (nonatomic, strong) AddressBookGroupsModel *model; @property (nonatomic, strong) NSIndexPath *index; @property (nonatomic, strong) Department *departModel; @end @implementation SendGroupBCell - (void)awakeFromNib { [super awakeFromNib]; [self.selectbuton setCurrentButtonHotSize:CGSizeZero]; } - (void)loadDataModel:(AddressBookGroupsModel *)model WithIndex:(nonnull NSIndexPath *)index{ self.model = model; self.index = index; if (model.hadSelected) { self.selectbuton.selected = YES; }else{ self.selectbuton.selected = NO; } self.nameLab.text = model.GroupName; if (ISEmptyString(model.GroupName)) { self.nameLab.text = model.Name; } self.rightImgeView.hidden = (model.hasSon == 1)? NO: YES; } // 选择抄送人 - (void)loadDataModelDepartment:(Department *)model WithIndex:(NSIndexPath *)index{ self.departModel = model; self.index = index; self.selectbuton.selected = model.hadSelected; // if (model.hadSelected) { // self.selectbuton.selected = YES; // }else{ // self.selectbuton.selected = NO; // } if (!ISEmptyString(model.Name)) { self.nameLab.text = model.Name; } if (!ISEmptyString(model.GroupName)) { self.nameLab.text = model.GroupName; } self.rightImgeView.hidden = (model.hasSon == 1)? NO: YES; } - (void)setDataModel:(MailModel *)model { self.nameLab.text = model.Name; self.selectbuton.selected = model.IsSelect; self.rightImgeView.hidden = NO; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } //- (IBAction)button:(UIButton *)sender { // self.selectbuton.selected = !self.selectbuton.selected; // if (self.selectbuton.selected == YES) { // if ([self.delegate respondsToSelector:@selector(selectAddressBookGroups: WithIndex:)]) { // [self.delegate selectAddressBookGroups:self.model WithIndex:self.index]; // } // // if ([self.delegate respondsToSelector:@selector(selectDepartment:WithIndex:)]) { // [self.delegate selectDepartment:self.departModel WithIndex:self.index]; // } // // }else{ // if ([self.delegate respondsToSelector:@selector(noSelectAddressBookGroups:WithIndex:)]) { // [self.delegate noSelectAddressBookGroups:self.model WithIndex:self.index]; // } // if ([self.delegate respondsToSelector:@selector(noSelectDepartment:WithIndex:)]) { // [self.delegate noSelectDepartment:self.departModel WithIndex:self.index]; // } // } //} - (AddressBookGroupsModel *)model{ if (!_model) { _model = [[AddressBookGroupsModel alloc]init]; } return _model; } - (NSIndexPath *)index{ if (!_index) { _index = [[NSIndexPath alloc] init]; } return _index; } - (Department *)departModel{ if (!_departModel) { _departModel = [[Department alloc]init]; } return _departModel; } @end