Skip to content

Commit 732d8d8

Browse files
committed
添加一级选择查找
1 parent 973a1e1 commit 732d8d8

File tree

6 files changed

+47
-18
lines changed

6 files changed

+47
-18
lines changed

Coding_iOS/Controllers/RootControllers/MyTask_RootViewController.m

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ @interface MyTask_RootViewController ()
3131
@property (nonatomic, strong) NSString *status; //任务状态,进行中的为1,已完成的为2
3232
@property (nonatomic, strong) NSString *label; //任务标签
3333
@property (nonatomic, strong) NSString *project_id;
34+
@property (nonatomic, strong) NSString *owner, *watcher, *creator;
3435
@end
3536

3637
@implementation MyTask_RootViewController
@@ -87,10 +88,24 @@ - (void)viewDidLoad
8788

8889

8990
//初始化过滤目录
90-
_myFliterMenu = [[TaskSelectionView alloc] initWithFrame:CGRectMake(0, 64, kScreen_Width, kScreen_Height - 64) items:nil];
91+
_myFliterMenu = [[TaskSelectionView alloc] initWithFrame:CGRectMake(0, 64, kScreen_Width, kScreen_Height - 64) items:@[@"我的任务", @"我关注的", @"我创建的"]];
9192
__weak typeof(self) weakSelf = self;
9293
_myFliterMenu.clickBlock = ^(NSInteger pageIndex){
9394
[weakSelf.titleBtn setTitle:weakSelf.myFliterMenu.items[pageIndex] forState:UIControlStateNormal];
95+
weakSelf.owner = weakSelf.watcher = weakSelf.creator = nil;
96+
if (pageIndex == 0) {
97+
weakSelf.owner = [Login curLoginUser].id.stringValue;
98+
}
99+
if (pageIndex == 1) {
100+
weakSelf.watcher = [Login curLoginUser].id.stringValue;
101+
}
102+
if (pageIndex == 2) {
103+
weakSelf.creator = [Login curLoginUser].id.stringValue;
104+
}
105+
ProjectTaskListView *listView = (ProjectTaskListView *)weakSelf.myCarousel.currentItemView;
106+
[weakSelf assignmentWithlistView:listView];
107+
[listView refresh];
108+
94109
};
95110
_myFliterMenu.closeBlock=^(){
96111
[weakSelf.myFliterMenu dismissMenu];
@@ -107,9 +122,7 @@ - (void)viewDidLoad
107122

108123
}
109124
ProjectTaskListView *listView = (ProjectTaskListView *)weakSelf.myCarousel.currentItemView;
110-
listView.keyword = keyword;
111-
listView.status = status;
112-
listView.label = label;
125+
[weakSelf assignmentWithlistView:listView];
113126
[listView refresh];
114127

115128
};
@@ -210,13 +223,11 @@ - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
210223

211224
ProjectTaskListView *listView = (ProjectTaskListView *)view;
212225
if (listView) {
213-
listView.keyword = _keyword;
214-
listView.status = _status;
215-
listView.label = _label;
226+
[self assignmentWithlistView:listView];
216227
[listView setTasks:curTasks];
217228
}else{
218229
__weak typeof(self) weakSelf = self;
219-
listView = [[ProjectTaskListView alloc] initWithFrame:carousel.bounds tasks:curTasks project_id:_project_id keyword:_keyword status:_status label:_label block:^(ProjectTaskListView *taskListView, Task *task) {
230+
listView = [[ProjectTaskListView alloc] initWithFrame:carousel.bounds tasks:curTasks project_id:_project_id keyword:_keyword status:_status label:_label owner:_owner watcher:_watcher creator:_creator block:^(ProjectTaskListView *taskListView, Task *task) {
220231
EditTaskViewController *vc = [[EditTaskViewController alloc] init];
221232
vc.myTask = task;
222233
vc.taskChangedBlock = ^(){
@@ -252,10 +263,7 @@ - (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel{
252263
} else {
253264
_project_id = ((Project *)_myProjectList[index - 1]).id.stringValue;
254265
}
255-
curView.project_id = _project_id;
256-
curView.keyword = _keyword;
257-
curView.status = _status;
258-
curView.label = _label;
266+
[self assignmentWithlistView:curView];
259267

260268
[curView refreshToQueryData];
261269
[carousel.visibleItemViews enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
@@ -323,5 +331,15 @@ - (UIBarButtonItem *)HDCustomNavButtonWithTitle:(NSString *)title imageName:(NSS
323331
return barButtonItem;
324332
}
325333

334+
- (void)assignmentWithlistView:(ProjectTaskListView *)listView {
335+
listView.keyword = self.keyword;
336+
listView.status = self.status;
337+
listView.label = self.label;
338+
listView.project_id = self.project_id;
339+
listView.owner = self.owner;
340+
listView.watcher = self.watcher;
341+
listView.creator = self.creator;
342+
}
343+
326344

327345
@end

Coding_iOS/Util/Manager/Coding_NetAPIManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ typedef NS_ENUM(NSInteger, PurposeType) {
165165
- (void)request_DeleteComment:(TaskComment *)comment ofTask:(Task *)task andBlock:(void (^)(id data, NSError *error))block;
166166
- (void)request_ChangeWatcher:(User *)watcher ofTask:(Task *)task andBlock:(void (^)(id data, NSError *error))block;
167167
- (void)request_Search_filtersAndBlock:(void (^)(id data, NSError *error))block; //任务标签
168-
- (void)request_tasks_searchWithOwner:(NSString *)owner project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label page:(NSInteger)page andBlock:(void (^)(id data, NSError *error))block;
168+
- (void)request_tasks_searchWithOwner:(NSString *)owner watcher:(NSString *)watcher creator:(NSString *)creator project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label page:(NSInteger)page andBlock:(void (^)(id data, NSError *error))block;
169169

170170

171171
#pragma mark - User

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,11 +1483,17 @@ - (void)request_Search_filtersAndBlock:(void (^)(id data, NSError *error))block
14831483

14841484
}
14851485

1486-
- (void)request_tasks_searchWithOwner:(NSString *)owner project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label page:(NSInteger)page andBlock:(void (^)(id data, NSError *error))block {
1486+
- (void)request_tasks_searchWithOwner:(NSString *)owner watcher:(NSString *)watcher creator:(NSString *)creator project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label page:(NSInteger)page andBlock:(void (^)(id data, NSError *error))block {
14871487
NSMutableDictionary *param = @{@"page": @(page)}.mutableCopy;
14881488
if (owner != nil) {
14891489
[param setValue:owner forKey:@"owner"];
14901490
}
1491+
if (watcher != nil) {
1492+
[param setValue:watcher forKey:@"watcher"];
1493+
}
1494+
if (creator != nil) {
1495+
[param setValue:creator forKey:@"creator"];
1496+
}
14911497
if (project_id != nil) {
14921498
[param setValue:project_id forKey:@"project_id"];
14931499
}

Coding_iOS/Views/TableListView/ProjectTaskListView.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ typedef void(^ProjectTaskBlock)(ProjectTaskListView *taskListView, Task *task);
1717
@property (nonatomic, strong) NSString *status; //任务状态,进行中的为1,已完成的为2
1818
@property (nonatomic, strong) NSString *label; //任务标签
1919
@property (nonatomic, strong) NSString *project_id;
20+
@property (nonatomic, strong) NSString *owner, *watcher, *creator;
21+
2022
@property (nonatomic, strong) void (^taskcountBlock)(NSInteger processingCount, NSInteger doneListCount);
2123

2224
- (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks block:(ProjectTaskBlock)block tabBarHeight:(CGFloat)tabBarHeight;
2325

24-
- (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label block:(ProjectTaskBlock)block tabBarHeight:(CGFloat)tabBarHeight;
26+
- (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label owner:(NSString *)owner watcher:(NSString *)watcher creator:(NSString *)creator block:(ProjectTaskBlock)block tabBarHeight:(CGFloat)tabBarHeight;
2527
- (void)setTasks:(Tasks *)tasks;
2628
- (void)refreshToQueryData;
2729
- (void)tabBarItemClicked;

Coding_iOS/Views/TableListView/ProjectTaskListView.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ - (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks block:(ProjectTaskBlock)b
8282
}
8383

8484

85-
- (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label block:(ProjectTaskBlock)block tabBarHeight:(CGFloat)tabBarHeight{
85+
- (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks project_id:(NSString *)project_id keyword:(NSString *)keyword status:(NSString *)status label:(NSString *)label owner:(NSString *)owner watcher:(NSString *)watcher creator:(NSString *)creator block:(ProjectTaskBlock)block tabBarHeight:(CGFloat)tabBarHeight{
8686
self = [super initWithFrame:frame];
8787
if (self) {
8888
// Initialization code
@@ -94,6 +94,9 @@ - (id)initWithFrame:(CGRect)frame tasks:(Tasks *)tasks project_id:(NSString *)pr
9494
self.keyword = keyword;
9595
self.status = status;
9696
self.label = label;
97+
self.owner = owner;
98+
self.watcher = watcher;
99+
self.creator = creator;
97100

98101

99102
_myTableView = ({
@@ -177,7 +180,7 @@ - (void)sendRequest{
177180
}
178181
__weak typeof(self) weakSelf = self;
179182

180-
[[Coding_NetAPIManager sharedManager] request_tasks_searchWithOwner:nil project_id:_project_id keyword:_keyword status:_status label:_label page:_page andBlock:^(Tasks *data, NSError *error) {
183+
[[Coding_NetAPIManager sharedManager] request_tasks_searchWithOwner:_owner watcher:_watcher creator:_creator project_id:_project_id keyword:_keyword status:_status label:_label page:_page andBlock:^(Tasks *data, NSError *error) {
181184
[weakSelf endLoading];
182185
[weakSelf.myRefreshControl endRefreshing];
183186
[weakSelf.myTableView.infiniteScrollingView stopAnimating];

Coding_iOS/Views/TaskSelectionView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ - (id)initWithFrame:(CGRect)frame items:(NSArray *)items {
3030
self = [super initWithFrame:frame];
3131
if (self) {
3232
// Initialization code
33-
self.items = @[@"我的任务", @"我关注的", @"我创建的"];
33+
self.items = items;
3434
self.pCount=[ProjectCount new];
3535
self.showStatus=FALSE;
3636
[self setup];

0 commit comments

Comments
 (0)