zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
//
//  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 ()<PBDropdownMenuDelegate, ExamineMenuViewDelegate>
@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