MyWorkWordVC.m 52 KB

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