MyWorkWordVC.m 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149
  1. //
  2. // MyWorkWordVC.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/1.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyWorkWordVC.h"
  9. #import "AutoLayoutScrollView.h"
  10. #import "MyWorkWordModel.h"
  11. #import "SelectTextCell.h"
  12. #import "InPutTextCell.h"
  13. #import "InPutGongWenCell.h"
  14. #import "AddFileTableViewCell.h"
  15. #import "AddPeopleToGongWenCell.h"
  16. #import "MOFSPickerManager.h"
  17. #import "SendInfoGroupVC.h"
  18. #import "LYLPhotoTailoringTool.h"
  19. #import "MyWorkAppApprovalCell.h"
  20. #import "AddLookUpUserSecondVC.h"
  21. #import "MailListVC.h"
  22. #import "AddPictureCell.h"
  23. #import "FWZFileGetTool.h"
  24. #import "TZImagePickerController.h"
  25. #import "TabBarController.h"
  26. #import "DrawerView.h"
  27. #import "DownFileViewController.h"
  28. #import "FWZGetNoteBookTool.h"
  29. #import "HomeDetailController.h"
  30. #import "ChatMsgNoticeDetailVC.h"
  31. #import "MyTDTopicDetailVC.h"
  32. #import "TDInterLeterDetailVC.h"
  33. #import "NoteBookDetailVC.h"
  34. #import "TDGroupInfoListVC.h"
  35. #import "WorkFlowDetailsController.h"
  36. #import "MyApprovalPageDetail.h"
  37. #import "MyFavoriteVC.h"
  38. #import "NoteBookVC.h"
  39. #import "CountDataVC.h"
  40. #import "WorkFlowDetailsController.h"
  41. @interface MyWorkWordVC ()<UITableViewDelegate,UITableViewDataSource, UINavigationControllerDelegate, UIImagePickerControllerDelegate,UITextViewDelegate,UITextFieldDelegate,AddPeopleToGongWenCellDelegate,MyWorkAppApprovalCellDelegate,AddLookUpUserSecondVCDelegate,AddPictureCellDelegate,UIDocumentPickerDelegate>{
  42. NSIndexPath *_currentIndexPath;
  43. }
  44. @property (nonatomic, strong) UIScrollView *scrollView;
  45. @property (nonatomic, strong) NSMutableArray<NSMutableArray<MyWorkWordModel*>*>* viewDataArray;
  46. @property (nonatomic, strong) NSMutableArray<FormFieldsModel*>* viewDataArray2;
  47. @property (nonatomic, strong) NSMutableArray<FlowAttachmentsModel*>* attrArray;
  48. @property (nonatomic, strong) TDTableView *myTableView;
  49. @property (nonatomic, strong) UIView *footerview;
  50. @property (nonatomic, strong) MyWorkWordModel *model;
  51. @property (nonatomic, assign) NSInteger isTest;
  52. @property (nonatomic, assign) CGFloat rowH;
  53. @property (nonatomic, strong) NSMutableDictionary *reuqestParams;
  54. @property (nonatomic, strong) NSMutableArray *chaoSongRenArr;
  55. @property (nonatomic, strong) NSMutableArray *shenPiRenArr;
  56. @property (nonatomic, strong) DrawerView *drawerView;
  57. @property (nonatomic, assign) BOOL isShenPinRen;
  58. @end
  59. @implementation MyWorkWordVC
  60. - (DrawerView *)drawerView {
  61. if(!_drawerView) {
  62. _drawerView = [[DrawerView alloc] init];
  63. }
  64. return _drawerView;
  65. }
  66. - (void)viewDidLoad {
  67. [super viewDidLoad];
  68. self.myTableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
  69. self.view.backgroundColor = [UIColor colorWithHexString:@"EEEEEE"];
  70. self.fd_prefersNavigationBarHidden = YES;
  71. self.isTest = 1;
  72. self.rowH = 120.f;
  73. [self.navigationController.navigationItem.leftBarButtonItem setImage:IMG(@"工作_返回")];
  74. [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithBgColor:[UIColor colorWithRed:92/255.0 green:118.0/255.0 blue:167.0/255.f alpha:1.0] alpha:1.0] forBarMetrics:UIBarMetricsDefault];
  75. self.myTableView.backgroundColor = [UIColor colorWithHexString:@"EEEEEE"];
  76. [self getData];
  77. [self.view addSubview:self.myTableView];
  78. self.footerview.frame = CGRectMake(0, 0, kGXScreenWidth,70);
  79. [self registerNotification];
  80. self.fd_interactivePopDisabled = YES;
  81. }
  82. - (void)viewWillAppear:(BOOL)animated{
  83. [super viewWillAppear:animated];
  84. [[IQKeyboardManager sharedManager] setEnable:NO];
  85. [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
  86. }
  87. - (void)viewWillDisappear:(BOOL)animated{
  88. [super viewWillDisappear:animated];
  89. [[IQKeyboardManager sharedManager] setEnable:YES];
  90. [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
  91. }
  92. - (UIStatusBarStyle)preferredStatusBarStyle{
  93. return UIStatusBarStyleLightContent;
  94. }
  95. - (void)backButtonAction2:(UIButton *)sender {
  96. [self secondBarButtonItems];
  97. }
  98. - (void)secondBarButtonItems{
  99. [[UtilsTools getWindow] addSubview:self.drawerView];
  100. WS(weakSelf);
  101. self.drawerView.SelectDrawerBlock = ^(NSIndexPath * _Nonnull indexPath) {
  102. if ([weakSelf.navigationController.viewControllers count] > 1) {
  103. [weakSelf.navigationController popToRootViewControllerAnimated:NO];
  104. }
  105. if (indexPath.section == 0) {
  106. [[TabBarController sharedTabBarController] setSelectedIndex:indexPath.row];
  107. }else{
  108. ///@"站内信", @"通知", @"收藏",@"笔记", @"设置"
  109. switch (indexPath.row) {
  110. case 0:
  111. {
  112. [[TabBarController sharedTabBarController] setSelectedIndex:2];
  113. }
  114. break;
  115. case 1:
  116. {
  117. [[TabBarController sharedTabBarController] setSelectedIndex:2];
  118. }
  119. break;
  120. default:
  121. {
  122. [[TabBarController sharedTabBarController] setSelectedIndex:3];
  123. }
  124. break;
  125. }
  126. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  127. [[NSNotificationCenter defaultCenter] postNotificationName:DRAWERPUSHVC object:nil userInfo:@{VCINDEX:@(indexPath.row)}];
  128. });
  129. }
  130. };
  131. self.drawerView.frame = CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT);
  132. }
  133. - (void)getData{
  134. [self getOnlineData];
  135. }
  136. - (void)getOnlineData{
  137. SHOWLOADING
  138. WS(weakSelf);
  139. [self.attrArray removeAllObjects];
  140. [self.shenPiRenArr removeAllObjects];
  141. [self.chaoSongRenArr removeAllObjects];
  142. [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,WorkFlowHomeData_Post,(long)self.indexID] parameters:@{@"id":@(self.indexID)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  143. REMOVESHOW
  144. NSDictionary *dic = responseObject;
  145. MyWorkWordModel *model = [[MyWorkWordModel alloc] initWithDictionary:dic error:nil];
  146. weakSelf.model = model;
  147. if (weakSelf.detailsModel) {
  148. weakSelf.model.FormFields = self.detailsModel.FormFields;
  149. for (NSDictionary * dict in self.detailsModel.ApproverCheckUsers) {
  150. SelectModel * model = [[SelectModel alloc] init];
  151. model.UserId = [dict[@"Id"] integerValue];
  152. model.Name = dict[@"Name"];
  153. model.UserName = dict[@"Name"];
  154. model.Id = [dict[@"Id"] integerValue];
  155. model.AvatarUrl = dict[@"AvatarUrl"];
  156. [weakSelf.shenPiRenArr addObject:model];
  157. }
  158. for (NSDictionary * dict in self.detailsModel.CarbonCopyUsers) {
  159. SelectModel * model = [[SelectModel alloc] init];
  160. model.UserId = [dict[@"Id"] integerValue];
  161. model.Name = dict[@"Name"];
  162. model.UserName = dict[@"Name"];
  163. model.Id = [dict[@"Id"] integerValue];
  164. model.AvatarUrl = dict[@"AvatarUrl"];
  165. [weakSelf.chaoSongRenArr addObject:model];
  166. }
  167. [weakSelf.attrArray addObjectsFromArray:weakSelf.detailsModel.FlowAttachments];
  168. if (weakSelf.attrArray.count > 0) {
  169. NSArray *cells = [weakSelf.myTableView visibleCells];
  170. for (UITableViewCell * cell in cells) {
  171. if ([cell isKindOfClass:[AddPictureCell class]]) {
  172. AddPictureCell * aCell = (AddPictureCell *)cell;
  173. [aCell.mycollectionView reloadData];
  174. }
  175. }
  176. }
  177. }
  178. //self.model.AllowApproverCheck = 1;
  179. NSLog(@"%@",model);
  180. weakSelf.viewDataArray2 = [NSMutableArray arrayWithArray:model.FormFields];
  181. weakSelf.isTest = 2;
  182. dispatch_async(dispatch_get_main_queue(), ^{
  183. [weakSelf.myTableView setTableFooterView:weakSelf.footerview];
  184. [weakSelf.myTableView reloadData];
  185. });
  186. /****************处理重新提交流程bug***********/
  187. //如果有其他页面需要处理
  188. if (weakSelf.loadDataBlock) {
  189. weakSelf.loadDataBlock();
  190. }
  191. //赋值
  192. } failure:^(NSError * _Nonnull error) {
  193. REMOVESHOW
  194. SHOWERROR([ZYCTool handerResultData:error]);
  195. }];
  196. }
  197. #pragma mark - UITableViewDelegate,UITableViewDataSource
  198. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  199. if (self.isTest == 1) {
  200. return self.viewDataArray.count;
  201. }else {
  202. return self.viewDataArray2.count + (self.model.AllowApproverCheck == 0 ? 0 : 1) + (self.model.AllowCarbonCopy == 0 ? 0 : 1);
  203. }
  204. }
  205. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  206. if (self.isTest == 1) {
  207. return self.viewDataArray[section].count;
  208. }else{
  209. return 1;
  210. }
  211. }
  212. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  213. NSString * cellIdentifier1 = @"SelectTextCell";
  214. SelectTextCell *selectTextCell = (SelectTextCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier1];
  215. NSString * cellIdentifier2 = @"InPutTextCell";
  216. InPutTextCell *inPutTextCell = (InPutTextCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier2];
  217. NSString * cellIdentifier3 = @"InPutGongWenCell";
  218. InPutGongWenCell *inPutGongWenCell = (InPutGongWenCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier3];
  219. // NSString * cellIdentifier4 = @"AddFileTableViewCell";
  220. // AddFileTableViewCell *addFileTableViewCell = (AddFileTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier4];
  221. //抄送人
  222. NSString * cellIdentifier5 = @"AddPeopleToGongWenCell";
  223. AddPeopleToGongWenCell *addPeopleToGongWenCell = (AddPeopleToGongWenCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier5];
  224. //审批人
  225. NSString * cellIdentifier6 = @"MyWorkAppApprovalCell";
  226. MyWorkAppApprovalCell *myWorkAppApprovalCell = (MyWorkAppApprovalCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier6];
  227. WS(weakSelf);
  228. NSString * cellIdentifier7 = @"AddPictureCell";
  229. AddPictureCell *addPictureCell = (AddPictureCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier7];
  230. if (self.model.AllowApproverCheck == 1) {
  231. if(indexPath.section == self.viewDataArray2.count){
  232. // 审批人
  233. myWorkAppApprovalCell.namelab.text = @"审批人";
  234. myWorkAppApprovalCell.delegate = self;
  235. myWorkAppApprovalCell.approvalSection = self.shenPiRenArr;
  236. [myWorkAppApprovalCell.collectView reloadData];
  237. return myWorkAppApprovalCell;
  238. }
  239. }
  240. if (self.model.AllowCarbonCopy == 1) {
  241. if(indexPath.section == (self.viewDataArray2.count + 1 )){
  242. // 抄送人
  243. addPeopleToGongWenCell.namelab.text = @"抄送人";
  244. addPeopleToGongWenCell.haveNeedImageView.hidden = YES;
  245. addPeopleToGongWenCell.delegate = self;
  246. addPeopleToGongWenCell.approvalSection = self.chaoSongRenArr;
  247. return addPeopleToGongWenCell;
  248. }
  249. }
  250. FormFieldsModel * formFieldsModel = self.viewDataArray2[indexPath.section];
  251. if (formFieldsModel.Value.length > 0) {
  252. formFieldsModel.paramString = formFieldsModel.Value;
  253. }
  254. if ([formFieldsModel.Type isEqualToString:@"Text"])//单行文本
  255. {
  256. inPutTextCell.nameLab.text = formFieldsModel.Label;
  257. inPutTextCell.imageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  258. inPutTextCell.haveNeedImageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  259. inPutTextCell.inputtextFeild.tag = indexPath.section + 10000;
  260. inPutTextCell.inputtextFeild.delegate = self;
  261. inPutTextCell.formFieldsModel = formFieldsModel;
  262. return inPutTextCell;
  263. }
  264. else if ([formFieldsModel.Type isEqualToString:@"TextArea"])//多行文本
  265. {
  266. inPutGongWenCell.namelab.text = formFieldsModel.Label;
  267. inPutGongWenCell.haveNeedImageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  268. inPutGongWenCell.gongwenContent.delegate = self;
  269. inPutGongWenCell.gongwenContent.tag = indexPath.section;
  270. inPutGongWenCell.gongwenContent.placeholder = formFieldsModel.Placeholder;
  271. inPutGongWenCell.formFieldsModel = formFieldsModel;
  272. return inPutGongWenCell;
  273. }
  274. else if ([formFieldsModel.Type isEqualToString:@"Number"])//数字
  275. {
  276. inPutTextCell.nameLab.text = formFieldsModel.Label;
  277. inPutTextCell.imageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  278. inPutTextCell.haveNeedImageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  279. inPutTextCell.inputtextFeild.tag = indexPath.section;
  280. inPutTextCell.inputtextFeild.keyboardType = UIKeyboardTypeNumberPad;
  281. inPutTextCell.inputtextFeild.delegate = self;
  282. inPutTextCell.formFieldsModel = formFieldsModel;
  283. return inPutTextCell;
  284. }
  285. else if ([formFieldsModel.Type isEqualToString:@"Currency"])//金额
  286. {
  287. inPutTextCell.nameLab.text = formFieldsModel.Label;
  288. inPutTextCell.imageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  289. inPutTextCell.haveNeedImageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  290. inPutTextCell.inputtextFeild.tag = indexPath.section;
  291. inPutTextCell.inputtextFeild.keyboardType = UIKeyboardTypeNumberPad;
  292. inPutTextCell.inputtextFeild.delegate = self;
  293. inPutTextCell.formFieldsModel = formFieldsModel;
  294. return inPutTextCell;
  295. }
  296. else if ([formFieldsModel.Type isEqualToString:@"DateTime"])//日期
  297. {
  298. selectTextCell.nameLab.text = formFieldsModel.Label;
  299. selectTextCell.haveImageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  300. selectTextCell.selectButton.tag = indexPath.section;
  301. if (!ISEmptyString(formFieldsModel.paramString)) {
  302. [selectTextCell.selectButton setTitle:formFieldsModel.paramString forState:UIControlStateNormal];
  303. [selectTextCell.selectButton setTitleColor: UIColorHex(#333333) forState:UIControlStateNormal];
  304. }
  305. return selectTextCell;
  306. }
  307. else if ([formFieldsModel.Type isEqualToString:@"Radio"])//单选
  308. {
  309. selectTextCell.nameLab.text = formFieldsModel.Label;
  310. selectTextCell.haveImageView.hidden = (formFieldsModel.Required == 1) ? NO : YES;
  311. selectTextCell.selectButton.tag = indexPath.section;
  312. if (!ISEmptyString(formFieldsModel.paramString)) {
  313. [selectTextCell.selectButton setTitle:formFieldsModel.paramString forState:UIControlStateNormal];
  314. [selectTextCell.selectButton setTitleColor: UIColorHex(#333333) forState:UIControlStateNormal];
  315. }
  316. return selectTextCell;
  317. }
  318. else if ([formFieldsModel.Type isEqualToString:@"Attachment"])//附件
  319. {
  320. addPictureCell.namelab.text = formFieldsModel.Label;
  321. if (self.pageType == Type_GongWen) {
  322. addPictureCell.placeholderImg = @"上传附件";
  323. }
  324. addPictureCell.haveNeedImageView.hidden = YES;
  325. addPictureCell.approvalSection = self.attrArray;
  326. addPictureCell.index = indexPath;
  327. addPictureCell.delegate = self;
  328. addPictureCell.ClickCellBlock = ^(NSInteger index) {
  329. FlowAttachmentsModel * model = weakSelf.attrArray[index];
  330. [weakSelf pushFileOpenWithModel:model];
  331. };
  332. return addPictureCell;
  333. }
  334. return selectTextCell;
  335. }
  336. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  337. [MOFSPickerManager shareManger].pickView.toolBar.cancelBar.textColor = UIColorHex(#888888);
  338. [MOFSPickerManager shareManger].pickView.toolBar.commitBar.textColor = UIColorHex(#3979D3);
  339. if (self.isTest == 1){
  340. }else{
  341. FormFieldsModel * formFieldsModel = self.viewDataArray2[indexPath.section];
  342. if ([formFieldsModel.Type isEqualToString:@"Text"])//单行文本
  343. {
  344. }
  345. else if ([formFieldsModel.Type isEqualToString:@"TextArea"])//多行文本
  346. {
  347. }
  348. else if ([formFieldsModel.Type isEqualToString:@"Number"])//数字
  349. {
  350. }
  351. else if ([formFieldsModel.Type isEqualToString:@"Currency"])//金额
  352. {
  353. }
  354. else if ([formFieldsModel.Type isEqualToString:@"DateTime"])//日期
  355. {
  356. [[MOFSPickerManager shareManger] showDatePickerWithTag:2 commitBlock:^(NSDate *date) {
  357. NSDateFormatter *dateformat = [[NSDateFormatter alloc]init];
  358. dateformat.dateFormat = @"yyyy-MM-dd";
  359. SelectTextCell *cell = [tableView cellForRowAtIndexPath:indexPath];
  360. [cell.selectButton setTitle: [dateformat stringFromDate:date] forState:UIControlStateNormal];
  361. cell.selectButton.tag = indexPath.section;
  362. [cell.selectButton setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal];
  363. self.viewDataArray2[indexPath.section].paramString = [dateformat stringFromDate:date];
  364. } cancelBlock:^{
  365. }];
  366. }
  367. else if ([formFieldsModel.Type isEqualToString:@"Radio"])//单选
  368. {
  369. MOFSPickerManager *manager = [[MOFSPickerManager alloc] init];
  370. [manager showPickerViewWithDataArray:formFieldsModel.Options tag:1 title:nil cancelTitle:@"取消" commitTitle:@"确定" commitBlock:^(NSString *string) {
  371. SelectTextCell *cell = [tableView cellForRowAtIndexPath:indexPath];
  372. [cell.selectButton setTitle: string forState:UIControlStateNormal];
  373. [cell.selectButton setTitleColor:UIColorHex(#333333) forState:UIControlStateNormal];
  374. self.viewDataArray2[indexPath.section].paramString = string;
  375. } cancelBlock:^{
  376. }];
  377. }
  378. else if ([formFieldsModel.Type isEqualToString:@"Attachment"])//附件
  379. {
  380. }
  381. }
  382. }
  383. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  384. if (self.isTest == 1) {
  385. if (indexPath.section == 0) {
  386. return 45;
  387. }
  388. if (indexPath.section == 1) {
  389. return 45;
  390. }
  391. if (indexPath.section == 2) {
  392. return 120;
  393. }
  394. if (indexPath.section == 3) {
  395. return 120;
  396. }
  397. if (indexPath.section == 4) {
  398. return 120;
  399. }
  400. if (indexPath.section == 5) {
  401. return 120;
  402. }
  403. return 0;
  404. }
  405. else{
  406. FormFieldsModel *formFieldsModel = self.viewDataArray2[indexPath.section];
  407. if ([formFieldsModel.Type isEqualToString:@"Text"])//单行文本
  408. {
  409. return 45;
  410. }
  411. else if ([formFieldsModel.Type isEqualToString:@"TextArea"])//多行文本
  412. {
  413. return self.rowH;
  414. }
  415. else if ([formFieldsModel.Type isEqualToString:@"Number"])//数字
  416. {
  417. return 45;
  418. }
  419. else if ([formFieldsModel.Type isEqualToString:@"Currency"])//金额
  420. {
  421. return 45;
  422. }
  423. else if ([formFieldsModel.Type isEqualToString:@"DateTime"])//日期
  424. {
  425. return 60;
  426. }
  427. else if ([formFieldsModel.Type isEqualToString:@"Radio"])//单选
  428. {
  429. return 60;
  430. }
  431. else if ([formFieldsModel.Type isEqualToString:@"Attachment"])//附件
  432. {
  433. return 120;
  434. }
  435. return 135.f;
  436. }
  437. }
  438. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
  439. CGFloat H = 0.f;
  440. if (section == 0) {
  441. H = 20;
  442. }
  443. if (section == 1) {
  444. H = 0.5;
  445. }
  446. if (section == 2) {
  447. H = 0.5;
  448. }
  449. if (section == 3) {
  450. H = self.indexID == 11 ? 20 : 0.5;
  451. }
  452. if (section >= 4) {
  453. H = 20;
  454. }
  455. UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, H)];
  456. view.backgroundColor = [UIColor colorWithHexString:@"EEEEEE"];
  457. return view;
  458. }
  459. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  460. if (self.isTest == 1) {
  461. if (section == 0) {
  462. return 10;
  463. }
  464. if (section == 1) {
  465. return 0.5;
  466. }
  467. if (section == 2) {
  468. return 0.5;
  469. }
  470. if (section == 3) {
  471. return 0.5;
  472. }
  473. if (section == 4) {
  474. return 10;
  475. }
  476. if (section == 5) {
  477. return 10;
  478. }
  479. return 0;
  480. }
  481. else{
  482. if (section == 0) {
  483. return 20;
  484. }
  485. if (section == 1) {
  486. return 0.5;
  487. }
  488. if (section == 2) {
  489. return 0.5;
  490. }
  491. if (section == 3) {
  492. return self.indexID == 11 ? 20 : 0.5;
  493. }
  494. if (section >= 4) {
  495. return 20;
  496. }
  497. return 0;
  498. }
  499. }
  500. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  501. if (self.isTest == 1) {
  502. if (section == 0) {
  503. return 20;
  504. }
  505. if (section == 1) {
  506. return 20;
  507. }
  508. if (section == 2) {
  509. return 20;
  510. }
  511. if (section == 3) {
  512. return 20;
  513. }
  514. if (section == 4) {
  515. return 20;
  516. }
  517. if (section == 5) {
  518. return 20;
  519. }
  520. return 0;
  521. }
  522. else{
  523. if (section == 0) {
  524. return 20.f;
  525. }
  526. return 0.01;
  527. }
  528. }
  529. #pragma mark - UITableViewDelegate,UITableViewDataSource
  530. - (NSMutableArray<NSMutableArray<MyWorkWordModel *> *> *)viewDataArray{
  531. if (!_viewDataArray) {
  532. _viewDataArray = [NSMutableArray new];
  533. }
  534. return _viewDataArray;
  535. }
  536. - (TDTableView *)myTableView{
  537. if (!_myTableView) {
  538. _myTableView = [[TDTableView alloc]initWithFrame:CGRectMake(0,kNavigationHeight,kGXScreenWidth,kGXScreenHeigh -kNavigationHeight - kiphoneXBootomHeight)];
  539. _myTableView.delegate = self;
  540. _myTableView.dataSource= self;
  541. _myTableView.bounces = NO;
  542. [_myTableView registerNib:[UINib nibWithNibName:@"SelectTextCell" bundle:nil] forCellReuseIdentifier:@"SelectTextCell"];
  543. [_myTableView registerNib:[UINib nibWithNibName:@"InPutTextCell" bundle:nil] forCellReuseIdentifier:@"InPutTextCell"];
  544. [_myTableView registerNib:[UINib nibWithNibName:@"AddFileTableViewCell" bundle:nil] forCellReuseIdentifier:@"AddFileTableViewCell"];
  545. [_myTableView registerNib:[UINib nibWithNibName:@"InPutGongWenCell" bundle:nil] forCellReuseIdentifier:@"InPutGongWenCell"];
  546. [_myTableView registerNib:[UINib nibWithNibName:@"AddPeopleToGongWenCell" bundle:nil] forCellReuseIdentifier:@"AddPeopleToGongWenCell"];
  547. [_myTableView registerNib:[UINib nibWithNibName:@"MyWorkAppApprovalCell" bundle:nil] forCellReuseIdentifier:@"MyWorkAppApprovalCell"];
  548. [_myTableView registerNib:[UINib nibWithNibName:@"AddPictureCell" bundle:nil] forCellReuseIdentifier:@"AddPictureCell"];
  549. }
  550. return _myTableView;
  551. }
  552. - (UIView *)footerview{
  553. if (!_footerview) {
  554. _footerview = [[UIView alloc]init];
  555. _footerview.backgroundColor = [UIColor colorWithHexString:@"EEEEEE"];
  556. TDButton *button = [[TDButton alloc]init];
  557. [button setTitle:@"提交" forState:UIControlStateNormal];
  558. [[button titleLabel] setFont: [UIFont systemFontOfSize:19]];
  559. [button setTitleColor:UIColorHex(FFFFFF) forState:UIControlStateNormal];
  560. button.backgroundColor = [UIColor colorWithHexString:@"457BC7"];
  561. button.layer.cornerRadius = 5.f;
  562. button.layer.masksToBounds = YES;
  563. [_footerview addSubview:button];
  564. [button addTarget:self action:@selector(commitGonwen:) forControlEvents:UIControlEventTouchDown];
  565. [button mas_makeConstraints:^(MASConstraintMaker *make) {
  566. make.centerX.equalTo(self.footerview.mas_centerX);
  567. make.centerY.equalTo(self.footerview.mas_centerY);
  568. make.width.mas_equalTo(kGXScreenWidth - 40);
  569. make.height.mas_equalTo(50);
  570. }];
  571. }
  572. return _footerview;
  573. }
  574. - (void)addFile:(NSIndexPath*)indexpath Sucuss:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
  575. WS(weakSelf);
  576. _currentIndexPath = indexpath;
  577. UIImagePickerController *picker = [[UIImagePickerController alloc] init];
  578. picker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
  579. picker.delegate = self;
  580. picker.allowsEditing = YES;//取消白框
  581. UIAlertController *alertvc = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  582. UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  583. [[LYLPhotoTailoringTool sharedTool] selectPhotoWithPhoroOrCamera: SelectPhotoWithTypePhoroOrCamera2 crop:YES showImgBlock:^(NSString *imageUrlStr) {
  584. } choosImgBlock:^(UIImage *image) {
  585. SHOWLOADING
  586. [[HttpManager sharedHttpManager] HeaderUploadUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,Modify_UserImages_Post] parameters:@{@"":@""} pictureData:UIImageJPEGRepresentation(image,1.0f) pictureKey:@"file" success:^(id _Nonnull responseObject) {
  587. NSDictionary *dict = responseObject[0];
  588. FlowAttachmentsModel *model = [[FlowAttachmentsModel alloc]initWithDictionary:dict error:nil];
  589. model.SoureId = [dict[@"FileId"] integerValue];
  590. model.Url = dict[@"AbsolutePath"];
  591. model.MinUrl = dict[@"MinAbsolutePath"];
  592. model.Title = dict[@"FileName"];
  593. model.SoureTypeId = CollectModel_file;
  594. success(model);
  595. } failure:^(NSError * _Nonnull error) {
  596. failure(error);
  597. }];
  598. }];
  599. }];
  600. [action1 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  601. [alertvc addAction:action1];
  602. UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"从相册选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  603. [self.view endEditing:YES];
  604. TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:nil];
  605. [imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){
  606. leftButton.hidden = YES;
  607. }];
  608. imagePickerVc.showSelectBtn = NO;
  609. imagePickerVc.allowCrop = YES;
  610. imagePickerVc.cropRect = CGRectMake(0, (SCREEN_HEIGHT - SCREEN_WIDTH) * 0.5, SCREEN_WIDTH, SCREEN_WIDTH);
  611. imagePickerVc.allowTakePicture = NO;
  612. imagePickerVc.allowTakeVideo = NO;
  613. [imagePickerVc setIsStatusBarDefault:YES];
  614. [imagePickerVc setNaviTitleColor:[UIColor blackColor]];
  615. [imagePickerVc setBarItemTextColor:[UIColor blackColor]];
  616. [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
  617. PHAsset *asset = assets.firstObject;
  618. switch (asset.mediaType) {
  619. case PHAssetMediaTypeVideo: {
  620. } break;
  621. case PHAssetMediaTypeImage: {
  622. [self didSelectImages:photos success:success withImgs:photos];
  623. } break;
  624. case PHAssetMediaTypeAudio:
  625. break;
  626. case PHAssetMediaTypeUnknown:
  627. break;
  628. default: break;
  629. }
  630. }];
  631. [self presentViewController:imagePickerVc animated:YES completion:nil];
  632. }];
  633. [alertvc addAction:action2];
  634. [action2 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  635. UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"从收藏选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  636. [[FWZGetNoteBookTool sharedTool] WorkOpenCollectListChooseCollectBlock:^(NSMutableArray<MyFavoriteSubModel *> * _Nonnull collectArr) {
  637. NSLog(@"SmartBarCollection %@",collectArr);
  638. NSArray * array = [weakSelf disSelectCollect:collectArr];
  639. success(array);
  640. }];
  641. }];
  642. [action3 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  643. [alertvc addAction:action3];
  644. UIAlertAction *action4 = [UIAlertAction actionWithTitle:@"从笔记选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  645. [[FWZGetNoteBookTool sharedTool] WorkOpenNoteBookListChooseNoteBookBlock:^(NSMutableArray<MyNoteBookSubModel *> * _Nonnull noteArr) {
  646. NSLog(@"SmartBarNotes %@",noteArr);
  647. NSArray * array = [weakSelf disSelectNoteBook:noteArr];
  648. success(array);
  649. }];
  650. }];
  651. [action4 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  652. [alertvc addAction:action4];
  653. UIAlertAction *action5 = [UIAlertAction actionWithTitle:@"本地文件" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  654. [[FWZFileGetTool sharedTool] openFileWithCrop:YES showImgBlock:^(NSString * _Nonnull fileUrlStr) {
  655. } choosFileBlock:^(NSData * _Nonnull fileData, NSString * _Nonnull fileName) {
  656. NSLog(@"%@",fileName);
  657. SHOWLOADING
  658. [[HttpManager sharedHttpManager] HeaderUploadFileUrl:Host(Modify_UserImages_Post) parameters:@{} fileData:fileData fileKey:@"file" fileName:fileName mimeType:@"multipart/form-data" success:^(id _Nonnull responseObject) {
  659. NSLog(@"上传成功的文件%@",responseObject);
  660. NSDictionary *dict = responseObject[0];
  661. FlowAttachmentsModel *model = [[FlowAttachmentsModel alloc] initWithDictionary:dict error:nil];
  662. model.SoureTypeId = CollectModel_file;
  663. model.SoureId = [dict[@"FileId"] integerValue];
  664. model.Url = dict[@"AbsolutePath"];
  665. model.MinUrl = dict[@"MinAbsolutePath"];
  666. model.Title = dict[@"FileName"];
  667. model.Size = [dict[@"Size"] integerValue];
  668. success(model);
  669. } failure:^(NSError * _Nonnull error) {
  670. failure(error);
  671. }];
  672. }];
  673. }];
  674. [action5 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  675. [alertvc addAction:action5];
  676. UIAlertAction *action6 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  677. }];
  678. [action6 setValue:UIColorHex(#0A0A0A) forKey:@"titleTextColor"];
  679. [alertvc addAction:action6];
  680. [self presentViewController:alertvc animated:YES completion:^{}];
  681. }
  682. #pragma mark - addNote
  683. - (NSArray *)disSelectNoteBook:(NSMutableArray<MyNoteBookSubModel *>*_Nonnull )noteArr{
  684. NSMutableArray * array = [NSMutableArray array];
  685. for (MyNoteBookSubModel *dataModel in noteArr ) {
  686. if (dataModel.AttributeValue == 1) {
  687. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  688. model.SoureId = dataModel.MiddleId;
  689. model.Url = dataModel.AvatarUrl;
  690. model.Author = dataModel.Name;
  691. model.Title = dataModel.Title;
  692. model.SoureTypeId = CollectModel_NoteBook;
  693. [array addObject:model];
  694. }
  695. }
  696. return array;
  697. }
  698. #pragma mark - addCollect
  699. - (NSArray *)disSelectCollect:(NSMutableArray<MyFavoriteSubModel *> * _Nonnull) collectArr{
  700. NSMutableArray * array = [NSMutableArray array];
  701. for (MyFavoriteSubModel *dataModel in collectArr ) {
  702. if(dataModel.AttributeValue == 1)
  703. {
  704. FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
  705. model.SoureId = dataModel.CollectionDataId;
  706. model.Url = dataModel.Data.File;
  707. model.Size = dataModel.Data.FileSize;
  708. model.Author = dataModel.Data.Author;
  709. model.Title = dataModel.Title;
  710. model.MinUrl = dataModel.Data.MinFile;
  711. model.SoureTypeId = dataModel.CollectionType;
  712. [array addObject:model];
  713. }
  714. }
  715. return array;
  716. }
  717. - (void)commitGonwen:(TDButton *)sender{
  718. if (self.isTest == 1) {
  719. }else{
  720. NSMutableArray *arr = [NSMutableArray array];
  721. NSMutableArray * flowAttachmentsArray = [NSMutableArray array];
  722. for (FormFieldsModel *model in self.viewDataArray2) {
  723. if ([model.Type isEqualToString:@"TextArea"]) {
  724. if ([model.paramString isEqualToString:@"请输入"]) {
  725. NSString *errorString = [NSString stringWithFormat:@"%@%@",model.Placeholder,model.Label];
  726. SHOWERROR(errorString);
  727. return;
  728. }
  729. }
  730. if (ISEmptyString(model.paramString)) {
  731. if (model.Required){
  732. NSString *errorString = [NSString stringWithFormat:@"%@%@",model.Placeholder,model.Label];
  733. NSLog(@"%@",model);
  734. SHOWERROR(errorString);
  735. return;
  736. }
  737. }else{
  738. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  739. if (![model.Type isEqualToString:@"Attachment"]) {
  740. [dic setValue:model.paramString forKey:@"Value"];
  741. }
  742. [dic setValue:model.Type forKey:@"Type"];
  743. [dic setValue:@(model.Id) forKey:@"ID"];
  744. [arr addObject:dic];
  745. }
  746. }
  747. if (self.attrArray.count > 0) {
  748. for (FlowAttachmentsModel * tempModel in self.attrArray) {
  749. NSDictionary * AttachmentDict = @{@"SoureId":@(tempModel.SoureId),
  750. @"Url":tempModel.Url,
  751. @"Title":tempModel.Title,
  752. @"SoureTypeId":@(tempModel.SoureTypeId),
  753. @"Size":@(tempModel.Size),
  754. };
  755. [flowAttachmentsArray addObject:AttachmentDict];
  756. }
  757. }
  758. NSMutableDictionary *dic2 = [NSMutableDictionary dictionary];
  759. [dic2 setValue:@(self.indexID) forKey:@"ProcessId"];
  760. [dic2 setValue:arr forKey:@"Fields"];
  761. //如果是公文类型,审批人也必填
  762. if (self.pageType == Type_GongWen && self.model.AllowApproverCheck == 1) {
  763. if (self.shenPiRenArr.count < 1) {
  764. SHOWERROR(@"请选择审批人");
  765. return;
  766. }
  767. }
  768. [dic2 setValue:flowAttachmentsArray forKey:@"flowAttachments"];
  769. NSMutableArray *shenPiRenIDarray = [NSMutableArray array];
  770. for (SelectModel *model in self.shenPiRenArr) {
  771. [shenPiRenIDarray addObject:@(model.UserId)];
  772. }
  773. [dic2 setValue:shenPiRenIDarray forKey:@"ApproverCheckUserIds"];
  774. NSMutableArray *chaoSongrenIDArray = [NSMutableArray array];
  775. for (SelectModel *model in self.chaoSongRenArr ) {
  776. [chaoSongrenIDArray addObject:@(model.UserId)];
  777. }
  778. [dic2 setValue:chaoSongrenIDArray forKey:@"CarbonCopyUserIds"];
  779. [dic2 setValue:@(self.Id) forKey:@"Id"];
  780. NSLog(@"成功成功成功成功%@",dic2);
  781. SHOWLOADING
  782. WS(weakSelf);
  783. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,WorkFlowAddApproval_Post] parameters:dic2 responseStyle:DATA success:^(id _Nonnull responseObject) {
  784. REMOVESHOW
  785. NSLog(@"成功");
  786. if (weakSelf.detailsModel && self.Id > 0) {
  787. for ( NSInteger i = (self.navigationController.viewControllers.count - 1); i > 0 ;i --) {
  788. if ([self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyApprovalPageVC")] ) {
  789. [[NSNotificationCenter defaultCenter] postNotificationName:WORKREUPDATA object:nil];
  790. [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES];
  791. return;
  792. }
  793. }
  794. }else{
  795. [weakSelf.navigationController popViewControllerAnimated:YES];
  796. }
  797. } failure:^(NSError * _Nonnull error) {
  798. NSLog(@"失败");
  799. SHOWERROR([ZYCTool handerResultData:error]);
  800. }];
  801. }
  802. }
  803. -(void)gotoAddPeople{
  804. SendInfoGroupVC *sendinfoVc = [[SendInfoGroupVC alloc] init];
  805. [self.navigationController pushViewController:sendinfoVc animated:YES];
  806. }
  807. - (BOOL)textFieldShouldReturn:(UITextField *)textField{
  808. if (_isTest == 2) {
  809. self.viewDataArray2[textField.tag].paramString = textField.text;
  810. }
  811. [textField resignFirstResponder];
  812. return YES;
  813. }
  814. - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
  815. return YES;
  816. }
  817. - (void)textViewDidChange:(UITextView *)textView{
  818. self.viewDataArray2[textView.tag].paramString = textView.text;
  819. NSArray * cells = [self.myTableView visibleCells];
  820. for (UITableViewCell * cell in cells) {
  821. if ([cell isKindOfClass:[InPutGongWenCell class]]) {
  822. InPutGongWenCell * inCell = (InPutGongWenCell *)cell;
  823. inCell.bgL.text = textView.text;
  824. CGFloat H = [inCell.bgL sizeThatFits:CGSizeMake(SCREEN_WIDTH - 20, 10)].height;
  825. if ((56 + H) >= 120) {
  826. self.rowH = 76 + H;
  827. [self.myTableView beginUpdates];
  828. [self.myTableView endUpdates];
  829. }
  830. }
  831. }
  832. }
  833. - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange interaction:(UITextItemInteraction)interaction{
  834. if (_isTest == 2) {
  835. self.viewDataArray2[textView.tag].paramString = textView.text;
  836. }
  837. return YES;
  838. }
  839. #pragma mark - AddPictureCellDelegate
  840. - (void)addPictureWith:(NSIndexPath *)index WithSuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
  841. WEAKSELF
  842. [self addFile:index Sucuss:^(id _Nullable responseObject) {
  843. AddPictureCell *cell = [weakSelf.myTableView cellForRowAtIndexPath:index];
  844. if ([responseObject isKindOfClass:[NSArray class]]) {
  845. [weakSelf.attrArray addObjectsFromArray:responseObject];
  846. }else {
  847. [weakSelf.attrArray addObject:responseObject];
  848. }
  849. [cell.mycollectionView reloadData];
  850. REMOVESHOW;
  851. } failure:^(NSError * _Nonnull error ) {
  852. REMOVESHOW;
  853. SHOWERROR([ZYCTool handerResultData:error]);
  854. }];
  855. }
  856. // 多张图片上传
  857. - (void)didSelectImages:(NSArray<UIImage *> *)images success:(void (^) (id _Nullable))successfulk withImgs:(NSArray *)imgs {
  858. NSMutableArray *imageArr = [NSMutableArray array];
  859. for (UIImage *image in images) {
  860. [imageArr addObject:UIImageJPEGRepresentation(image,1.0f)];
  861. }
  862. SHOWLOADING
  863. NSString *urlString = [[NSString alloc] initWithFormat:@"%@%@",BaseUrl,Modify_UserImages_Post];
  864. [[HttpManager sharedHttpManager] HeaderUploadUrl:urlString parameters:@{} pictureArray:[imageArr copy] pictureKey:@"file" success:^(id _Nonnull responseObject) {
  865. REMOVESHOW
  866. NSLog(@"%@",responseObject);
  867. NSMutableArray * array = [NSMutableArray array];
  868. for (NSDictionary * dict in responseObject) {
  869. FlowAttachmentsModel * model = [FlowAttachmentsModel modelWithDictionary:dict];
  870. model.SoureId = [dict[@"FileId"] integerValue];
  871. model.Url = dict[@"AbsolutePath"];
  872. model.MinUrl = dict[@"MinAbsolutePath"];
  873. model.Title = dict[@"FileName"];
  874. model.SoureTypeId = CollectModel_file;
  875. [array addObject:model];
  876. }
  877. successfulk(array);
  878. } failure:^(NSError * _Nonnull error) {
  879. REMOVESHOW
  880. SHOWERROR([ZYCTool handerResultData:error]);
  881. }];
  882. }
  883. - (void)deletePictureWithCell:(NSIndexPath *)index SuperViewCellIndexPath:(NSIndexPath *)superIndex WithSuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
  884. // [self.viewDataArray2[superIndex.section].paraImage removeObjectAtIndex:index.item];
  885. // [self.myTableView reloadRowsAtIndexPaths:@[superIndex] withRowAnimation:UITableViewRowAnimationAutomatic];
  886. }
  887. #pragma mark - AddPeopleToGongWenCellDelegate,MyWorkAppApprovalCellDelegate
  888. - (void)addLookUpPeopleSuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
  889. NSLog(@"点击添加抄送人");
  890. self.isShenPinRen = NO;
  891. Department *defaltGroupSetion = [[Department alloc]init];
  892. defaltGroupSetion.Name = @"单位通讯录";
  893. defaltGroupSetion.Id = 0;
  894. Department *myGroupSetion = [[Department alloc]init];
  895. myGroupSetion.Name = @"自建通讯录";
  896. defaltGroupSetion.Id = 0;
  897. AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
  898. vc.notSearchChangeColor = YES;
  899. vc.titleStr = @"选人";
  900. vc.departSourceDataArray = @[defaltGroupSetion,myGroupSetion].mutableCopy;
  901. vc.isDefalutPage = 1;
  902. vc.isShow = NO;
  903. NSMutableArray * userArray = [NSMutableArray array];
  904. for (SelectModel * model in self.chaoSongRenArr) {
  905. [userArray addObject:@(model.UserId)];
  906. }
  907. [userArray addObject:@([AppUserModel sharedAppUserModel].Id)];
  908. vc.UserIds = userArray;
  909. vc.delegate = self;
  910. [self.navigationController pushViewController:vc animated:YES];
  911. }
  912. - (void)addApprovalPeopleSuccess:(void (^)(id _Nullable))success failure:(void (^)(NSError * _Nonnull))failure{
  913. NSLog(@"点击添加审批人");
  914. self.isShenPinRen = YES;
  915. MailListVC *vc = [MailListVC initMailListVC];
  916. vc.isCheck = YES;
  917. vc.isHiddenSearchView = YES;
  918. NSMutableArray * UserIds = [NSMutableArray array];
  919. for (SelectModel * model in self.shenPiRenArr) {
  920. [UserIds addObject:@(model.UserId)];
  921. }
  922. [UserIds addObject:@([AppUserModel sharedAppUserModel].Id)];
  923. vc.isShow = NO;
  924. vc.UserIds = UserIds;
  925. [self.navigationController pushViewController:vc animated:YES];
  926. }
  927. #pragma mark - 注册通知 接受抄送人和审批人数据
  928. - (void)registerNotification{
  929. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recviveApprovalRen:) name:NOTIFI_ApprovalRen object:nil];
  930. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recviveChaoSongRen:) name:NOTIFI_ChaoSongRen object:nil];
  931. }
  932. - (void)recviveChaoSongRen:(NSNotification *)notification{
  933. NSMutableArray <SelectModel *>* array = notification.userInfo[@"selectPeople"];
  934. [self.chaoSongRenArr addObjectsFromArray:array];
  935. [self.myTableView reloadData];
  936. }
  937. - (void)recviveApprovalRen:(NSNotification *)notification{
  938. SelectModel * model = [SelectModel modelWithDictionary:notification.userInfo];
  939. if (self.isShenPinRen) {
  940. [self.shenPiRenArr addObject:model];
  941. }else{
  942. [self.chaoSongRenArr addObject:model];
  943. }
  944. [self.myTableView reloadData];
  945. }
  946. #pragma mark - setter
  947. - (NSMutableArray <FlowAttachmentsModel *>*)attrArray
  948. {
  949. if (!_attrArray) {
  950. _attrArray = [NSMutableArray array];
  951. }
  952. return _attrArray;
  953. }
  954. - (NSMutableArray *)chaoSongRenArr{
  955. if (!_chaoSongRenArr) {
  956. _chaoSongRenArr = [NSMutableArray array];
  957. }
  958. return _chaoSongRenArr;
  959. }
  960. - (NSMutableArray *)shenPiRenArr{
  961. if (!_shenPiRenArr) {
  962. _shenPiRenArr = [NSMutableArray array];
  963. }
  964. return _shenPiRenArr;
  965. }
  966. - (void)dealloc
  967. {
  968. [[NSNotificationCenter defaultCenter] removeObserver:self];
  969. }
  970. - (void)pushFileOpenWithModel:(FlowAttachmentsModel *)model
  971. {
  972. WS(weakSelf);
  973. switch (model.SoureTypeId) {
  974. case CollectModel_Group:
  975. {
  976. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  977. vc.GroupId = model.SoureId;
  978. vc.titleStr = model.Title;
  979. [self.navigationController pushViewController:vc animated:YES];
  980. }
  981. break;
  982. case CollectModel_file:{
  983. DownFileViewController * vc = [[DownFileViewController alloc] init];
  984. vc.model = model;
  985. [self.navigationController pushViewController:vc animated:YES];
  986. }break;
  987. case CollectModel_Image:{
  988. DownFileViewController * vc = [[DownFileViewController alloc] init];
  989. vc.model = model;
  990. [self.navigationController pushViewController:vc animated:YES];
  991. }break;
  992. case CollectModel_Aritle:{
  993. SHOWLOADING
  994. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.SoureId] parameters:@{} success:^(id _Nonnull responseObject) {
  995. REMOVESHOW;
  996. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  997. HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  998. [homeDetail loadCurrentModel:itemModel];
  999. [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  1000. } failure:^(NSError * _Nonnull error) {
  1001. SHOWERROR([ZYCTool handerResultData:error]);
  1002. }];
  1003. }break;
  1004. case CollectModel_Notice:{
  1005. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1006. vc.type = CollectModel_Notice;
  1007. vc.Id = model.SoureId;
  1008. [self.navigationController pushViewController:vc animated:YES];
  1009. }break;
  1010. case CollectModel_Toipc:{
  1011. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1012. vc.type = CollectModel_Toipc;
  1013. vc.Id = model.SoureId;
  1014. [self.navigationController pushViewController:vc animated:YES];
  1015. }break;
  1016. case CollectModel_NewTopic:{
  1017. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1018. vc.type = CollectModel_NewTopic;
  1019. vc.Id = model.SoureId;
  1020. [self.navigationController pushViewController:vc animated:YES];
  1021. }break;
  1022. case CollectModel_NoteBook:{
  1023. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1024. vc.type = CollectModel_NoteBook;
  1025. vc.Id = model.SoureId;
  1026. [self.navigationController pushViewController:vc animated:YES];
  1027. }break;
  1028. case CollectModel_Collect:{
  1029. }break;
  1030. case CollectModel_CollectFile:{
  1031. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  1032. vc.listType = MyFavoriteListLevelTypeB;
  1033. vc.ParentId = 0;
  1034. vc.FolderId = model.SoureId;
  1035. vc.myTitle = model.Title;
  1036. [self.navigationController pushViewController:vc animated:YES];
  1037. }break;
  1038. case CollectModel_NoteFile:{
  1039. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  1040. vc.listType = MyFavoriteListLevelTypeB;
  1041. vc.ParentId = 0;
  1042. vc.FolderId = model.SoureId;
  1043. vc.myTitle = model.Title;
  1044. vc.VisitUserId = 0;
  1045. [self.navigationController pushViewController:vc animated:YES];
  1046. }break;
  1047. case CollectModel_InterMail:{
  1048. TDInterLeterDetailVC * vc = [TDInterLeterDetailVC initTDInterLeterDetailVC];
  1049. vc.detailType = InterLeterDetialType_Sign;
  1050. vc.interLeterID = model.SoureId;
  1051. [self.navigationController pushViewController:vc animated:YES];
  1052. }break;
  1053. case CollectModel_work:{
  1054. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  1055. vc.pageType = Type_ONEC;
  1056. vc.indexId = model.SoureId;
  1057. vc.title = model.Title;
  1058. vc.TodoId = model.SoureId;
  1059. [self.navigationController pushViewController:vc animated:YES];
  1060. }break;
  1061. case CollectModel_meetDetail:{
  1062. WorkFlowDetailsController *vc = [[WorkFlowDetailsController alloc] initWithId:model.SoureId];
  1063. [self.navigationController pushViewController:vc animated:YES];
  1064. }break;
  1065. case CollectModel_meetMian:{
  1066. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1067. vc.type = CollectModel_meetMian;
  1068. vc.Id = model.SoureId;
  1069. [self.navigationController pushViewController:vc animated:YES];
  1070. }break;
  1071. case CollectModel_financeCount:{
  1072. CountDataVC *vc = [CountDataVC initCountDataVC];
  1073. vc.index = 0;
  1074. vc.titleStr = @"财务统计";
  1075. [self.navigationController pushViewController:vc animated:YES];
  1076. }break;
  1077. case CollectModel_affairsCount:{
  1078. CountDataVC *vc = [CountDataVC initCountDataVC];
  1079. vc.index = 1;
  1080. vc.titleStr = @"人事统计";
  1081. [self.navigationController pushViewController:vc animated:YES];
  1082. }break;
  1083. case CollectModel_publishCount:{
  1084. CountDataVC *vc = [CountDataVC initCountDataVC];
  1085. vc.index = 2;
  1086. vc.titleStr = @"出版统计";
  1087. [self.navigationController pushViewController:vc animated:YES];
  1088. }break;
  1089. default:
  1090. break;
  1091. }
  1092. }
  1093. @end