CoachListVC.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // CoachListVC.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/8.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "CoachListVC.h"
  9. #import "CoachDetail.h"
  10. #import "MengBanView.h"
  11. @interface CoachListVC ()
  12. {
  13. MengBanView * _mengBanView;
  14. NSString * _status;
  15. }
  16. @end
  17. @implementation CoachListVC
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. self.navigationItem.title = @"教练列表";
  21. // [self customRightBtn];
  22. _status = @"1";
  23. [self getData];
  24. __weak typeof(self) weakSelf = self;
  25. _block = ^{
  26. [weakSelf getData];
  27. };
  28. }
  29. -(void)customRightBtn{
  30. UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithTitle:@"筛选" style:UIBarButtonItemStylePlain target:self action:@selector(setMengbanView)];
  31. item.tintColor = COLOR_THEME;
  32. self.navigationItem.rightBarButtonItem = item;
  33. }
  34. -(void)setMengbanView{
  35. if (_mengBanView) {
  36. [_mengBanView showView];
  37. return;
  38. }
  39. NSArray * btnarr = @[@"待审核",@"审核通过",@"审核驳回"];
  40. _mengBanView = [[MengBanView alloc]initWithTitileStr:nil buttonsArray:@[btnarr] block:^(NSArray *array) {
  41. if ([array[0] isEqualToString:@"待审核"]) {
  42. _status = @"0";
  43. }else if ([array[0] isEqualToString:@"审核通过"]){
  44. _status = @"1";
  45. }else if ([array[0] isEqualToString:@"审核驳回"]){
  46. _status = @"2";
  47. }
  48. [self getData];
  49. }];
  50. [_mengBanView showView];
  51. }
  52. -(void)getData{
  53. NSMutableDictionary * mdic = [NSMutableDictionary new];
  54. [mdic setValue:[NSString stringWithFormat:@"%@",_shcDic[@"TSI_DQBH"]] forKey:@"dqbh"];
  55. [mdic setValue:[NSString stringWithFormat:@"%@",_shcDic[@"TSI_QXBH"]] forKey:@"qxbh"];
  56. [mdic setValue:[NSString stringWithFormat:@"%@",_shcDic[@"TSI_INSCODE"]] forKey:@"inscode"];
  57. [mdic setValue:@"" forKey:@"coachName"];
  58. [mdic setValue:@"" forKey:@"idcard"];
  59. [mdic setValue:@"" forKey:@"isPage"];
  60. [mdic setValue:@"" forKey:@"pageSize"];
  61. [mdic setValue:@"" forKey:@"currentPage"];
  62. [mdic setValue:_status forKey:@"auditStatus"];
  63. _requsetDic = mdic;
  64. [self getDataWithDic:mdic method:@"coachs" block:^(NSDictionary *successdic) {
  65. //
  66. [_sectionTitles removeAllObjects];
  67. [_dataSource removeAllObjects];
  68. NSArray * arr = successdic[@"body"];
  69. if (arr.count != 0) {
  70. self.holderV.hidden = YES;
  71. }
  72. for (NSDictionary * dic in arr) {
  73. if (![_sectionTitles containsObject:dic[@"ZM"]]) {
  74. [_sectionTitles addObject:dic[@"ZM"]];
  75. [_dataSource addObject:[NSMutableArray new]];
  76. }
  77. }
  78. //排序
  79. [_sectionTitles sortUsingSelector:@selector(compare:)];
  80. for (NSDictionary * dic in arr) {
  81. NSInteger location = [_sectionTitles indexOfObject:dic[@"ZM"]];
  82. [_dataSource[location] addObject:dic];
  83. }
  84. [self.tableView reloadData];
  85. }];
  86. }
  87. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  88. {
  89. UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath];
  90. if ([_dataSource[indexPath.section] count] > 0) {
  91. cell.textLabel.text = _dataSource[indexPath.section][indexPath.row][@"CI_NAME"];
  92. }
  93. return cell;
  94. }
  95. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  96. CoachDetail * coachvc = [[CoachDetail alloc]init];
  97. [_requsetDic setValue:_dataSource[indexPath.section][indexPath.row][@"CI_IDCARD"] forKey:@"idcard"];
  98. coachvc.requesetDic = _requsetDic;
  99. coachvc.coachNum = _dataSource[indexPath.section][indexPath.row][@"CI_COACHNUM"];
  100. [self.navigationController pushViewController:coachvc animated:YES];
  101. }
  102. - (void)didReceiveMemoryWarning {
  103. [super didReceiveMemoryWarning];
  104. // Dispose of any resources that can be recreated.
  105. }
  106. /*
  107. #pragma mark - Navigation
  108. // In a storyboard-based application, you will often want to do a little preparation before navigation
  109. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  110. // Get the new view controller using [segue destinationViewController].
  111. // Pass the selected object to the new view controller.
  112. }
  113. */
  114. @end