WorkFlowDetailsController.m 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. //
  2. // WorkFlowDetailsController.m
  3. // smartRhino
  4. //
  5. // Created by Android on 2019/12/18.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "WorkFlowDetailsController.h"
  9. #import "HistoricalWorkFlowDetailsBaseCell.h"
  10. #import "WorkFlowPersonnelListController.h"
  11. #import "HistoricalWorkFlowDetailsTitleCell.h"
  12. #import "HistoricalWorkFlowDetailsContentCell.h"
  13. #import "MeetingDetailsTimeCell.h"
  14. #import "MyWorkFlowListCell.h"
  15. #import "NoteBookShareVC.h"
  16. #import "MyTDGroupViewController.h"
  17. #import "MyTDTopicCreateVC.h"
  18. #import "MoveViewController.h"
  19. #import "DownFileViewController.h"
  20. #import "HomeDetailController.h"
  21. #import "ChatMsgNoticeDetailVC.h"
  22. #import "MyTDTopicDetailVC.h"
  23. #import "TDInterLeterDetailVC.h"
  24. #import "NoteBookDetailVC.h"
  25. #import "TDGroupInfoListVC.h"
  26. #import "HistoricalWorkFlowDetailsMoreCell.h"
  27. #import "WorkFlowOrderController.h"
  28. #import "WorkFlowFecordController.h"
  29. #import "MyApprovalPageDetail.h"
  30. @interface WorkFlowDetailsController ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
  31. @property (weak, nonatomic) IBOutlet UITableView *detailsTabView;
  32. @property (weak, nonatomic) IBOutlet UIView *bottomView;
  33. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomConstant;
  34. @property (strong, nonatomic) MyMeetingListModel * meetingModel;
  35. @property (strong, nonatomic) NoteBookShareVC * noteBookShareVC;
  36. @end
  37. @implementation WorkFlowDetailsController
  38. - (instancetype)initWithId:(NSInteger)meetingId {
  39. if (self = [super init]) {
  40. self.meetingId = meetingId;
  41. }
  42. return self;
  43. }
  44. - (IBAction)returnAction:(id)sender {
  45. [self shareHander];
  46. }
  47. - (void)shareHander{
  48. [self.noteBookShareVC initNoteBookShareData];
  49. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  50. }
  51. - (NoteBookShareVC *)noteBookShareVC{
  52. if (_noteBookShareVC == nil) {
  53. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  54. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  55. [_noteBookShareVC.view setHidden:YES];
  56. _noteBookShareVC.delegate = self;
  57. }
  58. return _noteBookShareVC;
  59. }
  60. -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
  61. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  62. if ([typeName isEqualToString:@"发给微信好友"]) {
  63. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  64. }else if ([typeName isEqualToString:@"发到微博"]){
  65. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  66. }else if ([typeName isEqualToString:@"发到消息"]){
  67. }else if ([typeName isEqualToString:@"发到小组"]){
  68. [self returnToGroup];
  69. }else if ([typeName isEqualToString:@"发到笔记"]){
  70. [self returnToNote];
  71. }else if ([typeName isEqualToString:@"发到话题"]){
  72. [self returnToTopic];
  73. }else{
  74. }
  75. }
  76. - (void)returnToGroup
  77. {
  78. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  79. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  80. model.SoureTypeId = CollectModel_meetDetail;
  81. model.Title = self.meetingModel.Name;
  82. model.SoureId = [self.meetingModel.Id integerValue];
  83. model.Author = self.meetingModel.UserName;
  84. vc.type = CollectModel_Group;
  85. vc.sendModel = model;
  86. vc.isReturn = YES;
  87. [self.navigationController pushViewController:vc animated:YES];
  88. }
  89. - (void)returnToNote
  90. {
  91. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  92. vc.type = CollectModel_NoteBook;
  93. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  94. model.SoureTypeId = CollectModel_meetDetail;
  95. model.Title = self.meetingModel.Name;
  96. model.SoureId = [self.meetingModel.Id integerValue];
  97. model.Author = self.meetingModel.UserName;
  98. vc.sendModel = model;
  99. vc.isReturn = YES;
  100. [self.navigationController pushViewController:vc animated:YES];
  101. }
  102. - (void)returnToTopic
  103. {
  104. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  105. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  106. model.SoureTypeId = CollectModel_meetDetail;
  107. model.Title = self.meetingModel.Name;
  108. model.SoureId = [self.meetingModel.Id integerValue];
  109. model.Author = self.meetingModel.UserName;
  110. vc.sendModel = model;
  111. vc.type = CollectModel_NewTopic;
  112. vc.isReturn = YES;
  113. [self.navigationController pushViewController:vc animated:YES];
  114. }
  115. - (void)viewDidLoad {
  116. [super viewDidLoad];
  117. self.fd_prefersNavigationBarHidden = YES;
  118. self.detailsTabView.dataSource = self;
  119. self.detailsTabView.delegate = self;
  120. self.detailsTabView.tableFooterView = [UIView new];
  121. self.detailsTabView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
  122. self.detailsTabView.separatorColor = [UIColor colorWithHexString:@"F7F7F7"];
  123. [self.detailsTabView registerNib:[UINib nibWithNibName:@"HistoricalWorkFlowDetailsTitleCell" bundle:nil] forCellReuseIdentifier:@"HistoricalWorkFlowDetailsTitleCell"];
  124. [self.detailsTabView registerNib:[UINib nibWithNibName:@"HistoricalWorkFlowDetailsContentCell" bundle:nil] forCellReuseIdentifier:@"HistoricalWorkFlowDetailsContentCell"];
  125. [self.detailsTabView registerNib:[UINib nibWithNibName:@"HistoricalWorkFlowDetailsMoreCell" bundle:nil] forCellReuseIdentifier:@"HistoricalWorkFlowDetailsMoreCell"];
  126. [self.detailsTabView registerNib:[UINib nibWithNibName:@"MeetingDetailsTimeCell" bundle:nil] forCellReuseIdentifier:@"MeetingDetailsTimeCell"];
  127. if (self.meetType == MeetingEndType) {
  128. self.bottomView.alpha = 0;
  129. self.bottomView.hidden = YES;
  130. }
  131. [self getData];
  132. [[UtilsTools getWindow] addSubview:self.noteBookShareVC.view];
  133. }
  134. - (void)setBottomStatus:(BOOL)hidden
  135. {
  136. self.bottomView.hidden = hidden;
  137. if (hidden) {
  138. self.view.backgroundColor = [UIColor whiteColor];
  139. self.bottomConstant.constant = 0.f;
  140. }else{
  141. self.view.backgroundColor = [UIColor colorWithRed:234/255.0 green:234/255.0 blue:234/255.0 alpha:1];
  142. self.bottomConstant.constant = 50.f;
  143. }
  144. }
  145. - (void)getData
  146. {
  147. WS(weakSelf);
  148. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(MeetingDetail),(long)self.meetingId];
  149. [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} success:^(id _Nonnull responseObject) {
  150. [weakSelf.detailsTabView.mj_header endRefreshing];
  151. [weakSelf.detailsTabView.mj_footer endRefreshing];
  152. weakSelf.meetingModel = [MyMeetingListModel modelWithDictionary:responseObject];
  153. if (weakSelf.meetingModel.Status == 0) {
  154. weakSelf.meetType = MeetingEndType;
  155. }else{
  156. weakSelf.meetType = MeetingWillOpenType;
  157. }
  158. dispatch_async(dispatch_get_main_queue(), ^{
  159. if ([weakSelf.meetingModel.UserId integerValue] == [AppUserModel sharedAppUserModel].Id) {
  160. [weakSelf setBottomStatus:NO];
  161. }else{
  162. [weakSelf setBottomStatus:YES];
  163. }
  164. [weakSelf.detailsTabView reloadData];
  165. });
  166. } failure:^(NSError * _Nonnull error) {
  167. [weakSelf.detailsTabView.mj_header endRefreshing];
  168. [weakSelf.detailsTabView.mj_footer endRefreshing];
  169. }];
  170. }
  171. #pragma mark - table delegate
  172. - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
  173. {
  174. if ([cell respondsToSelector:@selector(setSeparatorInset:)])
  175. {
  176. [cell setSeparatorInset:UIEdgeInsetsZero];
  177. }
  178. if ([cell respondsToSelector:@selector(setLayoutMargins:)])
  179. {
  180. [cell setLayoutMargins:UIEdgeInsetsZero];
  181. }
  182. }
  183. - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
  184. return 45.f;
  185. }
  186. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  187. if (indexPath.row == 1) {
  188. return self.meetingModel.MeetingTimes.count * 26.f + 18.f;
  189. }
  190. // if (indexPath.row == 2) {
  191. // NSString *address = [NSString stringWithFormat:@"%@ %@",self.meetingModel.Address,self.meetingModel.RoomName];
  192. // NSDictionary *txtAttribute = @{NSFontAttributeName: [UIFont systemFontOfSize:17]};
  193. // CGSize retSize = [address boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 100.f, MAXFLOAT)
  194. // options:\
  195. // NSStringDrawingTruncatesLastVisibleLine |
  196. // NSStringDrawingUsesLineFragmentOrigin |
  197. // NSStringDrawingUsesFontLeading
  198. // attributes:txtAttribute
  199. // context:nil].size;
  200. // return retSize.height + 24.f;
  201. // }
  202. if (indexPath.row == 3) {
  203. //获取实际内容
  204. NSString *content = self.meetingModel.Description;
  205. //获取字符串高度
  206. UILabel * label = [UILabel new];
  207. label.font = [UIFont systemFontOfSize:16];
  208. label.text = content;
  209. label.numberOfLines = 0;
  210. CGFloat contentHeight = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH - 36, 10)].height;
  211. //图片应该展示的高度
  212. CGFloat imageHeight = self.meetingModel.ImageUrl.length > 0 ? (SCREEN_WIDTH - 30.f) * 0.5 : 0;
  213. CGFloat H = 48.f;
  214. if (self.meetingModel.ImageUrl.length > 0) {
  215. H += 15.f;
  216. }
  217. if (self.meetingModel.FlowAttachments.count > 0) {
  218. H += 15.f;
  219. }
  220. if (content.length > 0) {
  221. H += 15.f;
  222. }
  223. //添加其他高度
  224. return (contentHeight + H + imageHeight + self.meetingModel.FlowAttachments.count * 87);
  225. }
  226. return UITableViewAutomaticDimension;
  227. }
  228. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  229. if (self.meetType == MeetingEndType) {
  230. return 6;
  231. }
  232. return 5;
  233. }
  234. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  235. WS(weakSelf);
  236. switch (indexPath.row) {
  237. case 0:{
  238. HistoricalWorkFlowDetailsTitleCell * cell = (HistoricalWorkFlowDetailsTitleCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsTitleCell" forIndexPath:indexPath];
  239. [cell.statusBtn setTitle:self.meetingModel.Status == 0 ? @"待开会" : @"已结束" forState:UIControlStateNormal];
  240. cell.statusBtn.hidden = self.meetType == MeetingEndType ? YES : NO;
  241. [cell setCellData:self.meetingModel withIndex:indexPath];
  242. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  243. return cell;
  244. }
  245. break;
  246. case 1:{
  247. MeetingDetailsTimeCell * cell = (MeetingDetailsTimeCell *)[tableView dequeueReusableCellWithIdentifier:@"MeetingDetailsTimeCell" forIndexPath:indexPath];
  248. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  249. [cell setCellData:self.meetingModel];
  250. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  251. return cell;
  252. }
  253. break;
  254. case 2:{
  255. HistoricalWorkFlowDetailsTitleCell * cell = [tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsTitleCell" forIndexPath:indexPath];
  256. [cell setCellData:self.meetingModel withIndex:indexPath];
  257. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  258. return cell;
  259. }
  260. break;
  261. case 3:{
  262. HistoricalWorkFlowDetailsContentCell * cell = (HistoricalWorkFlowDetailsContentCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsContentCell" forIndexPath:indexPath];
  263. [cell setCellData:self.meetingModel withIndex:indexPath];
  264. cell.ClickAttrBlock = ^(NSDictionary * _Nonnull dict) {
  265. [weakSelf pushWithDict:dict];
  266. };
  267. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  268. return cell;
  269. }
  270. break;
  271. case 4:{
  272. HistoricalWorkFlowDetailsMoreCell * cell = (HistoricalWorkFlowDetailsMoreCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsMoreCell" forIndexPath:indexPath];
  273. [cell setCellData:@"参会人员"];
  274. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  275. return cell;
  276. }
  277. break;
  278. default:{
  279. HistoricalWorkFlowDetailsMoreCell * cell = (HistoricalWorkFlowDetailsMoreCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsMoreCell" forIndexPath:indexPath];
  280. [cell setCellData:@"会议纪要"];
  281. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  282. return cell;
  283. }
  284. break;
  285. }
  286. }
  287. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  288. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  289. if (indexPath.row == 4) {
  290. WorkFlowPersonnelListController *controller = [[WorkFlowPersonnelListController alloc] init];
  291. controller.Id = self.meetingModel.Id;
  292. [self.navigationController pushViewController:controller animated:YES];
  293. }
  294. if (indexPath.row == 5) {
  295. WorkFlowFecordController * vc = [[WorkFlowFecordController alloc] init];
  296. vc.meetId = [self.meetingModel.Id integerValue];
  297. vc.isBack = YES;
  298. [self.navigationController pushViewController:vc animated:YES];
  299. }
  300. }
  301. - (void)pushWithDict:(NSDictionary *)dict
  302. {
  303. WS(weakSelf);
  304. NSLog(@"%@",dict);
  305. switch ([dict[@"SoureTypeId"] integerValue]){
  306. case CollectModel_Aritle:
  307. {
  308. SHOWLOADING
  309. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)[dict[@"SoureId"] integerValue]] parameters:@{} success:^(id _Nonnull responseObject) {
  310. REMOVESHOW;
  311. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  312. HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  313. [homeDetail loadCurrentModel:itemModel];
  314. [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  315. } failure:^(NSError * _Nonnull error) {
  316. SHOWERROR([ZYCTool handerResultData:error]);
  317. }];
  318. }
  319. break;
  320. case CollectModel_Toipc:
  321. {
  322. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  323. vc.type = CollectModel_Toipc;
  324. vc.Id = [dict[@"SoureId"] integerValue];
  325. [self.navigationController pushViewController:vc animated:YES];
  326. }
  327. break;
  328. case CollectModel_NewTopic:
  329. {
  330. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  331. vc.type = CollectModel_NewTopic;
  332. vc.Id = [dict[@"SoureId"] integerValue];
  333. [self.navigationController pushViewController:vc animated:YES];
  334. }
  335. break;
  336. case CollectModel_Collect:
  337. {
  338. }
  339. break;
  340. case CollectModel_NoteBook:
  341. {
  342. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  343. vc.type = CollectModel_NoteBook;
  344. vc.Id = [dict[@"SoureId"] integerValue];
  345. [self.navigationController pushViewController:vc animated:YES];
  346. }
  347. break;
  348. case CollectModel_Notice:
  349. {
  350. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  351. vc.type = CollectModel_Notice;
  352. vc.Id = [dict[@"SoureId"] integerValue];
  353. [self.navigationController pushViewController:vc animated:YES];
  354. }
  355. break;
  356. case CollectModel_InterMail:
  357. {
  358. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  359. vc.type = CollectModel_InterMail;
  360. vc.Id = [dict[@"SoureId"] integerValue];
  361. [self.navigationController pushViewController:vc animated:YES];
  362. }
  363. break;
  364. case CollectModel_Group:
  365. {
  366. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  367. vc.GroupId = [dict[@"SoureId"] integerValue];
  368. vc.titleStr = dict[@"Title"];
  369. [self.navigationController pushViewController:vc animated:YES];
  370. }
  371. break;
  372. case CollectModel_meetMian:
  373. {
  374. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  375. vc.type = CollectModel_meetMian;
  376. vc.Id = [dict[@"SoureId"] integerValue];
  377. [self.navigationController pushViewController:vc animated:YES];
  378. }
  379. break;
  380. case CollectModel_work:{
  381. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  382. vc.pageType = Type_ONEC;
  383. vc.indexId = [dict[@"SoureId"] integerValue];
  384. vc.title = dict[@"Title"];
  385. vc.TodoId = [dict[@"SoureId"] integerValue];
  386. [self.navigationController pushViewController:vc animated:YES];
  387. }break;
  388. default:
  389. {
  390. FlowAttachmentsModel * model = [FlowAttachmentsModel modelWithDictionary:dict];
  391. DownFileViewController *vc = [[DownFileViewController alloc]init];
  392. vc.model = model;
  393. [self.navigationController pushViewController:vc animated:YES];
  394. }
  395. break;
  396. }
  397. }
  398. #pragma mark - cancelMeeting
  399. - (IBAction)cancelMeetingBtn_Click:(id)sender {
  400. WS(weakSelf);
  401. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认预约会议" preferredStyle:UIAlertControllerStyleAlert];
  402. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  403. }];
  404. [ok setValue:k9 forKey:@"_titleTextColor"];
  405. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  406. SHOWLOADING
  407. [[HttpManager sharedHttpManager] POSTWithUrl:CancelMeeting(self.meetingModel.Id) parameters:@{} success:^(id _Nonnull responseObject) {
  408. REMOVESHOW
  409. SHOWSUCCESS(@"已取消预约会议");
  410. if (weakSelf.cancelSussBlock) {
  411. weakSelf.cancelSussBlock();
  412. }
  413. [weakSelf.navigationController popViewControllerAnimated:YES];
  414. } failure:^(NSError * _Nonnull error) {
  415. REMOVESHOW
  416. SHOWERROR([ZYCTool handerResultData:error]);
  417. }];
  418. }];
  419. [alertVC addAction:ok];
  420. [alertVC addAction:noOk];
  421. [self presentViewController:alertVC animated:YES completion:nil];
  422. }
  423. - (IBAction)editMeetingBtn_Click:(id)sender {
  424. WS(weakSelf);
  425. WorkFlowOrderController *workFlowOrderController = [[WorkFlowOrderController alloc] initWithRID:[NSString stringWithFormat:@"%ld",(long)self.meetingId]];
  426. workFlowOrderController.mettingTitle = self.meetingModel.Name;
  427. workFlowOrderController.meetingModel = self.meetingModel;
  428. workFlowOrderController.isEdit = YES;
  429. workFlowOrderController.ChangeSuccessBlock = ^{
  430. [weakSelf getData];
  431. };
  432. [self.navigationController pushViewController:workFlowOrderController animated:YES];
  433. }
  434. @end