DailyReconciliationSearchCell.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //
  2. // DailyReconciliationSearchCell.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2020/9/30.
  6. // Copyright © 2020 elongtian. All rights reserved.
  7. //
  8. #import "DailyReconciliationSearchCell.h"
  9. #import "DateFormat.h"
  10. @implementation DailyReconciliationSearchCell
  11. - (void)awakeFromNib {
  12. [super awakeFromNib];
  13. }
  14. - (IBAction)clickStartDateAction:(id)sender {
  15. __weak typeof(self) weakself=self;
  16. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  17. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  18. self->_tempStartDate=date;
  19. } andCompletionBlock:^(void){
  20. weakself.startDate = self->_tempStartDate;
  21. [weakself.btnStartDate setTitle:weakself.startDate forState:UIControlStateNormal];
  22. [self updateModel];
  23. } andCancelBlock:^(void){
  24. }];
  25. [_dealDatePicker show];
  26. }
  27. - (IBAction)clickEndDateAction:(id)sender {
  28. __weak typeof(self) weakself=self;
  29. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  30. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  31. self->_tempEndDate=date;
  32. } andCompletionBlock:^(void){
  33. weakself.endDate = self->_tempEndDate;
  34. [weakself.btnEndDate setTitle:weakself.endDate forState:UIControlStateNormal];
  35. [self updateModel];
  36. } andCancelBlock:^(void){
  37. }];
  38. [_dealDatePicker show];
  39. }
  40. /**
  41. 高度
  42. @return <#return value description#>
  43. */
  44. - (CGFloat)cellHeight {
  45. return 186.0f;
  46. }
  47. /**
  48. cell
  49. @param indexPath <#indexPath description#>
  50. @return <#return value description#>
  51. */
  52. + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
  53. DailyReconciliationSearchCell *cell = [[NSBundle mainBundle] loadNibNamed:@"DailyReconciliationSearchCell" owner:nil options:nil][0];
  54. return cell;
  55. }
  56. /**
  57. 重置按钮 事件
  58. */
  59. - (void)resetData {
  60. [_btnStartDate setTitle:@"请选择账务开始日期" forState:UIControlStateNormal];
  61. _startDate = @"";
  62. [_btnEndDate setTitle:@"请选择账务结束日期" forState:UIControlStateNormal];
  63. _endDate = @"";
  64. }
  65. /**
  66. Identifier
  67. @return <#return value description#>
  68. */
  69. + (NSString *)cellReuseIdentifier {
  70. return @"DailyReconciliationSearchCell";
  71. }
  72. /**
  73. 更新model
  74. @param model <#model description#>
  75. @param indexPath <#indexPath description#>
  76. */
  77. - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model indexPath:(NSIndexPath *)indexPath{
  78. _startDate= [DateFormat getCurrentDate];
  79. _endDate= [DateFormat getCurrentDate];
  80. [_btnStartDate setTitle:_startDate forState:UIControlStateNormal];
  81. [_btnEndDate setTitle:_endDate forState:UIControlStateNormal];
  82. self.regionModel = *model;
  83. [self updateModel];
  84. }
  85. /**
  86. 更新model
  87. */
  88. - (void)updateModel{
  89. DailyReconciliationSearchModel *model = [[DailyReconciliationSearchModel alloc] init];
  90. model.startDate=_startDate;
  91. model.endDate=_endDate;
  92. NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
  93. [mutDict setValue:model forKey:DAILY_RECONCILIATION_SEARCH_RANGE_MODEL];
  94. _regionModel.customDict = [mutDict copy];
  95. }
  96. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  97. [super setSelected:selected animated:animated];
  98. }
  99. @end