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
//
//  PBViewPointDetailCell.m
//  IphoneBIMe
//
//  Created by zjf on 2018/7/24.
//  Copyright © 2018年 ProBIM. All rights reserved.
//
 
#import "PBViewPointDetailCell.h"
#import "PBViewPointModel.h"
@interface PBViewPointDetailCell()
@property (nonatomic, weak) UILabel *viewPointNameL;
@property (nonatomic, weak) UILabel *viewPointDescL;
@property (nonatomic, weak) UILabel *creatorL;
@property (nonatomic, weak) UILabel *updateTimeL;
@property (nonatomic, weak) UILabel *isDefaultL;
@end
@implementation PBViewPointDetailCell
 
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    UILabel *viewPointNameL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:TitleFontSize];
    viewPointNameL.numberOfLines = 0;
    [self.contentView addSubview:viewPointNameL];
    [viewPointNameL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(20);
        make.left.equalTo(self.contentView).offset(16);
        make.right.equalTo(self.contentView).offset(-16);
    }];
 
    UILabel *viewPointDescL = [UILabel z_labelWithText:@"" Color:DescColor isBold:NO Font:DescFontSize];
    viewPointDescL.numberOfLines = 0;
    [self.contentView addSubview:viewPointDescL];
    [viewPointDescL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewPointNameL.mas_bottom).offset(10);
        make.left.right.equalTo(viewPointNameL);
    }];
    
//    UILabel *creatorL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:TitleFontSize];
//    creatorL.numberOfLines = 0;
//    [self.contentView addSubview:creatorL];
//    [creatorL mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(viewPointDescL.mas_bottom).offset(20);
//        make.left.right.equalTo(viewPointNameL);
//    }];
    UILabel *updateTimeL = [UILabel z_labelWithText:@"" Color:DescColor isBold:NO Font:DescFontSize];
    [self.contentView addSubview:updateTimeL];
    [updateTimeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(viewPointDescL.mas_bottom).offset(10);
        make.left.right.equalTo(viewPointNameL);
    }];
    UILabel *isDefaultL = [UILabel z_labelWithText:@"默认" Color:IndicatedColor isBold:YES Font:DescFontSize];
    [self.contentView addSubview:isDefaultL];
    [isDefaultL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(updateTimeL.mas_bottom).offset(10);
        make.left.equalTo(viewPointNameL);
        make.height.equalTo(@22);
        make.bottom.equalTo(self.contentView).offset(-20);
    }];
    
    self.viewPointNameL = viewPointNameL;
    self.viewPointDescL = viewPointDescL;
//    self.creatorL = creatorL;
    self.updateTimeL = updateTimeL;
    self.isDefaultL = isDefaultL;
}
 
- (void)setViewPointModel:(PBViewPointModel *)viewPointModel {
    _viewPointModel = viewPointModel;
    self.viewPointNameL.text = viewPointModel.Name;
    NSDictionary *dict = [NSString convertTodictionaryOrArr:viewPointModel.Tag];
    id desc = [dict valueForKey:@"description"];
    if ([desc isKindOfClass:[NSString class]]) {
        self.viewPointDescL.text = [desc isEqualToString:@""] ? @"<无描述>" : desc;
    }else {
        self.viewPointDescL.text = @"<无描述>";
    }    
//    self.creatorL.text = [NSString stringWithFormat:@"创建人   %@",viewPointModel.Editor];
    self.updateTimeL.text = [NSString stringWithFormat:@"更新时间    %@",[viewPointModel.EditTime stringByReplacingOccurrencesOfString:@"T" withString:@" "]];
    if (viewPointModel.IsDefault) {
        self.isDefaultL.hidden = NO;
    }else {
        self.isDefaultL.hidden = YES;
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
 
    // Configure the view for the selected state
}
 
@end