RegionsList.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // RegionsList.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/18.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "RegionsList.h"
  9. #import "RegionsCell.h"
  10. #import "RegionsDetail.h"
  11. #import "MengBanView.h"
  12. @interface RegionsList ()
  13. {
  14. MengBanView * _mengBanView;
  15. UIButton * _statusBtn;
  16. NSMutableDictionary * _requsetDic;
  17. NSString * _status;
  18. }
  19. @end
  20. @implementation RegionsList
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. self.navigationItem.title = @"教学区域列表";
  24. [self customRightBtn];
  25. if ([self.type isEqualToString:@"1"]) {
  26. _status = @"0";
  27. }else{
  28. _status = @"1,2";
  29. }
  30. [self getData];
  31. __weak typeof(self) weakSelf = self;
  32. self.block = ^{
  33. [weakSelf getData];
  34. };
  35. }
  36. -(void)customRightBtn{
  37. UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithTitle:@"筛选" style:UIBarButtonItemStylePlain target:self action:@selector(setMengbanView)];
  38. item.tintColor = COLOR_THEME;
  39. self.navigationItem.rightBarButtonItem = item;
  40. }
  41. -(void)setMengbanView{
  42. if (_mengBanView) {
  43. [_mengBanView showView];
  44. return;
  45. }
  46. NSArray * btnarr = @[@"待审核",@"审核通过",@"审核不通过",@"全部"];
  47. _mengBanView = [[MengBanView alloc]initWithTitileStr:nil buttonsArray:@[btnarr] block:^(NSArray *array) {
  48. if ([array[0] isEqualToString:@"待审核"]) {
  49. _status = @"0";
  50. }else if ([array[0] isEqualToString:@"审核通过"]){
  51. _status = @"1";
  52. }else if ([array[0] isEqualToString:@"审核不通过"]){
  53. _status = @"2";
  54. }else {
  55. _status = @"1,2";
  56. }
  57. [self getData];
  58. }];
  59. if (_status.length == 0) {
  60. [_mengBanView setSection:0 defaultIndex:3];
  61. }
  62. [_mengBanView showView];
  63. }
  64. #pragma mark tableview代理方法
  65. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  66. return self.dataurce.count;
  67. }
  68. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  69. return 70;
  70. }
  71. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath{
  72. RegionsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellId"];
  73. if (!cell) {
  74. cell = [[[NSBundle mainBundle] loadNibNamed:@"RegionsCell" owner:nil options:nil]lastObject];
  75. }
  76. [cell upDataWithDic:self.dataurce[indexPath.row]];
  77. return cell;
  78. }
  79. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  80. RegionsDetail * vc = [[RegionsDetail alloc]init];
  81. vc.block = ^{
  82. _status = @"1";
  83. [self getData];
  84. };
  85. [_requsetDic setValue:self.dataurce[indexPath.row][@"TCO_CARNUM"] forKey:@"idcard"];
  86. vc.requesetDic = _requsetDic;
  87. vc.dataSource = self.dataurce[indexPath.row];
  88. [self.navigationController pushViewController:vc animated:YES];
  89. }
  90. #pragma mark 数据请求
  91. - (void)getData{
  92. NSMutableDictionary * mdic = [NSMutableDictionary new];
  93. [mdic setValue:MYAPPDELEGATE.userDic[@"dqbh"] forKey:@"dqbh"];
  94. [mdic setValue:MYAPPDELEGATE.userDic[@"qxbh"] forKey:@"qxbh"];
  95. [mdic setValue:_status forKey:@"status"];
  96. _requsetDic = mdic;
  97. [self getDataWithDic:mdic method:@"regions"];
  98. }
  99. - (void)didReceiveMemoryWarning {
  100. [super didReceiveMemoryWarning];
  101. // Dispose of any resources that can be recreated.
  102. }
  103. /*
  104. #pragma mark - Navigation
  105. // In a storyboard-based application, you will often want to do a little preparation before navigation
  106. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  107. // Get the new view controller using [segue destinationViewController].
  108. // Pass the selected object to the new view controller.
  109. }
  110. */
  111. @end