// // CurrentStaffCurrentMonthPerformanceRankVc.m // IBOSS // // Created by guan hong hou on 2018/6/22. // Copyright © 2018年 elongtian. All rights reserved. // #import "CurrentStaffCurrentMonthPerformanceRankVc.h" @interface CurrentStaffCurrentMonthPerformanceRankVc () @end @implementation CurrentStaffCurrentMonthPerformanceRankVc - (void)viewDidLoad { [super viewDidLoad]; NSString *currentDate=[DateFormat getCurrentDate]; NSArray *dateArray = [currentDate componentsSeparatedByString:@"-"]; _currentYear= [dateArray objectAtIndex:0]; _currentMonth=[dateArray objectAtIndex:1]; _dataList=[[NSMutableArray alloc]init]; [self.view setBackgroundColor:[UIColor whiteColor]]; } -(void) loadStaffData:(NSMutableArray*)staffList{ _currentStaffList=staffList; if(_currentStaffList.count==1){ [self loadData]; } } -(void)loadData{ [self startLoading]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"SalesmanTaskCompleteStatisticsIphone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; [dict setObject:_currentYear forKey:@"TaskAnnual"]; [dict setObject:_currentMonth forKey:@"TaskMonth"]; [dict setObject:@"" forKey:@"StaffIDList"]; [dict setObject:@"1" forKey:@"Granularity"]; [dict setObject:@"1" forKey:@"ShowAllFlag"]; _mDownManager = [[ASIDownManager alloc] init]; _mDownManager.delegate = self; _mDownManager.onRequestSuccess = @selector(onStaffPerformanceLoadFinish:); _mDownManager.onRequestFail = @selector(onStaffPerformanceLoadFail:); [_mDownManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil]; } /** 加载数据成功回调 @param sender <#sender description#> */ - (void)onStaffPerformanceLoadFinish:(ASIDownManager *)sender { // 服务器返回数据 RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr]; // 服务器返回数据状态值 int iStatus = resultModel.status; [self stopLoading]; // 服务器返回数据消息 NSString *message = resultModel.message; // 服务器返回数据状态值正确 if (iStatus == 0) { NSDictionary * infoDic = (NSDictionary *)resultModel.result; NSArray *infoArray=[infoDic objectForKey:@"Table"]; if(infoArray!=nil&&infoArray.count>0){ for(int i=0;i */ - (void)onStaffPerformanceLoadFail:(ASIDownManager *)sender { [self showAlertViewText:@"网络异常"]; } -(void)drawCircle{ CircleView *circle=[[CircleView alloc]initWithFrame:CGRectMake(0,0,200, 150)]; if(_myPerformanceModel==nil){ circle.completePercent=@"0.00"; } else{ circle.completePercent=_myPerformanceModel.completePercent; } [self.view addSubview:circle]; _lblCompletePercent=[[UILabel alloc]init]; [self.view addSubview:_lblCompletePercent]; _lblCompletePercent.frame=CGRectMake(50,70, 80, 25); _lblCompletePercent.textColor=[UIColor whiteColor]; if(_myPerformanceModel==nil){ _lblCompletePercent.text=@"0.00%"; } else{ _lblCompletePercent.text=[NSString stringWithFormat:@"%@%@" , _myPerformanceModel.completePercent,@"%"]; } UILabel *lblCurrentMonthCurrentAmountTitle=[[UILabel alloc]init]; lblCurrentMonthCurrentAmountTitle.frame=CGRectMake(CGRectGetMaxX(circle.frame),10, 150, 25); lblCurrentMonthCurrentAmountTitle.textColor=LabelGrayTextColor; lblCurrentMonthCurrentAmountTitle.text=@"本月完成(元)"; [self.view addSubview:lblCurrentMonthCurrentAmountTitle]; _lblCurrentMontnCompleteAmount=[[UILabel alloc]init]; _lblCurrentMontnCompleteAmount.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(lblCurrentMonthCurrentAmountTitle.frame)+5,150, 25); _lblCurrentMontnCompleteAmount.textColor=[UIColor hexColor:@"fecb6e"]; if(_myPerformanceModel==nil){ _lblCurrentMontnCompleteAmount.text=@"¥0.00"; } else{ _lblCurrentMontnCompleteAmount.text=[NSString stringWithFormat:@"¥%@", _myPerformanceModel.salesAmount]; } [self.view addSubview:_lblCurrentMontnCompleteAmount]; UILabel *lblCurrentMonthTaskAmountTitle=[[UILabel alloc]init]; lblCurrentMonthTaskAmountTitle.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(_lblCurrentMontnCompleteAmount.frame)+5, 150, 25); lblCurrentMonthTaskAmountTitle.textColor=LabelGrayTextColor; lblCurrentMonthTaskAmountTitle.text=@"本月任务(元)"; [self.view addSubview:lblCurrentMonthTaskAmountTitle]; _lblCurrentMontnTaskAmount=[[UILabel alloc]init]; _lblCurrentMontnTaskAmount.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(lblCurrentMonthTaskAmountTitle.frame)+5,150, 25); _lblCurrentMontnTaskAmount.textColor=[UIColor hexColor:@"3ecccb"]; if(_myPerformanceModel==nil){ _lblCurrentMontnTaskAmount.text=@"¥0.00"; } else { _lblCurrentMontnTaskAmount.text=[NSString stringWithFormat:@"¥%@", _myPerformanceModel.currentMonthTaskAmount]; } [self.view addSubview:_lblCurrentMontnTaskAmount]; UILabel *lblCurrentMonthRankTitle=[[UILabel alloc]init]; lblCurrentMonthRankTitle.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(_lblCurrentMontnTaskAmount.frame)+5, 80, 25); lblCurrentMonthRankTitle.textColor=LabelGrayTextColor; lblCurrentMonthRankTitle.text=@"本月排行"; [self.view addSubview:lblCurrentMonthRankTitle]; _lblCurrentMontnRank=[[UILabel alloc]init]; _lblCurrentMontnRank.frame=CGRectMake(CGRectGetMaxX(lblCurrentMonthRankTitle.frame), CGRectGetMaxY(_lblCurrentMontnTaskAmount.frame)+5, 80,25); _lblCurrentMontnRank.textColor=[UIColor redColor]; if(_myPerformanceModel==nil){ _lblCurrentMontnRank.text=@"0"; } else{ _lblCurrentMontnRank.text=_myPerformanceModel.rankNo; } [self.view addSubview:_lblCurrentMontnRank]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end