MyApprovalPageDetail.m 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  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 "MailListVC.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. } failure:^(NSError * _Nonnull error) {
  420. SHOWERROR([ZYCTool handerResultData:error]);
  421. }];
  422. }
  423. break;
  424. case CollectModel_Toipc:
  425. {
  426. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  427. vc.type = CollectModel_Toipc;
  428. vc.Id = model.SoureId;
  429. [self.navigationController pushViewController:vc animated:YES];
  430. }
  431. break;
  432. case CollectModel_NewTopic:
  433. {
  434. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  435. vc.type = CollectModel_NewTopic;
  436. vc.Id = model.SoureId;
  437. [self.navigationController pushViewController:vc animated:YES];
  438. }
  439. break;
  440. case CollectModel_Collect:
  441. {
  442. }
  443. break;
  444. case CollectModel_NoteBook:
  445. {
  446. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  447. vc.type = CollectModel_NoteBook;
  448. vc.Id = model.SoureId;
  449. [self.navigationController pushViewController:vc animated:YES];
  450. }
  451. break;
  452. case CollectModel_Notice:
  453. {
  454. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  455. vc.type = CollectModel_Notice;
  456. vc.Id = model.SoureId;
  457. [self.navigationController pushViewController:vc animated:YES];
  458. }
  459. break;
  460. case CollectModel_InterMail:
  461. {
  462. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  463. vc.type = CollectModel_InterMail;
  464. vc.Id = model.SoureId;
  465. [self.navigationController pushViewController:vc animated:YES];
  466. }
  467. break;
  468. case CollectModel_Group:
  469. {
  470. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  471. vc.GroupId = model.SoureId;
  472. vc.titleStr = model.Title;
  473. [self.navigationController pushViewController:vc animated:YES];
  474. }
  475. break;
  476. case CollectModel_meetMian:
  477. {
  478. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  479. vc.type = CollectModel_meetMian;
  480. vc.Id = model.SoureId;
  481. [self.navigationController pushViewController:vc animated:YES];
  482. }
  483. break;
  484. case CollectModel_meetDetail:
  485. {
  486. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.SoureId];
  487. [self.navigationController pushViewController:vc animated:YES];
  488. }
  489. break;
  490. case CollectModel_work:
  491. {
  492. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  493. vc.pageType = Type_ONEC;
  494. vc.indexId = model.SoureId;
  495. vc.title = model.Title;
  496. vc.TodoId = model.SoureId;
  497. [self.navigationController pushViewController:vc animated:YES];
  498. }
  499. break;
  500. default:
  501. {
  502. DownFileViewController *vc = [[DownFileViewController alloc]init];
  503. vc.model = model;
  504. [self.navigationController pushViewController:vc animated:YES];
  505. }
  506. break;
  507. }
  508. }
  509. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  510. if (indexPath.section == 1){
  511. FormFieldsModel * formFieldsModel = self.currentModel.FormFields[indexPath.row];
  512. if ([formFieldsModel.Type isEqualToString:@"Attachment"])//附件
  513. {
  514. NSLog(@"%@",formFieldsModel.paraImage);
  515. }
  516. }
  517. }
  518. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  519. return section == 2 ? 1 : 20;
  520. }
  521. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  522. return 0.01f;
  523. }
  524. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  525. UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 1)];
  526. view.backgroundColor = [UIColor clearColor];
  527. return view;
  528. }
  529. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  530. UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, section == 2 ? 1 :20)];
  531. view.backgroundColor = [UIColor clearColor];
  532. return view;
  533. }
  534. - (void)rightButtonAction:(TDButton *)sender{
  535. [self.noteBookShareVC initNoteBookShareData];
  536. self.noteBookShareVC.isWork = YES;
  537. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  538. }
  539. - (NoteBookShareVC *)noteBookShareVC{
  540. if (_noteBookShareVC == nil) {
  541. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  542. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  543. [_noteBookShareVC.view setHidden:YES];
  544. _noteBookShareVC.delegate = self;
  545. }
  546. return _noteBookShareVC;
  547. }
  548. #pragma mark - 分享
  549. -(void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath{
  550. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  551. if ([typeName isEqualToString:@"发给微信好友"]) {
  552. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.title desc:@"微信" url:@"https://www.baidu.com/"];
  553. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  554. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.title desc:@"微信" url:@"https://www.baidu.com/"];
  555. }else if ([typeName isEqualToString:@"发到微博"]){
  556. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.title desc:@"微信" url:@"https://www.baidu.com/"];
  557. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  558. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.title desc:@"微信" url:@"https://www.baidu.com/"];
  559. }else if ([typeName isEqualToString:@"发到消息"]){
  560. [self returnToMessage];
  561. }else if ([typeName isEqualToString:@"发到小组"]){
  562. [self returnToGroup];
  563. }else if ([typeName isEqualToString:@"发到笔记"]){
  564. [self returnToNote];
  565. }else if ([typeName isEqualToString:@"发到话题"]){
  566. [self returnToTopic];
  567. }else{
  568. }
  569. }
  570. //UMSocialPlatformType_Sina = 0, //新浪
  571. //UMSocialPlatformType_WechatSession = 1, //微信聊天
  572. //UMSocialPlatformType_WechatTimeLine = 2,//微信朋友圈
  573. //UMSocialPlatformType_WechatFavorite = 3,//微信收藏
  574. //UMSocialPlatformType_QQ = 4,//QQ聊天页面
  575. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  576. {
  577. //创建分享消息对象
  578. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  579. messageObject.title = title;
  580. //创建网页内容对象
  581. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:[UIImage imageNamed:@"my_about_appicon"]];
  582. //设置网页地址
  583. shareObject.webpageUrl = url;
  584. //分享消息对象设置分享内容对象
  585. messageObject.shareObject = shareObject;
  586. //调用分享接口
  587. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  588. if (error) {
  589. NSLog(@"************Share fail with error %@*********",error);
  590. }else{
  591. NSLog(@"response data is %@",data);
  592. }
  593. }];
  594. }
  595. - (void)returnToMessage
  596. {
  597. MailListVC * vc = [MailListVC initMailListVC];
  598. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  599. model.SoureId = self.indexId;
  600. model.SoureTypeId = CollectModel_work;
  601. model.Title = self.title;
  602. model.Author = self.currentModel.UserName;
  603. vc.sendModel = model;
  604. vc.isReturn = YES;
  605. [self.navigationController pushViewController:vc animated:YES];
  606. }
  607. - (void)returnToGroup
  608. {
  609. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  610. vc.type = CollectModel_Group;
  611. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  612. model.SoureId = self.indexId;
  613. model.SoureTypeId = CollectModel_work;
  614. model.Title = self.title;
  615. model.Author = self.currentModel.UserName;
  616. vc.sendModel = model;
  617. vc.isReturn = YES;
  618. [self.navigationController pushViewController:vc animated:YES];
  619. }
  620. - (void)returnToNote
  621. {
  622. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  623. vc.type = CollectModel_NoteBook;
  624. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  625. model.SoureId = self.indexId;
  626. model.SoureTypeId = CollectModel_work;
  627. model.Title = self.title;
  628. model.Author = self.currentModel.UserName;
  629. vc.sendModel = model;
  630. vc.isReturn = YES;
  631. [self.navigationController pushViewController:vc animated:YES];
  632. }
  633. - (void)returnToTopic
  634. {
  635. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  636. vc.type = CollectModel_NewTopic;
  637. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  638. model.SoureId = self.indexId;
  639. model.SoureTypeId = CollectModel_work;
  640. model.Title = self.title;
  641. model.Author = self.currentModel.UserName;
  642. vc.sendModel = model;
  643. vc.isReturn = YES;
  644. [self.navigationController pushViewController:vc animated:YES];
  645. }
  646. #pragma mark - setter
  647. - (TDTableView *)mytableView{
  648. if (!_mytableView) {
  649. _mytableView = [[TDTableView alloc]init];
  650. _mytableView.frame = CGRectMake(0,kNavigationHeight,kGXScreenWidth, kGXScreenHeigh - kNavigationHeight - kiphoneXBootomHeight);
  651. _mytableView.delegate = self;
  652. _mytableView.dataSource = self;
  653. _mytableView.sectionHeaderHeight = 0;
  654. // [_mytableView registerNib:[UINib nibWithNibName:@"MyApprovalBCell" bundle:nil] forCellReuseIdentifier:@"MyApprovalBCell"];
  655. [_mytableView registerNib:[UINib nibWithNibName:@"MyApprovalFileCell" bundle:nil] forCellReuseIdentifier:@"MyApprovalFileCell"];
  656. }
  657. return _mytableView;
  658. }
  659. - (MyWorkFlowFooterView *)myfooterView2{
  660. if (!_myfooterView2) {
  661. _myfooterView2 = [[MyWorkFlowFooterView alloc]initWithFrame:CGRectMake(0,kGXScreenHeigh - 75, kGXScreenWidth, 75)];
  662. _myfooterView2.agreeView.nameLab.text = @"同意";
  663. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer1");
  664. _myfooterView2.noAgreeView.nameLab.text = @"驳回";
  665. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  666. _myfooterView2.disscusView.nameLab.text = @"上会";
  667. _myfooterView2.disscusView.imageVIew.image = IMG(@"work_footer2");
  668. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  669. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  670. _myfooterView2.delegate = self;
  671. }
  672. return _myfooterView2;
  673. }
  674. - (TDNavigationBar *)myNavigationBar{
  675. if (!_myNavigationBar) {
  676. _myNavigationBar = [[TDNavigationBar alloc]initNavigationBar];
  677. _myNavigationBar.delegate = self;
  678. _myNavigationBar.backButton2.hidden = NO;
  679. _myNavigationBar.titleLabel.textColor = UIColorHex(#FFFFFF);
  680. _myNavigationBar.titleLabel.font = [UIFont systemFontOfSize:19.f];
  681. [_myNavigationBar.backButton2 setImage:IMG(@"快捷跳转") forState:UIControlStateNormal];
  682. [_myNavigationBar.backButton setImage:IMG(@"工作_返回") forState:UIControlStateNormal];
  683. _myNavigationBar.rightButton.hidden = NO;
  684. [_myNavigationBar.rightButton setImage:IMG(@"shareWhile") forState:UIControlStateNormal];
  685. }
  686. return _myNavigationBar;
  687. }
  688. - (UIView *)myBackImageView{
  689. if (!_myBackImageView) {
  690. _myBackImageView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kGXScreenHeigh, kNavigationHeight)];
  691. _myBackImageView.backgroundColor = [UIColor colorWithRed:92/255.0 green:118.0/255.0 blue:167.0/255.f alpha:1.0];
  692. }
  693. return _myBackImageView;
  694. }
  695. - (void)backButtonAction {
  696. [self back];
  697. }
  698. - (void)backButtonAction2:(UIButton *)sender {
  699. [self secondBarButtonItems];
  700. }
  701. - (void)secondBarButtonItems{
  702. [self.view endEditing:YES];
  703. [[UtilsTools getWindow] addSubview:self.drawerView];
  704. WS(weakSelf);
  705. self.drawerView.SelectDrawerBlock = ^(NSIndexPath * _Nonnull indexPath) {
  706. if ([weakSelf.navigationController.viewControllers count] > 1) {
  707. [weakSelf.navigationController popToRootViewControllerAnimated:NO];
  708. }
  709. if (indexPath.section == 0) {
  710. [[TabBarController sharedTabBarController] setSelectedIndex:indexPath.row];
  711. }else{
  712. ///@"站内信", @"通知", @"收藏",@"笔记", @"设置"
  713. switch (indexPath.row) {
  714. case 0:
  715. {
  716. [[TabBarController sharedTabBarController] setSelectedIndex:2];
  717. }
  718. break;
  719. case 1:
  720. {
  721. [[TabBarController sharedTabBarController] setSelectedIndex:2];
  722. }
  723. break;
  724. default:
  725. {
  726. [[TabBarController sharedTabBarController] setSelectedIndex:3];
  727. }
  728. break;
  729. }
  730. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  731. [[NSNotificationCenter defaultCenter] postNotificationName:DRAWERPUSHVC object:nil userInfo:@{VCINDEX:@(indexPath.row)}];
  732. });
  733. }
  734. };
  735. self.drawerView.frame = CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT);
  736. }
  737. - (MyApprovalDetailModel *)currentModel{
  738. if (!_currentModel) {
  739. _currentModel = [[MyApprovalDetailModel alloc] init];
  740. }
  741. return _currentModel;
  742. }
  743. #pragma mark - 审批操作事件处理
  744. - (void)didMyWorkFlowFooterViewBack:(NSInteger)index {
  745. if (index == 130){ //同意
  746. [self aggreeApprovalHander:@"审批意见"];
  747. }
  748. if (index == 131 ){ //驳回
  749. [self refuseApproval];
  750. }
  751. if (index == 132){// 上会
  752. [self goDisscuss];
  753. }
  754. if (index == 133 || index == 123){// 转审
  755. [self goNextApproval:@"转审"];
  756. }
  757. if (index == 120){//会议结论
  758. [self goDisscusText];
  759. }
  760. if (index == 121){// 撤销上会
  761. [self deleteDiscussText];
  762. }
  763. if (index == 200 || index == 210){//下载
  764. [self dowonLoadAddFile];
  765. }
  766. if (index == 203|| index == 223 || index == 233){//重新提交
  767. [self secondCommit];
  768. }
  769. if (index == 220 || index == 230){//催办
  770. [self goWorkWork];
  771. }
  772. if (index == 221 ||index == 231){//撤销
  773. [self deleteApproval];
  774. }
  775. if (index == 124){//待定
  776. [self waitDisscuss];
  777. }
  778. }
  779. ///同意
  780. - (void)aggreeApprovalHander:(NSString *)titleName{
  781. AgreeApprovalViewControllerSub * agreeApprovalViewControllerSub = [[AgreeApprovalViewControllerSub alloc] init];
  782. agreeApprovalViewControllerSub.title = titleName;
  783. agreeApprovalViewControllerSub.TodoId = self.TodoId;
  784. agreeApprovalViewControllerSub.FlowId = self.indexId;
  785. agreeApprovalViewControllerSub.IsChecked = YES;
  786. [agreeApprovalViewControllerSub setActionSussBlock:self.ActionSussBlock];
  787. [self.navigationController pushViewController:agreeApprovalViewControllerSub animated:YES];
  788. }
  789. ///驳回
  790. - (void)refuseApproval{
  791. AgreeApprovalViewControllerSub * agreeApprovalViewControllerSub = [[AgreeApprovalViewControllerSub alloc] init];
  792. agreeApprovalViewControllerSub.title = @"审批意见";
  793. agreeApprovalViewControllerSub.TodoId = self.TodoId;
  794. agreeApprovalViewControllerSub.FlowId = self.indexId;
  795. agreeApprovalViewControllerSub.IsChecked = NO;
  796. [agreeApprovalViewControllerSub setActionSussBlock:self.ActionSussBlock];
  797. [self.navigationController pushViewController:agreeApprovalViewControllerSub animated:YES];
  798. }
  799. ///上会
  800. - (void)goDisscuss{
  801. SHOWLOADING
  802. WEAKSELF
  803. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalMetting_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  804. if (weakSelf.ActionSussBlock) {
  805. weakSelf.ActionSussBlock();
  806. }
  807. REMOVESHOW
  808. SHOWERROR2(@"已提交上会申请");
  809. [weakSelf.navigationController popViewControllerAnimated:YES];
  810. } failure:^(NSError * _Nonnull error) {
  811. SHOWERROR([ZYCTool handerResultData:error]);
  812. }];
  813. }
  814. ///待定
  815. - (void)waitDisscuss{
  816. SHOWLOADING
  817. WEAKSELF
  818. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,@"/api/app/flow/action/wait"] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  819. REMOVESHOW
  820. if (weakSelf.ActionSussBlock) {
  821. weakSelf.ActionSussBlock();
  822. }
  823. [weakSelf.navigationController popViewControllerAnimated:YES];
  824. } failure:^(NSError * _Nonnull error) {
  825. SHOWERROR([ZYCTool handerResultData:error]);
  826. }];
  827. }
  828. /// 催办成功页面处理
  829. -(void)goDisscussSuccess{
  830. _myfooterView2.agreeView.nameLab.text = @"会议结论";
  831. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer5");
  832. _myfooterView2.noAgreeView.nameLab.text = @"撤销上会";
  833. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  834. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  835. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  836. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/3,75);
  837. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  838. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/3 + kGXScreenWidth/3,0,kGXScreenWidth/3,75);
  839. _myfooterView2.disscusView.hidden = YES;
  840. _myfooterView2.agreeView.button.tag = 120;
  841. _myfooterView2.noAgreeView.button.tag = 121;
  842. _myfooterView2.disscusView.button.tag = 122;
  843. _myfooterView2.nextAggreView.button.tag = 123;
  844. }
  845. ///转审
  846. - (void)goNextApproval:(NSString *)titleName{
  847. NextApprovalViewController * nextApprovalViewController = [[NextApprovalViewController alloc]init];
  848. nextApprovalViewController.title = @"审批";
  849. nextApprovalViewController.userIds = @[@(self.userId),@([AppUserModel sharedAppUserModel].Id)];
  850. nextApprovalViewController.TodoId = self.TodoId;
  851. [nextApprovalViewController setActionSussBlock:self.ActionSussBlock];
  852. [self.navigationController pushViewController:nextApprovalViewController animated:YES];
  853. }
  854. ///会议结论
  855. - (void)goDisscusText{
  856. [self aggreeApprovalHander:@"审批意见"];
  857. }
  858. ///撤销上会
  859. - (void)deleteDiscussText{
  860. SHOWLOADING
  861. WEAKSELF
  862. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalCancelMetting_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  863. // NSData *strData = responseObject;
  864. // NSString *nameStr = [[NSString alloc]initWithData:strData encoding:NSUTF8StringEncoding];
  865. // NSLog(@"解析数据 ====%@",nameStr);
  866. SHOWERROR2(@"撤销上会");
  867. if (self.ActionSussBlock) {
  868. self.ActionSussBlock();
  869. }
  870. REMOVESHOW
  871. [weakSelf updateDisscussUI];
  872. } failure:^(NSError * _Nonnull error) {
  873. SHOWERROR([ZYCTool handerResultData:error]);
  874. }];
  875. }
  876. - (void)updateDisscussUI{
  877. _myfooterView2.agreeView.button.tag = 130;
  878. _myfooterView2.noAgreeView.button.tag = 131;
  879. _myfooterView2.disscusView.button.tag = 132;
  880. _myfooterView2.nextAggreView.button.tag = 133;
  881. _myfooterView2.agreeView.nameLab.text = @"同意";
  882. _myfooterView2.agreeView.imageVIew.image = IMG(@"work_footer1");
  883. _myfooterView2.noAgreeView.nameLab.text = @"驳回";
  884. _myfooterView2.noAgreeView.imageVIew.image = IMG(@"work_footer");
  885. _myfooterView2.disscusView.nameLab.text = @"上会";
  886. _myfooterView2.disscusView.imageVIew.image = IMG(@"work_footer2");
  887. _myfooterView2.nextAggreView.nameLab.text = @"转审";
  888. _myfooterView2.nextAggreView.imageVIew.image = IMG(@"work_footer3");
  889. _myfooterView2.agreeView.frame = CGRectMake(0,0,kGXScreenWidth/4,75);
  890. _myfooterView2.noAgreeView.frame = CGRectMake(kGXScreenWidth/4,0,kGXScreenWidth/4,75);
  891. _myfooterView2.disscusView.frame = CGRectMake(kGXScreenWidth/2,0,kGXScreenWidth/4,75);
  892. _myfooterView2.nextAggreView.frame = CGRectMake(kGXScreenWidth/4 +kGXScreenWidth/4 + kGXScreenWidth/4,0,kGXScreenWidth/4,75);
  893. _myfooterView2.agreeView.hidden = NO;
  894. _myfooterView2.noAgreeView.hidden = NO;
  895. _myfooterView2.disscusView.hidden = NO;
  896. _myfooterView2.nextAggreView.hidden = NO;
  897. _myfooterView2.waitView.hidden = YES;
  898. }
  899. ///下载
  900. - (void)dowonLoadAddFile{
  901. SHOWLOADING
  902. WEAKSELF
  903. // NSString *homePath = NSHomeDirectory();
  904. // //document目录
  905. // NSString *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
  906. // //library目录
  907. // NSString *libraryPath = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES).firstObject;
  908. // //caches目录
  909. // NSString *cachesPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
  910. // //application support目录
  911. // NSString *applicationSupportPath = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES).firstObject;
  912. // //preference目录
  913. // NSString *preferencePath = NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSUserDomainMask, YES).firstObject;
  914. //tem目录
  915. NSString *temPath = NSTemporaryDirectory();
  916. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalDownLoad_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  917. STRONGSELF
  918. NSLog(@"已下载 ====%@",responseObject);
  919. REMOVESHOW
  920. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  921. model.Url = responseObject[@"DownloadUrl"];
  922. model.MinUrl = responseObject[@"PreviewUrl"];
  923. model.SoureTypeId = CollectModel_file;
  924. model.SoureId = weakSelf.indexId;
  925. model.Id = weakSelf.indexId;
  926. model.Title = [NSString stringWithFormat:@"%@.doc",weakSelf.title];
  927. [strongSelf downSucces:model];
  928. [[HttpManager sharedHttpManager] downloadUrl:model.Url downloadFilePath:temPath success:^(id _Nonnull responseObject) {
  929. } failure:^(NSError * _Nonnull error) {
  930. }];
  931. } failure:^(NSError * _Nonnull error) {
  932. SHOWERROR([ZYCTool handerResultData:error]);
  933. }];
  934. }
  935. - (void)downSucces:(FlowAttachmentsModel *)model{
  936. DownFileViewController *downFileViewController = [[DownFileViewController alloc]init];
  937. downFileViewController.model = model;
  938. [self.navigationController pushViewController:downFileViewController animated:YES];
  939. }
  940. ///重新提交
  941. - (void)secondCommit{
  942. WS(weakSelf);
  943. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"重新提交后,当前审批单将自动撤销,确定继续?" preferredStyle:UIAlertControllerStyleAlert];
  944. UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  945. //需要先把数据传递到编辑界面
  946. MyWorkWordVC *myWorkWordVC = [[MyWorkWordVC alloc] init];
  947. myWorkWordVC.pageType = Type_GongWen;
  948. myWorkWordVC.detailsModel = weakSelf.currentModel;
  949. myWorkWordVC.Id = weakSelf.indexId;
  950. myWorkWordVC.title = weakSelf.currentModel.Name;
  951. myWorkWordVC.indexID = weakSelf.currentModel.ProcessId;
  952. [weakSelf.navigationController pushViewController:myWorkWordVC animated:YES];
  953. }];
  954. UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  955. }];
  956. [alert addAction:actionYes];
  957. [alert addAction:actionNo];
  958. [self presentViewController:alert animated:YES completion:^{
  959. }];
  960. }
  961. ///催办
  962. - (void)goWorkWork{
  963. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowApprovalComeon_Post] parameters:@{@"FlowId":@(self.indexId)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  964. NSData *strData = responseObject;
  965. NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:strData options:NSJSONReadingMutableLeaves error:nil];
  966. if ([jsonDict[@"Value"] boolValue]) {
  967. SHOWWAIT(@"已提醒对方查看,请耐心等待")
  968. }else{
  969. SHOWSUCCESS(@"已催办")
  970. }
  971. // if (self.ActionSussBlock) {
  972. // self.ActionSussBlock();
  973. // }
  974. } failure:^(NSError * _Nonnull error) {
  975. SHOWERROR([ZYCTool handerResultData:error]);
  976. }];
  977. }
  978. ///撤销
  979. - (void)deleteApproval{
  980. WS(weakSelf);
  981. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"确定继续撤销申请?" preferredStyle:UIAlertControllerStyleAlert];
  982. UIAlertAction *actionYes = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  983. [[HttpManager sharedHttpManager] DeleteUrl:[NSString stringWithFormat:@"%@%@/%ld",BaseUrl,WorkFlowAddApproval_Post,(long)self.indexId] parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  984. if (self.ActionSussBlock) {
  985. self.ActionSussBlock();
  986. }
  987. [self.navigationController popViewControllerAnimated:YES];
  988. SHOWSUCCESS(@"撤销成功")
  989. } failure:^(NSError * _Nonnull error) {
  990. SHOWSUCCESS(@"撤销失败,稍候再试")
  991. }];
  992. [weakSelf.navigationController popViewControllerAnimated:YES];
  993. }];
  994. UIAlertAction *actionNo = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  995. }];
  996. [alert addAction:actionYes];
  997. [alert addAction:actionNo];
  998. [self presentViewController:alert animated:YES completion:^{
  999. }];
  1000. }
  1001. - (void)getData{
  1002. SHOWLOADING
  1003. WS(weakSelf);
  1004. NSLog(@"%@",[NSString stringWithFormat:@"%@%@/%ld",BaseUrl,WorkFlowAddApproval_Post,(long)self.indexId]);
  1005. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@/%ld",BaseUrl,WorkFlowAddApproval_Post,(long)self.indexId] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1006. if (self.ActionSussBlock) {
  1007. self.ActionSussBlock();
  1008. }
  1009. NSLog(@"%@",responseObject);
  1010. NSDictionary *dic = responseObject;
  1011. weakSelf.currentModel = [[MyApprovalDetailModel alloc] initWithDictionary:dic error:nil];
  1012. NSMutableArray<NodesModel *> *tmpNodes = [weakSelf.currentModel.Nodes mutableCopy];
  1013. // [tmpNodes enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  1014. // NodesModel *nodeModel = obj;
  1015. // if ([nodeModel.Action isEqualToString:@"同意"]) {
  1016. // [tmpNodes exchangeObjectAtIndex:idx withObjectAtIndex:1];
  1017. // }
  1018. // }];
  1019. weakSelf.currentModel.Nodes = [tmpNodes mutableCopy];
  1020. //获取第一个审核中的位置
  1021. // [weakSelf.currentModel.Nodes enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  1022. // NodesModel *nodeModel = obj;
  1023. // if ([nodeModel.Action isEqualToString:@"审批中"]) {
  1024. // weakSelf.fristStatusIndex = idx;
  1025. // }
  1026. // }];
  1027. dispatch_async(dispatch_get_main_queue(), ^{
  1028. switch (weakSelf.pageType) {
  1029. case Type_ONEA:
  1030. {
  1031. [weakSelf loadCustomFooterFromStatus:weakSelf.currentModel.State];
  1032. }
  1033. break;
  1034. case Type_ONEB:
  1035. {
  1036. [weakSelf loadCustomFooterFromStatus:weakSelf.currentModel.FlowState];
  1037. }
  1038. break;
  1039. case Type_ONEC:
  1040. // [self loadCustomFooterFromPageTypeC];
  1041. break;
  1042. }
  1043. });
  1044. for (NSInteger x = 0; x < weakSelf.currentModel.FormFields.count; x++) {
  1045. FormFieldsModel *model = weakSelf.currentModel.FormFields[x];
  1046. if ([model.Type isEqualToString:@"所在部门"]) {
  1047. model.Value = weakSelf.currentModel.DepartmentName;
  1048. }
  1049. }
  1050. [weakSelf.mytableView reloadData];
  1051. REMOVESHOW
  1052. } failure:^(NSError * _Nonnull error) {
  1053. SHOWERROR([ZYCTool handerResultData:error])
  1054. }];
  1055. }
  1056. - (DrawerView *)drawerView {
  1057. if(!_drawerView) {
  1058. _drawerView = [[DrawerView alloc] init];
  1059. }
  1060. return _drawerView;
  1061. }
  1062. - (void)viewWillDisappear:(BOOL)animated
  1063. {
  1064. if (self.ActionSussBlock) {
  1065. self.ActionSussBlock();
  1066. }
  1067. }
  1068. @end