SingleProfitAnalyzeListSearchCell.m 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. //
  2. // SingleProfitAnalyzeListSearchCell.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2019/4/11.
  6. // Copyright © 2019 elongtian. All rights reserved.
  7. //
  8. #import "SingleProfitAnalyzeListSearchCell.h"
  9. #import "CustomerAchievementTextVC.h"
  10. @implementation SingleProfitAnalyzeListSearchCell
  11. - (void)awakeFromNib {
  12. [super awakeFromNib];
  13. }
  14. /**
  15. 单元格高度
  16. @return <#return value description#>
  17. */
  18. - (CGFloat)cellHeight {
  19. return 364.0f;
  20. }
  21. - (IBAction)clickSalesOrderAction:(id)sender {
  22. [self selectOrder:_btnSalesOrder];
  23. }
  24. - (IBAction)clickSalesSlipAction:(id)sender {
  25. [self selectOrder:_btnSalesSlip];
  26. }
  27. /**
  28. 初始化布局
  29. */
  30. - (void)initUI {
  31. self.btnSalesOrder.layer.borderWidth = 0.5;
  32. self.btnSalesOrder.layer.cornerRadius = 5;
  33. self.btnSalesOrder.tag = 6;
  34. self.btnSalesOrder.layer.borderColor = [NavBarUnEnbleItemColor CGColor];
  35. [ self.btnSalesOrder setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
  36. self.btnSalesSlip.layer.borderWidth = 0.5;
  37. self.btnSalesSlip.layer.cornerRadius = 5;
  38. self.btnSalesSlip.tag = 7;
  39. self.btnSalesSlip.layer.borderColor = [NavBarUnEnbleItemColor CGColor];
  40. [self.btnSalesSlip setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
  41. [self selectOrder:_btnSalesSlip];
  42. [self updateModel];
  43. }
  44. /**
  45. 更新model
  46. */
  47. - (void)updateModel{
  48. SingleProfitAnalyseSearchModel *model = [[SingleProfitAnalyseSearchModel alloc] init];
  49. model.organizationCode =_organizationCode;
  50. model.startDate = _sAccountStartDate;
  51. model.endDate = _sAccountEndDate;
  52. model.businessType = [NSString stringWithFormat:@"%ld",(long)_selectLable.tag];
  53. NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
  54. [mutDict setValue:model forKey:SINGLE_PROFIT_ANALYSE_SEARCH_MODEL];
  55. _regionModel.customDict = [mutDict copy];
  56. }
  57. /**
  58. 加载tableviewcell
  59. @param indexPath <#indexPath description#>
  60. @return <#return value description#>
  61. */
  62. + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
  63. SingleProfitAnalyzeListSearchCell *cell = [[NSBundle mainBundle] loadNibNamed:@"SingleProfitAnalyzeListSearchCell" owner:nil options:nil][0];
  64. return cell;
  65. }
  66. /**
  67. 切换排序
  68. @param lab <#lab description#>
  69. */
  70. - (void)selectOrder: (UIButton *) lab {
  71. if(_selectLable == lab){
  72. return;
  73. }else{
  74. _selectLable.layer.borderColor = [NavBarUnEnbleItemColor CGColor];
  75. [_selectLable setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
  76. _selectLable = lab;
  77. _selectLable.layer.borderColor = [[UIColor redColor] CGColor];
  78. [_selectLable setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  79. [self updateModel];
  80. }
  81. }
  82. /**
  83. 更新model
  84. 关宏厚2017-7-6
  85. @param model <#model description#>
  86. @param indexPath <#indexPath description#>
  87. */
  88. - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model indexPath:(NSIndexPath *)indexPath{
  89. self.regionModel = *model;
  90. [self initUI];
  91. NSString *startDateStr = [DateFormat getDateBefore:31];
  92. NSString *endDateStr = [DateFormat getCurrentDate];
  93. [_btnStartDate setTitle:startDateStr forState:UIControlStateNormal];
  94. _sAccountStartDate= _btnStartDate.titleLabel.text;
  95. [_btnEndDate setTitle:endDateStr forState:UIControlStateNormal];
  96. _sAccountEndDate =_btnEndDate.titleLabel.text;
  97. [self updateModel];
  98. }
  99. /**
  100. Identifier
  101. @return <#return value description#>
  102. */
  103. + (NSString *)cellReuseIdentifier {
  104. return @"SingleProfitAnalyzeListSearchCell";
  105. }
  106. /**
  107. 业务部门
  108. @param Amodel <#Amodel description#>
  109. @param cr <#cr description#>
  110. */
  111. - (void)achiementData:(AchiementDepartmentInfoModel *)Amodel CustomerReport:(CustomerReport)cr{
  112. //返回值
  113. if(cr == ReportAchiementDepartmt){
  114. _organizationCode=Amodel.organizationCode;
  115. [self.btnDepartment setTitle:Amodel.organizationName forState:UIControlStateNormal];
  116. }
  117. [self updateModel];
  118. }
  119. - (IBAction)clickDepartmentAction:(id)sender {
  120. CustomerAchievementTextVC *tc = [[CustomerAchievementTextVC alloc ]init];
  121. tc.cDelegate = self;
  122. tc.flag = YES;
  123. tc.isPresentViewFlag = YES;
  124. tc.showDialogViewTag=ReportAchiementDepartmt;
  125. if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
  126. [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
  127. }
  128. }
  129. - (IBAction)clickStartDateAction:(id)sender {
  130. __weak typeof(self) weakself=self;
  131. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  132. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  133. self->_tempAccountStartDate=date;
  134. } andCompletionBlock:^(void){
  135. weakself.sAccountStartDate = self->_tempAccountStartDate;
  136. [weakself.btnStartDate setTitle: weakself.sAccountStartDate forState:UIControlStateNormal];
  137. [self updateModel];
  138. } andCancelBlock:^(void){
  139. }];
  140. [_dealDatePicker show];
  141. }
  142. - (IBAction)clickEndDateAction:(id)sender {
  143. __weak typeof(self) weakself=self;
  144. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  145. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  146. self->_tempAccountEndDate=date;
  147. } andCompletionBlock:^(void){
  148. weakself.sAccountEndDate = self->_tempAccountEndDate;
  149. [weakself.btnEndDate setTitle:weakself.sAccountEndDate forState:UIControlStateNormal];
  150. [self updateModel];
  151. }
  152. andCancelBlock:^(void){
  153. }];
  154. [_dealDatePicker show];
  155. }
  156. /**
  157. 重置按钮 事件
  158. */
  159. - (void)resetData {
  160. [_btnDepartment setTitle:@"请选择业务部门" forState:UIControlStateNormal];
  161. _organizationCode = @"";
  162. [_btnStartDate setTitle:@"请选择开始日期" forState:UIControlStateNormal];
  163. _sAccountStartDate = @"";
  164. [_btnEndDate setTitle:@"请选择结束日期" forState:UIControlStateNormal];
  165. _sAccountEndDate= @"";
  166. }
  167. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  168. [super setSelected:selected animated:animated];
  169. }
  170. @end