// // RepDetailVC.m // LN_School // // Created by EchoShacolee on 2017/6/15. // Copyright © 2017年 Danson. All rights reserved. // #import "RepDetailVC.h" #import "RepairApplyVC.h" #import "RepDetailAllAppear.h" @interface RepDetailVC () { UITableView *_tableView; NSArray *_keys; CGFloat _bottomBarH; } @end @implementation RepDetailVC - (void)viewDidLoad { [super viewDidLoad]; [self setTitle:@"报修详情"]; [self goBackByNavigation]; _bottomBarH = 50; _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height-kNavOffSet) style:0]; _tableView.tableFooterView = [UIView new]; _tableView.delegate = self; _tableView.dataSource = self; [self.view addSubview:_tableView]; if ([[NSString stringWithFormat:@"%@",_dic[@"AR_STATUS"]] isEqualToString:@"2"]) { }else{ [self createBottomBarWithtoolTitles:@[@"取消报修",@"修改表单"]]; } _keys = @[ @[@"车牌号",@"AR_CARNUM"], // @[@"AR_CONTACTS",@"AR_CONTACTS"], @[@"设备场厂",@"AR_FACTORY"], @[@"创建日期",@"AR_CRDATE"], @[@"故障等级",@"AR_LEVEL"], @[@"终端型号",@"AR_MODEL"], @[@"故障描述",@"AR_REASON"], @[@"其它说明",@"AR_REMARK"], @[@"AR_SERIAL_NUMBER",@"AR_SERIAL_NUMBER"], // @[@"AR_STATUS",@"AR_STATUS"], @[@"联系电话",@"AR_TELPHONE"], @[@"发生故障时间",@"AR_TIME"] ]; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _keys.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellId"]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cellId"]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } NSString * key = _keys[indexPath.row][1]; cell.textLabel.text = _keys[indexPath.row][0]; if ([key isEqualToString:@"AR_STATUS"]){ NSString *status = [NSString stringWithFormat:@"%@",self.dic[key]]; cell.detailTextLabel.text = [status isEqualToString:@"1"] ? @"已备案" : @"未备案" ; }else if ([key isEqualToString:@"AR_LEVEL"]){ NSString *status = [NSString stringWithFormat:@"%@",self.dic[key]]; switch ([status integerValue]) { case 1: cell.detailTextLabel.text = @"一级"; break; case 2: cell.detailTextLabel.text = @"二级"; break; case 3: cell.detailTextLabel.text = @"三级"; break; default: break; } }else{ cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",self.dic[key]]; } NSArray * limitArr = @[@"故障描述",@"其它说明"]; if ([limitArr containsObject:cell.textLabel.text]) { cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row == 5 || indexPath.row == 6) { RepDetailAllAppear * vc = [[RepDetailAllAppear alloc]init]; vc.str = self.dic[_keys[indexPath.row][1]]; [self navPushHideTabbarToVC:vc]; } } #pragma mark 创建BottomBarButton -(void)createBottomBarWithtoolTitles:(NSArray *)toolTitles{ _tableView.height -= _bottomBarH+kSafeAreaBottomHeight; float widthBtn = (kSize.width-1*toolTitles.count+1)/toolTitles.count; float HeightBth = _bottomBarH; for (int i=0; i