BusinessDepartmentTreeTableViewCell.m 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // AveragePriceMonitorTableViewCell.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2017/9/7.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. // 功能描述:业务部门cell
  9. #import "BusinessDepartmentTreeTableViewCell.h"
  10. #define kTextFont [UIFont systemFontOfSize:13]
  11. @implementation BusinessDepartmentTreeTableViewCell
  12. #pragma 公共函数
  13. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  14. {
  15. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  16. if (self) {
  17. }
  18. return self;
  19. }
  20. #pragma 私有函数
  21. /**
  22. 设置cell的UI
  23. @param model <#model description#>
  24. */
  25. - (void)setUIWithModel:(BusinessDepartmentFrame *)frame{
  26. if(frame!=nil){
  27. _checkBT=[UIButton buttonWithType:UIButtonTypeCustom];
  28. _checkBT.frame=frame.checkBtF;
  29. self.achievementFrame =frame;
  30. self.achievementModel=frame.departmentModel;
  31. [self.checkBT setImage:frame.departmentModel.isSelect?[UIImage imageNamed:@"order_checked"]:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  32. [self.contentView addSubview:self.checkBT];
  33. _departmentNameLbl=[[UILabel alloc]init];
  34. _departmentNameLbl.frame=frame.departmentF;
  35. _departmentNameLbl.font=kTextFont;
  36. _departmentNameLbl.text = frame.departmentModel.organizationName;
  37. [self addSubview:_departmentNameLbl];
  38. if(frame.departmentModel!=nil){
  39. self.rightArrowImg=[[UIImageView alloc]init];
  40. self.rightArrowImg.frame=frame.rightArrowF;
  41. if (frame.departmentModel.isExpand) {
  42. self.rightArrowImg.image = [UIImage imageNamed:@"All_downState"];
  43. }else{
  44. if (frame.departmentModel.childArray!=nil&&frame.departmentModel.childArray.count>0) {
  45. self.rightArrowImg.image = [UIImage imageNamed:@"All_rightState"];
  46. }
  47. else{
  48. self.rightArrowImg.image = nil;
  49. }
  50. }
  51. [self.contentView addSubview:self.rightArrowImg];
  52. }
  53. UIView *bottomSeparator=[UIView new];
  54. bottomSeparator.frame=frame.separatorF;
  55. [bottomSeparator setBackgroundColor:LineBackgroundColor];
  56. [self.contentView addSubview:bottomSeparator];
  57. }
  58. }
  59. -(void)selectButtonClick{
  60. if ([self.delegate respondsToSelector:@selector(selectBtnClick:)]) {
  61. [self.delegate selectBtnClick:_achievementFrame];
  62. }
  63. }
  64. @end