// // PBExamineListViewController.m // IphoneBIMe // // Created by zjf on 2018/7/18. // Copyright © 2018年 ProBIM. All rights reserved. // #import "PBExamineListViewController.h" #import "PBDropdownMenu.h" #import "PBExamineSearchController.h" #import "PBNavigationController.h" #import "PBAddExamineViewController.h" #import "PBIssueNavModel.h" #import "PBScreeningView.h" #import "PBRetrieveView1.h" @interface PBExamineListViewController () @property (nonatomic, assign) BOOL isLoadType; @property (nonatomic, weak) PBScreeningView *screeningView; @property (nonatomic, strong) PBRetrieveView1 *menu; @property (nonatomic, strong) NSArray *btnArr; @property (nonatomic, strong) NSArray *labelArr; @property (nonatomic, strong) NSArray *imageArr; @end @implementation PBExamineListViewController - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // NSDictionary *dic = @{NSForegroundColorAttributeName : [UIColor whiteColor], // NSFontAttributeName : [UIFont systemFontOfSize:18 weight:UIFontWeightMedium]}; // if (@available(iOS 15.0, *)) { // UINavigationBarAppearance *barApp = [UINavigationBarAppearance new]; // barApp.backgroundColor = PBColor(35, 36, 41); // barApp.shadowColor = [UIColor blackColor]; // barApp.titleTextAttributes = dic; // self.navigationController.navigationBar.scrollEdgeAppearance = barApp; // self.navigationController.navigationBar.standardAppearance = barApp; // }else { // self.navigationController.navigationBar.barTintColor = PBColor(35, 36, 41); // self.navigationController.navigationBar.titleTextAttributes = dic; // [self.navigationController.navigationBar setShadowImage:[UIImage new]]; // [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; // // } // self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; // //导航栏背景颜色 // [self.navigationController.navigationBar setBarTintColor:PBColor(35, 36, 41)]; // // 去掉导航条下边的线 // self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init]; // //返回按钮颜色 // self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; // for (UIBarButtonItem *item in self.navigationItem.leftBarButtonItems) { // [item setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]} forState:UIControlStateNormal]; // } // for (UIBarButtonItem *item in self.navigationItem.rightBarButtonItems) { // [item setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]} forState:UIControlStateNormal]; // } // [item setTitleTextAttributes:@{NSForegroundColorAttributeName: IndicatedColor} forState:UIControlStateHighlighted]; // [item setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]} forState:UIControlStateDisabled]; //标题颜色 // [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],NSFontAttributeName: [UIFont boldSystemFontOfSize:16]}]; [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault; [self.navigationController setNavigationBarHidden:YES animated:animated]; if (self.isLoadType) { [self.tableView.mj_header beginRefreshing]; } } - (void)viewWillDisappear:(BOOL)animated { [self.navigationController setNavigationBarHidden:NO animated:animated]; } - (void)viewDidLoad { [super viewDidLoad]; [self setupTop]; [self setupSortingView]; [self loadtype]; [self addExamineBtn]; [self setupScreeningV]; } - (void)setupTop { CGFloat topH = 109; CGFloat searchTop = 23.f; if (IS_IPHONE_X) { topH = 109 + 24; searchTop = 23 + 24; } [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view).offset(topH); make.left.right.bottom.equalTo(self.view); }]; UIView *topView = [[UIView alloc] init]; topView.backgroundColor = [UIColor whiteColor]; [self.view addSubview:topView]; [topView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view); make.left.right.equalTo(self.view); make.height.equalTo(@109); }]; UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Examine_search_bd"]]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(searchAction)]; imageV.userInteractionEnabled = YES; [imageV addGestureRecognizer:tap]; [self.view addSubview:imageV]; [imageV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view).offset(searchTop); make.size.mas_equalTo(CGSizeMake(257, 36)); make.centerX.equalTo(self.view); }]; UIButton *leftBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"arrow_left"]]; [leftBtn addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:leftBtn]; [leftBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(imageV); make.left.equalTo(self.view).offset(15); make.size.mas_equalTo(CGSizeMake(24, 24)); }]; UIButton *rightBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"set"]]; [rightBtn addTarget:self action:@selector(setAction) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:rightBtn]; [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(imageV); make.right.equalTo(self.view).offset(-15); make.size.mas_equalTo(CGSizeMake(24, 24)); }]; } - (void)setupSortingView { CGFloat btnW = self.view.width / 3; UIButton *btn = [[UIButton alloc] init]; btn.tag = 600 + 0; [btn addTarget:self action:@selector(sortingAction:) forControlEvents:UIControlEventTouchUpInside]; btn.backgroundColor = [UIColor whiteColor]; [self.view addSubview:btn]; CGFloat btnTop = 69; if (IS_IPHONE_X) { btnTop = 69 + 24; } [btn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.view); make.top.equalTo(self.view).offset(btnTop); make.size.mas_equalTo(CGSizeMake(btnW, 40)); }]; UILabel *btnTitleL = [UILabel z_labelWithText:@"创建时间" Color:PBColor(97, 111, 125) isBold:YES Font:15]; [btn addSubview:btnTitleL]; [btnTitleL mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(64, 18)); make.left.equalTo(btn).offset(30); make.centerY.equalTo(btn); }]; UIImageView *btnIamgeV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"positiveSequence_nor"]]; [btn addSubview:btnIamgeV]; [btnIamgeV mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(14, 14)); make.centerY.equalTo(btn); make.left.equalTo(btnTitleL.mas_right).offset(4); }]; UIButton *btn1 = [[UIButton alloc] init]; btn1.tag = 600 + 1; [btn1 addTarget:self action:@selector(sortingAction:) forControlEvents:UIControlEventTouchUpInside]; btn1.backgroundColor = [UIColor whiteColor]; [self.view addSubview:btn1]; [btn1 mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(btn); make.left.equalTo(btn.mas_right); make.size.mas_equalTo(CGSizeMake(btnW, 40)); }]; UILabel *btn1TitleL = [UILabel z_labelWithText:@"截止时间" Color:PBColor(97, 111, 125) isBold:YES Font:15]; [btn1 addSubview:btn1TitleL]; [btn1TitleL mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(64, 18)); make.left.equalTo(btn1).offset(30); make.centerY.equalTo(btn1); }]; UIImageView *btn1IamgeV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"positiveSequence_nor"]]; [btn1 addSubview:btn1IamgeV]; [btn1IamgeV mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(14, 14)); make.centerY.equalTo(btn1); make.left.equalTo(btn1TitleL.mas_right).offset(4); }]; UIButton *btn2 = [[UIButton alloc] init]; btn2.tag = 600 + 2; [btn2 addTarget:self action:@selector(sortingAction:) forControlEvents:UIControlEventTouchUpInside]; btn2.backgroundColor = [UIColor whiteColor]; [self.view addSubview:btn2]; [btn2 mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(btn); make.left.equalTo(btn1.mas_right); make.size.mas_equalTo(CGSizeMake(btnW, 40)); }]; UILabel *btn2TitleL = [UILabel z_labelWithText:@"状态" Color:PBColor(97, 111, 125) isBold:YES Font:15]; [btn2 addSubview:btn2TitleL]; [btn2TitleL mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(34, 18)); make.left.equalTo(btn2).offset(45); make.centerY.equalTo(btn2); }]; UIImageView *btn2IamgeV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"positiveSequence_nor"]]; [btn2 addSubview:btn2IamgeV]; [btn2IamgeV mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(14, 14)); make.centerY.equalTo(btn2); make.left.equalTo(btn2TitleL.mas_right).offset(4); }]; self.btnArr = @[btn, btn1, btn2]; self.labelArr = @[btnTitleL, btn1TitleL, btn2TitleL]; self.imageArr = @[btnIamgeV, btn1IamgeV, btn2IamgeV]; self.sortingSelect = 1; self.sortingAse = 0; btn1TitleL.textColor = PBColor(0, 122, 255); btn1IamgeV.image = [UIImage imageNamed:@"positiveSequence_select"]; } - (void)sortingAction:(UIButton *)btn { NSInteger index = btn.tag - 600; if (self.sortingSelect == index) { UIImageView *imageV = self.imageArr[index]; if (self.sortingAse == 0) { self.sortingAse = 1; imageV.image = [UIImage imageNamed:@"arrow_select_top"]; }else { self.sortingAse = 0; imageV.image = [UIImage imageNamed:@"positiveSequence_select"]; } }else { self.sortingSelect = index; self.sortingAse = 0; for (NSInteger i = 0; i < self.btnArr.count; i++) { UILabel *label = self.labelArr[i]; UIImageView *imageV = self.imageArr[i]; if (i == index) { label.textColor = PBColor(0, 122, 255); imageV.image = [UIImage imageNamed:@"positiveSequence_select"]; }else { label.textColor = PBColor(97, 111, 125); imageV.image = [UIImage imageNamed:@"positiveSequence_nor"]; } } } [self.tableView.mj_header beginRefreshing]; } - (void)addExamineBtn { UIButton *addExamineBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"new_btn_background"]]; [addExamineBtn addTarget:self action:@selector(addExamineBtnAction) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:addExamineBtn]; [addExamineBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(60, 60)); make.right.equalTo(self.view).offset(-20); make.bottom.equalTo(self.view).offset(-10); }]; } - (void)setupScreeningV { PBScreeningView *screeningView = [[PBScreeningView alloc]initWithFrame:CGRectMake(MainScreenWidth * 0.18, 0, MainScreenWidth * 0.82, MainScreenHeight)]; screeningView.customDelegate = self; screeningView.determineBlock = ^(NSString *related_guid, NSString *level_guid, NSString *state_guid, NSString *type_guid) { self.relatedId = related_guid; self.levelId = level_guid; self.stateId = state_guid; self.typeId = type_guid; [self.menu hidenWithAnimation]; [self.tableView.mj_header beginRefreshing]; }; self.screeningView = screeningView; self.menu = [[PBRetrieveView1 alloc]initWithDependencyView:self.view MenuView:screeningView isShowCoverView:YES]; } - (void)loadtype { self.levelArr = @[@{@"aedt_name":@"非常严重"}, @{@"aedt_name":@"严重"}, @{@"aedt_name":@"一般"}, @{@"aedt_name":@"无"},]; self.stateArr = @[@{@"aedt_name":@"整改"}, @{@"aedt_name":@"合格"}]; [[PBNetworkTools sharedTools] RequestExam_GetExamTypesWithOrganizeId:self.projectModel.organizeid andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) { if (error) { [YJProgressHUD showMessage:@"" inView:self.view]; return; } NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; NSLog(@"%@",str); PBNetworkModel *networkMdoel = [PBNetworkModel yy_modelWithJSON:str]; if (networkMdoel.Ret == 1) { [YJProgressHUD hide]; self.typeArr = networkMdoel.Data; NSMutableArray *arrM = [[NSMutableArray alloc] init]; PBIssueNavModel *issueNavModel = [[PBIssueNavModel alloc] init]; issueNavModel.ItemDetailId = @""; issueNavModel.ItemName = @"类别"; [arrM addObject:issueNavModel]; NSMutableArray *typeArrM = [[NSMutableArray alloc] init]; PBIssueNavModel *issueNavModel1 = [[PBIssueNavModel alloc] init]; issueNavModel1.ItemDetailId = @""; issueNavModel1.ItemName = @"全部"; [typeArrM addObject:issueNavModel1]; for (NSDictionary *obj in self.typeArr) { PBIssueNavModel *issueNavModel = [[PBIssueNavModel alloc] init]; issueNavModel.ItemDetailId = [obj valueForKey:@"aedt_guid"]; issueNavModel.ItemName = [obj valueForKey:@"aedt_name"]; [arrM addObject:issueNavModel]; [typeArrM addObject:issueNavModel]; } self.screeningView.typeArr = typeArrM.copy; // [self.dropdownMenuArrM insertObject:arrM.copy atIndex:1]; // [self setupDropdownMenuView]; self.isLoadType = YES; [self.tableView.mj_header beginRefreshing]; }else { [YJProgressHUD showMessage:networkMdoel.Msg inView:self.view]; } }]; } - (void)setAction { [self.menu show]; } - (void)backItemAction { // [PBNoteCenter postNotificationName: PBNoteCenterDismissTabBarController object:nil]; [self.navigationController popViewControllerAnimated:YES]; } //- (void)addExamine { // PBAddExamineController *addExamineVC = [[PBAddExamineController alloc] init]; // addExamineVC.projectModel = self.projectModel; // addExamineVC.isAddExamine = YES; // addExamineVC.typeArr = self.typeArr; // addExamineVC.levelArr = self.levelArr; // PBNavigationController *nav = [[PBNavigationController alloc] initWithRootViewController:addExamineVC]; // nav.modalPresentationStyle = UIModalPresentationFullScreen; // [self presentViewController:nav animated:YES completion:nil]; //} - (void)addExamineBtnAction { PBAddExamineViewController *addExamineVC = [[PBAddExamineViewController alloc] init]; addExamineVC.projectModel = self.projectModel; addExamineVC.typeArr = self.typeArr; addExamineVC.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:addExamineVC animated:YES]; } //- (void)setupDropdownMenuView { // float dropdownMenuW = MainScreenWidth / 4; // PBDropdownMenu *dropdownMenu = [[PBDropdownMenu alloc] initWithFrame:CGRectMake(0, 0, self.dropdownMenuArrM.count * dropdownMenuW, 40) andArr:self.dropdownMenuArrM]; // dropdownMenu.delegate = self; // [self.view addSubview:dropdownMenu]; // //// UIButton *searchBtn = [[UIButton alloc] init]; //// [searchBtn setImage:[UIImage imageNamed:@"Doc_list_searchItem"] forState:UIControlStateNormal]; //// searchBtn.backgroundColor = [UIColor z_colorWithR:242 G:242 B:242]; //// searchBtn.frame = CGRectMake(dropdownMenuW * self.dropdownMenuArrM.count, 0, dropdownMenuW, 40); //// [searchBtn addTarget:self action:@selector(searchAction) forControlEvents:UIControlEventTouchUpInside]; //// [self.view addSubview:searchBtn]; //} - (void)searchAction { PBExamineSearchController *searchVC = [[PBExamineSearchController alloc] init]; searchVC.projectModel = self.projectModel; searchVC.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:searchVC animated:YES]; } //#pragma mark - PBDropdownMenuDelegate //- (void)dropdownMenu:(UIButton *)clickBtn selectedCellNumber:(NSInteger)number { // NSInteger index = clickBtn.tag -100; // switch (index) { // case 0:{ // self.resultSelectIndex = number; // [self.tableView.mj_header beginRefreshing]; // break; // } // case 1:{ // self.typeSelectIndex = number; // [self.tableView.mj_header beginRefreshing]; // break; // } // case 2:{ // self.levelSelectIndex = number; // [self.tableView.mj_header beginRefreshing]; // break; // } // case 3:{ // self.relatedSelectIndex = number; // [self.tableView.mj_header beginRefreshing]; // break; // } // default: // break; // } //} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end