| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- //
- // LYJournalCell.m
- // shiku_im
- //
- // Created by liyangyang-pc on 16/11/2.
- // Copyright © 2016年 Reese. All rights reserved.
- //
- #import "LYJournalCell.h"
- @interface LYJournalCell()
- @property (nonatomic,strong) UILabel *DateLabel; //日期label
- @property (nonatomic,strong) UILabel *STATUSLabel;//审批label
- @property (nonatomic,strong) UILabel *workLabel; //
- @property (nonatomic,strong) UILabel *COMMENTLabel; //工作总结
- @end
- @implementation LYJournalCell
- + (instancetype)cellWithTableView:(UITableView *)tableView
- {
-
- static NSString * ID =@"JOBOR1qq";
- LYJournalCell * cell=[tableView dequeueReusableCellWithIdentifier:ID];
-
- if (!cell) {
- cell=[[LYJournalCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
- }
-
- return cell;
- }
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if(self)
- {
- //cell点击没效果
- self.selectionStyle=UITableViewCellSelectionStyleDefault;
- self.backgroundColor=[UIColor whiteColor];
- // 裁剪看不到的
-
-
- //创建视图
- [self setModel];
-
-
- }
-
- return self;
-
-
- }
- #pragma mark -- 创建视图
- - (void)setModel{
- UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(10, 35, SCREEN_WIDTH -20, 1.0f)]; //为什么高度减去1?防止黑线被其他控件视图遮挡。
- lineView.backgroundColor = Color(235, 233, 233, 1.0);
- [self.contentView addSubview:lineView];
- //日期label
- _DateLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH-90, 15)];
-
- _DateLabel.font = FONT_SIZE(14);
-
- [self.contentView addSubview:_DateLabel];
-
-
- _STATUSLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-70, 10, 60, 10)];
- _STATUSLabel.font = FONT_SIZE(12);
-
- [self.contentView addSubview:_STATUSLabel];
-
- _workLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 40, 200, 15)];
- _workLabel.font = FONT_SIZE(14);
-
- [self.contentView addSubview:_workLabel];
- //
- _COMMENTLabel = [[UILabel alloc] initWithFrame:CGRectMake(18, 58, SCREEN_WIDTH-60, 60)];
- _COMMENTLabel.font = FONT_SIZE(12);
- _COMMENTLabel.numberOfLines = 3;
-
- _COMMENTLabel.lineBreakMode = NSLineBreakByTruncatingTail;
- _COMMENTLabel.textColor = [UIColor lightGrayColor];
- // _COMMENTLabel.backgroundColor = Color(247, 247, 247, 1.0);
-
- [self.contentView addSubview:_COMMENTLabel];
-
-
- UIView *viewqq = [[UIView alloc] initWithFrame:CGRectMake(0, 78+40, SCREEN_WIDTH, 8)];
- viewqq.backgroundColor = Color(236, 235, 235, 1.0);
-
- [self.contentView addSubview:viewqq];
-
-
-
- }
- -(void)setJmodel:(LYJournalModel *)Jmodel
- {
- _Jmodel = Jmodel;
-
- _DateLabel.text = FORMAT(@"%@ %@",[NSString getHHyYYmMMr:Jmodel.WD_DATE sendStype:@"yyyyMMdd" comeYear:@"yyyy年M月d日"],[NSString getTheDayOfTheWeekByDateString:Jmodel.WD_DATE]);
- _DateLabel.textColor = Color(0, 0, 0, 1.0);
- _STATUSLabel.text = Jmodel.STATUS;
- /*
- if ([Jmodel.STATUS isEqualToString:@"待审批"]) {
- _STATUSLabel.textColor = Color(241, 8, 19, 1.0);
- }else{
- _STATUSLabel.textColor = Color(38, 133, 9, 1.0);
- }
- */
-
- _STATUSLabel.text = Jmodel.WD_STATUS;
-
- if ([Jmodel.WD_STATUS isEqualToString:@"在录入"]) {
- _STATUSLabel.textColor = Color(241, 8, 19, 1.0);
- }else if([Jmodel.WD_STATUS isEqualToString:@"已审核"])
- {
- _STATUSLabel.textColor = Color(38, 133, 9, 1.0);
-
- }
- else{
- _STATUSLabel.textColor = Color(241, 8, 19, 1.0);
-
- }
-
-
- _workLabel.textColor = Color(87, 87, 87, 1.0);
- _workLabel.text = @"工作总结";
- _COMMENTLabel.text = Jmodel.WD_COMMENT;
- _COMMENTLabel.textColor = Color(87, 87, 87, 1.0);
- switch (workCaller) {
- case 0:
-
- break;
- case 1:{
-
- _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日"]);
-
- }
- break;
- case 2:{
- _DateLabel.text = FORMAT(@"%@",[NSString getHHyYYmMMr:[Jmodel.WW_STARTTIME substringWithRange:NSMakeRange(0, 8)] sendStype:@"yyyyMM" comeYear:@"yyyy年M月"]);
-
- }
- break;
- default:
- break;
- }
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|