zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
//
//  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