CustomerTraceListSearchCell.m 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. //
  2. // CustomerTraceListSearchCell.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2019/4/10.
  6. // Copyright © 2019 elongtian. All rights reserved.
  7. //
  8. #import "CustomerTraceListSearchCell.h"
  9. @implementation CustomerTraceListSearchCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. }
  13. /**
  14. 单元格高度
  15. @return <#return value description#>
  16. */
  17. - (CGFloat)cellHeight {
  18. return 443.5f;
  19. }
  20. /**
  21. 加载tableviewcell
  22. @param indexPath <#indexPath description#>
  23. @return <#return value description#>
  24. */
  25. + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
  26. CustomerTraceListSearchCell *cell = [[NSBundle mainBundle] loadNibNamed:@"CustomerTraceListSearchCell" owner:nil options:nil][0];
  27. return cell;
  28. }
  29. /**
  30. 更新model
  31. 关宏厚2017-7-6
  32. @param model <#model description#>
  33. @param indexPath <#indexPath description#>
  34. */
  35. - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model indexPath:(NSIndexPath *)indexPath{
  36. self.regionModel = *model;
  37. NSString *estimateSalesAmountStartDateValue = [DateFormat getDateBefore:31];
  38. NSString *estimateSalesAmountEndDate = [DateFormat getCurrentDate];
  39. [_btnEstimateSalesAmountStartDate setTitle:estimateSalesAmountStartDateValue forState:UIControlStateNormal];
  40. _sEstimateSalesAmountStartDate= _btnEstimateSalesAmountStartDate.titleLabel.text;
  41. [_btnEstimateSalesAmountEndDate setTitle:estimateSalesAmountEndDate forState:UIControlStateNormal];
  42. _sEstimateSalesAmountEndDate =_btnEstimateSalesAmountEndDate.titleLabel.text;
  43. NSString *accountStartDateValue = [DateFormat getDateBefore:31];
  44. NSString *accountEndDateValue = [DateFormat getCurrentDate];
  45. [_btnAccountStartDate setTitle:accountStartDateValue forState:UIControlStateNormal];
  46. _sAccountStartDate= _btnAccountStartDate.titleLabel.text;
  47. [_btnAccountEndDate setTitle:accountEndDateValue forState:UIControlStateNormal];
  48. _sAccountEndDate =_btnAccountEndDate.titleLabel.text;
  49. [self updateModel];
  50. }
  51. /**
  52. Identifier
  53. @return <#return value description#>
  54. */
  55. + (NSString *)cellReuseIdentifier {
  56. return @"CustomerTraceListSearchCell";
  57. }
  58. /**
  59. 重置按钮 事件
  60. */
  61. - (void)resetData {
  62. [_btnDepartment setTitle:@"请选择业务部门" forState:UIControlStateNormal];
  63. _organizationCode = @"";
  64. [_btnEstimateSalesAmountStartDate setTitle:@"请选择预估销售金额创建开始日期" forState:UIControlStateNormal];
  65. _sEstimateSalesAmountStartDate = @"";
  66. [_btnEstimateSalesAmountEndDate setTitle:@"请选择预估销售金额创建结束日期" forState:UIControlStateNormal];
  67. _sEstimateSalesAmountEndDate = @"";
  68. [_btnAccountStartDate setTitle:@"请选择账务开始日期" forState:UIControlStateNormal];
  69. _sAccountStartDate = @"";
  70. [_btnAccountEndDate setTitle:@"请选择账务结束日期" forState:UIControlStateNormal];
  71. _sAccountEndDate=@"";
  72. }
  73. /**
  74. 业务部门
  75. @param Amodel <#Amodel description#>
  76. @param cr <#cr description#>
  77. */
  78. - (void)achiementData:(AchiementDepartmentInfoModel *)Amodel CustomerReport:(CustomerReport)cr{
  79. //返回值
  80. if(cr == ReportAchiementDepartmt){
  81. _organizationCode=Amodel.organizationCode;
  82. [self.btnDepartment setTitle:Amodel.organizationName forState:UIControlStateNormal];
  83. }
  84. [self updateModel];
  85. }
  86. /**
  87. 更新model
  88. */
  89. - (void)updateModel{
  90. CustomerTraceListSearchModel *model = [[CustomerTraceListSearchModel alloc] init];
  91. model.organizationCode = _organizationCode;
  92. model.estimateSalesAmountStartDate = _sEstimateSalesAmountStartDate;
  93. model.estimateSalesAmountEndDate = _sEstimateSalesAmountEndDate;
  94. model.accountStartDate =_sAccountStartDate;
  95. model.accountEndDate = _sAccountEndDate;
  96. NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
  97. [mutDict setValue:model forKey:CUSTOMER_TRACE_LIST_SEARCH_MODEL];
  98. _regionModel.customDict = [mutDict copy];
  99. }
  100. - (IBAction)clickDepartmentAction:(id)sender {
  101. CustomerAchievementTextVC *tc = [[CustomerAchievementTextVC alloc ]init];
  102. tc.cDelegate = self;
  103. tc.flag = YES;
  104. tc.isPresentViewFlag = YES;
  105. tc.showDialogViewTag=ReportAchiementDepartmt;
  106. if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
  107. [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
  108. }
  109. }
  110. - (IBAction)clickEstimateSalesAmountStartDate:(id)sender {
  111. __weak typeof(self) weakself=self;
  112. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  113. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  114. self->_tempEstimateSalesAmountStartDate=date;
  115. } andCompletionBlock:^(void){
  116. weakself.sEstimateSalesAmountStartDate = self->_tempEstimateSalesAmountStartDate;
  117. [weakself.btnEstimateSalesAmountStartDate setTitle: weakself.sEstimateSalesAmountStartDate forState:UIControlStateNormal];
  118. [self updateModel];
  119. } andCancelBlock:^(void){
  120. }];
  121. [_dealDatePicker show];
  122. }
  123. - (IBAction)clickEstimateSalesAmountEndDate:(id)sender {
  124. __weak typeof(self) weakself=self;
  125. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  126. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  127. self->_tempEstimateSalesAmountEndDate=date;
  128. } andCompletionBlock:^(void){
  129. weakself.sEstimateSalesAmountEndDate = self->_tempEstimateSalesAmountEndDate;
  130. [weakself.btnEstimateSalesAmountEndDate setTitle:weakself. sEstimateSalesAmountEndDate forState:UIControlStateNormal];
  131. [self updateModel];
  132. } andCancelBlock:^(void){
  133. }];
  134. [_dealDatePicker show];
  135. }
  136. - (IBAction)clickAccountStartDateAction:(id)sender {
  137. __weak typeof(self) weakself=self;
  138. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  139. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  140. self->_tempAccountStartDate=date;
  141. } andCompletionBlock:^(void){
  142. weakself.sAccountStartDate = self->_tempAccountStartDate;
  143. [weakself.btnAccountStartDate setTitle: weakself.sAccountStartDate forState:UIControlStateNormal];
  144. [self updateModel];
  145. } andCancelBlock:^(void){
  146. }];
  147. [_dealDatePicker show];
  148. }
  149. - (IBAction)clickAccountEndDateAction:(id)sender {
  150. __weak typeof(self) weakself=self;
  151. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  152. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  153. self->_tempAccountEndDate=date;
  154. } andCompletionBlock:^(void){
  155. weakself.sAccountEndDate = self->_tempAccountEndDate;
  156. [weakself.btnAccountEndDate setTitle:weakself.sAccountEndDate forState:UIControlStateNormal];
  157. [self updateModel];
  158. } andCancelBlock:^(void){
  159. }];
  160. [_dealDatePicker show];
  161. }
  162. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  163. [super setSelected:selected animated:animated];
  164. }
  165. @end