|
|
@@ -9,10 +9,16 @@
|
|
|
#import "uploadFileRecordCell.h"
|
|
|
#import "UIScrollView+EmptyDataSet.h"
|
|
|
#import "uploadFileDataModel.h"
|
|
|
+#import "uploadFileRecordTableViewHeadView.h"
|
|
|
+#import "ComontAlretViewController.h"
|
|
|
+#import "uploadFileManager.h"
|
|
|
|
|
|
@interface uploadFileRecordBodyView ()<UITableViewDelegate,UITableViewDataSource,UIScrollViewDelegate,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
|
@property (nonatomic,strong) UIScrollView *bgScrollV;
|
|
|
-
|
|
|
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *leftHeadView;
|
|
|
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *midHeadView;
|
|
|
+@property (nonatomic,strong) uploadFileRecordTableViewHeadView *rightHeadView;
|
|
|
+@property (nonatomic,strong) NSMutableArray *selectModelArr;
|
|
|
@end
|
|
|
|
|
|
@implementation uploadFileRecordBodyView
|
|
|
@@ -23,6 +29,7 @@
|
|
|
_selectIndex = 1;
|
|
|
[self drawAnyView];
|
|
|
|
|
|
+ _selectModelArr = [NSMutableArray new];
|
|
|
return self;
|
|
|
}
|
|
|
|
|
|
@@ -77,12 +84,34 @@
|
|
|
make.width.mas_equalTo(SCREEN_W);
|
|
|
make.top.mas_equalTo(0);
|
|
|
make.height.mas_equalTo(frame.size.height);
|
|
|
+ //make.bottom.mas_equalTo(0);
|
|
|
}];
|
|
|
+
|
|
|
+
|
|
|
+ uploadFileRecordTableViewHeadView *headView = [[uploadFileRecordTableViewHeadView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
|
|
|
+ curTableview.tableHeaderView = headView;
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ headView.didClickButFun = ^{
|
|
|
+ if(headView == self->_midHeadView)
|
|
|
+ {
|
|
|
+ [weakSelf didClickClearRecordInDoneFun];
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ if(i==0){
|
|
|
+ self->_leftHeadView = headView;
|
|
|
+ }
|
|
|
+ else if(i==1){
|
|
|
+ self->_midHeadView = headView;
|
|
|
+ }
|
|
|
+ else if(i==2){
|
|
|
+ self->_rightHeadView = headView;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -127,6 +156,28 @@
|
|
|
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.isEditType = YES;
|
|
|
+ if(self->_didLongPressClick){
|
|
|
+ self->_didLongPressClick();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ cell.didClckSelectBut = ^(BOOL isSelect) {
|
|
|
+ [weakSelf selectModelOneByOne:model BySelect:isSelect];
|
|
|
+ };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -197,6 +248,15 @@
|
|
|
{
|
|
|
_allDataArr = allDataArr;
|
|
|
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ if(self->_allDataArr.count >=3){
|
|
|
+ [self RefresHeadUIFunBy:self->_allDataArr[0] withMidArr:self->_allDataArr[1] withRightArr:self->_allDataArr[2]];
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
mainBlock(^{
|
|
|
//刷新数据
|
|
|
[self reloadAllDataFun];
|
|
|
@@ -243,5 +303,156 @@
|
|
|
[curTabview reloadData];
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ [self RefresHeadUIFunBy:uploadingArr withMidArr:doneArr withRightArr:failArr];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 熟悉头部数据
|
|
|
+-(void)RefresHeadUIFunBy:(NSMutableArray*)letfArr withMidArr:(NSMutableArray*)midArr withRightArr:(NSMutableArray*)rightArr
|
|
|
+{
|
|
|
+
|
|
|
+ if(letfArr){
|
|
|
+ NSString *leftStr = NSLocalizedString(@"File_upload_Record_uploading",nil);
|
|
|
+ NSString *rightStr = NSLocalizedString(@"File_upload_Record_all_suspend",nil);
|
|
|
+ NSString *titleStr = [[NSString alloc] initWithFormat:@"%@ (%ld)",leftStr,letfArr.count];
|
|
|
+
|
|
|
+ _leftHeadView.titleLabel.text = titleStr;
|
|
|
+ [_leftHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ if(letfArr.count == 0){
|
|
|
+ _leftHeadView.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _leftHeadView.hidden = NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(midArr){
|
|
|
+ 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,midArr.count];
|
|
|
+
|
|
|
+ _midHeadView.titleLabel.text = titleStr;
|
|
|
+ [_midHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ if(midArr.count == 0){
|
|
|
+ _midHeadView.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _midHeadView.hidden = NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(rightArr){
|
|
|
+ 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,midArr.count];
|
|
|
+
|
|
|
+ _rightHeadView.titleLabel.text = titleStr;
|
|
|
+ [_rightHeadView.rightButton setTitle:rightStr forState:UIControlStateNormal];
|
|
|
+
|
|
|
+ if(rightArr.count == 0){
|
|
|
+ _rightHeadView.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _rightHeadView.hidden = NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 点击上传中的全部暂停
|
|
|
+
|
|
|
+#pragma mark 点击上传成功的清空记录
|
|
|
+- (void)didClickClearRecordInDoneFun
|
|
|
+{
|
|
|
+ /*弹窗提示二次确认*/
|
|
|
+ KWeakSelf
|
|
|
+ ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"File_upload_Record_clear_Tip_title",nil)
|
|
|
+ msg:NSLocalizedString(@"File_upload_Record_clear_Tip_msg",nil)
|
|
|
+ imageStr:nil
|
|
|
+ cancelTitle:NSLocalizedString(@"other_cancel",nil)
|
|
|
+ okTitle:NSLocalizedString(@"other_comment_ok",nil) isOkBtnHighlight:YES
|
|
|
+ didClickOk:^{
|
|
|
+ [weakSelf ClearAllRecordInDoneFun];
|
|
|
+ } didClickCancel:^{
|
|
|
+
|
|
|
+ }];
|
|
|
+ nextVC.modalPresentationStyle = UIModalPresentationCustom;
|
|
|
+
|
|
|
+ [_curVC presentViewController:nextVC animated:YES completion:^{
|
|
|
+ nextVC.view.superview.backgroundColor = [UIColor clearColor];
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)ClearAllRecordInDoneFun
|
|
|
+{
|
|
|
+ [[uploadFileManager shareInstance] deleteUploadFileRecordBy:_allDataArr[1] complete:^(BOOL isSuccess) {
|
|
|
+ HLog(@"isSuccess:%d",isSuccess);
|
|
|
+
|
|
|
+ if(isSuccess){
|
|
|
+ [self->_allDataArr replaceObjectAtIndex:1 withObject:[NSMutableArray new]];
|
|
|
+ [self reloadAllDataFun];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 点击上传失败的清空记录
|
|
|
+
|
|
|
+
|
|
|
+-(void)setIsEditType:(BOOL)isEditType
|
|
|
+{
|
|
|
+ _isEditType = isEditType;
|
|
|
+
|
|
|
+ if(_isEditType){
|
|
|
+ _bgScrollV.scrollEnabled = NO;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _bgScrollV.scrollEnabled = YES;
|
|
|
+ [_selectModelArr removeAllObjects];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ [self reloadAllDataFun];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 点击全选
|
|
|
+- (void)setIsSelectAllType:(BOOL)isSelectAllType
|
|
|
+{
|
|
|
+ if(isSelectAllType && _allDataArr && _allDataArr.count > (_selectIndex-1)){
|
|
|
+ _selectModelArr = [NSMutableArray arrayWithArray:_allDataArr[_selectIndex-1]];
|
|
|
+ [self reloadAllDataFun];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 单个点击选中 取消
|
|
|
+- (void)selectModelOneByOne:(uploadFileDataModel*)model BySelect:(BOOL)isSelcet
|
|
|
+{
|
|
|
+ if(isSelcet){
|
|
|
+ [_selectModelArr addObject:model];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [_selectModelArr removeObject:model];
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+#pragma mark 单个点击选中后删除
|
|
|
+- (void)deleteModelOneByOneFun{
|
|
|
+ if(!_selectModelArr || _selectModelArr.count==0){
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ [[uploadFileManager shareInstance] deleteUploadFileRecordBy:_selectModelArr complete:^(BOOL isSuccess) {
|
|
|
+ HLog(@"isSuccess:%d",isSuccess);
|
|
|
+
|
|
|
+ if(isSuccess){
|
|
|
+ NSMutableArray *curArr = self->_allDataArr[self->_selectIndex -1];
|
|
|
+ [curArr removeObjectsInArray:self->_selectModelArr];
|
|
|
+ [self reloadAllDataFun];
|
|
|
+ self->_selectModelArr = [NSMutableArray new];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
@end
|