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
//
//  PBScheduleHeaderView.m
//  IphoneBIMe
//
//  Created by ZhangJF on 2022/8/24.
//  Copyright © 2022 ProBIM. All rights reserved.
//
 
#import "PBScheduleHeaderView.h"
#import "PBSchedulePlanModel.h"
 
@interface PBScheduleHeaderView()
@property (nonatomic, weak) UILabel *nameL;
@property (nonatomic, weak) UILabel *dateL;
@property (nonatomic, weak) UILabel *placeL;
@property (nonatomic, copy) NSString *currentDate;
@end
@implementation PBScheduleHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    self.backgroundColor = [UIColor whiteColor];
    UIView *iconV = [[UIView alloc] init];
    iconV.backgroundColor = PBColor(95, 158, 249);
    [self addSubview:iconV];
    [iconV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(20);
        make.size.mas_equalTo(CGSizeMake(6, 20));
        make.left.equalTo(self);
    }];
    UILabel *titleL = [UILabel z_labelWithText:@"基本信息" Color:[UIColor z_colorWithR:95 G:158 B:249] isBold:YES Font:18];
    [self addSubview:titleL];
    [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(iconV);
        make.left.equalTo(iconV.mas_right).offset(5);
    }];
//    UILabel *planNameL = [UILabel z_labelWithText:@"计划名称: " Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:14];
//    [self addSubview:planNameL];
//    [planNameL mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(iconV.mas_bottom).offset(14);
//        make.left.equalTo(self).offset(12);
//        make.height.equalTo(@16);
//    }];
//    UILabel *nameL = [UILabel z_labelWithText:@"新建隆子机场总进度" Color:[UIColor z_colorWithR:108 G:108 B:108] isBold:NO Font:14];
//    [self addSubview:nameL];
//    [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(planNameL);
//        make.left.equalTo(planNameL.mas_right);
//        make.width.equalTo(@(self.width - 120));
//        make.height.equalTo(@16);
//    }];
//    UIButton *scanBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"scan_img"]];
//    [scanBtn addTarget:self action:@selector(scanAction) forControlEvents:UIControlEventTouchUpInside];
//    [self addSubview:scanBtn];
//    [scanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(nameL);
//        make.size.mas_equalTo(CGSizeMake(24, 24));
//        make.right.equalTo(self).offset(-12);
//    }];
    
//    UILabel *fillDateL = [UILabel z_labelWithText:@"填报日期: " Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:14];
//    [self addSubview:fillDateL];
//    [fillDateL mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(planNameL.mas_bottom).offset(18);
//        make.left.equalTo(self).offset(12);
//        make.height.equalTo(@44);
//    }];
//    UIButton *borderV = [[UIButton alloc] init];
//    [borderV addTarget:self action:@selector(chooseDate) forControlEvents:UIControlEventTouchUpInside];
//    borderV.layer.cornerRadius = 4;
//    borderV.layer.borderWidth = 1.f;
//    borderV.layer.borderColor = [[UIColor z_colorWithR:108 G:108 B:108] CGColor];
//    [self addSubview:borderV];
//    [borderV mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(fillDateL);
////        make.left.equalTo(fillDateL.mas_right);
//        make.right.equalTo(self).offset(-12);
//        make.height.equalTo(@44);
//        make.width.equalTo(@(self.width - 98));
//    }];
//
//    UILabel *dateL = [UILabel z_labelWithText:@"" Color:[UIColor z_colorWithR:108 G:108 B:108] isBold:NO Font:14];
//    [self addSubview:dateL];
//    [dateL mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(borderV).offset(12);
//        make.centerY.equalTo(borderV);
//    }];
//    UIImageView *chooseDateV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"date_btn"]];
//    [self addSubview:chooseDateV];
//    [chooseDateV mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(borderV).offset(10);
//        make.right.equalTo(borderV).offset(-10);
//        make.size.mas_equalTo(CGSizeMake(24, 24));
//    }];
    UILabel *fillPlaceL = [UILabel z_labelWithText:@"填报位置: " Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:14];
    [self addSubview:fillPlaceL];
    [fillPlaceL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(iconV.mas_bottom).offset(14);
        make.left.equalTo(self).offset(12);
        make.height.equalTo(@44);
    }];
    UILabel *placeL = [UILabel z_labelWithText:@"" Color:[UIColor z_colorWithR:108 G:108 B:108] isBold:NO Font:14];
    placeL.numberOfLines = 0;
    placeL.layer.cornerRadius = 4;
    placeL.layer.borderWidth = 1.f;
    placeL.layer.borderColor = [[UIColor z_colorWithR:108 G:108 B:108] CGColor];
    [self addSubview:placeL];
    [placeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(fillPlaceL);
        make.height.equalTo(@44);
        make.left.equalTo(fillPlaceL.mas_right);
        make.width.equalTo(@(self.width - 120));
    }];
    
    UIButton *scanBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"scan_img"]];
    [scanBtn addTarget:self action:@selector(scanAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:scanBtn];
    [scanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(placeL);
        make.size.mas_equalTo(CGSizeMake(24, 24));
        make.right.equalTo(self).offset(-12);
    }];
    UIView *linV = [[UIView alloc] init];
    linV.backgroundColor = PBColor(243, 243, 244);
    [self addSubview:linV];
    [linV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@2);
        make.left.right.bottom.equalTo(self);
    }];
//    self.nameL = nameL;
//    self.dateL = dateL;
    self.placeL = placeL;
}
- (void)chooseDate {
    if (self.ChooseDate) {
        self.ChooseDate();
    }
}
- (void)scanAction {
    if (self.Scanning) {
        self.Scanning();
    }
}
- (void)setPlace:(NSString *)place {
    _place = place;
    self.placeL.text = place;
}
- (void)setSchedulePlanModel:(PBSchedulePlanModel *)schedulePlanModel {
    _schedulePlanModel = schedulePlanModel;
    self.nameL.text = schedulePlanModel.Name;
}
- (void)setFillDate:(NSString *)fillDate {
    _fillDate = fillDate;
    self.dateL.text = fillDate;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
 
@end