Commit 2a743b25 authored by Sandy's avatar Sandy

选择采购单checkbox逻辑

parent 525917d1
...@@ -4424,7 +4424,7 @@ ...@@ -4424,7 +4424,7 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit; PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit;
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "e2cec26c-3666-4512-9b9a-cdb4cd9da56d";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Debug; name = Debug;
...@@ -4434,8 +4434,8 @@ ...@@ -4434,8 +4434,8 @@
baseConfigurationReference = 7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */; baseConfigurationReference = 7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPYING_PRESERVES_HFS_DATA = NO; COPYING_PRESERVES_HFS_DATA = NO;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
GCC_PREFIX_HEADER = "XFFruit/XFFruit-Prefix.pch"; GCC_PREFIX_HEADER = "XFFruit/XFFruit-Prefix.pch";
...@@ -4449,7 +4449,7 @@ ...@@ -4449,7 +4449,7 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit; PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit;
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "e2cec26c-3666-4512-9b9a-cdb4cd9da56d";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Release; name = Release;
......
...@@ -19,7 +19,7 @@ typedef NS_ENUM(NSUInteger, CheckBoxBGType) { ...@@ -19,7 +19,7 @@ typedef NS_ENUM(NSUInteger, CheckBoxBGType) {
@property (assign, nonatomic) BOOL isSelected; @property (assign, nonatomic) BOOL isSelected;
@property (assign, nonatomic) CheckBoxBGType m_eBGType; @property (assign, nonatomic) CheckBoxBGType m_eBGType;
@property (nonatomic, copy) void (^blockCheckBox)(BOOL isSelect);
- (void)onCheckBoxAction:(id)sender; - (void)onCheckBoxAction:(id)sender;
@end @end
...@@ -92,6 +92,9 @@ ...@@ -92,6 +92,9 @@
#pragma mark - Actions #pragma mark - Actions
- (void)onCheckBoxAction:(id)sender { - (void)onCheckBoxAction:(id)sender {
self.isSelected = !_isSelected; self.isSelected = !_isSelected;
if (self.blockCheckBox) {
self.blockCheckBox(self.isSelected);
}
} }
@end @end
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ICRCheckBox.h"
@protocol HeaderCellDelegate <NSObject> @protocol HeaderCellDelegate <NSObject>
@optional @optional
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
@interface HeaderCell : UIView @interface HeaderCell : UIView
@property (nonatomic,weak)id<HeaderCellDelegate>delegate; @property (nonatomic,weak)id<HeaderCellDelegate>delegate;
@property (strong, nonatomic) ICRCheckBox *checkBox;
@property (nonatomic, copy) void (^blockCheckBox)(BOOL isSelect);
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr; - (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr;
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr withHiddenEdit:(BOOL)isHiddenEdit; - (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr withHiddenEdit:(BOOL)isHiddenEdit;
- (instancetype)initWithFrame:(CGRect)frame WithCheckBoxArr:(NSArray *)arr checkBox:(void (^)(BOOL isSelect))check;
@end @end
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#define LeftWidth 45 #define LeftWidth 45
#define RightWidth 30 #define RightWidth 30
#define SpaceMargin 1 #define SpaceMargin 1
#import "ICRCheckBox.h"
@interface HeaderCell () @interface HeaderCell ()
@property (nonatomic,strong)NSArray *arr; @property (nonatomic,strong)NSArray *arr;
@property (nonatomic,strong)UILabel *lineLabel; @property (nonatomic,strong)UILabel *lineLabel;
...@@ -38,6 +39,18 @@ ...@@ -38,6 +39,18 @@
return self; return self;
} }
- (instancetype)initWithFrame:(CGRect)frame WithCheckBoxArr:(NSArray *)arr checkBox:(void (^)(BOOL isSelect))check {
self = [super initWithFrame:frame];
if (self) {
self.arr = arr;
self.isHiddenAdd = YES;
self.blockCheckBox = check;
[self bulidLayout];
[self uiAddCheckBox];
}
return self;
}
- (void)bulidLayout{ - (void)bulidLayout{
CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count; CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count;
...@@ -65,6 +78,23 @@ ...@@ -65,6 +78,23 @@
[self addSubview:addBtn]; [self addSubview:addBtn];
} }
}
- (void)uiAddCheckBox {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(ScreenSize.width - 30, 0, 30, self.frame.size.height)];
label.text = @"全选";
label.font = [UIFont systemFontOfSize:13];
[self addSubview:label];
ICRCheckBox *addBtn = [[ICRCheckBox alloc] initWithFrame:CGRectMake(ScreenSize.width - LeftWidth - SpaceMargin - 15, 0, LeftWidth, self.frame.size.height)];
self.checkBox = addBtn;
addBtn.m_eBGType = kCheckBoxBGGray;
addBtn.blockCheckBox = self.blockCheckBox;
[self addSubview:addBtn];
} }
- (void)addBtn{ - (void)addBtn{
......
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
#define TableHeight 44 #define TableHeight 44
#define ShowHeight 110 #define ShowHeight 110
@interface TransportPurchaseCell ()
@property (strong, nonatomic) HeaderCell *headCell;
@end
@implementation TransportPurchaseCell @implementation TransportPurchaseCell
...@@ -58,8 +60,15 @@ ...@@ -58,8 +60,15 @@
[self.bgView addSubview:self.secondTable]; [self.bgView addSubview:self.secondTable];
NSArray *arr = @[@"商品",@"包装规格",@"包装数量",@"基础数量"]; NSArray *arr = @[@"商品",@"包装规格",@"包装数量",@"基础数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:YES]; __weak TransportPurchaseCell *weakSelf = self;
self.secondTable.tableHeaderView = headCell; self.headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) WithCheckBoxArr:arr checkBox:^(BOOL isSelect) {
[weakSelf.selectArr removeAllObjects];
if (isSelect) {
[weakSelf.selectArr addObjectsFromArray:self.secondArr];
}
[weakSelf.secondTable reloadData];
}];
self.secondTable.tableHeaderView = self.headCell;
} }
...@@ -99,6 +108,8 @@ ...@@ -99,6 +108,8 @@
{ {
static NSString *cellID = @"TransportPurductCell"; static NSString *cellID = @"TransportPurductCell";
TransportPurductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; TransportPurductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
cell.editBtn.enabled = NO;
self.headCell.checkBox.isSelected = self.selectArr.count == self.secondArr.count;
if (cell == nil) { if (cell == nil) {
cell = [[TransportPurductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID withImageName:@"selected"]; cell = [[TransportPurductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID withImageName:@"selected"];
cell.editBtn.hidden = YES; cell.editBtn.hidden = YES;
...@@ -156,6 +167,7 @@ ...@@ -156,6 +167,7 @@
// cell.backgroundColor = [UIColor whiteColor]; // cell.backgroundColor = [UIColor whiteColor];
// [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_getSelectPurchaseProduct object:nil userInfo:@{@"selectArr":billProduct,@"state":@"remove"}]; // [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_getSelectPurchaseProduct object:nil userInfo:@{@"selectArr":billProduct,@"state":@"remove"}];
} }
self.headCell.checkBox.isSelected = self.selectArr.count == self.secondArr.count;
[self.secondTable reloadData]; [self.secondTable reloadData];
} }
- (BOOL)isHaveIndexPath:(TransportPdtDetail *)billProduct{ - (BOOL)isHaveIndexPath:(TransportPdtDetail *)billProduct{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment