MyApprovalPageDetail.m 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  1. //
  2. // MyApprovalPageDetail.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/4.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyApprovalPageDetail.h"
  9. #import "DrawerView.h"
  10. #import "TabBarController.h"
  11. #import "MyApprovalDetailCell.h"
  12. #import "MyApprovalDetailModel.h"
  13. #import "TDNavigationBar.h"
  14. #import "MyWorkFlowFooterView.h"
  15. #import "GoDisscussView.h"
  16. #import "AgreeApprovalViewControllerSub.h"
  17. #import "DownFileViewController.h"
  18. #import "NextApprovalViewController.h"
  19. #import "MyApprovalFileCell.h"
  20. #import "NoteBookShareVC.h"
  21. #import "MyWorkWordVC.h"
  22. #import "MyTDTopicCreateVC.h"
  23. #import "MyTDGroupViewController.h"
  24. #import "MoveViewController.h"
  25. #import "HomeDetailController.h"
  26. #import "ChatMsgNoticeDetailVC.h"
  27. #import "MyTDTopicDetailVC.h"
  28. #import "TDInterLeterDetailVC.h"
  29. #import "NoteBookDetailVC.h"
  30. #import "TDGroupInfoListVC.h"
  31. #import "WorkFlowDetailsController.h"
  32. #import "ShareListVC.h"
  33. @interface MyApprovalPageDetail ()<UITableViewDelegate,UITableViewDataSource,MyWorkFlowFooterViewDelegate,TDNavigationBarDelegate,NoteBookShareVCDelegate>
  34. @property (nonatomic, strong) TDNavigationBar *myNavigationBar;
  35. @property (nonatomic, strong) UIView *myBackImageView;
  36. @property (nonatomic, strong) TDTableView *mytableView;
  37. @property (nonatomic, strong) MyWorkFlowFooterView *myfooterView2;
  38. @property (nonatomic, strong) MyApprovalDetailModel *currentModel;
  39. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  40. //@property (assign, nonatomic) NSInteger fristStatusIndex;
  41. @property (nonatomic, strong) DrawerView *drawerView;
  42. @end
  43. @implementation MyApprovalPageDetail
  44. - (void)viewDidLoad {
  45. [super viewDidLoad];
  46. self.fd_prefersNavigationBarHidden = YES;
  47. self.view.backgroundColor = UIColorHex(eeeeee);
  48. self.myNavigationBar.titleLabel.text = self.title;
  49. self.myNavigationBar.titleLabel.font = [UIFont systemFontOfSize:19.0];
  50. self.mytableView.backgroundColor = UIColorHex(eeeeee);
  51. [self.view addSubview:self.mytableView];
  52. [self.view addSubview:self.myBackImageView];
  53. [self.view addSubview:self.myNavigationBar];
  54. [self getData];
  55. [[UtilsTools getWindow] addSubview:self.noteBookShareVC.view];
  56. }
  57. #pragma mark - 审核状态决定页面控件展示
  58. - (void)loadCustomFooterFromStatus:(NSString *)stats{
  59. switch (self.pageType) {
  60. case Type_ONEA:
  61. [self loadCustomFooterFromPageTypeA:stats];
  62. break;
  63. case Type_ONEB:
  64. [self loadCustomFooterFromPageTypeB:stats];
  65. break;
  66. case Type_ONEC:
  67. // [self loadCustomFooterFromPageTypeC];
  68. break;
  69. }
  70. }
  71. #pragma mark - 底部按钮视图
  72. - (void)loadCustomFooterFromPageTypeA:(NSString *)stats{
  73. if ([stats isEqualToString:@"Wait"]) {
  74. [self footerVieWhenWaitApproval];
  75. _myfooterView2.agreeView.nameLab.text = @"同意";
  76. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer1");
  77. _myfooterView2.noAgreeView.nameLab.text = @"驳回";
  78. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  79. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  80. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  81. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/3,75);
  82. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  83. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/3 * 2,0,kGXScreenWidth/3,75);
  84. _myfooterView2.agreeView.button.tag = 130;
  85. _myfooterView2.noAgreeView.button.tag = 131;
  86. _myfooterView2.nextAggreView.button.tag = 123;
  87. _myfooterView2.disscusView.hidden = YES;
  88. _myfooterView2.waitView.hidden = YES;
  89. _myfooterView2.noAgreeView.hidden = NO;
  90. _myfooterView2.nextAggreView.hidden = NO;
  91. _myfooterView2.agreeView.hidden = NO;
  92. }else if ([stats isEqualToString:@"Checked"]){
  93. }else if ([stats isEqualToString:@"Meeting"]){
  94. [self footerVieWhenWaitApproval];
  95. _myfooterView2.agreeView.nameLab.text = @"同意";
  96. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer1");
  97. _myfooterView2.noAgreeView.nameLab.text = @"驳回";
  98. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  99. _myfooterView2.waitView.nameLab.text = @"待定";
  100. _myfooterView2.waitView.imageVIew.image = IMG(@"work_footer_wait");
  101. _myfooterView2.disscusView.nameLab.text = @"撤会";
  102. _myfooterView2.disscusView.imageVIew.image = IMG(@"work_footer2");
  103. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  104. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  105. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/5,75);
  106. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/5,0, kGXScreenWidth/5, 75);
  107. _myfooterView2.waitView.frame = CGRectMake(kGXScreenWidth/5*2,0,kGXScreenWidth/5,75);
  108. _myfooterView2.disscusView.frame = CGRectMake(kGXScreenWidth/5*3,0, kGXScreenWidth/5, 75);
  109. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/5*4,0, kGXScreenWidth/5, 75);
  110. _myfooterView2.agreeView.button.tag = 130;
  111. _myfooterView2.noAgreeView.button.tag = 131;
  112. _myfooterView2.disscusView.button.tag = 121;
  113. _myfooterView2.nextAggreView.button.tag = 123;
  114. _myfooterView2.waitView.button.tag = 124;
  115. _myfooterView2.disscusView.hidden = NO;
  116. _myfooterView2.waitView.hidden = NO;
  117. _myfooterView2.noAgreeView.hidden = NO;
  118. _myfooterView2.nextAggreView.hidden = NO;
  119. _myfooterView2.agreeView.hidden = NO;
  120. }else if ([stats isEqualToString:@"Checking"]){
  121. [self footerVieWhenWaitApproval];
  122. _myfooterView2.agreeView.nameLab.text = @"同意";
  123. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer1");
  124. _myfooterView2.noAgreeView.nameLab.text = @"驳回";
  125. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  126. _myfooterView2.disscusView.nameLab.text = @"上会";
  127. _myfooterView2.disscusView.imageVIew.image = IMG(@"work_footer2");
  128. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  129. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  130. _myfooterView2.agreeView.button.tag = 130;
  131. _myfooterView2.noAgreeView.button.tag = 131;
  132. _myfooterView2.disscusView.button.tag = 132;
  133. _myfooterView2.nextAggreView.button.tag = 133;
  134. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/4,75);
  135. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/4,0,kGXScreenWidth/4,75);
  136. _myfooterView2.disscusView.frame = CGRectMake(kGXScreenWidth/4 * 2,0,kGXScreenWidth/4,75);
  137. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/4 * 3,0,kGXScreenWidth/4,75);
  138. _myfooterView2.waitView.hidden = YES;
  139. _myfooterView2.disscusView.hidden = NO;
  140. _myfooterView2.noAgreeView.hidden = NO;
  141. _myfooterView2.nextAggreView.hidden = NO;
  142. _myfooterView2.agreeView.hidden = NO;
  143. }else{///Denied 拒绝
  144. }
  145. }
  146. - (void)loadCustomFooterFromPageTypeB:(NSString *)stats{
  147. if ([stats isEqualToString:@"Wait"]) {
  148. [self footerVieWhenWaitApproval];
  149. _myfooterView2.agreeView.nameLab.text = @"催办";
  150. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer7");
  151. _myfooterView2.noAgreeView.nameLab.text = @"撤销";
  152. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer9");
  153. _myfooterView2.nextAggreView.nameLab.text = @"重新提交";
  154. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  155. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/3,75);
  156. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  157. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/3 + kGXScreenWidth/3-30,0,kGXScreenWidth/3,75);
  158. _myfooterView2.agreeView.button.tag = 220;
  159. _myfooterView2.noAgreeView.button.tag = 221;
  160. _myfooterView2.nextAggreView.button.tag = 223;
  161. _myfooterView2.disscusView.hidden = YES;
  162. _myfooterView2.waitView.hidden = YES;
  163. _myfooterView2.noAgreeView.hidden = NO;
  164. _myfooterView2.nextAggreView.hidden = NO;
  165. _myfooterView2.agreeView.hidden = NO;
  166. }else if ([stats isEqualToString:@"Checked"]){
  167. [self footerVieWhenWaitApproval];
  168. _myfooterView2.agreeView.nameLab.text = @"下载";
  169. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer6");
  170. _myfooterView2.noAgreeView.hidden = YES;
  171. _myfooterView2.disscusView.hidden = YES;
  172. _myfooterView2.waitView.hidden = YES;
  173. _myfooterView2.nextAggreView.hidden = YES;
  174. _myfooterView2.agreeView.hidden = NO;
  175. _myfooterView2.agreeView.button.tag = 200;
  176. }else if ([stats isEqualToString:@"Meeting"]){
  177. [self footerVieWhenWaitApproval];
  178. _myfooterView2.agreeView.nameLab.text = @"催办";
  179. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer7");
  180. _myfooterView2.noAgreeView.nameLab.text = @"撤销";
  181. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer9");
  182. _myfooterView2.nextAggreView.nameLab.text = @"重新提交";
  183. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  184. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/3,75);
  185. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  186. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/3 * 2,0,kGXScreenWidth/3,75);
  187. _myfooterView2.agreeView.button.tag = 220;
  188. _myfooterView2.noAgreeView.button.tag = 221;
  189. _myfooterView2.disscusView.hidden = YES;
  190. _myfooterView2.waitView.hidden = YES;
  191. _myfooterView2.agreeView.hidden = NO;
  192. _myfooterView2.noAgreeView.hidden = NO;
  193. _myfooterView2.nextAggreView.hidden = NO;
  194. _myfooterView2.nextAggreView.button.tag = 223;
  195. }else if ([stats isEqualToString:@"Checking"]){
  196. [self footerVieWhenWaitApproval];
  197. _myfooterView2.agreeView.nameLab.text = @"催办";
  198. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer7");
  199. _myfooterView2.noAgreeView.nameLab.text = @"撤销";
  200. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer9");
  201. _myfooterView2.nextAggreView.nameLab.text = @"重新提交";
  202. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"重新加载");
  203. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/3,75);
  204. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  205. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/3 * 2,0,kGXScreenWidth/3,75);
  206. _myfooterView2.disscusView.hidden = YES;
  207. _myfooterView2.waitView.hidden = YES;
  208. _myfooterView2.agreeView.hidden = NO;
  209. _myfooterView2.noAgreeView.hidden = NO;
  210. _myfooterView2.nextAggreView.hidden = NO;
  211. _myfooterView2.agreeView.button.tag = 230;
  212. _myfooterView2.noAgreeView.button.tag = 231;
  213. _myfooterView2.nextAggreView.button.tag = 233;
  214. }else{///Denied 拒绝
  215. [self footerVieWhenWaitApproval];
  216. _myfooterView2.agreeView.nameLab.text = @"下载";
  217. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer6");
  218. _myfooterView2.noAgreeView.hidden = YES;
  219. _myfooterView2.waitView.hidden = YES;
  220. _myfooterView2.disscusView.hidden = YES;
  221. _myfooterView2.nextAggreView.hidden = NO;
  222. _myfooterView2.agreeView.hidden = NO;
  223. _myfooterView2.nextAggreView.nameLab.text = @"重新提交";
  224. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer8");
  225. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/3,75);
  226. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/3 * 2,0,kGXScreenWidth/3,75);
  227. _myfooterView2.agreeView.button.tag = 200;
  228. _myfooterView2.nextAggreView.button.tag = 203;
  229. }
  230. }
  231. - (void)loadCustomFooterFromPageTypeC{
  232. [self footerVieWhenWaitApproval];
  233. }
  234. - (void)footerVieWhenWaitApproval{
  235. _mytableView.frame = CGRectMake(0,kNavigationHeight,kGXScreenWidth, kGXScreenHeigh - kNavigationHeight-75) ;
  236. self.myfooterView2.frame = CGRectMake(0,kGXScreenHeigh - 75, kGXScreenWidth, 75);
  237. [self.view addSubview:self.myfooterView2];
  238. }
  239. - (void)footButtonHander:(UIButton *)sender{
  240. }
  241. #pragma mark - 导航栏事件处理
  242. -(void)back{
  243. if (self.navigationController.viewControllers.count > 1) {
  244. [self.navigationController popViewControllerAnimated:YES];
  245. }else{
  246. [self dismissViewControllerAnimated:YES completion:nil];
  247. }
  248. }
  249. #pragma mark - UITableViewDelegate,UITableViewDataSource
  250. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  251. return 4;
  252. }
  253. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  254. if (section == 0) {
  255. return 1;
  256. }
  257. if (section == 1) {
  258. return self.currentModel.FlowAttachments.count > 0 ? self.currentModel.FormFields.count + 1 : self.currentModel.FormFields.count;
  259. }
  260. if (section == 2) {
  261. return 1 + self.currentModel.Nodes.count;
  262. }
  263. if (section == 3) {
  264. return 1;
  265. }
  266. return 1;
  267. }
  268. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  269. switch (indexPath.section) {
  270. case 0:
  271. return 180;
  272. break;
  273. case 1:{
  274. if (indexPath.row == self.currentModel.FormFields.count) {
  275. return self.currentModel.FlowAttachments.count > 0 ? 140 : 0.01f;
  276. }
  277. FormFieldsModel * formFieldsModel = self.currentModel.FormFields[indexPath.row];
  278. if ([formFieldsModel.Type isEqualToString:@"Number"] || [formFieldsModel.Type isEqualToString:@"Currency"] || [formFieldsModel.Type isEqualToString:@"DateTime"] || [formFieldsModel.Type isEqualToString:@"Radio"])//单行文本
  279. {
  280. if (self.currentModel.FlowAttachments.count == 0 && indexPath.row == self.currentModel.FormFields.count - 1) {
  281. return 50.f;
  282. }
  283. return 40;
  284. }
  285. else if ([formFieldsModel.Type isEqualToString:@"Text"])//单行文本
  286. {
  287. UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH - 112.5, 10)];
  288. label.numberOfLines = 0;
  289. label.text = formFieldsModel.Value;
  290. CGSize maxSize = CGSizeMake(label.frame.size.width, CGFLOAT_MAX);
  291. CGSize newSize = [label sizeThatFits:maxSize];
  292. if (self.currentModel.FlowAttachments.count == 0 && indexPath.row == self.currentModel.FormFields.count - 1) {
  293. return newSize.height + 30;
  294. }
  295. return newSize.height + 20;
  296. }
  297. else if ([formFieldsModel.Type isEqualToString:@"TextArea"])//多行文本
  298. {
  299. return formFieldsModel.getCellHeight;
  300. }
  301. else if ([formFieldsModel.Type isEqualToString:@"Picture"])//图片
  302. {
  303. return 120;
  304. }
  305. return 0.01;
  306. }break;
  307. case 2:
  308. {
  309. if (indexPath.row == 0) {
  310. return 40;
  311. }else{
  312. NodesModel * model = self.currentModel.Nodes[indexPath.row - 1];
  313. UILabel * label = [UILabel new];
  314. label.numberOfLines = 0;
  315. label.text = [NSString stringWithFormat:@"审批意见:%@",model.Message];
  316. label.font = [UIFont systemFontOfSize:12];
  317. CGSize size = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH - 85, 15)];
  318. if (model.Message.length > 0) {
  319. return 70 + (size.height > 15 ? size.height : 15);
  320. }else{
  321. return 70;
  322. }
  323. }
  324. }break;
  325. default:
  326. {
  327. NSString * title = [NSString stringWithFormat:@"抄送人:%@",self.currentModel.CarbonCopies.length > 0 ? self.currentModel.CarbonCopies : @"无"];
  328. UILabel * label = [UILabel new];
  329. label.numberOfLines = 0;
  330. label.text = title;
  331. label.font = [UIFont systemFontOfSize:16];
  332. CGFloat H = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH - 30, 10)].height;
  333. return H + 10;
  334. }
  335. break;
  336. }
  337. }
  338. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  339. WS(weakSelf);
  340. if (indexPath.section == 0) {
  341. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:1];
  342. [cell loadDetailData: self.currentModel];
  343. return cell;
  344. }else if (indexPath.section == 1) {
  345. if (indexPath.row == self.currentModel.FormFields.count) {
  346. MyApprovalFileCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyApprovalFileCell"];
  347. [cell loadFile:@"附件" forWithImageArray:self.currentModel.FlowAttachments];
  348. cell.ClickCellModelBlock = ^(FlowAttachmentsModel * model) {
  349. [weakSelf pushFileOpenWithModel:model];
  350. };
  351. return cell;
  352. }
  353. FormFieldsModel * formFieldsModel = self.currentModel.FormFields[indexPath.row];
  354. if ([formFieldsModel.Type isEqualToString:@"Radio"] || [formFieldsModel.Type isEqualToString:@"Number"] || [formFieldsModel.Type isEqualToString:@"Currency"] || [formFieldsModel.Type isEqualToString:@"DateTime"] )//单行文本
  355. {
  356. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:6];
  357. [cell loadTextCellKey:formFieldsModel.Label withValue:formFieldsModel.Value];
  358. return cell;
  359. }
  360. else if ([formFieldsModel.Type isEqualToString:@"Text"] )//多行文本
  361. {
  362. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:6];
  363. [cell loadTextCellKey:formFieldsModel.Label withValue:formFieldsModel.Value];
  364. return cell;
  365. }
  366. else if ([formFieldsModel.Type isEqualToString:@"TextArea"] )//多行文本
  367. {
  368. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:9];
  369. [cell loadMutbleTextCellKey:formFieldsModel.Label withValue:formFieldsModel.Value];
  370. return cell;
  371. }else{
  372. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:6];
  373. cell.contentView.hidden = YES;
  374. // [cell loadTextCellKey:@"提交时间" withValue:self.currentModel.CreatedDate];
  375. return cell;
  376. }
  377. }else if (indexPath.section == 2) {
  378. if (indexPath.row == 0){
  379. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:8];
  380. cell.nameLabel8.text = @"审批流程";
  381. return cell;
  382. }else{
  383. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:7];
  384. if (self.currentModel.Nodes.count > 0) {
  385. [cell loadApprovalData:self.currentModel.Nodes[indexPath.row - 1]];
  386. if (indexPath.row == 1) {
  387. cell.topLineView.hidden = YES;
  388. }
  389. if (indexPath.row == self.currentModel.Nodes.count) {
  390. cell.bottomLineView.hidden = YES;
  391. }
  392. }
  393. return cell;
  394. }
  395. }else{
  396. MyApprovalDetailCell *cell = [MyApprovalDetailCell cellWithTableView:tableView AndIndex:8];
  397. cell.nameLabel8.numberOfLines = 0;
  398. cell.nameLabel8.text = [NSString stringWithFormat:@"抄送人:%@",self.currentModel.CarbonCopies.length > 0 ? self.currentModel.CarbonCopies : @"无"];
  399. return cell;
  400. }
  401. return nil;
  402. }
  403. - (void)pushFileOpenWithModel:(FlowAttachmentsModel *)model
  404. {
  405. WS(weakSelf);
  406. if (model.SoureId == 0) {
  407. model.SoureId = model.Id;
  408. }
  409. switch (model.SoureTypeId) {
  410. case CollectModel_Aritle:
  411. {
  412. SHOWLOADING
  413. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.SoureId] parameters:@{} success:^(id _Nonnull responseObject) {
  414. REMOVESHOW;
  415. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  416. // HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  417. // [homeDetail loadCurrentModel:itemModel];
  418. // [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  419. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  420. vc.type = CollectModel_Aritle;
  421. vc.Id = itemModel.Id;
  422. [weakSelf.navigationController pushViewController:vc animated:YES];
  423. } failure:^(NSError * _Nonnull error) {
  424. SHOWERROR([ZYCTool handerResultData:error]);
  425. }];
  426. }
  427. break;
  428. case CollectModel_Toipc:
  429. {
  430. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  431. vc.type = CollectModel_Toipc;
  432. vc.Id = model.SoureId;
  433. [self.navigationController pushViewController:vc animated:YES];
  434. }
  435. break;
  436. case CollectModel_NewTopic:
  437. {
  438. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  439. vc.type = CollectModel_NewTopic;
  440. vc.Id = model.SoureId;
  441. [self.navigationController pushViewController:vc animated:YES];
  442. }
  443. break;
  444. case CollectModel_Collect:
  445. {
  446. }
  447. break;
  448. case CollectModel_NoteBook:
  449. {
  450. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  451. vc.type = CollectModel_NoteBook;
  452. vc.Id = model.SoureId;
  453. [self.navigationController pushViewController:vc animated:YES];
  454. }
  455. break;
  456. case CollectModel_Notice:
  457. {
  458. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  459. vc.type = CollectModel_Notice;
  460. vc.Id = model.SoureId;
  461. [self.navigationController pushViewController:vc animated:YES];
  462. }
  463. break;
  464. case CollectModel_InterMail:
  465. {
  466. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  467. vc.type = CollectModel_InterMail;
  468. vc.Id = model.SoureId;
  469. [self.navigationController pushViewController:vc animated:YES];
  470. }
  471. break;
  472. case CollectModel_Group:
  473. {
  474. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  475. vc.GroupId = model.SoureId;
  476. vc.titleStr = model.Title;
  477. [self.navigationController pushViewController:vc animated:YES];
  478. }
  479. break;
  480. case CollectModel_meetMian:
  481. {
  482. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  483. vc.type = CollectModel_meetMian;
  484. vc.Id = model.SoureId;
  485. [self.navigationController pushViewController:vc animated:YES];
  486. }
  487. break;
  488. case CollectModel_meetDetail:
  489. {
  490. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.SoureId];
  491. [self.navigationController pushViewController:vc animated:YES];
  492. }
  493. break;
  494. case CollectModel_work:
  495. {
  496. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  497. vc.pageType = Type_ONEC;
  498. vc.indexId = model.SoureId;
  499. vc.title = model.Title;
  500. vc.TodoId = self.currentModel.TodoId;
  501. [self.navigationController pushViewController:vc animated:YES];
  502. }
  503. break;
  504. default:
  505. {
  506. DownFileViewController *vc = [[DownFileViewController alloc]init];
  507. vc.model = model;
  508. [self.navigationController pushViewController:vc animated:YES];
  509. }
  510. break;
  511. }
  512. }
  513. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  514. if (indexPath.section == 1){
  515. FormFieldsModel * formFieldsModel = self.currentModel.FormFields[indexPath.row];
  516. if ([formFieldsModel.Type isEqualToString:@"Attachment"])//附件
  517. {
  518. NSLog(@"%@",formFieldsModel.paraImage);
  519. }
  520. }
  521. }
  522. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  523. return section == 2 ? 1 : 20;
  524. }
  525. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  526. return 0.01f;
  527. }
  528. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  529. UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 1)];
  530. view.backgroundColor = [UIColor clearColor];
  531. return view;
  532. }
  533. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  534. UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, section == 2 ? 1 :20)];
  535. view.backgroundColor = [UIColor clearColor];
  536. return view;
  537. }
  538. - (void)rightButtonAction:(TDButton *)sender{
  539. [self.noteBookShareVC initNoteBookShareData];
  540. // self.noteBookShareVC.isWork = YES;
  541. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  542. }
  543. - (NoteBookShareVC *)noteBookShareVC{
  544. if (_noteBookShareVC == nil) {
  545. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  546. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  547. [_noteBookShareVC.view setHidden:YES];
  548. _noteBookShareVC.delegate = self;
  549. }
  550. return _noteBookShareVC;
  551. }
  552. #pragma mark - 分享
  553. -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
  554. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  555. if ([typeName isEqualToString:@"发给微信好友"]) {
  556. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.title desc:[NSString stringWithFormat:@"来自-%@",self.currentModel.UserName] url:[NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.indexId]];
  557. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  558. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.title desc:[NSString stringWithFormat:@"来自-%@",self.currentModel.UserName] url:[NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.indexId]];
  559. }else if ([typeName isEqualToString:@"发到微博"]){
  560. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.title desc:[NSString stringWithFormat:@"来自-%@",self.currentModel.UserName] url:[NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.indexId]];
  561. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  562. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.title desc:[NSString stringWithFormat:@"来自-%@",self.currentModel.UserName] url:[NSString stringWithFormat:@"%@%ld",ShareHost(@"mobile/approvalWx?"),(long)self.indexId]];
  563. }else if ([typeName isEqualToString:@"发到消息"]){
  564. [self returnToMessage];
  565. }else if ([typeName isEqualToString:@"发到小组"]){
  566. [self returnToGroup];
  567. }else if ([typeName isEqualToString:@"发到笔记"]){
  568. [self returnToNote];
  569. }else if ([typeName isEqualToString:@"发到话题"]){
  570. [self returnToTopic];
  571. }else{
  572. }
  573. }
  574. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  575. {
  576. //创建分享消息对象
  577. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  578. messageObject.title = title;
  579. //创建网页内容对象
  580. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:[UIImage imageNamed:@"审批"]];
  581. //设置网页地址
  582. shareObject.webpageUrl = url;
  583. //分享消息对象设置分享内容对象
  584. messageObject.shareObject = shareObject;
  585. //调用分享接口
  586. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  587. if (error) {
  588. NSLog(@"************Share fail with error %@*********",error);
  589. }else{
  590. NSLog(@"response data is %@",data);
  591. }
  592. }];
  593. }
  594. - (void)returnToMessage
  595. {
  596. ShareListVC * vc = [ShareListVC initShareListVC];
  597. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  598. model.SoureId = self.indexId;
  599. model.SoureTypeId = CollectModel_work;
  600. model.Title = self.title;
  601. model.Author = self.currentModel.UserName;
  602. vc.sendModel = model;
  603. vc.isReturn = YES;
  604. [self.navigationController pushViewController:vc animated:YES];
  605. }
  606. - (void)returnToGroup
  607. {
  608. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  609. vc.type = CollectModel_Group;
  610. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  611. model.SoureId = self.indexId;
  612. model.SoureTypeId = CollectModel_work;
  613. model.Title = self.title;
  614. model.Author = self.currentModel.UserName;
  615. vc.sendModel = model;
  616. vc.isReturn = YES;
  617. [self.navigationController pushViewController:vc animated:YES];
  618. }
  619. - (void)returnToNote
  620. {
  621. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  622. vc.type = CollectModel_NoteBook;
  623. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  624. model.SoureId = self.indexId;
  625. model.SoureTypeId = CollectModel_work;
  626. model.Title = self.title;
  627. model.Author = self.currentModel.UserName;
  628. vc.sendModel = model;
  629. vc.isReturn = YES;
  630. [self.navigationController pushViewController:vc animated:YES];
  631. }
  632. - (void)returnToTopic
  633. {
  634. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  635. vc.type = CollectModel_NewTopic;
  636. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  637. model.SoureId = self.indexId;
  638. model.SoureTypeId = CollectModel_work;
  639. model.Title = self.title;
  640. model.Author = self.currentModel.UserName;
  641. vc.sendModel = model;
  642. vc.isReturn = YES;
  643. [self.navigationController pushViewController:vc animated:YES];
  644. }
  645. #pragma mark - setter
  646. - (TDTableView *)mytableView{
  647. if (!_mytableView) {
  648. _mytableView = [[TDTableView alloc]init];
  649. _mytableView.frame = CGRectMake(0,kNavigationHeight,kGXScreenWidth, kGXScreenHeigh - kNavigationHeight - kiphoneXBootomHeight);
  650. _mytableView.delegate = self;
  651. _mytableView.dataSource = self;
  652. _mytableView.sectionHeaderHeight = 0;
  653. // [_mytableView registerNib:[UINib nibWithNibName:@"MyApprovalBCell" bundle:nil] forCellReuseIdentifier:@"MyApprovalBCell"];
  654. [_mytableView registerNib:[UINib nibWithNibName:@"MyApprovalFileCell" bundle:nil] forCellReuseIdentifier:@"MyApprovalFileCell"];
  655. }
  656. return _mytableView;
  657. }
  658. - (MyWorkFlowFooterView *)myfooterView2{
  659. if (!_myfooterView2) {
  660. _myfooterView2 = [[MyWorkFlowFooterView alloc]initWithFrame:CGRectMake(0,kGXScreenHeigh - 75, kGXScreenWidth, 75)];
  661. _myfooterView2.agreeView.nameLab.text = @"同意";
  662. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer1");
  663. _myfooterView2.noAgreeView.nameLab.text = @"驳回";
  664. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  665. _myfooterView2.disscusView.nameLab.text = @"上会";
  666. _myfooterView2.disscusView.imageVIew.image = IMG(@"work_footer2");
  667. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  668. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  669. _myfooterView2.delegate = self;
  670. }
  671. return _myfooterView2;
  672. }
  673. - (TDNavigationBar *)myNavigationBar{
  674. if (!_myNavigationBar) {
  675. _myNavigationBar = [[TDNavigationBar alloc]initNavigationBar];
  676. _myNavigationBar.delegate = self;
  677. _myNavigationBar.backButton2.hidden = NO;
  678. _myNavigationBar.titleLabel.textColor = UIColorHex(#FFFFFF);
  679. _myNavigationBar.titleLabel.font = [UIFont systemFontOfSize:19.f];
  680. [_myNavigationBar.backButton2 setImage:IMG(@"快捷跳转") forState:UIControlStateNormal];
  681. [_myNavigationBar.backButton setImage:IMG(@"工作_返回") forState:UIControlStateNormal];
  682. _myNavigationBar.rightButton.hidden = NO;
  683. [_myNavigationBar.rightButton setImage:IMG(@"shareWhile") forState:UIControlStateNormal];
  684. }
  685. return _myNavigationBar;
  686. }
  687. - (UIView *)myBackImageView{
  688. if (!_myBackImageView) {
  689. _myBackImageView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kGXScreenHeigh, kNavigationHeight)];
  690. _myBackImageView.backgroundColor = [UIColor colorWithRed:92/255.0 green:118.0/255.0 blue:167.0/255.f alpha:1.0];
  691. }
  692. return _myBackImageView;
  693. }
  694. - (void)backButtonAction {
  695. [self back];
  696. }
  697. - (void)backButtonAction2:(UIButton *)sender {
  698. [self secondBarButtonItems];
  699. }
  700. - (void)secondBarButtonItems{
  701. [self.view endEditing:YES];
  702. [[UtilsTools getWindow] addSubview:self.drawerView];
  703. WS(weakSelf);
  704. self.drawerView.SelectDrawerBlock = ^(NSIndexPath * _Nonnull indexPath) {
  705. if (![weakSelf.tabBarController isKindOfClass:[TabBarController class]]) {
  706. [TabBarController sharedTabBarController].tabBar.hidden = NO;
  707. [weakSelf.tabBarController.navigationController popViewControllerAnimated:NO];
  708. }
  709. if ([weakSelf.navigationController.viewControllers count] > 1) {
  710. [weakSelf.navigationController popToRootViewControllerAnimated:NO];
  711. }
  712. switch (indexPath.section) {
  713. case 0:
  714. {
  715. [[TabBarController sharedTabBarController] setSelectedIndex:indexPath.row];
  716. }
  717. break;
  718. case 1:
  719. {
  720. switch (indexPath.row) {
  721. case 0:
  722. {
  723. [[TabBarController sharedTabBarController] setSelectedIndex:2];
  724. }
  725. break;
  726. case 1:
  727. {
  728. [[TabBarController sharedTabBarController] setSelectedIndex:2];
  729. }
  730. break;
  731. default:
  732. {
  733. [[TabBarController sharedTabBarController] setSelectedIndex:3];
  734. }
  735. break;
  736. }
  737. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  738. [[NSNotificationCenter defaultCenter] postNotificationName:DRAWERPUSHVC object:nil userInfo:@{VCINDEX:@(indexPath.row)}];
  739. });
  740. }
  741. break;
  742. default:
  743. {
  744. [[TabBarController sharedTabBarController] setSelectedIndex:3];
  745. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  746. [[NSNotificationCenter defaultCenter] postNotificationName:DRAWERPUSHVC object:nil userInfo:@{VCINDEX:@(4 + indexPath.row)}];
  747. });
  748. }
  749. break;
  750. }
  751. };
  752. self.drawerView.frame = CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT);// - kNavigationHeight
  753. }
  754. - (MyApprovalDetailModel *)currentModel{
  755. if (!_currentModel) {
  756. _currentModel = [[MyApprovalDetailModel alloc] init];
  757. }
  758. return _currentModel;
  759. }
  760. #pragma mark - 审批操作事件处理
  761. - (void)didMyWorkFlowFooterViewBack:(NSInteger)index {
  762. if (index == 130){ //同意
  763. [self aggreeApprovalHander:@"审批意见"];
  764. }
  765. if (index == 131 ){ //驳回
  766. [self refuseApproval];
  767. }
  768. if (index == 132){// 上会
  769. [self goDisscuss];
  770. }
  771. if (index == 133 || index == 123){// 转审
  772. [self goNextApproval:@"转审"];
  773. }
  774. if (index == 120){//会议结论
  775. [self goDisscusText];
  776. }
  777. if (index == 121){// 撤销上会
  778. [self deleteDiscussText];
  779. }
  780. if (index == 200 || index == 210){//下载
  781. [self dowonLoadAddFile];
  782. }
  783. if (index == 203|| index == 223 || index == 233){//重新提交
  784. [self secondCommit];
  785. }
  786. if (index == 220 || index == 230){//催办
  787. [self goWorkWork];
  788. }
  789. if (index == 221 ||index == 231){//撤销
  790. [self deleteApproval];
  791. }
  792. if (index == 124){//待定
  793. [self waitDisscuss];
  794. }
  795. }
  796. ///同意
  797. - (void)aggreeApprovalHander:(NSString *)titleName{
  798. AgreeApprovalViewControllerSub * agreeApprovalViewControllerSub = [[AgreeApprovalViewControllerSub alloc] init];
  799. agreeApprovalViewControllerSub.title = titleName;
  800. agreeApprovalViewControllerSub.TodoId = self.currentModel.TodoId;
  801. agreeApprovalViewControllerSub.FlowId = self.indexId;
  802. agreeApprovalViewControllerSub.IsChecked = YES;
  803. [agreeApprovalViewControllerSub setActionSussBlock:self.ActionSussBlock];
  804. [self.navigationController pushViewController:agreeApprovalViewControllerSub animated:YES];
  805. }
  806. ///驳回
  807. - (void)refuseApproval{
  808. AgreeApprovalViewControllerSub * agreeApprovalViewControllerSub = [[AgreeApprovalViewControllerSub alloc] init];
  809. agreeApprovalViewControllerSub.title = @"审批意见";
  810. agreeApprovalViewControllerSub.TodoId = self.currentModel.TodoId;
  811. agreeApprovalViewControllerSub.FlowId = self.indexId;
  812. agreeApprovalViewControllerSub.IsChecked = NO;
  813. [agreeApprovalViewControllerSub setActionSussBlock:self.ActionSussBlock];
  814. [self.navigationController pushViewController:agreeApprovalViewControllerSub animated:YES];
  815. }
  816. ///上会
  817. - (void)goDisscuss{
  818. SHOWLOADING
  819. WEAKSELF
  820. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalMetting_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  821. if (weakSelf.ActionSussBlock) {
  822. weakSelf.ActionSussBlock();
  823. }
  824. REMOVESHOW
  825. SHOWERROR2(@"已提交上会申请");
  826. [weakSelf.navigationController popViewControllerAnimated:YES];
  827. } failure:^(NSError * _Nonnull error) {
  828. SHOWERROR([ZYCTool handerResultData:error]);
  829. }];
  830. }
  831. ///待定
  832. - (void)waitDisscuss{
  833. SHOWLOADING
  834. WEAKSELF
  835. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,@"/api/app/flow/action/wait"] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  836. REMOVESHOW
  837. if (weakSelf.ActionSussBlock) {
  838. weakSelf.ActionSussBlock();
  839. }
  840. [weakSelf.navigationController popViewControllerAnimated:YES];
  841. } failure:^(NSError * _Nonnull error) {
  842. SHOWERROR([ZYCTool handerResultData:error]);
  843. }];
  844. }
  845. /// 催办成功页面处理
  846. -(void)goDisscussSuccess{
  847. _myfooterView2.agreeView.nameLab.text = @"会议结论";
  848. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer5");
  849. _myfooterView2.noAgreeView.nameLab.text = @"撤销上会";
  850. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  851. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  852. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  853. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/3,75);
  854. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  855. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/3 + kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  856. _myfooterView2.disscusView.hidden = YES;
  857. _myfooterView2.agreeView.button.tag = 120;
  858. _myfooterView2.noAgreeView.button.tag = 121;
  859. _myfooterView2.disscusView.button.tag = 122;
  860. _myfooterView2.nextAggreView.button.tag = 123;
  861. }
  862. ///转审
  863. - (void)goNextApproval:(NSString *)titleName{
  864. NextApprovalViewController * nextApprovalViewController = [[NextApprovalViewController alloc]init];
  865. nextApprovalViewController.title = @"审批";
  866. nextApprovalViewController.userIds = @[@(self.userId),@([AppUserModel sharedAppUserModel].Id)];
  867. nextApprovalViewController.TodoId = self.currentModel.TodoId;
  868. [nextApprovalViewController setActionSussBlock:self.ActionSussBlock];
  869. [self.navigationController pushViewController:nextApprovalViewController animated:YES];
  870. }
  871. ///会议结论
  872. - (void)goDisscusText{
  873. [self aggreeApprovalHander:@"审批意见"];
  874. }
  875. ///撤销上会
  876. - (void)deleteDiscussText{
  877. SHOWLOADING
  878. WEAKSELF
  879. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalCancelMetting_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  880. // NSData *strData = responseObject;
  881. // NSString *nameStr = [[NSString alloc]initWithData:strData encoding:NSUTF8StringEncoding];
  882. // NSLog(@"解析数据 ====%@",nameStr);
  883. SHOWERROR2(@"撤销上会");
  884. if (self.ActionSussBlock) {
  885. self.ActionSussBlock();
  886. }
  887. REMOVESHOW
  888. [weakSelf updateDisscussUI];
  889. } failure:^(NSError * _Nonnull error) {
  890. SHOWERROR([ZYCTool handerResultData:error]);
  891. }];
  892. }
  893. - (void)updateDisscussUI{
  894. _myfooterView2.agreeView.button.tag = 130;
  895. _myfooterView2.noAgreeView.button.tag = 131;
  896. _myfooterView2.disscusView.button.tag = 132;
  897. _myfooterView2.nextAggreView.button.tag = 133;
  898. _myfooterView2.agreeView.nameLab.text = @"同意";
  899. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer1");
  900. _myfooterView2.noAgreeView.nameLab.text = @"驳回";
  901. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  902. _myfooterView2.disscusView.nameLab.text = @"上会";
  903. _myfooterView2.disscusView.imageVIew.image = IMG(@"work_footer2");
  904. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  905. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  906. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/4,75);
  907. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/4,0,kGXScreenWidth/4,75);
  908. _myfooterView2.disscusView.frame = CGRectMake(kGXScreenWidth/2,0,kGXScreenWidth/4,75);
  909. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/4 +kGXScreenWidth/4 + kGXScreenWidth/4,0,kGXScreenWidth/4,75);
  910. _myfooterView2.agreeView.hidden = NO;
  911. _myfooterView2.noAgreeView.hidden = NO;
  912. _myfooterView2.disscusView.hidden = NO;
  913. _myfooterView2.nextAggreView.hidden = NO;
  914. _myfooterView2.waitView.hidden = YES;
  915. }
  916. ///下载
  917. - (void)dowonLoadAddFile{
  918. SHOWLOADING
  919. WEAKSELF
  920. // NSString *homePath = NSHomeDirectory();
  921. // //document目录
  922. // NSString *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
  923. // //library目录
  924. // NSString *libraryPath = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES).firstObject;
  925. // //caches目录
  926. // NSString *cachesPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
  927. // //application support目录
  928. // NSString *applicationSupportPath = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES).firstObject;
  929. // //preference目录
  930. // NSString *preferencePath = NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSUserDomainMask, YES).firstObject;
  931. //tem目录
  932. NSString *temPath = NSTemporaryDirectory();
  933. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalDownLoad_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  934. STRONGSELF
  935. NSLog(@"已下载 ====%@",responseObject);
  936. REMOVESHOW
  937. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  938. model.Url = responseObject[@"DownloadUrl"];
  939. model.MinUrl = responseObject[@"PreviewUrl"];
  940. model.SoureTypeId = CollectModel_file;
  941. model.SoureId = weakSelf.indexId;
  942. model.Id = weakSelf.indexId;
  943. model.Title = [NSString stringWithFormat:@"%@.doc",weakSelf.title];
  944. [strongSelf downSucces:model];
  945. [[HttpManager sharedHttpManager] downloadUrl:model.Url downloadFilePath:temPath success:^(id _Nonnull responseObject) {
  946. } failure:^(NSError * _Nonnull error) {
  947. }];
  948. } failure:^(NSError * _Nonnull error) {
  949. SHOWERROR([ZYCTool handerResultData:error]);
  950. }];
  951. }
  952. - (void)downSucces:(FlowAttachmentsModel *)model{
  953. DownFileViewController *downFileViewController = [[DownFileViewController alloc]init];
  954. downFileViewController.model = model;
  955. [self.navigationController pushViewController:downFileViewController animated:YES];
  956. }
  957. ///重新提交
  958. - (void)secondCommit{
  959. WS(weakSelf);
  960. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"重新提交后,当前审批单将自动撤销,确定继续?" preferredStyle:UIAlertControllerStyleAlert];
  961. UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  962. //需要先把数据传递到编辑界面
  963. MyWorkWordVC *myWorkWordVC = [[MyWorkWordVC alloc] init];
  964. myWorkWordVC.pageType = Type_GongWen;
  965. myWorkWordVC.detailsModel = weakSelf.currentModel;
  966. myWorkWordVC.Id = weakSelf.indexId;
  967. myWorkWordVC.title = weakSelf.currentModel.Name;
  968. myWorkWordVC.indexID = weakSelf.currentModel.ProcessId;
  969. [weakSelf.navigationController pushViewController:myWorkWordVC animated:YES];
  970. }];
  971. UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  972. }];
  973. [alert addAction:actionYes];
  974. [alert addAction:actionNo];
  975. [self presentViewController:alert animated:YES completion:^{
  976. }];
  977. }
  978. ///催办
  979. - (void)goWorkWork{
  980. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalComeon_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  981. NSData *strData = responseObject;
  982. NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:strData options:NSJSONReadingMutableLeaves error:nil];
  983. if ([jsonDict[@"Value"] boolValue]) {
  984. SHOWWAIT(@"已提醒对方查看,请耐心等待")
  985. }else{
  986. SHOWSUCCESS(@"已催办")
  987. }
  988. // if (self.ActionSussBlock) {
  989. // self.ActionSussBlock();
  990. // }
  991. } failure:^(NSError * _Nonnull error) {
  992. SHOWERROR([ZYCTool handerResultData:error]);
  993. }];
  994. }
  995. ///撤销
  996. - (void)deleteApproval{
  997. WS(weakSelf);
  998. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"确定继续撤销申请?" preferredStyle:UIAlertControllerStyleAlert];
  999. UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1000. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Flow_Action_Recall),(long)self.indexId];
  1001. [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1002. if (weakSelf.ActionSussBlock) {
  1003. weakSelf.ActionSussBlock();
  1004. }
  1005. [weakSelf.navigationController popViewControllerAnimated:YES];
  1006. SHOWSUCCESS(@"撤销成功")
  1007. } failure:^(NSError * _Nonnull error) {
  1008. SHOWSUCCESS(@"撤销失败,稍候再试")
  1009. }];
  1010. // [[HttpManager sharedHttpManager] DeleteUrl:[NSString stringWithFormat:@"%@%@/%ld",BaseUrl,WorkFlowAddApproval_Post,(long)self.indexId] parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1011. // if (self.ActionSussBlock) {
  1012. // self.ActionSussBlock();
  1013. // }
  1014. // [self.navigationController popViewControllerAnimated:YES];
  1015. // SHOWSUCCESS(@"撤销成功")
  1016. // } failure:^(NSError * _Nonnull error) {
  1017. // SHOWSUCCESS(@"撤销失败,稍候再试")
  1018. // }];
  1019. }];
  1020. UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  1021. }];
  1022. [alert addAction:actionYes];
  1023. [alert addAction:actionNo];
  1024. [self presentViewController:alert animated:YES completion:^{
  1025. }];
  1026. }
  1027. - (void)getData{
  1028. WS(weakSelf);
  1029. NSLog(@"%@",[NSString stringWithFormat:@"%@%@/%ld",BaseUrl,WorkFlowAddApproval_Post,(long)self.indexId]);
  1030. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@/%ld",BaseUrl,WorkFlowAddApproval_Post,(long)self.indexId] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1031. NSLog(@"%@",responseObject);
  1032. NSDictionary *dic = responseObject;
  1033. weakSelf.currentModel = [[MyApprovalDetailModel alloc] initWithDictionary:dic error:nil];
  1034. NSMutableArray<NodesModel *> *tmpNodes = [weakSelf.currentModel.Nodes mutableCopy];
  1035. // [tmpNodes enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  1036. // NodesModel *nodeModel = obj;
  1037. // if ([nodeModel.Action isEqualToString:@"同意"]) {
  1038. // [tmpNodes exchangeObjectAtIndex:idx withObjectAtIndex:1];
  1039. // }
  1040. // }];
  1041. weakSelf.currentModel.Nodes = [tmpNodes mutableCopy];
  1042. //获取第一个审核中的位置
  1043. // [weakSelf.currentModel.Nodes enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  1044. // NodesModel *nodeModel = obj;
  1045. // if ([nodeModel.Action isEqualToString:@"审批中"]) {
  1046. // weakSelf.fristStatusIndex = idx;
  1047. // }
  1048. // }];
  1049. dispatch_async(dispatch_get_main_queue(), ^{
  1050. if (self.title.length == 0) {
  1051. weakSelf.myNavigationBar.titleLabel.text = weakSelf.currentModel.Name;
  1052. }
  1053. if (weakSelf.currentModel.IsRecall) {
  1054. weakSelf.pageType = Type_ONEC;
  1055. }
  1056. if ([weakSelf.currentModel.State isEqualToString:@"Checking"]) {
  1057. weakSelf.pageType = Type_ONEA;
  1058. }else{
  1059. if (weakSelf.currentModel.IsAdmin) {
  1060. weakSelf.pageType = Type_ONEB;
  1061. }else{
  1062. weakSelf.pageType = Type_ONEC;
  1063. }
  1064. }
  1065. switch (weakSelf.pageType) {
  1066. case Type_ONEA:
  1067. {
  1068. [weakSelf loadCustomFooterFromStatus:weakSelf.currentModel.State];
  1069. }
  1070. break;
  1071. case Type_ONEB:
  1072. {
  1073. [weakSelf loadCustomFooterFromStatus:weakSelf.currentModel.FlowState];
  1074. }
  1075. break;
  1076. case Type_ONEC:
  1077. // [self loadCustomFooterFromPageTypeC];
  1078. break;
  1079. }
  1080. });
  1081. for (NSInteger x = 0; x < weakSelf.currentModel.FormFields.count; x++) {
  1082. FormFieldsModel *model = weakSelf.currentModel.FormFields[x];
  1083. if ([model.Type isEqualToString:@"所在部门"]) {
  1084. model.Value = weakSelf.currentModel.DepartmentName;
  1085. }
  1086. }
  1087. [weakSelf.mytableView reloadData];
  1088. } failure:^(NSError * _Nonnull error) {
  1089. SHOWERROR([ZYCTool handerResultData:error])
  1090. }];
  1091. }
  1092. - (DrawerView *)drawerView {
  1093. if(!_drawerView) {
  1094. _drawerView = [[DrawerView alloc] init];
  1095. }
  1096. return _drawerView;
  1097. }
  1098. - (void)viewWillDisappear:(BOOL)animated
  1099. {
  1100. if (self.ActionSussBlock) {
  1101. self.ActionSussBlock();
  1102. }
  1103. }
  1104. @end