//
|
// PBScheduleListViewController.m
|
// IphoneBIMe
|
//
|
// Created by ZhangJF on 2022/8/18.
|
// Copyright © 2022 ProBIM. All rights reserved.
|
//
|
|
#import "PBScheduleListViewController.h"
|
#import "PBDropdownMenu.h"
|
#import "PBIssueSearchController.h"
|
#import "PBNavigationController.h"
|
#import "PBSchedulePlanViewController.h"
|
#import "PBProjectPower.h"
|
#import "PBSchedulePlanModel.h"
|
#define IssueModuleName @"IssueTracking"
|
|
@interface PBScheduleListViewController ()<PBDropdownMenuDelegate>
|
@property (nonatomic, strong) NSArray *archiveArr;
|
@property (nonatomic, strong) NSArray *statusArr;
|
@end
|
|
@implementation PBScheduleListViewController
|
|
- (void)viewWillAppear:(BOOL)animated {
|
[super viewWillAppear:animated];
|
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
|
[self.tableView.mj_header beginRefreshing];
|
}
|
- (void)viewDidLoad {
|
[super viewDidLoad];
|
[self setupNav];
|
// for (PBProjectPower *power in self.powerArr) {
|
// if ([power.Bm_EnCode isEqualToString:IssueModuleName]) {
|
// if ([power.checkstate isEqualToString:@"1"]) {
|
// //有权限
|
// self.promptView.hidden = YES;
|
[self loadTypeAndStatus];
|
[self.tableView.mj_header beginRefreshing];
|
// for (NSDictionary *obj in power.Bmbs) {
|
// if ([[obj valueForKey:@"Bmb_FullName"] isEqualToString:@"新增问题"]) {
|
// if ([[obj valueForKey:@"checkstate"] isEqualToString:@"1"]) {
|
// self.navigationItem.rightBarButtonItem.enabled = YES;
|
// }
|
// }
|
// }
|
// return;
|
// }else {
|
// //无权限
|
// self.promptView.textL.text = @"暂无权限";
|
// self.promptView.hidden = NO;
|
// return;
|
// }
|
// }
|
// }
|
// //无权限
|
// self.promptView.textL.text = @"暂无权限";
|
// self.promptView.hidden = NO;
|
}
|
#pragma mark - PBDropdownMenuDelegate
|
- (void)dropdownMenu:(UIButton *)clickBtn selectedCellNumber:(NSInteger)number {
|
NSInteger index = clickBtn.tag -100;
|
switch (index) {
|
case 0:
|
self.statusSelectIndex = number;
|
[self.tableView.mj_header beginRefreshing];
|
break;
|
case 1:
|
self.archiveSelectIndex = number;
|
[self.tableView.mj_header beginRefreshing];
|
break;
|
default:
|
break;
|
}
|
}
|
|
- (void)loadTypeAndStatus {
|
[[PBNetworkTools sharedTools] GetSchedualTreeWithOrganizeId:self.projectModel.bimcomposerid andUid:@"" andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) {
|
if (error) {
|
NSLog(@"%@",error);
|
[YJProgressHUD showMessage:@"加载失败" inView:self.view];
|
return;
|
}
|
NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str];
|
if (networkModel.Ret == 1) {
|
[YJProgressHUD hide];
|
NSMutableArray *planArrM = [[NSMutableArray alloc] init];
|
for (NSDictionary *obj in networkModel.Data) {
|
PBSchedulePlanModel *model = [PBSchedulePlanModel yy_modelWithDictionary:obj];
|
PBIssueNavModel *navModel = [[PBIssueNavModel alloc] init];
|
navModel.ItemName = model.Name;
|
navModel.ItemDetailId = model.UID;
|
[planArrM addObject:navModel];
|
}
|
PBIssueNavModel *typeNavModel = [[PBIssueNavModel alloc] init];
|
typeNavModel.ItemDetailId = @"";
|
typeNavModel.ItemName = @"全部计划";
|
[planArrM insertObject:typeNavModel atIndex:0];
|
self.archiveArr = planArrM.copy;
|
// [self.dropdownMenuArrM addObject:self.statusArr];
|
[self.dropdownMenuArrM addObject:self.archiveArr];
|
[self setupDropdownMenuView];
|
[self.tableView.mj_header beginRefreshing];
|
|
}else {
|
[YJProgressHUD showMessage:networkModel.Msg inView:self.view];
|
}
|
}];
|
|
}
|
- (void)setupDropdownMenuView {
|
float dropdownMenuW = MainScreenWidth / self.dropdownMenuArrM.count;
|
PBDropdownMenu *dropdownMenu = [[PBDropdownMenu alloc] initWithFrame:CGRectMake(0, 0, self.dropdownMenuArrM.count * dropdownMenuW, 40) andArr:self.dropdownMenuArrM];
|
dropdownMenu.delegate = self;
|
[self.view addSubview:dropdownMenu];
|
}
|
|
- (void)setupNav {
|
self.title = self.projectModel.fullname;
|
PBBackNavItem *backNav = [PBBackNavItem backNacItem];
|
backNav.title = @" ";
|
[backNav addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside];
|
UIBarButtonItem *backNavItem = [[UIBarButtonItem alloc] initWithCustomView:backNav];
|
self.navigationItem.leftBarButtonItem = backNavItem;
|
UIBarButtonItem *addIssueItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Issue_list_add"] style:UIBarButtonItemStylePlain target:self action:@selector(addSchedule)];
|
self.navigationItem.rightBarButtonItem = addIssueItem;
|
}
|
- (void)addSchedule {
|
PBSchedulePlanViewController *schedulePlanVC = [[PBSchedulePlanViewController alloc] init];
|
schedulePlanVC.projectModel = self.projectModel;
|
schedulePlanVC.SaveSuccessBlock = ^{
|
[self.tableView.mj_header beginRefreshing];
|
};
|
[self.navigationController pushViewController:schedulePlanVC animated:YES];
|
}
|
- (void)backItemAction {
|
// [PBNoteCenter postNotificationName: PBNoteCenterDismissTabBarController object:nil];
|
[self.navigationController popViewControllerAnimated:YES];
|
}
|
|
- (NSArray *)archiveArr {
|
if (_archiveArr == nil) {
|
PBIssueNavModel *issueNavModel = [[PBIssueNavModel alloc] init];
|
issueNavModel.ItemDetailId = @"";
|
issueNavModel.ItemName = @"计划";
|
_archiveArr = @[issueNavModel];
|
}
|
return _archiveArr;
|
}
|
- (NSArray *)statusArr {
|
if (_statusArr == nil) {
|
PBIssueNavModel *issueNavModel = [[PBIssueNavModel alloc] init];
|
issueNavModel.ItemDetailId = @"";
|
issueNavModel.ItemName = @"全部状态";
|
|
PBIssueNavModel *issueNavModel1 = [[PBIssueNavModel alloc] init];
|
issueNavModel1.ItemDetailId = @"待提交";
|
issueNavModel1.ItemName = @"待提交";
|
|
PBIssueNavModel *issueNavModel2 = [[PBIssueNavModel alloc] init];
|
issueNavModel2.ItemDetailId = @"待审核";
|
issueNavModel2.ItemName = @"待审核";
|
|
PBIssueNavModel *issueNavModel3 = [[PBIssueNavModel alloc] init];
|
issueNavModel3.ItemDetailId = @"驳回待提交";
|
issueNavModel3.ItemName = @"驳回待提交";
|
|
PBIssueNavModel *issueNavModel4 = [[PBIssueNavModel alloc] init];
|
issueNavModel4.ItemDetailId = @"已审核";
|
issueNavModel4.ItemName = @"已审核";
|
|
_statusArr = @[issueNavModel, issueNavModel1, issueNavModel2, issueNavModel3, issueNavModel4];
|
}
|
return _statusArr;
|
}
|
- (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
|