|
|
@ -30,9 +30,15 @@ |
|
|
|
@property (nonatomic ,weak) UIButton *duoBtn; |
|
|
|
@property (nonatomic ,weak) UIButton *duoBtn; |
|
|
|
@property (nonatomic ,weak) UIButton *yuanBtn; |
|
|
|
@property (nonatomic ,weak) UIButton *yuanBtn; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UIButton *anBtn; |
|
|
|
|
|
|
|
@property (nonatomic ,weak) UIButton *weiBtn; |
|
|
|
|
|
|
|
|
|
|
|
/// 围栏类型 |
|
|
|
/// 围栏类型 |
|
|
|
@property (nonatomic ,assign) NSInteger railType; |
|
|
|
@property (nonatomic ,assign) NSInteger railType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// 安全区域 |
|
|
|
|
|
|
|
@property (nonatomic ,assign) NSInteger property; |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation AddRailViewController |
|
|
|
@implementation AddRailViewController |
|
|
@ -45,10 +51,14 @@ |
|
|
|
if (self.isRedact == 1) |
|
|
|
if (self.isRedact == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
self.railType = 1; |
|
|
|
self.railType = 1; |
|
|
|
|
|
|
|
self.property = 1; |
|
|
|
self.railModel = [[SafetyRailModel alloc] init]; |
|
|
|
self.railModel = [[SafetyRailModel alloc] init]; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
self.railType = self.railModel.type; |
|
|
|
self.railType = self.railModel.type; |
|
|
|
|
|
|
|
self.property = self.railModel.property; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[self zx_setRightBtnWithText:GJText(@"保存") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { |
|
|
|
[self zx_setRightBtnWithText:GJText(@"保存") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) { |
|
|
|
[self AddRails]; |
|
|
|
[self AddRails]; |
|
|
@ -56,7 +66,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
kWeakSelf(self) |
|
|
|
kWeakSelf(self) |
|
|
|
|
|
|
|
|
|
|
|
NSArray *arr = @[GJText(@"围栏类型"),GJText(@"地址名称"),GJText(@"地址"),GJText(@"有效时间"),GJText(@"星期")]; |
|
|
|
NSArray *arr = @[GJText(@"围栏类型"),GJText(@"安全区域"),GJText(@"地址名称"),GJText(@"地址"),GJText(@"有效时间"),GJText(@"星期")]; |
|
|
|
NSArray *timeArr = @[GJText(@"一"),GJText(@"二"),GJText(@"三"),GJText(@"四"),GJText(@"五"),GJText(@"六"),GJText(@"日")]; |
|
|
|
NSArray *timeArr = @[GJText(@"一"),GJText(@"二"),GJText(@"三"),GJText(@"四"),GJText(@"五"),GJText(@"六"),GJText(@"日")]; |
|
|
|
|
|
|
|
|
|
|
|
UIView *bgView = [UICommon ui_view:CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH, Adapted(55)*arr.count) backgroundColor:KKWhiteColorColor cornerRadius:0 borderWidth:0 borderColor:KKWhiteColorColor]; |
|
|
|
UIView *bgView = [UICommon ui_view:CGRectMake(0, iPhoneX_NavHeight, SCREEN_WIDTH, Adapted(55)*arr.count) backgroundColor:KKWhiteColorColor cornerRadius:0 borderWidth:0 borderColor:KKWhiteColorColor]; |
|
|
@ -119,7 +129,39 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else if (i > 0 &&i < 3) |
|
|
|
else if (i == 1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UIButton *weiBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(14) normalColor:KKTextBlackColor normalText:@" 危险区域" click:^(UIButton *btn) { |
|
|
|
|
|
|
|
self.property = 2; |
|
|
|
|
|
|
|
[self selectbtnImg:btn :self.anBtn]; |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
self.weiBtn = weiBtn; |
|
|
|
|
|
|
|
[bgView addSubview:weiBtn]; |
|
|
|
|
|
|
|
[weiBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
|
|
|
make.right.equalTo(bgView.mas_right).inset(15); |
|
|
|
|
|
|
|
make.centerY.equalTo(titleLabel); |
|
|
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(100, 40)); |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIButton *anBtn = [UICommon ui_buttonSimple:CGRectZero font:Font_(14) normalColor:KKTextBlackColor normalText:@" 安全区域" click:^(UIButton *btn) { |
|
|
|
|
|
|
|
self.property = 1; |
|
|
|
|
|
|
|
[self selectbtnImg:btn :self.weiBtn]; |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
self.anBtn = anBtn; |
|
|
|
|
|
|
|
[bgView addSubview:anBtn]; |
|
|
|
|
|
|
|
[anBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
|
|
|
make.right.equalTo(weiBtn.mas_left).inset(15); |
|
|
|
|
|
|
|
make.centerY.equalTo(titleLabel); |
|
|
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(100, 40)); |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (self.property == 1) |
|
|
|
|
|
|
|
[self selectbtnImg:self.anBtn :self.weiBtn]; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
[self selectbtnImg:self.weiBtn :self.anBtn]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (i > 1 &&i < 4) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; |
|
|
|
UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; |
|
|
|
[bgView addSubview:rightImg]; |
|
|
|
[bgView addSubview:rightImg]; |
|
|
@ -129,12 +171,12 @@ |
|
|
|
make.size.mas_equalTo(CGSizeMake(Adapted(rightImg.image.size.width), Adapted(rightImg.image.size.height))); |
|
|
|
make.size.mas_equalTo(CGSizeMake(Adapted(rightImg.image.size.width), Adapted(rightImg.image.size.height))); |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
NSString *text; |
|
|
|
NSString *text; |
|
|
|
if (i == 1) |
|
|
|
|
|
|
|
text = self.isRedact == 1 ? GJText(@"请设置地址名称") : self.railModel.name; |
|
|
|
|
|
|
|
if (i == 2) |
|
|
|
if (i == 2) |
|
|
|
|
|
|
|
text = self.isRedact == 1 ? GJText(@"请设置地址名称") : self.railModel.name; |
|
|
|
|
|
|
|
if (i == 3) |
|
|
|
text = self.isRedact == 1 ? GJText(@"请设置详细地址") : self.railModel.address; |
|
|
|
text = self.isRedact == 1 ? GJText(@"请设置详细地址") : self.railModel.address; |
|
|
|
UIButton *rightBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(13) normalColor:self.isRedact == 1 ? KKGrey121 : KKTextBlackColor normalText:text click:^(UIButton *btn) { |
|
|
|
UIButton *rightBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(13) normalColor:self.isRedact == 1 ? KKGrey121 : KKTextBlackColor normalText:text click:^(UIButton *btn) { |
|
|
|
if (btn.tag == 1) |
|
|
|
if (btn.tag == 2) |
|
|
|
{ |
|
|
|
{ |
|
|
|
RailNameTagViewController *vc = [RailNameTagViewController new]; |
|
|
|
RailNameTagViewController *vc = [RailNameTagViewController new]; |
|
|
|
vc.addressName = weakself.nameBtn.currentTitle; |
|
|
|
vc.addressName = weakself.nameBtn.currentTitle; |
|
|
@ -182,8 +224,8 @@ |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
rightBtn.tag = i; |
|
|
|
rightBtn.tag = i; |
|
|
|
rightBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; |
|
|
|
rightBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; |
|
|
|
if (i == 1) self.nameBtn = rightBtn; |
|
|
|
if (i == 2) self.nameBtn = rightBtn; |
|
|
|
if (i == 2) self.addressBtn = rightBtn; |
|
|
|
if (i == 3) self.addressBtn = rightBtn; |
|
|
|
[bgView addSubview:rightBtn]; |
|
|
|
[bgView addSubview:rightBtn]; |
|
|
|
[rightBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
[rightBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
make.right.equalTo(rightImg.mas_left).inset(5); |
|
|
|
make.right.equalTo(rightImg.mas_left).inset(5); |
|
|
@ -193,7 +235,7 @@ |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else if (i == 3) |
|
|
|
else if (i == 4) |
|
|
|
{ |
|
|
|
{ |
|
|
|
UIButton *endTime = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(13) normalColor:KKTextBlackColor normalText:self.isRedact == 2 ? self.railModel.endTime : @"17:00" click:^(id x) { |
|
|
|
UIButton *endTime = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(13) normalColor:KKTextBlackColor normalText:self.isRedact == 2 ? self.railModel.endTime : @"17:00" click:^(id x) { |
|
|
|
|
|
|
|
|
|
|
@ -318,6 +360,7 @@ |
|
|
|
[parameters setValue:self.railModel.address forKey:@"address"]; |
|
|
|
[parameters setValue:self.railModel.address forKey:@"address"]; |
|
|
|
[parameters setValue:self.nameBtn.currentTitle forKey:@"name"]; |
|
|
|
[parameters setValue:self.nameBtn.currentTitle forKey:@"name"]; |
|
|
|
[parameters setValue:[self.btnArr componentsJoinedByString:@""] forKey:@"week"]; |
|
|
|
[parameters setValue:[self.btnArr componentsJoinedByString:@""] forKey:@"week"]; |
|
|
|
|
|
|
|
[parameters setValue:@(self.property) forKey:@"property"]; |
|
|
|
NSString *urlStr; |
|
|
|
NSString *urlStr; |
|
|
|
if (self.railType == 1) |
|
|
|
if (self.railType == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|