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
//
//  PBIssueListTableViewCell.m
//  IphoneBIMe
//
//  Created by zjf on 2018/8/8.
//  Copyright © 2018年 ProBIM. All rights reserved.
//
 
#import "PBIssueListTableViewCell.h"
#import "PBIssueListModel.h"
#import "PBProjectModel.h"
@interface PBIssueListTableViewCell()
@property (nonatomic, weak) UIImageView *imageV;
@property (nonatomic, weak) UILabel *titleL;
@property (nonatomic, weak) UILabel *creatorL;
@property (nonatomic, weak) UILabel *creatimeL;
@property (nonatomic, weak) UILabel *archiveL;
@end
 
@implementation PBIssueListTableViewCell
 
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self setupUI];
    }
    return self;
}
 
- (void)setupUI {
    UIImageView *imageV = [[UIImageView alloc] init];
    [self.contentView addSubview:imageV];
    [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(10);
        make.left.equalTo(self.contentView).offset(16);
        make.size.mas_equalTo(CGSizeMake(120, 90));
    }];
 
    UILabel *titleL = [UILabel z_labelWithText:@"测试问题追踪" Color:TitleColor isBold:NO Font:TitleFontSize];
    titleL.numberOfLines = 0;
    [self.contentView addSubview:titleL];
    [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageV);
        make.left.equalTo(imageV.mas_right).offset(8);
        make.right.equalTo(self.contentView).offset(-16);
        make.height.equalTo(@44);
    }];
    UIImageView *creatorV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Project_list_cell_manager"]];
    [self.contentView addSubview:creatorV];
    [creatorV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(titleL.mas_bottom).offset(12);
        make.left.equalTo(imageV.mas_right).offset(8);
        make.size.mas_equalTo(CGSizeMake(24, 24));
    }];
    
    UILabel *creatorL = [UILabel z_labelWithText:@"张三丰" Color:IndicatedColor isBold:NO Font:DescFontSize];
    [self.contentView addSubview:creatorL];
    [creatorL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(creatorV.mas_right).offset(8);
        make.centerY.equalTo(creatorV);
        make.width.equalTo(@70);
    }];
    
    
    UILabel *creatimeL = [UILabel z_labelWithText:@"" Color:DescColor isBold:NO Font:DescFontSize];
    [self.contentView addSubview:creatimeL];
    [creatimeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(creatorV);
        make.right.equalTo(self.contentView).offset(-16);
    }];
    UILabel *archiveL = [UILabel z_labelWithText:@"已归档" Color:[UIColor redColor] isBold:YES Font:12];
    [self.contentView addSubview:archiveL];
    [archiveL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(creatimeL.mas_bottom).offset(5);
        make.right.equalTo(self.contentView).offset(-20);
    }];
    
    self.imageV = imageV;
    self.titleL = titleL;
    self.creatorL = creatorL;
    self.creatimeL = creatimeL;
    self.archiveL = archiveL;
}
 
- (void)setIssueListModel:(PBIssueListModel *)issueListModel {
    _issueListModel = issueListModel;
    if ([issueListModel.DeleteMark isEqualToString:@"2"]) {
        self.archiveL.hidden = NO;
    }else {
        self.archiveL.hidden = YES;
    }
    
//    NSString *url = [NSString stringWithFormat:@"%@/api/Doc/GetHideFile?ProjectID=%@&FileId=%@&FileType=Issue",BimUrl,self.projectModel.bimcomposerid,issueListModel.FileId];
    if (issueListModel.ViewpointID == nil || [issueListModel.ViewpointID isEqualToString:@""]) {
        [self.imageV sd_setImageWithURL:[NSURL URLWithString:issueListModel.bgpicture_src] placeholderImage:[UIImage imageNamed:@"Issue_listimg_defult"]];
    }else {
        [self.imageV sd_setImageWithURL:[NSURL URLWithString:issueListModel.ImageUrl] placeholderImage:[UIImage imageNamed:@"Issue_listimg_defult"]];
    }
    _titleL.text = issueListModel.Title;
    _creatorL.text = _issueListModel.CreateUserName;
    NSString *time = issueListModel.CreateDate;
    time = [time stringByReplacingOccurrencesOfString:@"T" withString:@" "];
    time = [time stringByReplacingOccurrencesOfString:@"-" withString:@"/"];
    time = [time substringToIndex:time.length - 3];
    _creatimeL.text = time;
    
}
- (void)setProjectModel:(PBProjectModel *)projectModel {
    _projectModel = projectModel;
}
@end