| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- //
- // JOHYQDXQViewController.m
- // shiku_im
- //
- // Created by 周兵 on 16/7/28.
- // Copyright © 2016年 Reese. All rights reserved.
- //
- #import "JOHYQDXQViewController.h"
- #import "SegmentTapView.h"
- #import "UITableView+WFEmpty.h"
- @interface JOHYQDXQViewController ()<SegmentTapViewDelegate,UITableViewDataSource,UITableViewDelegate>
- {
- NSMutableArray * _qiandaole;
- NSMutableArray * _meiqiandao;
- NSMutableArray * _zhonjian;
-
- }
- @property (nonatomic, strong)SegmentTapView *segment;
- @property (nonatomic, strong)UITableView * tableView;
- @end
- @implementation JOHYQDXQViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- CGFloat height = 0;
-
- if (statusX) {
-
- height = 24;
- }
-
- self.view.backgroundColor=[UIColor whiteColor];
-
- _qiandaole=[[NSMutableArray alloc]init];
- _meiqiandao=[[NSMutableArray alloc]init];
- _zhonjian=[[NSMutableArray alloc]init];
-
- self.segment = [[SegmentTapView alloc] initWithFrame:CGRectMake(0,height, self_width, 40) withDataArray:[NSArray arrayWithObjects:Localized(@"UU_work_OA_MM_MeetingDetail_SignedIn"),Localized(@"UU_work_OA_MM_MeetingDetail_NoSignIn"), nil] withFont:15];
- self.segment.delegate = self;
- self.segment.lineColor = HexColor(@"#1084D1");
- self.segment.textSelectedColor = HexColor(@"#1084D1");
- self.segment.textNomalColor = [UIColor blackColor];
- self.segment.btnColor = BGKJ_COLOR;
- self.segment.selectIndex=1;
-
- [self.view addSubview:self.segment];
-
- UIImageView *line = [[UIImageView alloc]initWithFrame:CGRectMake(self_width/2, 10, 1, 20)];
- line.backgroundColor = [[UIColor lightGrayColor]colorWithAlphaComponent:0.2];
- [self.segment addSubview:line];
-
- [self setNavi];
-
- [self getcanhuiranyuan];
-
- self.tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 104+height,self_width,self_height-104-height) style:UITableViewStylePlain];
- self.tableView.delegate=self;
- self.tableView.dataSource=self;
- [self.view addSubview:self.tableView];
-
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.bottom.right.equalTo(self.view);
- make.top.equalTo(self.segment.mas_bottom);
- }];
-
- //这句代码可以去掉tableview多余分割线
- self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
-
-
- }
- - (void)selectedIndex:(NSInteger)index
- {
- DLog(@"选了第几个%ld",(long)index);
- if (index==1)
- {
- _zhonjian=_meiqiandao;
- }else if (index==0)
- {
- _zhonjian=_qiandaole;
-
- }
-
- [self.tableView reloadData];
- }
- - (void)backView
- {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)setNavi
- {
- //1设置title
- UILabel * titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(0,0,80,30)];
- titleLabel.text=Localized(@"UU_work_OA_MM_MeetingDetail_ConferencePunch");
- titleLabel.textColor=[UIColor whiteColor];
-
- self.navigationItem.titleView=titleLabel;
-
- UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeSystem];
- btn2.frame = CGRectMake(0, 5, 22, 22);
- UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(0, iOS11?5:0, 22, 22)];
- image.image = [UIImage imageNamed:@"icon_back_nor3"];
- [btn2 addSubview:image];
- [btn2 addTarget:self action:@selector(backView) forControlEvents:UIControlEventTouchUpInside];
- UIBarButtonItem *bbi2 = [[UIBarButtonItem alloc]initWithCustomView:btn2];
- self.navigationItem.leftBarButtonItems = @[bbi2];
- self.navigationController.navigationBar.barTintColor = NB_COLOR;
-
- }
- /**获取参会人员*/
- - (void)getcanhuiranyuan
- {
- //1,创建一个网络请求管理对象
- UASNetworkManager *manager1 = [UASNetworkManager shareManager];
- manager1.responseSerializer=[AFHTTPResponseSerializer serializer];
-
-
- //2,取出sessionID和IP
- NSUserDefaults *userDefault=[NSUserDefaults standardUserDefaults];
-
- NSString *sessionId=[userDefault stringForKey:@"sessionId"];
-
- NSString * ips=[UASUserInfo shareManager].urlIp;
-
-
-
- NSString * userID=[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"];
- NSString *master=[[[NSUserDefaults standardUserDefaults] objectForKey:@"masterDic"]objectForKey:@"ma_user"];
-
- //3.拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //4.设置cookie
- [manager1.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
-
- //5,接口http://218.17.158.219:8090/ERP//mobile/crm/getMeetingDetailParticipants.action
- NSString * urlAddress=@"mobile/crm/getMeetingDetailParticipants.action";
- //6,Caller
- NSString * caller=@"Meetingroomapply";
-
-
-
-
- //formCondition=ma_id=
- NSString *url=[@"" stringByAppendingFormat:@"%@%@?caller=%@&formCondition=ma_id=%@&sessionId=%@&emcode=%@&gridCondition=ma_id=%@&ma_code=%@&master=%@&sessionUser=%@",ips,urlAddress,caller,_huiyiID,sessionId,userID,_huiyiID,_huiyiID,master,userID];
-
-
- DLog(@"url=%@",url);
-
-
- //7.二进制数据转换
- NSString *urlStringUTF8 = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- [manager1 request:urlStringUTF8 method:GET parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
-
- NSData *data = responseObject;
- //1,系统自带的nsjson解析数据
- id rootDic =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
- DLog(@"请求参会人员成功:%@",rootDic);
-
- if ([[rootDic allKeys] containsObject:@"sessionId"]==YES)
- {
- NSString * sessionId=[NSString stringWithFormat:@"%@",[rootDic objectForKey:@"sessionId"]];
- [[NSUserDefaults standardUserDefaults] setObject:sessionId forKey:@"sessionId"];
- }
-
-
- NSDictionary * dict=[NSDictionary dictionary];
- dict=[rootDic objectForKey:@"participants"];
- NSDictionary * dicts=[NSDictionary changeType:dict];
- /**
- "EM_CODE" = L00010102002;
- "EM_DEFAULTHSNAME" = "\U4eba\U4e8b\U4e13\U5458";
- "EM_DEPART" = "\U4eba\U4e8b\U79d1";
- "EM_NAME" = "\U5218\U6770";
- */
-
- _qiandaole=[dicts objectForKey:@"confirmed"];
- _meiqiandao=[dicts objectForKey:@"unconfirmed"];
-
- // for (int i=0; i<_meiqiandao.count; i++)
- // {
- // DLog(@"%@ %@ %@",[_meiqiandao[i] objectForKey:@"EM_DEFAULTHSNAME"],[_meiqiandao[i] objectForKey:@"EM_DEPART"],[_meiqiandao[i] objectForKey:@"EM_NAME"]);
- // }
- _zhonjian=_qiandaole;
-
- if (_zhonjian.count == 0) {
- [self.tableView addEmptyViewWithImageName:@"crm_all_noData" title:nil];
- }
- [self.tableView reloadData];
-
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
- [self.tableView addEmptyViewWithImageName:@"crm_all_noData" title:nil];
- DLog(@"什么错误呀==%@",error);
- [((AppDelegate*)[[UIApplication sharedApplication] delegate]) showAlertController:self withMessage:Localized(@"UU_work_OA_MM_MeetingDetail_title1")];
-
- }];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return _zhonjian.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- static NSString * ID =@"JOBOR";
- UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:ID];
- cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
- cell.selectionStyle=UITableViewCellSelectionStyleNone;
-
-
- self.tableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
-
- UILabel * label=[[UILabel alloc]init];
- label.frame=CGRectMake(15,5,100,20);
- label.font=FONT_SIZE(17);
- label.textColor=[UIColor blackColor];
- label.text=[_zhonjian[indexPath.row] objectForKey:@"EM_NAME"];
- [cell.contentView addSubview:label];
-
- UILabel * label2=[[UILabel alloc]init];
- label2.frame=CGRectMake(15,25,self_width,20);
- label2.font=FONT_SIZE(13);
- label2.textColor=[UIColor lightGrayColor];
- label2.text=[[_zhonjian[indexPath.row] objectForKey:@"EM_DEFAULTHSNAME"] stringByAppendingFormat:@"-%@",[_zhonjian[indexPath.row] objectForKey:@"EM_DEPART"]];
- [cell.contentView addSubview:label2];
-
-
-
- return cell ;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 50;
- }
- @end
|