// // CarList.m // LNManager // // Created by EchoShacolee on 2017/4/9. // Copyright © 2017年 lee. All rights reserved. // #import "CarList.h" #import "CarDetail.h" #import "MengBanView.h" #import "SYBaseCell.h" @interface CarList () { NSMutableDictionary * _requsetDic; MengBanView * _mengBanView; NSString * _status; } @end @implementation CarList - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"车辆列表"; // [self customRightBtn]; _status = @"1"; [self getData]; __weak typeof(self) weakSelf = self; self.block = ^{ [weakSelf getData]; }; [self.tableView registerNib:[UINib nibWithNibName:@"SYBaseCell" bundle:nil] forCellReuseIdentifier:@"SYBaseCellId"]; } -(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:@"licNum"]; [mdic setValue:@"" forKey:@"isPage"]; [mdic setValue:@"" forKey:@"pageSize"]; [mdic setValue:@"" forKey:@"currentPage"]; [mdic setValue:_status forKey:@"auditStatus"]; _requsetDic = mdic; [self getDataWithDic:mdic method:@"cars"]; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 44; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.dataurce.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath{ SYBaseCell * cell = [tableView dequeueReusableCellWithIdentifier:@"SYBaseCellId" forIndexPath:indexPath]; cell.nameLab.text = self.dataurce[indexPath.row][@"TCO_LICNUM"]; NSString *str = [NSString stringWithFormat:@"%@",self.dataurce[indexPath.row][@"TCO_LOCK_STATUS"]]; cell.lockingImgV.hidden = [str intValue]==0; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ CarDetail * vc = [[CarDetail alloc]init]; vc.lockBlock = ^(NSDictionary *data) { [self.dataurce replaceObjectAtIndex:indexPath.row withObject:data]; [self.tableView reloadData]; }; vc.objNum = self.dataurce[indexPath.row][@"TCO_CARNUM"]; [_requsetDic setValue:self.dataurce[indexPath.row][@"TCO_LICNUM"] forKey:@"licNum"]; vc.requesetDic = _requsetDic; [self.navigationController pushViewController:vc 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