LogSearchTableViewCell.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // LogSearchTableViewCell.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2017/5/12.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. #import "LogSearchTableViewCell.h"
  9. #import "LogShareVC.h"
  10. @implementation LogSearchTableViewCell
  11. static LogSearchTableViewCell* logSearchCell;
  12. #pragma mark -公有方法
  13. //加载xib
  14. - (void)awakeFromNib {
  15. [super awakeFromNib];
  16. }
  17. #pragma mark -委托方法
  18. //创建人选择完成回调方法
  19. -(void)selectListItem: (NSArray*)shareArr{
  20. NSMutableArray* ids=[NSMutableArray new];
  21. NSMutableArray* names=[NSMutableArray new];
  22. for (int i=0; i<shareArr.count; i++) {
  23. LogShareAndCommentInfoModel* model=shareArr[i];
  24. [names addObject:model.userName];
  25. [ids addObject:model.userId];
  26. }
  27. if(shareArr!=nil &&shareArr.count>0){
  28. _sShareId=[ ids componentsJoinedByString:@","];
  29. _sShareName=[names componentsJoinedByString:@","];
  30. [_createrBtn setTitle:_sShareName forState:UIControlStateNormal];
  31. }
  32. [_searchModel setCreateUserId:_sShareId];
  33. [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
  34. _slideModel.customDict = _mutDict;
  35. }
  36. #pragma mark -私有方法
  37. //创建人点击事件
  38. - (IBAction)createrClickAction:(id)sender {
  39. LogShareVC *tc=[LogShareVC new];
  40. tc.isPresentViewFlg = YES;
  41. tc.shareDelegate=self;
  42. tc.tag=@"logList";
  43. if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
  44. [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
  45. }
  46. }
  47. //开始日期点击事件
  48. - (IBAction)selectStartDateAction:(id)sender {
  49. _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  50. [_brDatePicker configureSelectionBlock:^(NSString *date){
  51. _startDate=date;
  52. } andCompletionBlock:^(void){
  53. [_searchModel setStartDate:_startDate];
  54. [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
  55. _slideModel.customDict =_mutDict;
  56. [sender setTitle:_startDate forState:UIControlStateNormal];
  57. } andCancelBlock:^(void){
  58. _startDate=_startDateBtn.titleLabel.text;
  59. }];
  60. [_brDatePicker show];
  61. }
  62. //结束日期点击事件
  63. - (IBAction)selectEndDate:(id)sender {
  64. _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  65. [_brDatePicker configureSelectionBlock:^(NSString *date){
  66. _endDate=date;
  67. } andCompletionBlock:^(void){
  68. [_searchModel setEndDate:_endDate];
  69. [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
  70. _slideModel.customDict = _mutDict;
  71. [sender setTitle:_endDate forState:UIControlStateNormal];
  72. } andCancelBlock:^(void){
  73. _endDate=_endDateBtn.titleLabel.text;
  74. }];
  75. [_brDatePicker show];
  76. }
  77. //单元格高度
  78. - (CGFloat)cellHeight {
  79. return 280.0f;
  80. }
  81. //加载tableviewcell
  82. + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
  83. LogSearchTableViewCell *cell = [[NSBundle mainBundle] loadNibNamed:@"LogSearchTableViewCell" owner:nil options:nil][0];
  84. logSearchCell=cell;
  85. return cell;
  86. }
  87. //初始化cell数据
  88. - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model
  89. indexPath:(NSIndexPath *)indexPath {
  90. _slideModel=*model;
  91. _mutDict = [NSMutableDictionary dictionaryWithDictionary:_slideModel.customDict];
  92. _searchModel=[LogSearchModel new];
  93. [_mutDict setValue:_searchModel forKey:SEARCH_RANGE_MODEL];
  94. _slideModel.customDict = _mutDict;
  95. }
  96. //返回tableviewcell标识
  97. + (NSString *)cellReuseIdentifier {
  98. return @"SearchTableViewCell";
  99. }
  100. @end