//
|
// PBExamineListToCheckCell.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2020/8/24.
|
// Copyright © 2020 ProBIM. All rights reserved.
|
//
|
|
#import "PBExamineListToCheckCell.h"
|
#import "PBExamineListModel.h"
|
@interface PBExamineListToCheckCell()
|
@property (nonatomic, weak) UILabel *referredL;//检查人 简称
|
@property (nonatomic, weak) UILabel *checkNameL;//检查人
|
@property (nonatomic, weak) UIImageView *stateImageV;//状态
|
@property (nonatomic, weak) UILabel *originatorL;//发起人
|
@property (nonatomic, weak) UILabel *timeL;//发起时间
|
@property (nonatomic, weak) UILabel *titleL;//标题
|
@property (nonatomic, weak) UILabel *typeL;//类型
|
@property (nonatomic, weak) UILabel *limitL;//期限
|
@end
|
@implementation PBExamineListToCheckCell
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
[self setupUI];
|
}
|
return self;
|
}
|
- (void)setupUI {
|
self.contentView.backgroundColor = PBColor(244, 245, 246);
|
UIView *bgV = [[UIView alloc] init];
|
bgV.backgroundColor = [UIColor whiteColor];
|
[self.contentView addSubview:bgV];
|
[bgV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.left.equalTo(self.contentView).offset(10);
|
make.right.equalTo(self.contentView).offset(-10);
|
make.bottom.equalTo(self.contentView);
|
}];
|
|
UIView *portraitImageV = [[UIView alloc] init];
|
portraitImageV.backgroundColor = PBColor(40, 58, 79);
|
[self.contentView addSubview:portraitImageV];
|
[portraitImageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(bgV).offset(13);
|
make.left.equalTo(bgV).offset(10);
|
make.size.mas_equalTo(CGSizeMake(40, 40));
|
}];
|
[portraitImageV circleViewWithRadius:20];
|
|
UILabel *referredL = [UILabel z_labelWithText:@"" Color:[UIColor whiteColor] isBold:YES Font:16];
|
referredL.textAlignment = NSTextAlignmentCenter;
|
[self.contentView addSubview:referredL];
|
[referredL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.centerY.equalTo(portraitImageV);
|
make.left.right.equalTo(portraitImageV);
|
}];
|
UILabel *checkNameL = [UILabel z_labelWithText:@"" Color:PBColor(40, 58, 79) isBold:YES Font:14];
|
[self.contentView addSubview:checkNameL];
|
[checkNameL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(portraitImageV);
|
make.left.equalTo(portraitImageV.mas_right).offset(8);
|
make.right.equalTo(bgV).offset(-70);
|
make.height.equalTo(@20);
|
}];
|
UIImageView *stateImageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Rectify_ qualified"]];
|
[self.contentView addSubview:stateImageV];
|
[stateImageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(bgV).offset(10);
|
make.right.equalTo(bgV);
|
make.size.mas_equalTo(CGSizeMake(60, 22));
|
}];
|
|
UILabel *originatorL = [UILabel z_labelWithText:@"" Color:PBColor(97, 111, 125) isBold:YES Font:13];
|
[self.contentView addSubview:originatorL];
|
[originatorL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(checkNameL.mas_bottom).offset(4);
|
make.left.equalTo(checkNameL);
|
make.height.equalTo(@16);
|
}];
|
UILabel *timeL = [UILabel z_labelWithText:@"" Color:PBColor(166, 174, 182) isBold:YES Font:13];
|
[self.contentView addSubview:timeL];
|
[timeL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.bottom.equalTo(originatorL);
|
make.left.equalTo(originatorL.mas_right).offset(8);
|
}];
|
|
UILabel *titleL = [UILabel z_labelWithText:@"" Color:PBColor(40, 58, 79) isBold:YES Font:14];
|
titleL.numberOfLines = 3;
|
[self.contentView addSubview:titleL];
|
[titleL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(timeL.mas_bottom).offset(15);
|
make.left.equalTo(bgV).offset(10);
|
make.right.equalTo(bgV).offset(-10);
|
}];
|
UIImageView *typeImageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"typebg"]];
|
[self.contentView addSubview:typeImageV];
|
[typeImageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(titleL);
|
make.left.equalTo(titleL);
|
make.size.mas_equalTo(CGSizeMake(62, 22));
|
}];
|
UILabel *typeL = [UILabel z_labelWithText:@"设计问题" Color:[UIColor whiteColor] isBold:YES Font:12];
|
typeL.textAlignment = NSTextAlignmentCenter;
|
[self.contentView addSubview:typeL];
|
[typeL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.bottom.left.right.equalTo(typeImageV);
|
}];
|
|
UILabel *timeLimitL = [UILabel z_labelWithText:@"任务期限" Color:PBColor(166, 174, 182) isBold:YES Font:13];
|
[self.contentView addSubview:timeLimitL];
|
[timeLimitL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(titleL.mas_bottom).offset(15);
|
make.left.equalTo(bgV).offset(10);
|
make.size.mas_equalTo(CGSizeMake(52, 16));
|
make.bottom.equalTo(bgV).offset(-10);
|
}];
|
UILabel *limitL = [UILabel z_labelWithText:@"" Color:PBColor(97, 111, 125) isBold:YES Font:13];
|
[self.contentView addSubview:limitL];
|
[limitL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(timeLimitL);
|
make.left.equalTo(timeLimitL.mas_right).offset(18);
|
}];
|
self.referredL = referredL;
|
self.checkNameL = checkNameL;
|
self.stateImageV = stateImageV;
|
self.originatorL = originatorL;
|
self.timeL = timeL;
|
self.titleL = titleL;
|
self.typeL = typeL;
|
self.limitL = limitL;
|
}
|
|
- (void)setExamineListModel:(PBExamineListModel *)examineListModel {
|
_examineListModel = examineListModel;
|
BOOL isChiness = [self IsChinese:examineListModel.bu_checker_RealName];
|
if (isChiness) {
|
self.referredL.text = [examineListModel.bu_checker_RealName substringFromIndex:examineListModel.bu_checker_RealName.length - 1];
|
}else {
|
self.referredL.text = [examineListModel.bu_checker_RealName substringToIndex:1];
|
}
|
self.checkNameL.text = examineListModel.bu_checker_RealName;
|
NSString *flagStr = [examineListModel.ExamineResult substringToIndex:1];
|
if ([flagStr isEqualToString:@"A"]) {
|
self.stateImageV.image = [UIImage imageNamed:@"Rectify_ check"];
|
}else if ([flagStr isEqualToString:@"B"]) {
|
self.stateImageV.image = [UIImage imageNamed:@"Rectify_ rectification"];
|
}else if ([flagStr isEqualToString:@"C"]) {
|
self.stateImageV.image = [UIImage imageNamed:@"Rectify_ acceptance"];
|
}else if ([flagStr isEqualToString:@"D"]) {
|
self.stateImageV.image = [UIImage imageNamed:@"Rectify_ qualified"];
|
}else {
|
self.stateImageV.image = [UIImage imageNamed:@""];
|
}
|
self.originatorL.text = examineListModel.bu_examiner_name;
|
self.timeL.text = [NSString stringWithFormat:@"于%@发起任务",[examineListModel.CreateDate stringByReplacingOccurrencesOfString:@"T" withString:@" "]];
|
self.titleL.text = [NSString stringWithFormat:@"------- %@",examineListModel.ExamineRemark];
|
self.typeL.text = examineListModel.aedt_name;
|
NSRange range1 = [examineListModel.ExamineDate rangeOfString:@"T"];
|
NSRange range2 = [examineListModel.RectificateDate rangeOfString:@"T"];
|
NSString *start = [examineListModel.ExamineDate substringToIndex:range1.location];
|
NSString *end = [examineListModel.RectificateDate substringToIndex:range2.location];
|
self.limitL.text = [NSString stringWithFormat:@"%@ - %@",start, end];
|
|
|
// UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.stateBgV.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerBottomLeft cornerRadii:CGSizeMake(10, 10)];
|
// CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
// maskLayer.frame = self.stateBgV.bounds;
|
// maskLayer.path = maskPath.CGPath;
|
// self.stateBgV.layer.mask = maskLayer;
|
//
|
// UIBezierPath *maskPath1 = [UIBezierPath bezierPathWithRoundedRect:self.checkBgV.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
|
// CAShapeLayer *maskLayer1 = [[CAShapeLayer alloc] init];
|
// maskLayer1.frame = self.checkBgV.bounds;
|
// maskLayer1.path = maskPath1.CGPath;
|
// self.checkBgV.layer.mask = maskLayer1;
|
}
|
- (BOOL)IsChinese:(NSString *)str {
|
for(int i=0; i< [str length];i++){
|
int a = [str characterAtIndex:i];
|
if( a > 0x4e00 && a < 0x9fff){
|
return YES;
|
}
|
}
|
return NO;
|
}
|
|
|
|
|
- (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
|