|
@@ -9,6 +9,7 @@
|
|
|
#import "uploadFileRecordCell.h"
|
|
|
#import "UIScrollView+EmptyDataSet.h"
|
|
|
#import "uploadFileManager.h"
|
|
|
+#import "uploadFileRecordTableViewHeadView.h"
|
|
|
|
|
|
@interface uploadFileRecordTableView()<UITableViewDataSource,UITableViewDelegate,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
|
{
|
|
@@ -16,6 +17,11 @@
|
|
|
NSMutableArray *uploadfailArr;
|
|
|
NSMutableArray *uploadDoneArr;
|
|
|
}
|
|
|
+
|
|
|
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *uploadingHeadView;
|
|
|
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *failHeadView;
|
|
|
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *doneHeadView;
|
|
|
+
|
|
|
@property (nonatomic, strong) NSMutableArray *curDataArr;
|
|
|
@end
|
|
|
|
|
@@ -56,6 +62,8 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ _outSideDataArr = outSideDataArr;
|
|
|
+
|
|
|
uploadingArr = outSideDataArr[0];
|
|
|
uploadfailArr = outSideDataArr[1];
|
|
|
uploadDoneArr = outSideDataArr[2];
|
|
@@ -115,47 +123,46 @@
|
|
|
[cell setAccessoryType:(UITableViewCellAccessoryNone)];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- NSMutableArray *curArr = _curDataArr;
|
|
|
-
|
|
|
- if(row < curArr.count){
|
|
|
- uploadFileDataModel *model = curArr[row];
|
|
|
- cell.curUploadFileDataModel = model;
|
|
|
- cell.isEditType = _isEditType;
|
|
|
-
|
|
|
- if(_isEditType){
|
|
|
- if([_selectModelArr containsObject:model]){
|
|
|
- cell.isSelectType = YES;
|
|
|
- }
|
|
|
- else{
|
|
|
- cell.isSelectType = NO;
|
|
|
- }
|
|
|
- }
|
|
|
+ if(section < _curDataArr.count){
|
|
|
+ NSMutableArray *curArr = _curDataArr[section];
|
|
|
|
|
|
- KWeakSelf
|
|
|
- cell.didLongPressClick = ^{
|
|
|
- [weakSelf didLongPressClickFun];
|
|
|
- };
|
|
|
-
|
|
|
- cell.didClckSelectBut = ^(BOOL isSelect) {
|
|
|
- [weakSelf selectModelOneByOne:model BySelect:isSelect];
|
|
|
- };
|
|
|
-
|
|
|
- cell.didTapPressClick = ^{
|
|
|
- if(model.curUploadStateType == uploadStateUploading){
|
|
|
- [weakSelf handleUploadingStateTapFunBy:YES with:model];
|
|
|
- }
|
|
|
- else if(model.curUploadStateType == uploadStateSuspend){
|
|
|
- [weakSelf handleUploadingStateTapFunBy:NO with:model];
|
|
|
- }
|
|
|
- else if(model.curUploadStateType == uploadStateFail){
|
|
|
- [weakSelf handleUploadFailStateWith:model];
|
|
|
+ if(row < curArr.count){
|
|
|
+ uploadFileDataModel *model = curArr[row];
|
|
|
+ cell.curUploadFileDataModel = model;
|
|
|
+ cell.isEditType = _isEditType;
|
|
|
+
|
|
|
+ if(_isEditType){
|
|
|
+ if([_selectModelArr containsObject:model]){
|
|
|
+ cell.isSelectType = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ cell.isSelectType = NO;
|
|
|
+ }
|
|
|
}
|
|
|
- };
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ cell.didLongPressClick = ^{
|
|
|
+ [weakSelf didLongPressClickFun];
|
|
|
+ };
|
|
|
+
|
|
|
+ cell.didClckSelectBut = ^(BOOL isSelect) {
|
|
|
+ [weakSelf selectModelOneByOne:model BySelect:isSelect];
|
|
|
+ };
|
|
|
+
|
|
|
+ cell.didTapPressClick = ^{
|
|
|
+ if(model.curUploadStateType == uploadStateUploading){
|
|
|
+ [weakSelf handleUploadingStateTapFunBy:YES with:model];
|
|
|
+ }
|
|
|
+ else if(model.curUploadStateType == uploadStateSuspend){
|
|
|
+ [weakSelf handleUploadingStateTapFunBy:NO with:model];
|
|
|
+ }
|
|
|
+ else if(model.curUploadStateType == uploadStateFail){
|
|
|
+ [weakSelf handleUploadFailStateWith:model];
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
return cell;
|
|
|
}
|
|
|
|
|
@@ -163,7 +170,81 @@
|
|
|
return 70;
|
|
|
}
|
|
|
|
|
|
+- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
|
|
+{
|
|
|
+ NSInteger curType = 0;// 0 上传中 1 失败 2 完成
|
|
|
+ if(section == 2){
|
|
|
+ curType = 2;
|
|
|
+ }
|
|
|
+ else if(section == 1){
|
|
|
+ if(uploadingArr.count == 0){
|
|
|
+ curType = 2;
|
|
|
+ }
|
|
|
+ else if(uploadfailArr.count == 0){
|
|
|
+ curType = 2;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ curType = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(uploadingArr.count > 0){
|
|
|
+ curType = 0;
|
|
|
+ }
|
|
|
+ else if(uploadfailArr.count > 0){
|
|
|
+ curType = 1;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ curType = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ uploadFileRecordTableViewHeadView *headView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
|
|
|
+ //headView.backgroundColor = [UIColor greenColor];
|
|
|
+
|
|
|
+ headView.didClickButFun = ^{
|
|
|
+ //[weakSelf didClickAllSuspendInLoadingFun];
|
|
|
+ };
|
|
|
+
|
|
|
+ if(curType == 2){
|
|
|
+
|
|
|
+ if(_doneHeadView){
|
|
|
+ return _doneHeadView;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _doneHeadView = headView;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(curType == 1){
|
|
|
+
|
|
|
+ if(_failHeadView){
|
|
|
+ return _failHeadView;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _failHeadView = headView;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(_uploadingHeadView){
|
|
|
+ return _uploadingHeadView;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _uploadingHeadView = headView;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ [self RefresHeadUIFun];
|
|
|
+
|
|
|
+ return headView;
|
|
|
+}
|
|
|
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
|
|
+{
|
|
|
+ return 40;
|
|
|
+}
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
|
|
|
|
@@ -215,47 +296,70 @@
|
|
|
#pragma mark 熟悉头部数据
|
|
|
-(void)RefresHeadUIFun
|
|
|
{
|
|
|
- uploadFileRecordTableViewHeadView *headView = (uploadFileRecordTableViewHeadView *)self.tableHeaderView;
|
|
|
-
|
|
|
- if(!headView || ![headView isKindOfClass:[uploadFileRecordTableViewHeadView class]]){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if(!_curDataArr ||_curDataArr.count ==0){
|
|
|
- headView.hidden = YES;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- headView.hidden = NO;
|
|
|
-
|
|
|
- NSInteger tag = self.tag;
|
|
|
+// uploadFileRecordTableViewHeadView *headView = (uploadFileRecordTableViewHeadView *)self.tableHeaderView;
|
|
|
+//
|
|
|
+// if(!headView || ![headView isKindOfClass:[uploadFileRecordTableViewHeadView class]]){
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if(!_curDataArr ||_curDataArr.count ==0){
|
|
|
+// headView.hidden = YES;
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// headView.hidden = NO;
|
|
|
+//
|
|
|
+// NSInteger tag = self.tag;
|
|
|
|
|
|
- if(tag == 100){
|
|
|
+ if(_uploadingHeadView){
|
|
|
NSString *leftStr = NSLocalizedString(@"File_upload_Record_uploading",nil);
|
|
|
NSString *rightStr = NSLocalizedString(@"File_upload_Record_all_suspend",nil);
|
|
|
NSString *rightSelectStr = NSLocalizedString(@"File_upload_Record_all_open",nil);
|
|
|
- NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_curDataArr.count];
|
|
|
+ NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,uploadingArr.count];
|
|
|
|
|
|
- headView.titleLabel.text = titleStr;
|
|
|
- [headView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
- [headView.rightButton setTitle:rightSelectStr forState:UIControlStateSelected];
|
|
|
+ _uploadingHeadView.titleLabel.text = titleStr;
|
|
|
+ [_uploadingHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+ [_uploadingHeadView.rightButton setTitle:rightSelectStr forState:UIControlStateSelected];
|
|
|
|
|
|
+ if(uploadingArr.count == 0){
|
|
|
+ _uploadingHeadView.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _uploadingHeadView.hidden = NO;
|
|
|
+ }
|
|
|
}
|
|
|
- else if(tag == 101){
|
|
|
+
|
|
|
+
|
|
|
+ if(_failHeadView){
|
|
|
NSString *leftStr = NSLocalizedString(@"File_upload_Record_did_upload",nil);
|
|
|
NSString *rightStr = NSLocalizedString(@"File_upload_Record_clear_Record",nil);
|
|
|
- NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_curDataArr.count];
|
|
|
-
|
|
|
- headView.titleLabel.text = titleStr;
|
|
|
- [headView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+ NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,uploadfailArr.count];
|
|
|
+
|
|
|
+ _failHeadView.titleLabel.text = titleStr;
|
|
|
+ [_failHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ if(uploadfailArr.count == 0){
|
|
|
+ _failHeadView.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _failHeadView.hidden = NO;
|
|
|
+ }
|
|
|
}
|
|
|
- else if(tag == 102){
|
|
|
+
|
|
|
+ if(_doneHeadView){
|
|
|
NSString *leftStr = NSLocalizedString(@"File_upload_Record_did_upload",nil);
|
|
|
NSString *rightStr = NSLocalizedString(@"File_upload_Record_clear_Record",nil);
|
|
|
- NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,_curDataArr.count];
|
|
|
+ NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,uploadDoneArr.count];
|
|
|
|
|
|
- headView.titleLabel.text = titleStr;
|
|
|
- [headView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+ _doneHeadView.titleLabel.text = titleStr;
|
|
|
+ [_doneHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ if(uploadDoneArr.count == 0){
|
|
|
+ _doneHeadView.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _doneHeadView.hidden = NO;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|