NotuceRecordCell.m 3.75 KB
Newer Older
zhu's avatar
zhu committed
1 2 3 4 5 6 7 8 9
//
//  NotuceRecordCell.m
//  XFFruit
//
//  Created by mac on 15/9/16.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "NotuceRecordCell.h"
陈俊俊's avatar
陈俊俊 committed
10
#define LeftMargin 10
zhu's avatar
zhu committed
11 12 13 14 15 16 17 18 19 20 21 22 23
@implementation NotuceRecordCell

- (void)awakeFromNib {
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self bulidLayout];
    }
    return self;
}
陈俊俊's avatar
陈俊俊 committed
24

zhu's avatar
zhu committed
25 26
- (void)bulidLayout
{
陈俊俊's avatar
陈俊俊 committed
27 28
    self.contentView.backgroundColor = XXFBgColor;
    
陈俊俊's avatar
陈俊俊 committed
29
    UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 5, ScreenSize.width, 130 -10)];
陈俊俊's avatar
陈俊俊 committed
30
    bgView.backgroundColor = [UIColor whiteColor];
陈俊俊's avatar
陈俊俊 committed
31 32
//    bgView.layer.cornerRadius = 5;
//    bgView.layer.masksToBounds = YES;
陈俊俊's avatar
陈俊俊 committed
33 34 35 36
    [self.contentView addSubview:bgView];
    
    self.createdLable = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, 0, bgView.width - 100, 30)];//业务时间
    self.createdLable.font = GXF_FIFTEENTEN_SIZE;
陈俊俊's avatar
陈俊俊 committed
37
    self.createdLable.textColor = GXF_NAVIGAYION_COLOR;
陈俊俊's avatar
陈俊俊 committed
38 39 40 41 42
    self.createdLable.text = @"2015-04-05 09:05:05";
    
    self.creatorLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.right, 0, bgView.width - self.createdLable.width - LeftMargin * 2, 30)];//业务人
    self.creatorLable.font = GXF_FIFTEENTEN_SIZE;
    self.creatorLable.textAlignment = NSTextAlignmentRight;
陈俊俊's avatar
陈俊俊 committed
43
    self.creatorLable.textColor = GXF_NAVIGAYION_COLOR;
陈俊俊's avatar
陈俊俊 committed
44 45 46
    
    self.traceIdLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.x, self.createdLable.bottom, bgView.width - LeftMargin*2, 20)];//采购通知单uuid
    self.traceIdLable.font = GXF_FIFTEENTEN_SIZE;
陈俊俊's avatar
陈俊俊 committed
47
    self.traceIdLable.textColor = GXF_CELL_COLOR;
陈俊俊's avatar
陈俊俊 committed
48 49 50
    
    self.typeLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.x, self.traceIdLable.bottom, bgView.width- LeftMargin*2, 20)];//业务类型
    self.typeLable.font = GXF_FIFTEENTEN_SIZE;
陈俊俊's avatar
陈俊俊 committed
51
    self.typeLable.textColor = GXF_CELL_COLOR;
陈俊俊's avatar
陈俊俊 committed
52 53 54
    
    self.remarkLable = [[UILabel alloc]initWithFrame:CGRectMake(self.createdLable.x, self.typeLable.bottom, bgView.width-LeftMargin*2, 20)];//日志描述信息
    self.remarkLable.font = GXF_FIFTEENTEN_SIZE;
陈俊俊's avatar
陈俊俊 committed
55
    self.remarkLable.textColor = GXF_CELL_COLOR;
陈俊俊's avatar
陈俊俊 committed
56 57 58 59 60 61 62
    
    [bgView addSubview:self.createdLable];
    [bgView addSubview:self.creatorLable];
    [bgView addSubview:self.traceIdLable];
    [bgView addSubview:self.remarkLable];
    [bgView addSubview:self.typeLable];
    [bgView addSubview:self.uuidLable];
陈俊俊's avatar
陈俊俊 committed
63
}
陈俊俊's avatar
陈俊俊 committed
64

陈俊俊's avatar
陈俊俊 committed
65
- (void)setNoticeRecode:(NoticeRecord *)noticeRecode withNumber:(NSString *)number{
陈俊俊's avatar
陈俊俊 committed
66 67
    self.creatorLable.text = [NSString stringWithFormat:@"%@",noticeRecode.creator];
    self.createdLable.text = [NSString stringWithFormat:@"%@",noticeRecode.created];
陈俊俊's avatar
陈俊俊 committed
68 69 70
    self.traceIdLable.text = [NSString stringWithFormat:@"单号:%@",number];
    
      NSMutableAttributedString *attributeStr1 = [IBTCommon setTextViewFontOfString:@"类型:" paragraphStyle:0 fontSize:15 color:GXF_CELL_COLOR];
陈俊俊's avatar
陈俊俊 committed
71
    
陈俊俊's avatar
陈俊俊 committed
72 73 74 75 76 77 78 79 80 81 82

    NSString *str = @"";
    if ([noticeRecode.type isEqualToString:@"noticeAccepted"]) {
        str = @"接受任务";
    }else if ([noticeRecode.type isEqualToString:@"billCreated"]){
        str = @"新建采购单";
    }
    [attributeStr1 appendAttributedString:[IBTCommon setTextViewFontOfString:str paragraphStyle:0 fontSize:15 color:[UIColor redColor]]];
    self.typeLable.attributedText = attributeStr1;
    self.remarkLable.text = [NSString stringWithFormat:@"备注:%@",noticeRecode.remark];
    self.remarkLable.numberOfLines = 0;
陈俊俊's avatar
陈俊俊 committed
83
    
陈俊俊's avatar
陈俊俊 committed
84 85 86 87
    CGFloat height =  [self.remarkLable calculateHeight];
    if (height > 20) {
        self.remarkLable.height = height;
    }
zhu's avatar
zhu committed
88
}
陈俊俊's avatar
陈俊俊 committed
89

zhu's avatar
zhu committed
90 91 92 93 94
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end