123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- //
- // RegionsList.m
- // LNManager
- //
- // Created by EchoShacolee on 2017/4/18.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #import "RegionsList.h"
- #import "RegionsCell.h"
- #import "RegionsDetail.h"
- #import "MengBanView.h"
- @interface RegionsList ()
- {
- MengBanView * _mengBanView;
-
- UIButton * _statusBtn;
-
- NSMutableDictionary * _requsetDic;
-
- NSString * _status;
- }
- @end
- @implementation RegionsList
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- self.navigationItem.title = @"教学区域列表";
-
- [self customRightBtn];
-
- if ([self.type isEqualToString:@"1"]) {
- _status = @"0";
- }else{
- _status = @"1,2";
- }
-
- [self getData];
-
- __weak typeof(self) weakSelf = self;
- self.block = ^{
- [weakSelf getData];
- };
- }
- -(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";
- }else {
- _status = @"1,2";
- }
-
- [self getData];
- }];
-
- if (_status.length == 0) {
- [_mengBanView setSection:0 defaultIndex:3];
- }
-
- [_mengBanView showView];
- }
- #pragma mark tableview代理方法
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return self.dataurce.count;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- return 70;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath{
-
- RegionsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellId"];
- if (!cell) {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"RegionsCell" owner:nil options:nil]lastObject];
- }
- [cell upDataWithDic:self.dataurce[indexPath.row]];
- return cell;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
-
- RegionsDetail * vc = [[RegionsDetail alloc]init];
- vc.block = ^{
- _status = @"1";
- [self getData];
- };
- [_requsetDic setValue:self.dataurce[indexPath.row][@"TCO_CARNUM"] forKey:@"idcard"];
- vc.requesetDic = _requsetDic;
- vc.dataSource = self.dataurce[indexPath.row];
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark 数据请求
- - (void)getData{
-
- NSMutableDictionary * mdic = [NSMutableDictionary new];
- [mdic setValue:MYAPPDELEGATE.userDic[@"dqbh"] forKey:@"dqbh"];
- [mdic setValue:MYAPPDELEGATE.userDic[@"qxbh"] forKey:@"qxbh"];
- [mdic setValue:_status forKey:@"status"];
-
- _requsetDic = mdic;
-
- [self getDataWithDic:mdic method:@"regions"];
- }
- - (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
|