123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881 |
- //
- // MyApprovalPageVC.m
- // smartRhino
- //
- // Created by tederen on 2019/11/1.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "MyApprovalPageVC.h"
- #import "DrawerView.h"
- #import "WorkListCell.h"
- #import "MyApprovalModel.h"
- #import "MyApprovalBCell.h"
- #import "MyApprovalPageDetail.h"
- #import "WorkFlowSearchVC.h"
- #import "TDNavigationBar.h"
- #import "WorkFLowCollectionSelectView.h"
- #import "TabBarController.h"
- @interface MyApprovalPageVC ()<UITableViewDelegate,UITableViewDataSource,TDNavigationBarDelegate,WorkFLowCollectionSelectViewDelegate>
- @property (nonatomic, strong) TDNavigationBar *myNavigationBar;
- @property (nonatomic, strong) TDTableView *mytableView;
- @property (nonatomic, assign) ApprovalPageSelectType apprvovalType;
- @property (nonatomic, strong) UIView *header1;
- @property (nonatomic, strong) UIView *header2;
- @property (nonatomic, strong) TDButton *waitApprovalButton;
- @property (nonatomic, strong) UIView *waitApprovalButtonBottomLine;
- @property (nonatomic, strong) TDButton *approvalButton;
- @property (nonatomic, strong) UIView *approvalButtonBottomLine;
- @property (nonatomic, strong) TDButton *searchButton;
- @property (nonatomic, strong) TDButton *selectButton;
- @property (nonatomic, strong) NSMutableArray <MyApprovalModel*>*waitApprovalDataArray;
- @property (nonatomic, strong) NSMutableArray <MyApprovalModel*>*approvalDataArray;
- @property (nonatomic, strong) UIView *myBackImageView;
- @property (nonatomic, strong) WorkFLowCollectionSelectView *workFLowCollectionSelectView;
- @property (nonatomic, assign) NSInteger haveRedFlag;
- @property (nonatomic, strong) NSString *approvalTypeStr;
- @property (nonatomic, assign) NSInteger page;
- @property (nonatomic, assign) NSInteger dataCount;
- @property (nonatomic, strong) NSArray<WorkFilterModel *> *selectedMyApprovalModel;
- @property (nonatomic, strong) NSMutableArray<WorkFilterModel *> *selectModelArray;
- @property (nonatomic, strong) DrawerView *drawerView;
- @property (nonatomic, strong) NSMutableArray * selectArray;
- @end
- @implementation MyApprovalPageVC
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
- [self getCount];
- [self headerRefresh];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.myNavigationBar setTitle:self.title];
- [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithBgColor:[UIColor colorWithRed:92/255.0 green:118.0/255.0 blue:167.0/255.f alpha:1.0] alpha:1.0] forBarMetrics:UIBarMetricsDefault];
- [self.view addSubview:self.myBackImageView];
- [self.view addSubview:self.myNavigationBar];
- self.view.backgroundColor = UIColorHex(EEEEEE);
- self.fd_prefersNavigationBarHidden = YES;
- CGFloat listTopSpace = 96 + kNavigationHeight;
- self.apprvovalType = WaitApprovalType;
- // 头部处理
- switch (self.pageType) {
- case Type_ONEA:
- [self myapprovall];
- self.waitApprovalButtonBottomLine.hidden = NO;
- self.approvalButtonBottomLine.hidden = YES;
- self.waitApprovalButton.selected = YES;
- self.approvalButton.selected = NO;
- self.approvalTypeStr = @"MyChecking";
- break;
- case Type_ONEB:
- [self myapprovallB];
- self.haveRedFlag = 1;
- self.approvalTypeStr = @"SubmittedChecked";
- self.waitApprovalButtonBottomLine.hidden = NO;
- self.approvalButtonBottomLine.hidden = YES;
- self.waitApprovalButton.selected = YES;
- self.approvalButton.selected = NO;
- break;
- case Type_ONEC:
- [self myapprovallC];
- self.waitApprovalButtonBottomLine.hidden = NO;
- self.approvalButtonBottomLine.hidden = YES;
- self.waitApprovalButton.selected = YES;
- self.approvalButton.selected = NO;
- self.approvalTypeStr = @"CcUnread";
- break;
- default:
- break;
- }
- // [self getData];
- [self getFilterModelData];
- [self.view addSubview:self.mytableView];
- [self.mytableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view);
- make.right.equalTo(self.view);
- make.top.equalTo(self.view).offset(listTopSpace);
- make.bottom.equalTo(self.view);
- }];
- [self setTableViewRefresh];
- [self addNoDataMessageToViewCenter:self.mytableView message:@"暂无审核内容"];
- self.selectArray = [NSMutableArray array];
- for (NSInteger i = 0; i < 3; i ++) {
- NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithDictionary:@{@"waitTitle":@"筛选",@"Title":@"筛选",@"waitIds":@[],@"ids":@[]}];
- [self.selectArray addObject:dict];
- }
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(headerRefresh) name:WORKREUPDATA object:nil];
- }
- - (void)dealloc
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- - (void)setTableViewRefresh{
- WeakSelf(self)
- self.mytableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- [weakself headerRefresh];
- }];
- self.mytableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
- [weakself footerRefresh];
- }];
- }
- - (void)headerRefresh
- {
- [self.waitApprovalDataArray removeAllObjects];
- [self.approvalDataArray removeAllObjects];
- self.page = 1;
- [self getFromePage:self.page WithType:self.approvalTypeStr];
- }
- - (void)footerRefresh{
- switch (self.apprvovalType) {
- case WaitApprovalType:{
- if (self.waitApprovalDataArray.count == self.dataCount) {
- [self.mytableView.mj_footer endRefreshingWithNoMoreData];
- }else{
- self.page ++;
- [self getFromePage:self.page WithType:self.approvalTypeStr];
- }
- }break;
- case ApprovalType:{
- if (self.approvalDataArray.count == self.dataCount) {
- [self.mytableView.mj_footer endRefreshingWithNoMoreData];
- }else{
- self.page ++;
- [self getFromePage:self.page WithType:self.approvalTypeStr];
- }
- }break;
- }
- }
- #pragma mark - 界面头部异化处理
- - (void)myapprovall{
- self.view.backgroundColor = UIColorHex(EEEEEE);
- [self.view addSubview:self.header1];
- [self.header1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view);
- make.top.equalTo(self.view).offset(kNavigationHeight);
- make.right.equalTo(self.view);
- make.height.mas_equalTo(44);
- }];
-
- [self.view addSubview:self.header2];
- [self.header2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view);
- make.top.equalTo(self.header1.mas_bottom).offset(9);
- make.right.equalTo(self.view);
- make.height.mas_equalTo(32);
- }];
- }
- - (void)myapprovallB{
- self.view.backgroundColor = UIColorHex(EEEEEE);
- [self.view addSubview:self.header1];
- [self.header1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view);
- make.top.equalTo(self.view).offset(kNavigationHeight);
- make.right.equalTo(self.view);
- make.height.mas_equalTo(44);
- }];
-
- [self.view addSubview:self.header2];
- [self.header2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view);
- make.top.equalTo(self.header1.mas_bottom).offset(9);
- make.right.equalTo(self.view);
- make.height.mas_equalTo(32);
- }];
-
- }
- - (void)myapprovallC{
- self.view.backgroundColor = UIColorHex(EEEEEE);
- [self.view addSubview:self.header1];
- [self.header1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view);
- make.top.equalTo(self.view).offset(kNavigationHeight);
- make.right.equalTo(self.view);
- make.height.mas_equalTo(44);
- }];
- [self.waitApprovalButton setTitle:@"未读" forState:UIControlStateNormal];
- [self.approvalButton setTitle:@"己读" forState:UIControlStateNormal];
-
-
- [self.view addSubview:self.header2];
- [self.header2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.view);
- make.top.equalTo(self.header1.mas_bottom).offset(9);
- make.right.equalTo(self.view);
- make.height.mas_equalTo(32);
- }];
- }
- #pragma mark - 导航栏事件处理
- - (void)backButtonAction{
- [self back];
- }
- - (void)rightButtonAction:(TDButton *)sender{
-
- }
- -(void)back{
- if (self.navigationController.viewControllers.count > 1) {
- [self.navigationController popViewControllerAnimated:YES];
- }else{
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- }
- - (void)backButtonAction2:(UIButton *)sender {
- [self secondBarButtonItems];
- }
- - (void)secondBarButtonItems{
- [self.view endEditing:YES];
- [[UtilsTools getWindow] addSubview:self.drawerView];
- WS(weakSelf);
- self.drawerView.SelectDrawerBlock = ^(NSIndexPath * _Nonnull indexPath) {
- if ([weakSelf.navigationController.viewControllers count] > 1) {
- [weakSelf.navigationController popToRootViewControllerAnimated:NO];
- }
- if (indexPath.section == 0) {
- [[TabBarController sharedTabBarController] setSelectedIndex:indexPath.row];
- }else{
- ///@"站内信", @"通知", @"收藏",@"笔记", @"设置"
- switch (indexPath.row) {
- case 0:
- {
- [[TabBarController sharedTabBarController] setSelectedIndex:2];
- }
- break;
- case 1:
- {
- [[TabBarController sharedTabBarController] setSelectedIndex:2];
- }
- break;
- default:
- {
- [[TabBarController sharedTabBarController] setSelectedIndex:3];
- }
- break;
- }
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:DRAWERPUSHVC object:nil userInfo:@{VCINDEX:@(indexPath.row)}];
- });
- }
- };
- self.drawerView.frame = CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT);
- }
- - (void)viewWillDisappear:(BOOL)animated{
- [super viewWillDisappear:animated];
- [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
- }
- - (UIStatusBarStyle)preferredStatusBarStyle{
- return UIStatusBarStyleLightContent;
- }
- #pragma mark - 数据加载
- - (void)setCountNumWithDict:(NSDictionary *)dict
- {
- switch (self.pageType) {
- case Type_ONEA:
- if ([dict[@"MyCheckingCount"] integerValue] == 0) {
- [self.waitApprovalButton setTitle:@"待审批" forState:UIControlStateNormal];
- }else{
- [self.waitApprovalButton setTitle:[NSString stringWithFormat:@"待审批(%ld)",(long)[dict[@"MyCheckingCount"] integerValue]] forState:UIControlStateNormal];
- }
- if ([dict[@"MyCheckedCount"] integerValue] == 0) {
- [self.approvalButton setTitle:@"已审批" forState:UIControlStateNormal];
- }else{
- [self.approvalButton setTitle:[NSString stringWithFormat:@"已审批(%ld)",(long)[dict[@"MyCheckedCount"] integerValue]] forState:UIControlStateNormal];
- }
- break;
- case Type_ONEB:
- if ([dict[@"SubmittedCheckingCount"] integerValue] > 0) {
- [self.approvalButton setTitle:[NSString stringWithFormat:@"待批复(%ld)",(long)[dict[@"SubmittedCheckingCount"] integerValue]] forState:UIControlStateNormal];
- }else {
- [self.approvalButton setTitle:@"待批复" forState:UIControlStateNormal];
- }
- if ([dict[@"SubmittedCheckedCount"] integerValue] > 0) {
- [self.waitApprovalButton setTitle:[NSString stringWithFormat:@"已批复(%ld)",(long)[dict[@"SubmittedCheckedCount"] integerValue]] forState:UIControlStateNormal];
- }else {
- [self.waitApprovalButton setTitle:@"已批复" forState:UIControlStateNormal];
- }
- break;
- case Type_ONEC:
- if ([dict[@"CcUnreadCount"] integerValue] > 0) {
- [self.waitApprovalButton setTitle:[NSString stringWithFormat:@"未读(%ld)",(long)[dict[@"CcUnreadCount"] integerValue]] forState:UIControlStateNormal];
- }else {
- [self.waitApprovalButton setTitle:@"未读" forState:UIControlStateNormal];
- }
- if ([dict[@"CcAllCount"] integerValue] > 0) {
- [self.approvalButton setTitle:[NSString stringWithFormat:@"已读(%ld)",(long)[dict[@"CcAllCount"] integerValue]] forState:UIControlStateNormal];
- }else {
- [self.approvalButton setTitle:@"已读" forState:UIControlStateNormal];
- }
- break;
- default:
- break;
- }
- }
- - (void)getCount
- {
- WS(weakSelf);
- [[HttpManager sharedHttpManager] GETUrl:Host(WorkFlowNumberCount_Get) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf setCountNumWithDict:responseObject];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- //- (void)getData{
- // [self getFromMe];
- // [self getFilterModelData];
- //}
- //- (void)getFromMe{
- // if ([self.approvalTypeStr isEqualToString:@"MyChecking"]) {
- // [self getFromePage:1 WithType:self.approvalTypeStr];
- // }
- // if ([self.approvalTypeStr isEqualToString:@"SubmittedChecked"]) {
- // [self getFromePage:1 WithType:self.approvalTypeStr];
- // }
- // if ([self.approvalTypeStr isEqualToString:@"CcUnread"]) {
- // [self getFromePage:1 WithType:self.approvalTypeStr];
- // }
- //}
- - (void)getFromePage:(NSInteger)page WithType:(NSString *)type{
- NSArray * ids = @[];
- switch (self.pageType) {
- case Type_ONEA:{
- NSMutableDictionary * dict = self.selectArray[0];
- if (self.apprvovalType == WaitApprovalType) {
- ids = dict[@"waitIds"];
- }else{
- ids = dict[@"ids"];
- }
- }break;
- case Type_ONEB: {
- NSMutableDictionary * dict = self.selectArray[1];
- if (self.apprvovalType == WaitApprovalType) {
- ids = dict[@"waitIds"];
- }else{
- ids = dict[@"ids"];
- }
- }break;
- case Type_ONEC:{
- NSMutableDictionary * dict = self.selectArray[2];
- if (self.apprvovalType == WaitApprovalType) {
- ids = dict[@"waitIds"];
- }else{
- ids = dict[@"ids"];
- }
- }break;
- default:
- break;
- }
- NSLog(@"=======%@",type);
- NSLog(@"%@",ids);
- WS(weakSelf);
- //原来的接口WorkFlowAddApproval_Post
- [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,@"/api/app/flow/list"] parameters:@{@"PerPage":@(10),
- @"Page":@(page),
- @"Type":type,
- @"ProcessIds":ids} responseStyle:JOSN
- success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- if (weakSelf.page == 1) {
- [weakSelf.waitApprovalDataArray removeAllObjects];
- [weakSelf.approvalDataArray removeAllObjects];
- }
- NSDictionary *dic = responseObject;
- weakSelf.dataCount = [dic[@"Count"] integerValue];
- id arr = dic[@"Items"];
- NSMutableArray *array = [NSMutableArray array];
- if (arr != [NSNull null]) {
- for (NSDictionary *dic2 in arr) {
- MyApprovalModel *model = [[MyApprovalModel alloc]initWithDictionary:dic2 error:nil];
- [array addObject:model];
- }
- }
- switch (weakSelf.apprvovalType) {
- case WaitApprovalType:{
- [weakSelf.waitApprovalDataArray addObjectsFromArray:array];
- }break;
- case ApprovalType:{
- [weakSelf.approvalDataArray addObjectsFromArray:array];
- }break;
- }
- [weakSelf.mytableView.mj_header endRefreshing];
- [weakSelf.mytableView.mj_footer endRefreshing];
- [weakSelf changeMessageStatusWithNumber:array.count];
- [weakSelf.mytableView reloadData];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }
- - (NSMutableArray<WorkFilterModel *>*)selectModelArray
- {
- if (!_selectModelArray) {
- _selectModelArray = [NSMutableArray array];
- }
- return _selectModelArray;
- }
- - (void)getFilterModelData{
- WS(weakSelf);
- [self.selectModelArray removeAllObjects];
- [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowFilter_Get] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSArray *arr = responseObject;
- for (NSDictionary *dic in arr) {
- WorkFilterModel *model = [[WorkFilterModel alloc]initWithDictionary:dic error:nil];
- [weakSelf.selectModelArray addObject:model];
- }
- weakSelf.workFLowCollectionSelectView.approvalNameArray = weakSelf.selectModelArray;
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.workFLowCollectionSelectView.collectionView reloadData] ;
- });
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- #pragma mark -
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- switch (self.apprvovalType) {
- case WaitApprovalType:
- return self.waitApprovalDataArray.count;
- case ApprovalType:
- return self.approvalDataArray.count;
- }
-
- return 5;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- MyApprovalModel *model;
- switch (self.apprvovalType) {
- case WaitApprovalType:
- model = self.waitApprovalDataArray[indexPath.row];
- break;
- case ApprovalType:
- model = self.approvalDataArray[indexPath.row];
- break;
- }
-
- NSString *cellIdentifier = @"MyApprovalBCell";
- MyApprovalBCell *cell = (MyApprovalBCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
- [cell loadApprovalData:model];
- // if ([self.approvalTypeStr isEqualToString:@"MyChecking"] ||
- // [self.approvalTypeStr isEqualToString:@"SubmittedChecked"] ||
- // [self.approvalTypeStr isEqualToString:@"CcUnread"] ||
- // [self.approvalTypeStr isEqualToString:@"SubmittedChecking"] ) {
- // cell.falgLab.hidden = model.IsRead;
- // }else {
- // cell.falgLab.hidden = YES;
- // }
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 159.f;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- MyApprovalModel *model;
- switch (self.apprvovalType) {
-
- case WaitApprovalType:
- model = self.waitApprovalDataArray[indexPath.row];
- break;
-
- case ApprovalType:
- model = self.approvalDataArray[indexPath.row];
- break;
-
- }
- if (model.Id > 0) {
- MyApprovalPageDetail * myApprovalPageDetail = [[MyApprovalPageDetail alloc]init];
- myApprovalPageDetail.pageType = self.pageType;
- myApprovalPageDetail.indexId = model.Id;
- myApprovalPageDetail.title = model.Title;
- myApprovalPageDetail.TodoId = model.TodoId;
- myApprovalPageDetail.userId = model.UserId;
- WS(weakSelf);
- [myApprovalPageDetail setActionSussBlock:^{
- //重新获取数据
- [weakSelf headerRefresh];
- }];
- [self.navigationController pushViewController:myApprovalPageDetail animated:YES];
- }
- }
- #pragma mark - setter
- - (TDTableView *)mytableView{
- if (!_mytableView) {
- _mytableView = [[TDTableView alloc]init];
- _mytableView.backgroundColor = [UIColor clearColor];
- _mytableView.delegate = self;
- _mytableView.dataSource = self;
- [_mytableView registerNib:[UINib nibWithNibName:@"MyApprovalBCell" bundle:nil] forCellReuseIdentifier:@"MyApprovalBCell"];
- }
- return _mytableView;
- }
- - (UIView *)header1{
- if (!_header1) {
- _header1 = [[UIView alloc]init];
- _header1.backgroundColor = [UIColor whiteColor];
- [_header1 addSubview:self.waitApprovalButton];
- [self.waitApprovalButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.header1.mas_centerX).multipliedBy(0.5);
- make.centerY.equalTo(self.header1.mas_centerY);
- }];
-
- [_header1 addSubview:self.waitApprovalButtonBottomLine];
-
- [self.waitApprovalButtonBottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.waitApprovalButton.mas_centerX);
- make.bottom.equalTo(self.header1.mas_bottom).offset(-1);
- make.width.equalTo(self.waitApprovalButton);
- make.height.mas_equalTo(2);
-
- }];
- self.waitApprovalButtonBottomLine.backgroundColor = UIColorHex(3795FD);
-
- [_header1 addSubview:self.approvalButton];
- [self.approvalButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.header1.mas_centerX).multipliedBy(1.5);
- make.centerY.equalTo(self.header1.mas_centerY);
- }];
-
- [_header1 addSubview:self.approvalButtonBottomLine];
- [self.approvalButtonBottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.approvalButton.mas_centerX);
- make.bottom.equalTo(self.header1.mas_bottom).offset(-1);
- make.bottom.equalTo(@10);
- make.width.equalTo(self.approvalButton);
- make.height.mas_equalTo(2);
- }];
- self.approvalButtonBottomLine.backgroundColor = UIColorHex(3795FD);
- }
- return _header1;
- }
- - (UIView *)approvalButtonBottomLine{
- if (!_approvalButtonBottomLine) {
- _approvalButtonBottomLine = [[UIView alloc]init];
- }
- return _approvalButtonBottomLine;
- }
- - (UIView *)waitApprovalButtonBottomLine{
- if (!_waitApprovalButtonBottomLine) {
- _waitApprovalButtonBottomLine = [UIView new];
- }
- return _waitApprovalButtonBottomLine;
- }
- - (TDButton *)waitApprovalButton{
- if (!_waitApprovalButton) {
- _waitApprovalButton = [[TDButton alloc]init];
- [_waitApprovalButton setTitle:@"待审批" forState:UIControlStateNormal];
- [_waitApprovalButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_waitApprovalButton titleLabel] setFont:[UIFont systemFontOfSize:15.f]];
- [_waitApprovalButton setTitleColor:UIColorHex(3795FD) forState:UIControlStateSelected];
- [_waitApprovalButton addTarget:self action:@selector(waitApprovalButtonHander:) forControlEvents:UIControlEventTouchDown];
- }
- return _waitApprovalButton;
- }
- - (TDButton *)approvalButton{
- if (!_approvalButton) {
- _approvalButton =[[TDButton alloc] init];
- [_approvalButton setTitle:@"已审批" forState:UIControlStateNormal];
- [_approvalButton setTitleColor:UIColorHex(333333) forState:UIControlStateNormal];
- [[_approvalButton titleLabel] setFont:[UIFont systemFontOfSize:15.f]];
- [_approvalButton setTitleColor:UIColorHex(3795FD) forState:UIControlStateSelected];
- [_approvalButton addTarget:self action:@selector(approvalButtonHander:) forControlEvents:UIControlEventTouchDown];
- }
- return _approvalButton;
- }
- - (UIView *)header2{
- if (!_header2) {
- _header2 = [[UIView alloc] init];
- _header2.backgroundColor = [UIColor whiteColor];
- [_header2 addSubview:self.searchButton];
- [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.header2.mas_centerX).multipliedBy(0.5);
- make.centerY.equalTo(self.header2.mas_centerY);
- make.width.mas_equalTo(self.header2.mas_width).multipliedBy(0.25);
- make.height.mas_equalTo(self.header2.mas_height);
- }];
-
- UIView *verticalView = [[UIView alloc]init];
- verticalView.backgroundColor = UIColorHex(E6E6E6);
- [_header2 addSubview:verticalView];
- [verticalView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.header2);
- make.centerY.equalTo(self.header2);
- make.width.mas_equalTo(0.5);
- make.height.equalTo(self.header2.mas_height).multipliedBy(0.7);
- }];
-
-
- [_header2 addSubview:self.selectButton];
- [self.selectButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.header2.mas_centerX).multipliedBy(1.5);
- make.centerY.equalTo(self.header2.mas_centerY);
- make.width.mas_equalTo(self.header2.mas_width).multipliedBy(0.25);
- make.height.mas_equalTo(self.header2.mas_height);
- }];
- }
- return _header2;
- }
- - (TDButton *)searchButton{
- if (!_searchButton) {
- _searchButton = [[TDButton alloc] init];
- [_searchButton setTitle:@"搜索" forState:UIControlStateNormal];
- [_searchButton addTarget:self action:@selector(searchApprovalButtonHander) forControlEvents:UIControlEventTouchDown];
- [_searchButton setImage:IMG(@"approval_sousuo") forState:UIControlStateNormal];
- // [[_searchButton imageView] setSize:CGSizeMake(14.f, 14.f)];
- [_searchButton setTitleColor:UIColorHex(666666) forState:UIControlStateNormal];
- [[_searchButton titleLabel] setFont:[UIFont systemFontOfSize:14.f weight:UIFontWeightRegular]];
- [_searchButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleLeft imageTitleSpace:6.5];
- }
- return _searchButton;
- }
- - (TDButton *)selectButton{
- if (!_selectButton) {
- _selectButton = [[TDButton alloc] init];
- [_selectButton setTitle:@"筛选" forState:UIControlStateNormal];
- [_selectButton setImage:IMG(@"筛选") forState:UIControlStateNormal];
- [_selectButton setTitleColor:UIColorHex(666666) forState:UIControlStateNormal];
- [[_selectButton titleLabel] setFont:[UIFont systemFontOfSize:14.f weight:UIFontWeightRegular]];
- // [[_selectButton imageView] setSize:CGSizeMake(14.f, 14.f)];
- [_selectButton addTarget:self action:@selector(selectButtonHander) forControlEvents:UIControlEventTouchDown];
- [_selectButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleLeft imageTitleSpace:6.5];
- }
- return _selectButton;
- }
- - (NSMutableArray <MyApprovalModel *>*)approvalDataArray{
- if (!_approvalDataArray) {
- _approvalDataArray = [NSMutableArray array];
- }
- return _approvalDataArray;
-
- }
- - (NSMutableArray <MyApprovalModel *>*)waitApprovalDataArray{
- if (!_waitApprovalDataArray) {
- _waitApprovalDataArray = [NSMutableArray array];
- }
- return _waitApprovalDataArray;
- }
- #pragma mark - 已审批事件处理
- - (void)approvalButtonHander:(TDButton *)approvalButton{
- self.approvalButton.selected = YES;
- self.waitApprovalButton.selected = NO;
- self.approvalButtonBottomLine.hidden = NO;
- self.waitApprovalButtonBottomLine.hidden = YES;
- self.apprvovalType = ApprovalType;
- switch (self.pageType) {
- case Type_ONEA:{
- self.approvalTypeStr = @"MyChecked";
- NSMutableDictionary * dict = self.selectArray[0];
- [self.selectButton setTitle:dict[@"Title"] forState:UIControlStateNormal];
- }break;
- case Type_ONEB: {
- self.approvalTypeStr = @"SubmittedChecking";
- NSMutableDictionary * dict = self.selectArray[1];
- [self.selectButton setTitle:dict[@"Title"] forState:UIControlStateNormal];
- }break;
- case Type_ONEC:{
- self.approvalTypeStr = @"CcAll";
- NSMutableDictionary * dict = self.selectArray[2];
- [self.selectButton setTitle:dict[@"Title"] forState:UIControlStateNormal];
- }break;
- default:
- break;
- }
- [self headerRefresh];
- [self.mytableView reloadData];
- }
- #pragma mark - 待审批事件处理
- - (void)waitApprovalButtonHander:(TDButton *)waitApprovalButton{
- self.approvalButton.selected = NO;
- self.waitApprovalButton.selected = YES;
- self.approvalButtonBottomLine.hidden = YES;
- self.waitApprovalButtonBottomLine.hidden = NO;
- self.apprvovalType = WaitApprovalType;
- switch (self.pageType) {
- case Type_ONEA:{
- self.approvalTypeStr = @"MyChecking";
- NSMutableDictionary * dict = self.selectArray[0];
- [self.selectButton setTitle:dict[@"waitTitle"] forState:UIControlStateNormal];
- }break;
- case Type_ONEB:{
- self.approvalTypeStr = @"SubmittedChecked";
- NSMutableDictionary * dict = self.selectArray[1];
- [self.selectButton setTitle:dict[@"waitTitle"] forState:UIControlStateNormal];
- }break;
- case Type_ONEC:{
- self.approvalTypeStr = @"CcUnread";
- NSMutableDictionary * dict = self.selectArray[2];
- [self.selectButton setTitle:dict[@"waitTitle"] forState:UIControlStateNormal];
- }break;
- default:
- break;
- }
- [self headerRefresh];
- [self.mytableView reloadData];
- }
- #pragma mark - 搜索事件处理
- - (void)searchApprovalButtonHander{
- WorkFlowSearchVC *workFlowSearchVC = [[WorkFlowSearchVC alloc]init];
- workFlowSearchVC.typeString = self.approvalTypeStr;
- workFlowSearchVC.apprvovalType = self.apprvovalType;
- workFlowSearchVC.pageType = self.pageType;
- [self.navigationController pushViewController:workFlowSearchVC animated:YES];
- }
- #pragma mark - 筛选事件处理
- - (void)selectButtonHander{
- if(self.workFLowCollectionSelectView != nil){
- NSMutableDictionary * dict = nil;
- switch (self.pageType) {
- case Type_ONEA:{
- dict = self.selectArray[0];
- }break;
- case Type_ONEB:{
- dict = self.selectArray[1];
- }break;
- case Type_ONEC:{
- dict = self.selectArray[2];
- }break;
- default:
- break;
- }
- for (WorkFilterModel * model in self.selectModelArray) {
- model.isSelected = NO;
- }
- if (self.apprvovalType == WaitApprovalType) {
- for (id obj in dict[@"waitIds"]) {
- NSInteger ids = [obj integerValue];
- for (WorkFilterModel * model in self.selectModelArray) {
- if (model.Value == ids) {
- model.isSelected = YES;
- }
- }
- self.workFLowCollectionSelectView.approvalNameArray = self.selectModelArray.mutableCopy;
- }
- }else{
- for (id obj in dict[@"ids"]) {
- NSInteger ids = [obj integerValue];
- for (WorkFilterModel * model in self.selectModelArray) {
- if (model.Value == ids) {
- model.isSelected = YES;
- }
- }
- self.workFLowCollectionSelectView.approvalNameArray = self.selectModelArray.mutableCopy;
- }
- }
- [self.workFLowCollectionSelectView collectionViewReloadData];
- }
- }
- - (void)selecetWorkFLow:(NSIndexPath *)path withModel:(NSArray<WorkFilterModel *> *)modle {
- NSLog(@"%@",self.workFLowCollectionSelectView.approvalNameArray[path.item]);
- self.selectedMyApprovalModel = modle;
- NSMutableString *labelStr = [[NSMutableString alloc] initWithString:@""];
- NSMutableArray *ids = [NSMutableArray array];
- [modle enumerateObjectsUsingBlock:^(WorkFilterModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
- WorkFilterModel *filterModel = obj;
- if ((idx + 1) < modle.count) {
- [labelStr appendFormat:@"%@,",filterModel.Label];
- }else {
- [labelStr appendFormat:@"%@",filterModel.Label];
- }
- [ids addObject:@(filterModel.Value)];
- }];
- [self.selectButton setTitle:labelStr forState:UIControlStateNormal];
- switch (self.pageType) {
- case Type_ONEA:
- {
- NSMutableDictionary * dict = self.selectArray[0];
- if (self.apprvovalType == WaitApprovalType) {
- [dict setObject:labelStr forKey:@"waitTitle"];
- [dict setObject:ids forKey:@"waitIds"];
- }else{
- [dict setObject:labelStr forKey:@"Title"];
- [dict setObject:ids forKey:@"ids"];
- }
- }
- break;
- case Type_ONEB:
- {
- NSMutableDictionary * dict = self.selectArray[1];
- if (self.apprvovalType == WaitApprovalType) {
- [dict setObject:labelStr forKey:@"waitTitle"];
- [dict setObject:ids forKey:@"waitIds"];
- }else{
- [dict setObject:labelStr forKey:@"Title"];
- [dict setObject:ids forKey:@"ids"];
- }
- }
- break;
- case Type_ONEC:
- {
- NSMutableDictionary * dict = self.selectArray[2];
- if (self.apprvovalType == WaitApprovalType) {
- [dict setObject:labelStr forKey:@"waitTitle"];
- [dict setObject:ids forKey:@"waitIds"];
- }else{
- [dict setObject:labelStr forKey:@"Title"];
- [dict setObject:ids forKey:@"ids"];
- }
- }
- break;
- default:
- break;
- }
- [self headerRefresh];
- }
- - (TDNavigationBar *)myNavigationBar{
- if (!_myNavigationBar) {
- _myNavigationBar = [[TDNavigationBar alloc]initNavigationBar];
- _myNavigationBar.delegate = self;
- _myNavigationBar.backButton2.hidden = NO;
- _myNavigationBar.titleLabel.textColor = UIColorHex(#FFFFFF);
- _myNavigationBar.titleLabel.font = [UIFont systemFontOfSize:19.f];
- [_myNavigationBar.backButton2 setImage:IMG(@"快捷跳转") forState:UIControlStateNormal];
- [_myNavigationBar.backButton setImage:IMG(@"工作_返回") forState:UIControlStateNormal];
- }
- return _myNavigationBar;
- }
- - (UIView *)myBackImageView{
- if (!_myBackImageView) {
- _myBackImageView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kGXScreenHeigh, kNavigationHeight)];
- _myBackImageView.backgroundColor = [UIColor colorWithRed:92/255.0 green:118.0/255.0 blue:167.0/255.f alpha:1.0];
- }
- return _myBackImageView;
- }
- - (WorkFLowCollectionSelectView *)workFLowCollectionSelectView{
- if(!_workFLowCollectionSelectView){
- _workFLowCollectionSelectView = [[WorkFLowCollectionSelectView alloc] init];
- _workFLowCollectionSelectView.delegate = self;
- }
- return _workFLowCollectionSelectView;
- }
- - (DrawerView *)drawerView {
- if(!_drawerView) {
- _drawerView = [[DrawerView alloc] init];
- }
- return _drawerView;
- }
- @end
|