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
//
//  PBChooseTableViewCell.m
//  IphoneBIMe
//
//  Created by zjf on 2018/8/15.
//  Copyright © 2018年 ProBIM. All rights reserved.
//
 
#import "PBChooseTableViewCell.h"
#import "PBIssueAddModel.h"
 
@interface PBChooseTableViewCell()
@property (nonatomic, weak) UILabel *leftTitleL;
@property (nonatomic, weak) UILabel *rightTitleL;
@property (nonatomic, weak) UILabel *leftSelectL;
@property (nonatomic, weak) UILabel *rightSelectL;
 
@end
@implementation PBChooseTableViewCell
 
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    UIView *topView = [[UIView alloc] init];
    topView.backgroundColor = [UIColor z_colorWithR:242 G:242 B:242];
    [self.contentView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.contentView);
        make.height.equalTo(@10);
    }];
    UIView *linView = [[UIView alloc] init];
    linView.backgroundColor = [UIColor z_colorWithR:242 G:242 B:242];
    [self.contentView addSubview:linView];
    [linView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom).offset(16);
        make.bottom.equalTo(self.contentView).offset(-22);
        make.centerX.equalTo(self.contentView);
        make.width.equalTo(@1);
        make.height.equalTo(@55);
    }];
    UIButton *statusBtn = [[UIButton alloc] init];
    [statusBtn addTarget:self action:@selector(statusBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:statusBtn];
    [statusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom);
        make.left.bottom.equalTo(self.contentView);
        make.right.equalTo(linView.mas_left);
    }];
    
    UIButton *typeBtn = [[UIButton alloc] init];
    [typeBtn addTarget:self action:@selector(typeBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:typeBtn];
    [typeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom);
        make.right.bottom.equalTo(self.contentView);
        make.left.equalTo(linView.mas_right);
    }];
 
    UILabel *statusTieleL = [UILabel z_labelWithText:@"" Color:PromptColor isBold:NO Font:DescFontSize];
    [self.contentView addSubview:statusTieleL];
    [statusTieleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom).offset(16);
        make.centerX.equalTo(statusBtn);
        make.height.equalTo(@20);
    }];
    
    UILabel *typeTieleL = [UILabel z_labelWithText:@"" Color:PromptColor isBold:NO Font:DescFontSize];
    [self.contentView addSubview:typeTieleL];
    [typeTieleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(topView.mas_bottom).offset(16);
        make.centerX.equalTo(typeBtn);
        make.height.equalTo(@20);
    }];
    
    UILabel *statusSelectL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:MarkedFontSize];
    statusSelectL.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:statusSelectL];
    [statusSelectL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(statusTieleL.mas_bottom).offset(16);
        make.left.equalTo(statusBtn).offset(16);
        make.right.equalTo(statusBtn).offset(-16);
        make.height.equalTo(@25);
    }];
    
    UILabel *typeSelectL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:MarkedFontSize];
    typeSelectL.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:typeSelectL];
    [typeSelectL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(typeTieleL.mas_bottom).offset(16);
        make.left.equalTo(typeBtn).offset(16);
        make.right.equalTo(typeBtn).offset(-16);
        make.height.equalTo(@25);
    }];
    self.leftTitleL = statusTieleL;
    self.rightTitleL = typeTieleL;
    self.leftSelectL = statusSelectL;
    self.rightSelectL = typeSelectL;
}
- (void)statusBtnAction {
    if (!self.leftIssueAddModel.isIssueManager) {
        return;
    }
    if (self.ChooseBlock) {
        self.ChooseBlock(0);
    }
}
- (void)typeBtnAction {
    if (self.rightIssueAddModel.isAddIssue || self.rightIssueAddModel.isIssueManager) {
        if (self.ChooseBlock) {
            self.ChooseBlock(1);
        }
    }
}
 
- (void)setLeftIssueAddModel:(PBIssueAddModel *)leftIssueAddModel {
    _leftIssueAddModel = leftIssueAddModel;
    if (leftIssueAddModel.isAddIssue) {
        self.leftTitleL.text = leftIssueAddModel.title;
        self.leftSelectL.text = @"打开";
    }else {
        self.leftTitleL.text = leftIssueAddModel.title;
        if(_leftIssueAddModel.navModel) {
            self.leftSelectL.text = leftIssueAddModel.navModel.ItemName;
//            self.leftSelectL.textColor = TitleColor;
        }else {
            self.leftSelectL.text = leftIssueAddModel.prompt;
//            self.leftSelectL.textColor = TitleColor;
        }
        if (self.leftIssueAddModel.isIssueManager) {
            self.leftSelectL.textColor = TitleColor;
        }else {
            self.leftSelectL.textColor = PromptColor;
        }
        
        
    }
}
- (void)setRightIssueAddModel:(PBIssueAddModel *)rightIssueAddModel {
    _rightIssueAddModel = rightIssueAddModel;
    self.rightTitleL.text = rightIssueAddModel.title;
    if(_rightIssueAddModel.navModel) {
        self.rightSelectL.text = rightIssueAddModel.navModel.ItemName;
//        self.rightSelectL.textColor = TitleColor;
    }else {
        self.rightSelectL.text = rightIssueAddModel.prompt;
//        self.rightSelectL.textColor = TitleColor;
    }
    if (self.rightIssueAddModel.isAddIssue || self.rightIssueAddModel.isIssueManager){
        self.rightSelectL.textColor = TitleColor;
    }else {
        self.rightSelectL.textColor = PromptColor;
    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
 
    // Configure the view for the selected state
}
 
@end