// // AssessorList.m // LNManager // // Created by EchoShacolee on 2017/4/8. // Copyright © 2017年 lee. All rights reserved. // #import "AssessorList.h" #import "AssessorDetail.h" @interface AssessorList () @end @implementation AssessorList - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"考核员列表"; [self getData]; __weak typeof(self) weakSelf = self; self.holdervBlock = ^{ [weakSelf getData]; }; } -(void)getData{ NSMutableDictionary * mDic = [[NSMutableDictionary alloc]init]; [mDic setValue:defUser.userDict[@"dqbh"] forKey:@"dqbh"]; [mDic setValue:defUser.userDict[@"qxbh"] forKey:@"qxbh"]; [mDic setValue:defUser.userDict[@"school"] forKey:@"schoolId"]; [mDic setValue:@"" forKey:@"name"]; [mDic setValue:@"" forKey:@"idcard"]; [mDic setValue:@"" forKey:@"mobile"]; [self getDataWithDic:mDic method:@"examers" block:^(NSDictionary *successdic) { NSArray * arr = successdic[@"body"]; if (arr.count != 0) { self.holderV.hidden = YES; } for (NSDictionary * dic in arr) { if (![self.sectionTitles containsObject:dic[@"ZM"]]) { [self.sectionTitles addObject:dic[@"ZM"]]; [self.dataSource addObject:[NSMutableArray new]]; } } //排序 [self.sectionTitles sortUsingSelector:@selector(compare:)]; for (NSDictionary * dic in arr) { NSInteger location = [self.sectionTitles indexOfObject:dic[@"ZM"]]; [self.dataSource[location] addObject:dic]; } [self.tableView reloadData]; }]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellId" forIndexPath:indexPath]; if ([self.dataSource[indexPath.section] count] > 0) { cell.textLabel.text = self.dataSource[indexPath.section][indexPath.row][@"EI_NAME"]; } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ AssessorDetail * vc = [[AssessorDetail alloc]init]; vc.dataSource = self.dataSource[indexPath.section][indexPath.row]; [self navPushHideTabbarToVC:vc]; } - (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