//
|
// PBTaskHeaderView.m
|
// IphoneBIMe
|
//
|
// Created by ZhangJF on 2022/9/20.
|
// Copyright © 2022 ProBIM. All rights reserved.
|
//
|
|
#import "PBTaskHeaderView.h"
|
#import "PBSchedulePlanModel.h"
|
|
@interface PBTaskHeaderView()<UITextFieldDelegate>
|
@property (nonatomic, weak) UILabel *nameL;
|
@property (nonatomic, weak) UILabel *dateL;
|
@property (nonatomic, copy) NSString *currentDate;
|
@property (nonatomic, weak) UITextField *unitTF;
|
@end
|
@implementation PBTaskHeaderView
|
- (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.height.equalTo(@16);
|
}];
|
|
UILabel *unitL = [UILabel z_labelWithText:@"施工单位: " Color:[UIColor z_colorWithR:51 G:51 B:51] isBold:YES Font:14];
|
[self addSubview:unitL];
|
[unitL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(planNameL.mas_bottom).offset(8);
|
make.left.equalTo(self).offset(12);
|
make.height.equalTo(@44);
|
}];
|
UITextField *unitTF = [[UITextField alloc] init];
|
unitTF.placeholder = @"请输入...";
|
unitTF.textAlignment= NSTextAlignmentLeft;
|
unitTF.textColor = PBColor(108, 108, 108);
|
unitTF.font = [UIFont fontWithName:Coarse size:14.0];
|
unitTF.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
|
unitTF.delegate = self;
|
unitTF.layer.cornerRadius = 4;
|
unitTF.layer.borderWidth = 1.f;
|
unitTF.layer.borderColor = [[UIColor z_colorWithR:108 G:108 B:108] CGColor];
|
unitTF.leftViewMode = UITextFieldViewModeAlways;
|
unitTF.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 12, 44)];
|
[self addSubview:unitTF];
|
[unitTF mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(unitL);
|
make.right.equalTo(self).offset(-12);
|
make.height.equalTo(@44);
|
make.width.equalTo(@(self.width - 98));
|
}];
|
|
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(unitL.mas_bottom).offset(8);
|
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));
|
}];
|
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.unitTF = unitTF;
|
}
|
- (void)chooseDate {
|
if (self.ChooseDate) {
|
self.ChooseDate();
|
}
|
}
|
- (void)setSchedulePlanModel:(PBSchedulePlanModel *)schedulePlanModel {
|
_schedulePlanModel = schedulePlanModel;
|
self.nameL.text = schedulePlanModel.Name;
|
}
|
- (void)setFillDate:(NSString *)fillDate {
|
_fillDate = fillDate;
|
self.dateL.text = fillDate;
|
}
|
- (void)setUnitText:(NSString *)unitText {
|
_unitText = unitText;
|
self.unitTF.text = unitText;
|
}
|
#pragma mark - UITextFieldDelegate
|
- (void)textFieldDidEndEditing:(UITextField *)textField{
|
self.unitText = textField.text;
|
if (self.textEditBlock) {
|
self.textEditBlock(textField.text);
|
}
|
}
|
/*
|
// Only override drawRect: if you perform custom drawing.
|
// An empty implementation adversely affects performance during animation.
|
- (void)drawRect:(CGRect)rect {
|
// Drawing code
|
}
|
*/
|
|
@end
|