123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- //
- // WorkFlowDetailsController.m
- // smartRhino
- //
- // Created by Android on 2019/12/18.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "WorkFlowDetailsController.h"
- #import "HistoricalWorkFlowDetailsBaseCell.h"
- #import "WorkFlowPersonnelListController.h"
- #import "HistoricalWorkFlowDetailsTitleCell.h"
- #import "HistoricalWorkFlowDetailsContentCell.h"
- #import "MeetingDetailsTimeCell.h"
- #import "MyWorkFlowListCell.h"
- #import "NoteBookShareVC.h"
- #import "MyTDGroupViewController.h"
- #import "MyTDTopicCreateVC.h"
- #import "MoveViewController.h"
- #import "DownFileViewController.h"
- #import "HomeDetailController.h"
- #import "ChatMsgNoticeDetailVC.h"
- #import "MyTDTopicDetailVC.h"
- #import "TDInterLeterDetailVC.h"
- #import "NoteBookDetailVC.h"
- #import "TDGroupInfoListVC.h"
- #import "HistoricalWorkFlowDetailsMoreCell.h"
- #import "WorkFlowOrderController.h"
- #import "WorkFlowFecordController.h"
- #import "MyApprovalPageDetail.h"
- @interface WorkFlowDetailsController ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
- @property (weak, nonatomic) IBOutlet UITableView *detailsTabView;
- @property (weak, nonatomic) IBOutlet UIView *bottomView;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomConstant;
- @property (strong, nonatomic) MyMeetingListModel * meetingModel;
- @property (strong, nonatomic) NoteBookShareVC * noteBookShareVC;
- @end
- @implementation WorkFlowDetailsController
- - (instancetype)initWithId:(NSInteger)meetingId {
- if (self = [super init]) {
- self.meetingId = meetingId;
- }
- return self;
- }
- - (IBAction)returnAction:(id)sender {
- [self shareHander];
- }
- - (void)shareHander{
- [self.noteBookShareVC initNoteBookShareData];
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- }
- - (NoteBookShareVC *)noteBookShareVC{
- if (_noteBookShareVC == nil) {
- _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
- [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookShareVC.view setHidden:YES];
- _noteBookShareVC.delegate = self;
- }
- return _noteBookShareVC;
- }
- -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
-
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
-
- }else if ([typeName isEqualToString:@"发到微博"]){
-
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
-
- }else if ([typeName isEqualToString:@"发到消息"]){
-
- }else if ([typeName isEqualToString:@"发到小组"]){
- [self returnToGroup];
- }else if ([typeName isEqualToString:@"发到笔记"]){
- [self returnToNote];
- }else if ([typeName isEqualToString:@"发到话题"]){
- [self returnToTopic];
- }else{
- }
- }
- - (void)returnToGroup
- {
- MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureTypeId = CollectModel_meetDetail;
- model.Title = self.meetingModel.Name;
- model.SoureId = [self.meetingModel.Id integerValue];
- model.Author = self.meetingModel.UserName;
- vc.type = CollectModel_Group;
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToNote
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NoteBook;
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureTypeId = CollectModel_meetDetail;
- model.Title = self.meetingModel.Name;
- model.SoureId = [self.meetingModel.Id integerValue];
- model.Author = self.meetingModel.UserName;
- vc.sendModel = model;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToTopic
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.SoureTypeId = CollectModel_meetDetail;
- model.Title = self.meetingModel.Name;
- model.SoureId = [self.meetingModel.Id integerValue];
- model.Author = self.meetingModel.UserName;
- vc.sendModel = model;
- vc.type = CollectModel_NewTopic;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
- self.detailsTabView.dataSource = self;
- self.detailsTabView.delegate = self;
- self.detailsTabView.tableFooterView = [UIView new];
- self.detailsTabView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
- self.detailsTabView.separatorColor = [UIColor colorWithHexString:@"F7F7F7"];
- [self.detailsTabView registerNib:[UINib nibWithNibName:@"HistoricalWorkFlowDetailsTitleCell" bundle:nil] forCellReuseIdentifier:@"HistoricalWorkFlowDetailsTitleCell"];
- [self.detailsTabView registerNib:[UINib nibWithNibName:@"HistoricalWorkFlowDetailsContentCell" bundle:nil] forCellReuseIdentifier:@"HistoricalWorkFlowDetailsContentCell"];
- [self.detailsTabView registerNib:[UINib nibWithNibName:@"HistoricalWorkFlowDetailsMoreCell" bundle:nil] forCellReuseIdentifier:@"HistoricalWorkFlowDetailsMoreCell"];
- [self.detailsTabView registerNib:[UINib nibWithNibName:@"MeetingDetailsTimeCell" bundle:nil] forCellReuseIdentifier:@"MeetingDetailsTimeCell"];
- if (self.meetType == MeetingEndType) {
- self.bottomView.alpha = 0;
- self.bottomView.hidden = YES;
- }
- [self getData];
- [[UtilsTools getWindow] addSubview:self.noteBookShareVC.view];
- }
- - (void)setBottomStatus:(BOOL)hidden
- {
- self.bottomView.hidden = hidden;
- if (hidden) {
- self.view.backgroundColor = [UIColor whiteColor];
- self.bottomConstant.constant = 0.f;
- }else{
- self.view.backgroundColor = [UIColor colorWithRed:234/255.0 green:234/255.0 blue:234/255.0 alpha:1];
- self.bottomConstant.constant = 50.f;
- }
- }
- - (void)getData
- {
- WS(weakSelf);
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(MeetingDetail),(long)self.meetingId];
- [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} success:^(id _Nonnull responseObject) {
- [weakSelf.detailsTabView.mj_header endRefreshing];
- [weakSelf.detailsTabView.mj_footer endRefreshing];
- weakSelf.meetingModel = [MyMeetingListModel modelWithDictionary:responseObject];
- if (weakSelf.meetingModel.Status == 0) {
- weakSelf.meetType = MeetingEndType;
- }else{
- weakSelf.meetType = MeetingWillOpenType;
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- if ([weakSelf.meetingModel.UserId integerValue] == [AppUserModel sharedAppUserModel].Id) {
- [weakSelf setBottomStatus:NO];
- }else{
- [weakSelf setBottomStatus:YES];
- }
- [weakSelf.detailsTabView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
- [weakSelf.detailsTabView.mj_header endRefreshing];
- [weakSelf.detailsTabView.mj_footer endRefreshing];
- }];
- }
- #pragma mark - table delegate
- - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if ([cell respondsToSelector:@selector(setSeparatorInset:)])
- {
- [cell setSeparatorInset:UIEdgeInsetsZero];
- }
- if ([cell respondsToSelector:@selector(setLayoutMargins:)])
- {
- [cell setLayoutMargins:UIEdgeInsetsZero];
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 45.f;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- if (indexPath.row == 1) {
- return self.meetingModel.MeetingTimes.count * 26.f + 18.f;
- }
- // if (indexPath.row == 2) {
- // NSString *address = [NSString stringWithFormat:@"%@ %@",self.meetingModel.Address,self.meetingModel.RoomName];
- // NSDictionary *txtAttribute = @{NSFontAttributeName: [UIFont systemFontOfSize:17]};
- // CGSize retSize = [address boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 100.f, MAXFLOAT)
- // options:\
- // NSStringDrawingTruncatesLastVisibleLine |
- // NSStringDrawingUsesLineFragmentOrigin |
- // NSStringDrawingUsesFontLeading
- // attributes:txtAttribute
- // context:nil].size;
- // return retSize.height + 24.f;
- // }
- if (indexPath.row == 3) {
- //获取实际内容
- NSString *content = self.meetingModel.Description;
- //获取字符串高度
- UILabel * label = [UILabel new];
- label.font = [UIFont systemFontOfSize:16];
- label.text = content;
- label.numberOfLines = 0;
- CGFloat contentHeight = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH - 36, 10)].height;
- //图片应该展示的高度
- CGFloat imageHeight = self.meetingModel.ImageUrl.length > 0 ? (SCREEN_WIDTH - 30.f) * 0.5 : 0;
- CGFloat H = 48.f;
- if (self.meetingModel.ImageUrl.length > 0) {
- H += 15.f;
- }
- if (self.meetingModel.FlowAttachments.count > 0) {
- H += 15.f;
- }
- if (content.length > 0) {
- H += 15.f;
- }
- //添加其他高度
- return (contentHeight + H + imageHeight + self.meetingModel.FlowAttachments.count * 87);
- }
- return UITableViewAutomaticDimension;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- if (self.meetType == MeetingEndType) {
- return 6;
- }
- return 5;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- WS(weakSelf);
- switch (indexPath.row) {
- case 0:{
- HistoricalWorkFlowDetailsTitleCell * cell = (HistoricalWorkFlowDetailsTitleCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsTitleCell" forIndexPath:indexPath];
- [cell.statusBtn setTitle:self.meetingModel.Status == 0 ? @"待开会" : @"已结束" forState:UIControlStateNormal];
- cell.statusBtn.hidden = self.meetType == MeetingEndType ? YES : NO;
- [cell setCellData:self.meetingModel withIndex:indexPath];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- case 1:{
- MeetingDetailsTimeCell * cell = (MeetingDetailsTimeCell *)[tableView dequeueReusableCellWithIdentifier:@"MeetingDetailsTimeCell" forIndexPath:indexPath];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- [cell setCellData:self.meetingModel];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- case 2:{
- HistoricalWorkFlowDetailsTitleCell * cell = [tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsTitleCell" forIndexPath:indexPath];
- [cell setCellData:self.meetingModel withIndex:indexPath];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- case 3:{
- HistoricalWorkFlowDetailsContentCell * cell = (HistoricalWorkFlowDetailsContentCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsContentCell" forIndexPath:indexPath];
- [cell setCellData:self.meetingModel withIndex:indexPath];
- cell.ClickAttrBlock = ^(NSDictionary * _Nonnull dict) {
- [weakSelf pushWithDict:dict];
- };
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- case 4:{
- HistoricalWorkFlowDetailsMoreCell * cell = (HistoricalWorkFlowDetailsMoreCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsMoreCell" forIndexPath:indexPath];
- [cell setCellData:@"参会人员"];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- default:{
- HistoricalWorkFlowDetailsMoreCell * cell = (HistoricalWorkFlowDetailsMoreCell *)[tableView dequeueReusableCellWithIdentifier:@"HistoricalWorkFlowDetailsMoreCell" forIndexPath:indexPath];
- [cell setCellData:@"会议纪要"];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- }
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
- if (indexPath.row == 4) {
- WorkFlowPersonnelListController *controller = [[WorkFlowPersonnelListController alloc] init];
- controller.Id = self.meetingModel.Id;
- [self.navigationController pushViewController:controller animated:YES];
- }
- if (indexPath.row == 5) {
- WorkFlowFecordController * vc = [[WorkFlowFecordController alloc] init];
- vc.meetId = [self.meetingModel.Id integerValue];
- vc.isBack = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- - (void)pushWithDict:(NSDictionary *)dict
- {
- WS(weakSelf);
- NSLog(@"%@",dict);
- switch ([dict[@"SoureTypeId"] integerValue]){
- case CollectModel_Aritle:
- {
- SHOWLOADING
- [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)[dict[@"SoureId"] integerValue]] parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW;
- Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
- HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
- [homeDetail loadCurrentModel:itemModel];
- [weakSelf.navigationController pushViewController:homeDetail animated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- break;
- case CollectModel_Toipc:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Toipc;
- vc.Id = [dict[@"SoureId"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_NewTopic:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.Id = [dict[@"SoureId"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Collect:
- {
- }
- break;
- case CollectModel_NoteBook:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NoteBook;
- vc.Id = [dict[@"SoureId"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Notice:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Notice;
- vc.Id = [dict[@"SoureId"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_InterMail:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_InterMail;
- vc.Id = [dict[@"SoureId"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Group:
- {
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = [dict[@"SoureId"] integerValue];
- vc.titleStr = dict[@"Title"];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetMian:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_meetMian;
- vc.Id = [dict[@"SoureId"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_work:{
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.pageType = Type_ONEC;
- vc.indexId = [dict[@"SoureId"] integerValue];
- vc.title = dict[@"Title"];
- vc.TodoId = [dict[@"SoureId"] integerValue];
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- {
- FlowAttachmentsModel * model = [FlowAttachmentsModel modelWithDictionary:dict];
- DownFileViewController *vc = [[DownFileViewController alloc]init];
- vc.model = model;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- }
- }
- #pragma mark - cancelMeeting
- - (IBAction)cancelMeetingBtn_Click:(id)sender {
- WS(weakSelf);
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认预约会议" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- SHOWLOADING
- [[HttpManager sharedHttpManager] POSTWithUrl:CancelMeeting(self.meetingModel.Id) parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW
- SHOWSUCCESS(@"已取消预约会议");
- if (weakSelf.cancelSussBlock) {
- weakSelf.cancelSussBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [self presentViewController:alertVC animated:YES completion:nil];
- }
- - (IBAction)editMeetingBtn_Click:(id)sender {
- WS(weakSelf);
- WorkFlowOrderController *workFlowOrderController = [[WorkFlowOrderController alloc] initWithRID:[NSString stringWithFormat:@"%ld",(long)self.meetingId]];
- workFlowOrderController.mettingTitle = self.meetingModel.Name;
- workFlowOrderController.meetingModel = self.meetingModel;
- workFlowOrderController.isEdit = YES;
- workFlowOrderController.ChangeSuccessBlock = ^{
- [weakSelf getData];
- };
- [self.navigationController pushViewController:workFlowOrderController animated:YES];
- }
- @end
|