123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- //
- // CoachListVC.m
- // LNManager
- //
- // Created by EchoShacolee on 2017/4/8.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #import "CoachListVC.h"
- #import "CoachDetail.h"
- #import "MengBanView.h"
- @interface CoachListVC ()
- {
- MengBanView * _mengBanView;
- NSString * _status;
- }
- @end
- @implementation CoachListVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.navigationItem.title = @"教练列表";
-
- // [self customRightBtn];
-
- _status = @"1";
- [self getData];
-
- __weak typeof(self) weakSelf = self;
- _block = ^{
- [weakSelf getData];
- };
- }
- -(void)customRightBtn{
- UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithTitle:@"筛选" style:UIBarButtonItemStylePlain target:self action:@selector(setMengbanView)];
- item.tintColor = COLOR_THEME;
- self.navigationItem.rightBarButtonItem = item;
- }
- -(void)setMengbanView{
-
- if (_mengBanView) {
- [_mengBanView showView];
- return;
- }
-
- NSArray * btnarr = @[@"待审核",@"审核通过",@"审核驳回"];
- _mengBanView = [[MengBanView alloc]initWithTitileStr:nil buttonsArray:@[btnarr] block:^(NSArray *array) {
-
- if ([array[0] isEqualToString:@"待审核"]) {
- _status = @"0";
- }else if ([array[0] isEqualToString:@"审核通过"]){
- _status = @"1";
- }else if ([array[0] isEqualToString:@"审核驳回"]){
- _status = @"2";
- }
- [self getData];
- }];
- [_mengBanView showView];
- }
- -(void)getData{
-
- NSMutableDictionary * mdic = [NSMutableDictionary new];
- [mdic setValue:[NSString stringWithFormat:@"%@",_shcDic[@"TSI_DQBH"]] forKey:@"dqbh"];
- [mdic setValue:[NSString stringWithFormat:@"%@",_shcDic[@"TSI_QXBH"]] forKey:@"qxbh"];
- [mdic setValue:[NSString stringWithFormat:@"%@",_shcDic[@"TSI_INSCODE"]] forKey:@"inscode"];
- [mdic setValue:@"" forKey:@"coachName"];
- [mdic setValue:@"" forKey:@"idcard"];
- [mdic setValue:@"" forKey:@"isPage"];
- [mdic setValue:@"" forKey:@"pageSize"];
- [mdic setValue:@"" forKey:@"currentPage"];
- [mdic setValue:_status forKey:@"auditStatus"];
-
- _requsetDic = mdic;
- [self getDataWithDic:mdic method:@"coachs" block:^(NSDictionary *successdic) {
-
- //
- [_sectionTitles removeAllObjects];
- [_dataSource removeAllObjects];
-
- NSArray * arr = successdic[@"body"];
- if (arr.count != 0) {
- self.holderV.hidden = YES;
- }
-
- for (NSDictionary * dic in arr) {
- if (![_sectionTitles containsObject:dic[@"ZM"]]) {
- [_sectionTitles addObject:dic[@"ZM"]];
- [_dataSource addObject:[NSMutableArray new]];
- }
- }
-
- //排序
- [_sectionTitles sortUsingSelector:@selector(compare:)];
-
- for (NSDictionary * dic in arr) {
- NSInteger location = [_sectionTitles indexOfObject:dic[@"ZM"]];
- [_dataSource[location] addObject:dic];
- }
-
- [self.tableView reloadData];
- }];
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath];
- if ([_dataSource[indexPath.section] count] > 0) {
- cell.textLabel.text = _dataSource[indexPath.section][indexPath.row][@"CI_NAME"];
- }
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-
- CoachDetail * coachvc = [[CoachDetail alloc]init];
- [_requsetDic setValue:_dataSource[indexPath.section][indexPath.row][@"CI_IDCARD"] forKey:@"idcard"];
- coachvc.requesetDic = _requsetDic;
- coachvc.coachNum = _dataSource[indexPath.section][indexPath.row][@"CI_COACHNUM"];
- [self.navigationController pushViewController:coachvc animated:YES];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|