1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- //
- // SafeList.m
- // LNManager
- //
- // Created by EchoShacolee on 2017/4/9.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #import "SafeList.h"
- #import "SafeDetail.h"
- @interface SafeList ()
- @end
- @implementation SafeList
- - (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:@"securityguards" 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][@"SI_NAME"];
- }
- return cell;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-
- SafeDetail * vc = [[SafeDetail 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
|