EleOneCell.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // EleOneCell.m
  3. // JSJPCoach
  4. //
  5. // Created by EchoShacolee on 2018/1/31.
  6. // Copyright © 2018年 Danson. All rights reserved.
  7. //
  8. #import "EleOneCell.h"
  9. @implementation EleOneCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. self.selectionStyle = UITableViewCellSelectionStyleNone;
  13. self.time.adjustsFontSizeToFitWidth = YES;
  14. if (_kemu == 4) {
  15. _status4.hidden = NO;
  16. }else{
  17. _status4.hidden = YES;
  18. }
  19. }
  20. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  21. [super setSelected:selected animated:animated];
  22. // Configure the view for the selected state
  23. }
  24. -(void)setDataDic:(NSDictionary *)dataDic{
  25. self.stuName.text = [dataDic[@"CRI_STARTTIME"] substringToIndex:10];
  26. self.history.attributedText = [self getHistoryWithStatus:dataDic[@"HISTORY"]];
  27. self.type.text = [self getTypeWithKemu:dataDic[@"CRI_TRAIN_SUBJECT"] pxName:dataDic[@"PXLX_NAME"]];
  28. self.time.text = [self getTimeWithStart:dataDic[@"CRI_STARTTIME"] end:dataDic[@"CRI_ENDTIME"]];
  29. self.allTime.text = [NSString stringWithFormat:@"总时长 : %@分钟",dataDic[@"CRI_DURATION"]];
  30. //二次审核相关
  31. self.checkMan.text = [NSString stringWithFormat:@"审核人 : %@",dataDic[@"CRI_AUDIT_USERNAME"]];
  32. self.checkTime.text = [NSString stringWithFormat:@"审核时间: %@",dataDic[@"CRI_AUDIT_TIME"]];
  33. self.reason.text = [NSString stringWithFormat:@"审核原因: %@",dataDic[@"CRI_SECOND_AUDIT_REASON"]];
  34. //状态栏
  35. [self getStastusWithHz:dataDic[@"CRI_COUNT"] sb:dataDic[@"CRI_RECORD_STATUS"] sh:dataDic[@"CRI_AUDIT_RESULT"] secondSH:dataDic[@"CRI_SECOND_AUDIT_RESULT"]];
  36. }
  37. -(NSMutableAttributedString *)getHistoryWithStatus:(id)status{
  38. NSInteger zz = [status integerValue];
  39. NSString *str = [NSString stringWithFormat:@"历史学员: %@",zz==1?@"是":@"否"];
  40. NSMutableAttributedString *aStr = [[NSMutableAttributedString alloc]initWithString:str];
  41. if (zz==1) {
  42. [aStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(str.length-1, 1)];
  43. }
  44. return aStr;
  45. }
  46. -(NSString*)getTypeWithKemu:(id)kemu pxName:(NSString *)pxName{
  47. NSArray *arr = @[@"科一",@"科二",@"科三",@"科四"];
  48. NSString * kemuStr = arr[[kemu integerValue]-1];
  49. return [NSString stringWithFormat:@"%@%@",kemuStr,[pxName substringToIndex:2]];
  50. }
  51. -(NSString *)getTimeWithStart:(NSString *)start end:(NSString *)end{
  52. return [NSString stringWithFormat:@"训练时段: %@至%@",[start substringFromIndex:11],[end substringFromIndex:11]];
  53. }
  54. -(void)getStastusWithHz:(id)hz sb:(id)sb sh:(id)sh secondSH:(id)secondSh{
  55. //
  56. NSString *hStr = @"未汇总";
  57. _status1.textColor = [UIColor lightGrayColor];
  58. if ([hz integerValue]==1) {
  59. hStr = @"已汇总";
  60. _status1.textColor = RGB_COLOR(76, 75, 76);
  61. }else if ([hz integerValue]==2){
  62. hStr = @"汇总失败";
  63. _status1.textColor = [UIColor redColor];
  64. }
  65. _status1.text = hStr;
  66. //
  67. NSString *sStr = [sb integerValue]==1?@"已上报":@"未上报";
  68. _status2.text = sStr;
  69. _status2.textColor = [sb integerValue]==1?RGB_COLOR(76, 75, 76):[UIColor lightGrayColor];
  70. //
  71. NSString *eStr = @"合格";
  72. _status3.textColor = RGB_COLOR(76, 75, 76);
  73. if ([sh integerValue]==1) {
  74. eStr = @"不合格";
  75. _status3.textColor = [UIColor redColor];
  76. }else if ([sh integerValue]==2){
  77. eStr = @"待审核";
  78. _status3.textColor = [UIColor lightGrayColor];
  79. }
  80. _status3.text = eStr;
  81. if (_kemu == 1) {
  82. _status3.text = @"";
  83. }
  84. //
  85. NSString *shStr = @"审核通过";
  86. _status4.textColor = RGB_COLOR(76, 75, 76);
  87. self.statusTop.constant = -64;
  88. _checkMan.hidden = YES;
  89. _checkTime.hidden = YES;
  90. _reason.hidden = YES;
  91. if ([secondSh integerValue]==1) {
  92. shStr = @"异常记录";
  93. _status4.textColor = [UIColor redColor];
  94. self.statusTop.constant = 5;
  95. _checkMan.hidden = NO;
  96. _checkTime.hidden = NO;
  97. _reason.hidden = NO;
  98. }else if ([secondSh integerValue]==2){
  99. shStr = @"待审核";
  100. _status4.textColor = [UIColor lightGrayColor];
  101. }
  102. _status4.text = shStr;
  103. }
  104. @end