// // CurrentStaffPerformanceRankVcViewController.m // IBOSS // // Created by guan hong hou on 2018/6/22. // Copyright © 2018年 elongtian. All rights reserved. // #import "CurrentStaffLastMonthPerformanceRankVc.h" @interface CurrentStaffLastMonthPerformanceRankVc () @end @implementation CurrentStaffLastMonthPerformanceRankVc - (void)viewDidLoad { [super viewDidLoad]; NSString *currentDate=[DateFormat getCurrentDate]; NSArray *dateArray = [currentDate componentsSeparatedByString:@"-"]; _currentYear= [dateArray objectAtIndex:0]; NSString *currentMonth=[dateArray objectAtIndex:1]; int lastMonthDate= [currentMonth intValue]-1; if(lastMonthDate<10){ _lastMonth=[NSString stringWithFormat:@"0%d",lastMonthDate]; } else{ _lastMonth=[NSString stringWithFormat:@"%d",lastMonthDate]; } _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:_lastMonth 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 *lblLastMonthCurrentAmountTitle=[[UILabel alloc]init]; lblLastMonthCurrentAmountTitle.frame=CGRectMake(CGRectGetMaxX(circle.frame),10, 150, 25); lblLastMonthCurrentAmountTitle.textColor=LabelGrayTextColor; lblLastMonthCurrentAmountTitle.text=@"上月完成(元)"; [self.view addSubview:lblLastMonthCurrentAmountTitle]; _lblLastMontnCompleteAmount=[[UILabel alloc]init]; _lblLastMontnCompleteAmount.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(lblLastMonthCurrentAmountTitle.frame)+5,150, 25); _lblLastMontnCompleteAmount.textColor=[UIColor hexColor:@"fecb6e"]; if(_myPerformanceModel==nil){ _lblLastMontnCompleteAmount.text=@"¥0.00"; } else{ _lblLastMontnCompleteAmount.text=[NSString stringWithFormat:@"¥%@", _myPerformanceModel.salesAmount]; } [self.view addSubview:_lblLastMontnCompleteAmount]; UILabel *lblLastMonthTaskAmountTitle=[[UILabel alloc]init]; lblLastMonthTaskAmountTitle.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(_lblLastMontnCompleteAmount.frame)+5, 150, 25); lblLastMonthTaskAmountTitle.textColor=LabelGrayTextColor; lblLastMonthTaskAmountTitle.text=@"上月任务(元)"; [self.view addSubview:lblLastMonthTaskAmountTitle]; _lblLastMontnTaskAmount=[[UILabel alloc]init]; _lblLastMontnTaskAmount.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(lblLastMonthTaskAmountTitle.frame)+5,150, 25); _lblLastMontnTaskAmount.textColor=[UIColor hexColor:@"3ecccb"]; if(_myPerformanceModel==nil){ _lblLastMontnTaskAmount.text=@"¥0.00"; } else{ _lblLastMontnTaskAmount.text=[NSString stringWithFormat:@"¥%@", _myPerformanceModel.currentMonthTaskAmount]; } [self.view addSubview:_lblLastMontnTaskAmount]; UILabel *lblLastMonthRankTitle=[[UILabel alloc]init]; lblLastMonthRankTitle.frame=CGRectMake(CGRectGetMaxX(circle.frame),CGRectGetMaxY(_lblLastMontnTaskAmount.frame)+5, 80, 25); lblLastMonthRankTitle.textColor=LabelGrayTextColor; lblLastMonthRankTitle.text=@"上月排行"; [self.view addSubview:lblLastMonthRankTitle]; _lblLastMontnRank=[[UILabel alloc]init]; _lblLastMontnRank.frame=CGRectMake(CGRectGetMaxX(lblLastMonthRankTitle.frame), CGRectGetMaxY(_lblLastMontnTaskAmount.frame)+5, 80,25); _lblLastMontnRank.textColor=[UIColor redColor]; if(_myPerformanceModel==nil){ _lblLastMontnRank.text=@"0"; } else{ _lblLastMontnRank.text=_myPerformanceModel.rankNo; } [self.view addSubview:_lblLastMontnRank]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end