EleTwoCell.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //
  2. // EleTwoCell.m
  3. // JSJPCoach
  4. //
  5. // Created by EchoShacolee on 2018/1/31.
  6. // Copyright © 2018年 Danson. All rights reserved.
  7. //
  8. #import "EleTwoCell.h"
  9. @implementation EleTwoCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. self.time.adjustsFontSizeToFitWidth = YES;
  13. NSMutableDictionary*attr = [NSMutableDictionary dictionary];
  14. attr[NSFontAttributeName] = [UIFont systemFontOfSize:15.0];
  15. attr[NSForegroundColorAttributeName] = RGB_COLOR(40, 152, 255);
  16. attr[NSUnderlineStyleAttributeName] = [NSNumber numberWithInteger:NSUnderlineStyleSingle];
  17. attr[NSUnderlineColorAttributeName] = RGB_COLOR(40, 152, 255);
  18. NSAttributedString *attributedStr = [[NSAttributedString alloc]initWithString:@"查看评价" attributes:attr];
  19. [_ckBtn setAttributedTitle:attributedStr forState:UIControlStateNormal];
  20. _ckBtn.hidden = YES;
  21. }
  22. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  23. [super setSelected:selected animated:animated];
  24. // Configure the view for the selected state
  25. }
  26. -(void)setDataDic:(NSDictionary *)dataDic{
  27. self.name.text = [dataDic[@"CRI_STARTTIME"] substringToIndex:10];
  28. self.history.attributedText = [self getHistoryWithStatus:dataDic[@"HISTORY"]];
  29. self.type.text = [self getTypeWithKemu:dataDic[@"CRI_TRAIN_SUBJECT"] pxName:dataDic[@"PXLX_NAME"]];
  30. self.time.text = [self getTimeWithStart:dataDic[@"CRI_STARTTIME"] end:dataDic[@"CRI_ENDTIME"]];
  31. self.allTime.text = [NSString stringWithFormat:@"总时长:%@分",dataDic[@"CRI_DURATION"]];
  32. self.validTime.text = [NSString stringWithFormat:@"有效时长:%@分",dataDic[@"CRI_VAILD_TIME"]];
  33. self.percent.text = [NSString stringWithFormat:@"占比:%@",dataDic[@"PERCENT"]];
  34. self.car.text = [NSString stringWithFormat:@"培训车辆: %@",dataDic[@"CAR_LICNUM"]];
  35. self.mileage.text = [NSString stringWithFormat:@"里程: %@m",dataDic[@"CRI_MILEAGE"]];
  36. CGFloat mile = [[NSString stringWithFormat:@"%@",dataDic[@"CRI_MILEAGE"]] floatValue];
  37. if (mile > 1000) {
  38. self.mileage.text = [NSString stringWithFormat:@"里程: %.1fkm",mile/1000];
  39. }
  40. self.coach.text = [NSString stringWithFormat:@"带教教练: %@",dataDic[@"COACH_NAME"]];
  41. //二次审核相关
  42. self.checkMan.text = [NSString stringWithFormat:@"审核人 : %@",dataDic[@"CRI_AUDIT_USERNAME"]];
  43. self.checkTime.text = [NSString stringWithFormat:@"审核时间: %@",dataDic[@"CRI_AUDIT_TIME"]];
  44. self.reason.text = [NSString stringWithFormat:@"审核原因: %@",dataDic[@"CRI_SECOND_AUDIT_REASON"]];
  45. //状态
  46. [self getStastusWithHz:dataDic[@"CRI_COUNT"] sb:dataDic[@"CRI_RECORD_STATUS"] sh:dataDic[@"CRI_AUDIT_RESULT"] secondSH:dataDic[@"CRI_SECOND_AUDIT_RESULT"]];
  47. }
  48. -(NSMutableAttributedString *)getHistoryWithStatus:(id)status{
  49. NSInteger zz = [status integerValue];
  50. NSString *str = [NSString stringWithFormat:@"历史学员: %@",zz==1?@"是":@"否"];
  51. NSMutableAttributedString *aStr = [[NSMutableAttributedString alloc]initWithString:str];
  52. if (zz==1) {
  53. [aStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(str.length-1, 1)];
  54. }
  55. return aStr;
  56. }
  57. -(NSString*)getTypeWithKemu:(id)kemu pxName:(NSString *)pxName{
  58. NSArray *arr = @[@"科一",@"科二",@"科三",@"科四"];
  59. NSString * kemuStr = arr[[kemu integerValue]-1];//[kemu integerValue]
  60. return [NSString stringWithFormat:@"%@%@",kemuStr,[pxName substringToIndex:2]];
  61. }
  62. -(NSString *)getTimeWithStart:(NSString *)start end:(NSString *)end{
  63. return [NSString stringWithFormat:@"训练时段: %@至%@",[start substringFromIndex:11],[end substringFromIndex:11]];
  64. }
  65. -(void)getStastusWithHz:(id)hz sb:(id)sb sh:(id)sh secondSH:(id)secondSh{
  66. //
  67. NSString *hStr = @"未汇总";
  68. _status1.textColor = [UIColor lightGrayColor];
  69. if ([hz integerValue]==1) {
  70. hStr = @"已汇总";
  71. _status1.textColor = RGB_COLOR(76, 75, 76);
  72. }else if ([hz integerValue]==2){
  73. hStr = @"汇总失败";
  74. _status1.textColor = [UIColor redColor];
  75. }
  76. _status1.text = hStr;
  77. //
  78. NSString *sStr = [sb integerValue]==1?@"已上报":@"未上报";
  79. _stauts2.text = sStr;
  80. _stauts2.textColor = [sb integerValue]==1?RGB_COLOR(76, 75, 76):[UIColor lightGrayColor];
  81. //
  82. NSString *eStr = @"合格";
  83. _status3.textColor = RGB_COLOR(76, 75, 76);
  84. if ([sh integerValue]==1) {
  85. eStr = @"不合格";
  86. _status3.textColor = [UIColor redColor];
  87. }else if ([sh integerValue]==2){
  88. eStr = @"待审核";
  89. _status3.textColor = [UIColor lightGrayColor];
  90. }
  91. _status3.text = eStr;
  92. //
  93. NSString *shStr = @"审核通过";
  94. _status4.textColor = RGB_COLOR(76, 75, 76);
  95. self.statusTop.constant = -64;
  96. _checkMan.hidden = YES;
  97. _checkTime.hidden = YES;
  98. _reason.hidden = YES;
  99. if ([secondSh integerValue]==1) {
  100. shStr = @"异常记录";
  101. _status4.textColor = [UIColor redColor];
  102. self.statusTop.constant = 5;
  103. _checkMan.hidden = NO;
  104. _checkTime.hidden = NO;
  105. _reason.hidden = NO;
  106. }else if ([secondSh integerValue]==2){
  107. shStr = @"待审核";
  108. _status4.textColor = [UIColor lightGrayColor];
  109. }
  110. _status4.text = shStr;
  111. }
  112. - (IBAction)chakanBtnclick:(id)sender {
  113. }
  114. @end