InventoryAnalysisSearchCel.m 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // InventoryAnalysisSearchCel.m
  3. // IBOSS
  4. //
  5. // Created by ssl on 2018/1/4.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "InventoryAnalysisSearchCel.h"
  9. @implementation InventoryAnalysisSearchCel
  10. /**
  11. 加载xib
  12. */
  13. - (void)awakeFromNib {
  14. [super awakeFromNib];
  15. }
  16. #pragma 委托函数
  17. /**
  18. 单元格高度
  19. @return <#return value description#>
  20. */
  21. - (CGFloat)cellHeight {
  22. return 280.0f;
  23. }
  24. /**
  25. 加载tableviewcell
  26. @param indexPath <#indexPath description#>
  27. @return <#return value description#>
  28. */
  29. + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
  30. InventoryAnalysisSearchCel *cell = [[NSBundle mainBundle] loadNibNamed:@"InventoryAnalysisSearchCel" owner:nil options:nil][0];
  31. return cell;
  32. }
  33. /**
  34. 初始化cell数据
  35. @param model <#model description#>
  36. @param indexPath <#indexPath description#>
  37. */
  38. - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model
  39. indexPath:(NSIndexPath *)indexPath {
  40. _slideModel = *model;
  41. _mutDict = [NSMutableDictionary dictionaryWithDictionary:_slideModel.customDict];
  42. _searchModel = [InventoryAnalysisSearchModel new];
  43. [self selectBtn:self.btnKind unSelected:self.btnBrand];
  44. [self updateModel];
  45. }
  46. /**
  47. 返回tableviewcell标识
  48. @return <#return value description#>
  49. */
  50. + (NSString *)cellReuseIdentifier {
  51. return @"SearchTableViewCell";
  52. }
  53. /**
  54. 品牌
  55. @param sender <#sender description#>
  56. */
  57. - (IBAction)selectBrand:(id)sender {
  58. if(self.btnBrand.tag == 0){
  59. [self selectBtn:self.btnBrand unSelected:self.btnKind];
  60. [self updateModel];
  61. }
  62. }
  63. /**
  64. 种类
  65. @param sender <#sender description#>
  66. */
  67. - (IBAction)selectKind:(id)sender {
  68. if(self.btnKind.tag == 0){
  69. [self selectBtn:self.btnKind unSelected:self.btnBrand];
  70. [self updateModel];
  71. }
  72. }
  73. /**
  74. 改变状态
  75. @param selectBtn <#selectBtn description#>
  76. @param unSelecteBtn <#unSelecteBtn description#>
  77. */
  78. -(void) selectBtn:(UIButton *) selectBtn unSelected:(UIButton *) unSelecteBtn{
  79. selectBtn.layer.cornerRadius = 10;
  80. [selectBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  81. selectBtn.layer.borderColor = [[UIColor redColor] CGColor];
  82. selectBtn.layer.borderWidth =1;
  83. selectBtn.tag = 1;
  84. unSelecteBtn.layer.cornerRadius = 10;
  85. [unSelecteBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
  86. unSelecteBtn.layer.borderColor = [[UIColor grayColor] CGColor];
  87. unSelecteBtn.layer.borderWidth =1;
  88. unSelecteBtn.tag = 0;
  89. }
  90. /**
  91. 确定按钮回调
  92. */
  93. - (void)updateModel{
  94. InventoryAnalysisSearchModel *model = [[InventoryAnalysisSearchModel alloc] init];
  95. if(self.btnKind.tag == 1){
  96. model.OperateType = @"1";
  97. }else{
  98. model.OperateType = @"2";
  99. }
  100. NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_slideModel.customDict];
  101. [mutDict setValue:model forKey:INVENTORY_ANALYSIS_SEARCH];
  102. _slideModel.customDict = [mutDict copy];
  103. }
  104. @end