1111#define kCellIdentifier_TaskComment @" TaskCommentCell"
1212#define kCellIdentifier_TaskCommentTop @" TaskCommentTopCell"
1313#define kCellIdentifier_TaskCommentBlank @" TaskCommentBlankCell"
14+ #define kCellIdentifier_TaskDescription @" TaskDescriptionCell"
1415
1516#import " EditTaskViewController.h"
1617#import " TPKeyboardAvoidingTableView.h"
2425#import " TaskCommentTopCell.h"
2526#import " TaskCommentBlankCell.h"
2627#import " ActionSheetDatePicker.h"
28+ #import " TaskDescriptionCell.h"
2729
2830@interface EditTaskViewController ()
2931@property (strong , nonatomic ) UITableView *myTableView;
@@ -86,6 +88,7 @@ - (void)loadView{
8688 [tableView registerClass: [TaskCommentCell class ] forCellReuseIdentifier: kCellIdentifier_TaskComment ];
8789 [tableView registerClass: [TaskCommentBlankCell class ] forCellReuseIdentifier: kCellIdentifier_TaskCommentBlank ];
8890 [tableView registerClass: [TaskCommentTopCell class ] forCellReuseIdentifier: kCellIdentifier_TaskCommentTop ];
91+ [tableView registerClass: [TaskDescriptionCell class ] forCellReuseIdentifier: kCellIdentifier_TaskDescription ];
8992 tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
9093 tableView;
9194 });
@@ -109,7 +112,7 @@ - (void)loadView{
109112 case TaskHandleTypeEdit:{
110113 self.title = @" 任务详情" ;
111114 _myCopyTask = [Task taskWithTask: _myTask];
112- if (_myCopyTask.needRefreshDetail ) {
115+ if (_myCopyTask.needRefreshDetail || _myCopyTask. has_description . boolValue ) {
113116 [self queryToRefreshTaskDetail ];
114117 }else {
115118 _myMsgInputView.curProject = _myCopyTask.project ;
@@ -172,7 +175,7 @@ - (void)queryToRefreshCommentList{
172175 [[Coding_NetAPIManager sharedManager ] request_CommentListOfTask: _myCopyTask andBlock: ^(id data, NSError *error) {
173176 if (data) {
174177 weakSelf.myCopyTask .commentList = data;
175- [weakSelf.myTableView reloadSections: [NSIndexSet indexSetWithIndex: 2 ] withRowAnimation: UITableViewRowAnimationAutomatic];
178+ [weakSelf.myTableView reloadSections: [NSIndexSet indexSetWithIndex: 3 ] withRowAnimation: UITableViewRowAnimationAutomatic];
176179 };
177180 }];
178181}
@@ -184,7 +187,7 @@ - (void)queryToRefreshTaskDetail{
184187 weakSelf.myTask = data;
185188 weakSelf.myCopyTask = [Task taskWithTask: weakSelf.myTask];
186189 weakSelf.myMsgInputView .curProject = weakSelf.myCopyTask .project ;
187- [weakSelf.myTableView reloadSections: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange (0 , 2 )] withRowAnimation: UITableViewRowAnimationAutomatic];
190+ [weakSelf.myTableView reloadSections: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange (0 , 3 )] withRowAnimation: UITableViewRowAnimationAutomatic];
188191 [weakSelf queryToRefreshCommentList ];
189192 }
190193 }];
@@ -285,18 +288,16 @@ - (void)deleteComment:(TaskComment *)comment{
285288}
286289#pragma mark Table M
287290- (NSInteger )numberOfSectionsInTableView : (UITableView *)tableView {
288- return self.myTask .handleType == TaskEditTypeAdd? 2 :3 ;
291+ return ( self.myCopyTask .handleType == TaskEditTypeAdd) ? 2 : 4 ;
289292}
290293- (NSInteger )tableView : (UITableView *)tableView numberOfRowsInSection : (NSInteger )section {
291294 NSInteger row = 0 ;
292295 if (section == 0 ) {
293296 row = 1 ;
297+ }else if (section == 2 ){
298+ row = 1 ;
294299 }else if (section == 1 ){
295- if (_myTask.handleType == TaskHandleTypeAdd) {
296- row = 3 ;
297- }else {
298- row = 4 ;
299- }
300+ row = (self.myCopyTask .handleType == TaskHandleTypeAdd)? 3 : 4 ;
300301 }else {
301302 if ([self hasComment ]) {
302303 row = self.myCopyTask .commentList .count +1 ;
@@ -340,6 +341,16 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
340341 }
341342 [tableView addLineforPlainCell: cell forRowAtIndexPath: indexPath withLeftSpace: 20 ];
342343 return cell;
344+ }else if (indexPath.section == 2 ){
345+ TaskDescriptionCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_TaskDescription forIndexPath: indexPath];
346+ if (_myCopyTask.has_description && !_myCopyTask.has_description .boolValue ) {
347+ // 没有描述
348+ [cell setDescriptionStr: @" " ];
349+ }else {
350+ [cell setDescriptionStr: _myCopyTask.task_description.description_mine];
351+ }
352+ [cell addLineUp: YES andDown: NO andColor: tableView.separatorColor];
353+ return cell;
343354 }else if (indexPath.section == 1 ){
344355 LeftImage_LRTextCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_LeftImage_LRText forIndexPath: indexPath];
345356 [cell setObj: _myCopyTask type: indexPath.row];
@@ -349,7 +360,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
349360 if (indexPath.row == 0 ) {
350361 TaskCommentTopCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_TaskCommentTop forIndexPath: indexPath];
351362 cell.commentNumStrLabel .text = [NSString stringWithFormat: @" %d 条评论" , _myCopyTask.comments.intValue];
352- [cell addLineUp: YES andDown: NO andColor: tableView.separatorColor];
353363 return cell;
354364 }else {
355365 if ([self hasComment ]) {
@@ -372,6 +382,8 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
372382 CGFloat cellHeight = 0 ;
373383 if (indexPath.section == 0 ) {
374384 cellHeight = [TaskContentCell cellHeightWithObj: _myCopyTask];
385+ }else if (indexPath.section == 2 ){
386+ cellHeight = [TaskDescriptionCell cellHeight ];
375387 }else if (indexPath.section == 1 ){
376388 cellHeight = [LeftImage_LRTextCell cellHeight ];
377389 }else {
@@ -391,6 +403,8 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
391403- (CGFloat)tableView : (UITableView *)tableView heightForHeaderInSection : (NSInteger )section {
392404 if (section == 0 ) {
393405 return 30.0 ;
406+ }else if (section == 3 ){
407+ return 1.0 ;
394408 }else {
395409 return 20.0 ;
396410 }
@@ -405,16 +419,27 @@ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger
405419 headerView.backgroundColor = [UIColor colorWithHexString: @" 0xe5e5e5" ];
406420 if (section == 0 ) {
407421 [headerView setHeight: 30.0 ];
422+ }else if (section == 3 ){
423+ headerView.backgroundColor = [UIColor whiteColor ];
424+ [headerView setHeight: 0.0 ];
408425 }else {
409426 [headerView setHeight: 20 ];
410427 }
411428 return headerView;
412429}
413430
431+ - (UIView *)tableView : (UITableView *)tableView viewForFooterInSection : (NSInteger )section {
432+ UIView *footerView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , kScreen_Width , 1 )];
433+ footerView.backgroundColor = (section == 2 )? [UIColor whiteColor ]: [UIColor clearColor ];
434+ return footerView;
435+ }
436+
414437- (void )tableView : (UITableView *)tableView didSelectRowAtIndexPath : (NSIndexPath *)indexPath {
415438 [tableView deselectRowAtIndexPath: indexPath animated: YES ];
416439 ESWeakSelf;
417- if (indexPath.section == 1 ) {
440+ if (indexPath.section == 2 ) {
441+ // [self showHudTipStr:@"现在还不能添加或编辑描述内容"];
442+ }else if (indexPath.section == 1 ){
418443 if (indexPath.row == LeftImage_LRTextCellTypeTaskOwner) {
419444 ProjectMemberListViewController *vc = [[ProjectMemberListViewController alloc ] init ];
420445 [vc setFrame: self .view.bounds project: _myCopyTask.project type: ProMemTypeTaskOwner refreshBlock: nil selectBlock: ^(ProjectMember *member) {
@@ -458,7 +483,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
458483 }];
459484 [self .navigationController pushViewController: vc animated: YES ];
460485 }
461- }else if (indexPath.section == 2 ){
486+ }else if (indexPath.section == 3 ){
462487 if (indexPath.row > 0 && [self hasComment ]) {
463488 TaskComment *curComment = [_myCopyTask.commentList objectAtIndex: indexPath.row-1 ];
464489 [self doCommentToComment: curComment sender: [tableView cellForRowAtIndexPath: indexPath]];
0 commit comments