LYJournalCell.m 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. //
  2. // LYJournalCell.m
  3. // shiku_im
  4. //
  5. // Created by liyangyang-pc on 16/11/2.
  6. // Copyright © 2016年 Reese. All rights reserved.
  7. //
  8. #import "LYJournalCell.h"
  9. @interface LYJournalCell()
  10. @property (nonatomic,strong) UILabel *DateLabel; //日期label
  11. @property (nonatomic,strong) UILabel *STATUSLabel;//审批label
  12. @property (nonatomic,strong) UILabel *workLabel; //
  13. @property (nonatomic,strong) UILabel *COMMENTLabel; //工作总结
  14. @end
  15. @implementation LYJournalCell
  16. + (instancetype)cellWithTableView:(UITableView *)tableView
  17. {
  18. static NSString * ID =@"JOBOR1qq";
  19. LYJournalCell * cell=[tableView dequeueReusableCellWithIdentifier:ID];
  20. if (!cell) {
  21. cell=[[LYJournalCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
  22. }
  23. return cell;
  24. }
  25. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  26. {
  27. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  28. if(self)
  29. {
  30. //cell点击没效果
  31. self.selectionStyle=UITableViewCellSelectionStyleDefault;
  32. self.backgroundColor=[UIColor whiteColor];
  33. // 裁剪看不到的
  34. //创建视图
  35. [self setModel];
  36. }
  37. return self;
  38. }
  39. #pragma mark -- 创建视图
  40. - (void)setModel{
  41. UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(10, 35, SCREEN_WIDTH -20, 1.0f)]; //为什么高度减去1?防止黑线被其他控件视图遮挡。
  42. lineView.backgroundColor = Color(235, 233, 233, 1.0);
  43. [self.contentView addSubview:lineView];
  44. //日期label
  45. _DateLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH-90, 15)];
  46. _DateLabel.font = FONT_SIZE(14);
  47. [self.contentView addSubview:_DateLabel];
  48. _STATUSLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-70, 10, 60, 10)];
  49. _STATUSLabel.font = FONT_SIZE(12);
  50. [self.contentView addSubview:_STATUSLabel];
  51. _workLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 40, 200, 15)];
  52. _workLabel.font = FONT_SIZE(14);
  53. [self.contentView addSubview:_workLabel];
  54. //
  55. _COMMENTLabel = [[UILabel alloc] initWithFrame:CGRectMake(18, 58, SCREEN_WIDTH-60, 60)];
  56. _COMMENTLabel.font = FONT_SIZE(12);
  57. _COMMENTLabel.numberOfLines = 3;
  58. _COMMENTLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  59. _COMMENTLabel.textColor = [UIColor lightGrayColor];
  60. // _COMMENTLabel.backgroundColor = Color(247, 247, 247, 1.0);
  61. [self.contentView addSubview:_COMMENTLabel];
  62. UIView *viewqq = [[UIView alloc] initWithFrame:CGRectMake(0, 78+40, SCREEN_WIDTH, 8)];
  63. viewqq.backgroundColor = Color(236, 235, 235, 1.0);
  64. [self.contentView addSubview:viewqq];
  65. }
  66. -(void)setJmodel:(LYJournalModel *)Jmodel
  67. {
  68. _Jmodel = Jmodel;
  69. _DateLabel.text = FORMAT(@"%@ %@",[NSString getHHyYYmMMr:Jmodel.WD_DATE sendStype:@"yyyyMMdd" comeYear:@"yyyy年M月d日"],[NSString getTheDayOfTheWeekByDateString:Jmodel.WD_DATE]);
  70. _DateLabel.textColor = Color(0, 0, 0, 1.0);
  71. _STATUSLabel.text = Jmodel.STATUS;
  72. /*
  73. if ([Jmodel.STATUS isEqualToString:@"待审批"]) {
  74. _STATUSLabel.textColor = Color(241, 8, 19, 1.0);
  75. }else{
  76. _STATUSLabel.textColor = Color(38, 133, 9, 1.0);
  77. }
  78. */
  79. _STATUSLabel.text = Jmodel.WD_STATUS;
  80. if ([Jmodel.WD_STATUS isEqualToString:@"在录入"]) {
  81. _STATUSLabel.textColor = Color(241, 8, 19, 1.0);
  82. }else if([Jmodel.WD_STATUS isEqualToString:@"已审核"])
  83. {
  84. _STATUSLabel.textColor = Color(38, 133, 9, 1.0);
  85. }
  86. else{
  87. _STATUSLabel.textColor = Color(241, 8, 19, 1.0);
  88. }
  89. _workLabel.textColor = Color(87, 87, 87, 1.0);
  90. _workLabel.text = @"工作总结";
  91. _COMMENTLabel.text = Jmodel.WD_COMMENT;
  92. _COMMENTLabel.textColor = Color(87, 87, 87, 1.0);
  93. switch (workCaller) {
  94. case 0:
  95. break;
  96. case 1:{
  97. _DateLabel.text = FORMAT(@"%@年%@周 %@-%@",[Jmodel.WW_STARTTIME substringWithRange:NSMakeRange(0, 4)],Jmodel.WW_WEEK,[NSString getHHyYYmMMr:[Jmodel.WW_STARTTIME substringWithRange:NSMakeRange(5, 5)] sendStype:@"MMdd" comeYear:@"M月d日"], [NSString getHHyYYmMMr:[Jmodel.WW_ENDTIME substringWithRange:NSMakeRange(5, 5)] sendStype:@"MMdd" comeYear:@"M月d日"]);
  98. }
  99. break;
  100. case 2:{
  101. _DateLabel.text = FORMAT(@"%@",[NSString getHHyYYmMMr:[Jmodel.WW_STARTTIME substringWithRange:NSMakeRange(0, 8)] sendStype:@"yyyyMM" comeYear:@"yyyy年M月"]);
  102. }
  103. break;
  104. default:
  105. break;
  106. }
  107. }
  108. - (void)awakeFromNib {
  109. [super awakeFromNib];
  110. // Initialization code
  111. }
  112. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  113. [super setSelected:selected animated:animated];
  114. // Configure the view for the selected state
  115. }
  116. @end