|
21 | 21 | #import "TaskDescriptionViewController.h" |
22 | 22 | #import "WebViewController.h" |
23 | 23 | #import "ProjectToChooseListViewController.h" |
| 24 | +#import "EditLabelViewController.h" |
24 | 25 |
|
25 | 26 | @interface EditTaskViewController ()<TTTAttributedLabelDelegate> |
26 | 27 | @property (strong, nonatomic) UITableView *myTableView; |
@@ -322,6 +323,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N |
322 | 323 | } |
323 | 324 | [weakSelf goToDescriptionVC]; |
324 | 325 | }; |
| 326 | + cell.addTagBlock = ^(){ |
| 327 | + [weakSelf goToTagsVC]; |
| 328 | + }; |
| 329 | + cell.tagsChangedBlock = ^(){ |
| 330 | + weakSelf.myTask.labels = [weakSelf.myCopyTask.labels mutableCopy]; |
| 331 | + [weakSelf.myTableView reloadData]; |
| 332 | + }; |
325 | 333 |
|
326 | 334 | cell.backgroundColor = kColorTableBG; |
327 | 335 | // [tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:20]; |
@@ -404,7 +412,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa |
404 | 412 |
|
405 | 413 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ |
406 | 414 | if (section == 0) { |
407 | | - return 30.0; |
| 415 | + return 0.5; |
408 | 416 | }else if (section == 3){ |
409 | 417 | return 0.5; |
410 | 418 | }else{ |
@@ -449,6 +457,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath |
449 | 457 | ESStrongSelf; |
450 | 458 | _self.myCopyTask.project = project; |
451 | 459 | _self.myCopyTask.owner = nil;//更换新的执行人 |
| 460 | + [_self.myCopyTask.labels removeAllObjects]; |
452 | 461 | [_self.myTableView reloadData]; |
453 | 462 | }; |
454 | 463 | [self.navigationController pushViewController:vc animated:YES]; |
@@ -527,6 +536,48 @@ - (void)goToDescriptionVC{ |
527 | 536 | [self.navigationController pushViewController:vc animated:YES]; |
528 | 537 | } |
529 | 538 |
|
| 539 | +- (void)goToTagsVC{ |
| 540 | + if (!_myCopyTask.project) { |
| 541 | + [self showHudTipStr:@"需要选定所属项目先~"]; |
| 542 | + return; |
| 543 | + } |
| 544 | + EditLabelViewController *vc = [[EditLabelViewController alloc] init]; |
| 545 | + vc.curProject = self.myCopyTask.project; |
| 546 | + vc.orignalTags = self.myCopyTask.labels; |
| 547 | + @weakify(self); |
| 548 | + vc.tagsChangedBlock = ^(EditLabelViewController *vc, NSMutableArray *selectedTags){ |
| 549 | + @strongify(self); |
| 550 | + [self tagsHasChanged:selectedTags fromVC:vc]; |
| 551 | + }; |
| 552 | + [self.navigationController pushViewController:vc animated:YES]; |
| 553 | +} |
| 554 | + |
| 555 | +- (void)tagsHasChanged:(NSMutableArray *)selectedTags fromVC:(EditLabelViewController *)vc{ |
| 556 | + if ([ProjectTag tags:self.myCopyTask.labels isEqualTo:selectedTags]) { |
| 557 | + [vc.navigationController popViewControllerAnimated:YES]; |
| 558 | + }else{ |
| 559 | + if (self.myCopyTask.handleType > TaskHandleTypeEdit) { |
| 560 | + self.myCopyTask.labels = selectedTags; |
| 561 | + self.myTask.labels = [self.myCopyTask.labels mutableCopy]; |
| 562 | + [self.myTableView reloadData]; |
| 563 | + [vc.navigationController popViewControllerAnimated:YES]; |
| 564 | + }else{ |
| 565 | + vc.navigationItem.rightBarButtonItem.enabled = NO; |
| 566 | + @weakify(self); |
| 567 | + [[Coding_NetAPIManager sharedManager] request_EditTask:_myCopyTask withTags:selectedTags andBlock:^(id data, NSError *error) { |
| 568 | + @strongify(self); |
| 569 | + vc.navigationItem.rightBarButtonItem.enabled = YES; |
| 570 | + if (data) { |
| 571 | + self.myCopyTask.labels = selectedTags; |
| 572 | + self.myTask.labels = [self.myCopyTask.labels mutableCopy]; |
| 573 | + [self.myTableView reloadData]; |
| 574 | + [vc.navigationController popViewControllerAnimated:YES]; |
| 575 | + } |
| 576 | + }]; |
| 577 | + } |
| 578 | + } |
| 579 | +} |
| 580 | + |
530 | 581 | - (void)doCommentToComment:(TaskComment *)toComment sender:(id)sender{ |
531 | 582 | if ([self.myMsgInputView isAndResignFirstResponder]) { |
532 | 583 | return ; |
|
0 commit comments