AddLookUpUserSecondVC.m 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. //
  2. // AddLookUpUserSecondVC.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/25.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "AddLookUpUserSecondVC.h"
  9. #import "SendInfoGroupCell.h"
  10. #import "SendGroupBCell.h"
  11. #import "MailListSearchVC.h"
  12. #import "MyTDGroupView.h"
  13. #import "MailModel.h"
  14. #import "MailListCell.h"
  15. #import "ShareSysVC.h"
  16. #import "ShareCusVC.h"
  17. #import "ShowSysVC.h"
  18. #import "ShowUserVC.h"
  19. #import "ShowDesVC.h"
  20. @interface AddLookUpUserSecondVC ()<UITableViewDelegate,UITableViewDataSource>
  21. @property (nonatomic, strong) TDTableView *myTableView;
  22. @property (nonatomic, strong) UIView *listHeaderVIew;
  23. @property (nonatomic, strong) TDButton *serachButton;
  24. @property (nonatomic, strong) AddressBookGroupModel *addressBookModel;
  25. @property (nonatomic, strong) MyTDGroupView *searchView;
  26. @property (nonatomic,assign) NSInteger indexflag;
  27. @property (nonatomic, strong) NSMutableArray <SelectModel*>*selectArray;
  28. @property (nonatomic, strong) NSMutableArray <Department *>*selectDepartArray;
  29. @property (nonatomic, strong) NSMutableArray <SelectModel*>*usersSourceDataArray;
  30. @property (nonatomic, strong) NSMutableArray *dataSourceArray;
  31. @property (nonatomic, strong) NSMutableArray *OtherArray;
  32. @property (nonatomic, strong) UIView *SortView;
  33. @property (nonatomic, strong) UIButton *allSelectBtn;
  34. @property (nonatomic, strong) UILabel *selectCountL;
  35. @property (nonatomic, assign) BOOL allSelected;
  36. @end
  37. @implementation AddLookUpUserSecondVC
  38. - (void)viewWillAppear:(BOOL)animated
  39. {
  40. [super viewWillAppear:animated];
  41. [self countMailArray:@[]];
  42. }
  43. - (void)viewDidLoad {
  44. [super viewDidLoad];
  45. [self getdata];
  46. [self.view addSubview:self.listHeaderVIew];
  47. [self.listHeaderVIew mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.left.right.mas_equalTo(self.view);
  49. make.top.mas_equalTo(self.myNavigationBar.mas_bottom);
  50. make.height.mas_offset(44);
  51. }];
  52. [self.listHeaderVIew addSubview:self.searchView];
  53. [self addSortV];
  54. [self.view addSubview:self.myTableView];
  55. [self.myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.top.mas_equalTo(self.SortView.mas_bottom);
  57. make.left.right.mas_equalTo(self.view);
  58. make.bottom.mas_equalTo(self.view.mas_safeAreaLayoutGuideBottom);
  59. }];
  60. WS(weakSelf);
  61. [self.searchView.button setAction:^{
  62. MailGroupListSerachVC *vc = [[MailGroupListSerachVC alloc] init];
  63. vc.IsSelect = YES;
  64. [weakSelf.navigationController pushViewController:vc animated:YES];
  65. }];
  66. self.fd_prefersNavigationBarHidden = YES;
  67. self.view.backgroundColor = UIColorHex(#FFFFFF);
  68. self.myTableView.backgroundColor = UIColorHex(#F5F6F8);
  69. [self createnavi];
  70. }
  71. #pragma mark - 导航视图
  72. - (void)createnavi{
  73. self.myNavigationBar.titleLabel.text = self.titleStr;
  74. [self.myNavigationBar.rightButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  75. [self.myNavigationBar.rightButton setTitle:@"确定" forState:UIControlStateNormal];
  76. [[self.myNavigationBar.rightButton titleLabel] setFont:[UIFont systemFontOfSize:15.f]];
  77. self.myNavigationBar.rightButton.hidden = NO;
  78. [self.myNavigationBar.rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  79. make.centerY.equalTo(self.myNavigationBar.backButton);
  80. make.height.mas_offset(@44);
  81. make.right.mas_equalTo(self.myNavigationBar.mas_right).offset(-15);
  82. }];
  83. }
  84. #pragma mark - 导航事件处理
  85. -(void)back{
  86. [self.navigationController popViewControllerAnimated:YES];
  87. }
  88. -(void)back1{
  89. for ( NSInteger i = (self.navigationController.viewControllers.count - 1); i >= 0 ;i --) {
  90. NSLog(@"%@",self.navigationController.viewControllers[i]);
  91. if ([self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyWorkWordVC")]
  92. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"SourceHomeVC")]
  93. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"ChatNewGroupVC")]
  94. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"H5ViewController")]
  95. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyTDTopicCreateVC")]
  96. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyFavoriteNewFindVC")]
  97. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"ChatNewRowVC")]
  98. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyTDTopicGroupUserVC")]
  99. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"WorkFlowOrderController")]
  100. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"ChatMsgDetailChatInfoVC")]
  101. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"CreateInterLeterVC")]
  102. || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MailListByZuVC")]) {
  103. [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES];
  104. return;
  105. }
  106. }
  107. }
  108. //全选操作
  109. - (void)selectedAction{
  110. if (self.allSelected) {
  111. [self.allSelectBtn setImage:IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  112. }else{
  113. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  114. }
  115. if (self.IsSubVC) {
  116. NSInteger count = 0;
  117. for(NSInteger i = 0 ; i < 2 ; i++){
  118. if (i == 0) {
  119. for (Department *depart in self.departSourceDataArray) {
  120. depart.hadSelected = self.allSelected;
  121. if (depart.hadSelected) {
  122. count ++;
  123. }
  124. [self countMailArray:@[depart]];
  125. }
  126. }
  127. if (i == 1) {
  128. for (SelectModel * model in self.usersSourceDataArray) {
  129. model.hadSelected = self.allSelected;
  130. if (model.hadSelected) {
  131. count ++;
  132. }
  133. [self countMailArray:@[model]];
  134. }
  135. }
  136. }
  137. self.selectCountL.text = [NSString stringWithFormat:@"%ld",count];
  138. }else{
  139. NSInteger count = 0;
  140. for (NSArray * array in self.dataSourceArray) {
  141. for (id sub in array) {
  142. if ([sub isKindOfClass:[MailModel class]]) {
  143. MailModel * model = (MailModel *)sub;
  144. model.IsSelect = self.allSelected;
  145. if (model.IsSelect) {
  146. count ++;
  147. }
  148. [self countMailArray:@[model]];
  149. }
  150. if ([sub isKindOfClass:[SelectModel class]]) {
  151. SelectModel * model = (SelectModel *)sub;
  152. model.hadSelected = self.allSelected;
  153. if (model.hadSelected) {
  154. count ++;
  155. }
  156. [self countMailArray:@[model]];
  157. }
  158. }
  159. }
  160. self.selectCountL.text = [NSString stringWithFormat:@"%ld",count];
  161. }
  162. [self.myTableView reloadData];
  163. }
  164. // 左边按钮 全选 取消全选
  165. - (void)secondBarButtonItems:(TDButton *)sender{
  166. [super menuAction:sender];
  167. }
  168. - (void)rightButtonAction:(TDButton *)sender{
  169. [self confirmAction:sender];
  170. }
  171. - (BOOL)hidesBottomBarWhenPushed{
  172. return YES;
  173. }
  174. - (void)confirmAction:(UIButton*)btn{
  175. NSMutableArray * mailArray = [NSMutableArray arrayWithArray:USERDEFAULTSGET(MAILSELECT)];
  176. NSMutableArray * chaoArray = [NSMutableArray array];
  177. NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
  178. NSMutableArray * mArray = [NSMutableArray array];
  179. [self.selectArray removeAllObjects];
  180. for (NSDictionary * dict in mailArray) {
  181. SelectModel * model = [SelectModel modelWithDictionary:dict];
  182. [chaoArray addObject:model];
  183. [mArray addObject:@{@"SourceType":@(model.SourceType),@"SourceId":@(model.SourceId),@"SourceTypeValue":@(model.TypeValue),@"SourceName":model.SourceName}];
  184. }
  185. if (self.isAllSelected) {
  186. [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFI_ChaoSongRen object:nil userInfo:@{@"selectPeople":chaoArray}];
  187. [self back1];
  188. return;
  189. }else{
  190. [paraDict setValue:mArray forKey:@"Item"];
  191. SHOWLOADING
  192. WS(weakSelf);
  193. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_User_Middle) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  194. REMOVESHOW
  195. for (NSDictionary *dict in responseObject) {
  196. SelectModel * model = [SelectModel modelWithDictionary:dict];
  197. model.UserId = model.Id;
  198. model.UserName = model.Name;
  199. model.SourceType = model.SourceType;
  200. model.SourceId = model.UserId;
  201. model.SourceName = model.UserName;
  202. [weakSelf.selectArray addObject:model];
  203. }
  204. [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFI_ChaoSongRen object:nil userInfo:@{@"selectPeople":weakSelf.selectArray}];
  205. [weakSelf back1];
  206. } failure:^(NSError * _Nonnull error) {
  207. // SHOWERROR([ZYCTool handerResultData:error]);
  208. }];
  209. }
  210. }
  211. #pragma mark - setter
  212. - (TDTableView *)myTableView{
  213. if (!_myTableView) {
  214. _myTableView = [[TDTableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
  215. _myTableView.delegate = self;
  216. _myTableView.dataSource = self;
  217. [self.myTableView registerNib:[UINib nibWithNibName:@"SendInfoGroupCell" bundle:nil] forCellReuseIdentifier:@"SendInfoGroupCell"];//SendGroupBCell
  218. [self.myTableView registerNib:[UINib nibWithNibName:@"SendGroupBCell" bundle:nil] forCellReuseIdentifier:@"SendGroupBCell"];
  219. }
  220. return _myTableView;
  221. }
  222. - (UIView *)listHeaderVIew{
  223. if (!_listHeaderVIew) {
  224. _listHeaderVIew = [UIView new];
  225. _listHeaderVIew.backgroundColor = UIColorHex(#FFFFFF);
  226. }
  227. return _listHeaderVIew;
  228. }
  229. - (MyTDGroupView *)searchView
  230. {
  231. if (!_searchView) {
  232. _searchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 4, SCREEN_WIDTH, 36)];
  233. }
  234. return _searchView;
  235. }
  236. - (TDButton *)serachButton{
  237. if (!_serachButton) {
  238. _serachButton = [[TDButton alloc]initWithFrame:CGRectMake(20,5, kGXScreenWidth-40,40)];
  239. [_serachButton setTitle:@"搜索" forState:UIControlStateNormal];
  240. [[_serachButton titleLabel] setFont:[UIFont systemFontOfSize:14.f]];
  241. [_serachButton setImage:IMG(@"sendinfo_search") forState:UIControlStateNormal];
  242. [_serachButton setTitleColor:UIColorHex(B6B7B9) forState:UIControlStateNormal];
  243. _serachButton.backgroundColor = UIColorHex(F5F6F8);
  244. [_serachButton addTarget:self action:@selector(searchhander:) forControlEvents:UIControlEventTouchDown];
  245. [_serachButton layoutButtonWithEdgeInsetsStyle:GLButtonEdgeInsetsStyleLeft imageTitleSpace:2];
  246. _serachButton.layer.cornerRadius = 20;
  247. _serachButton.layer.masksToBounds = YES;
  248. }
  249. return _serachButton;
  250. }
  251. - (NSMutableArray<SelectModel *> *)selectArray{
  252. if (!_selectArray) {
  253. _selectArray = [NSMutableArray array];
  254. }
  255. return _selectArray;
  256. }
  257. #pragma mark -UITableViewDelegate,UITableViewDataSource
  258. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  259. if (!self.IsSubVC) {
  260. return self.dataSourceArray.count;
  261. }else{
  262. return 2;
  263. }
  264. }
  265. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  266. if (!self.IsSubVC) {
  267. NSArray * array = self.dataSourceArray[section];
  268. return [array count];
  269. }else{
  270. if (section == 0) {
  271. return self.departSourceDataArray.count;
  272. }else{
  273. return self.usersSourceDataArray.count;
  274. }
  275. }
  276. }
  277. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  278. WS(weakSelf);
  279. if (!self.IsSubVC) {
  280. if ([self checkAllSelect:2]) {
  281. [self.allSelectBtn setImage:IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  282. }else{
  283. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  284. }
  285. NSString *cellIdentifier2 = @"SendGroupBCell";
  286. SendGroupBCell * cell = (SendGroupBCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier2];
  287. NSArray * array = self.dataSourceArray[indexPath.section];
  288. switch (indexPath.section) {
  289. case 0:
  290. {
  291. if (array.count > 0) {
  292. MailModel * model = array[indexPath.row];
  293. [cell setDataModel:model];
  294. [cell.selectbuton setAction:^{
  295. model.IsSelect = !model.IsSelect;
  296. [weakSelf checkSelectCount:model];
  297. [weakSelf.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  298. }];
  299. }
  300. }
  301. break;
  302. default:{
  303. NSString *cellIdentifier = @"SendInfoGroupCell";
  304. SendInfoGroupCell * detailCommentCell = (SendInfoGroupCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  305. SelectModel *model = array[indexPath.row];
  306. [detailCommentCell loadDataDepartUserModel:model indexWith:indexPath];
  307. [detailCommentCell.selectbuton setAction:^{
  308. model.hadSelected = !model.hadSelected;
  309. [weakSelf checkSelectCount:model];
  310. [weakSelf.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  311. }];
  312. detailCommentCell.rightImgeView.hidden = YES;
  313. return detailCommentCell;
  314. }
  315. break;
  316. }
  317. return cell;
  318. }else{
  319. if (indexPath.section == 1) {
  320. if ([self checkAllSelect:0]) {
  321. [self.allSelectBtn setImage:IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  322. }else{
  323. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  324. }
  325. NSString *cellIdentifier = @"SendInfoGroupCell";
  326. SendInfoGroupCell * detailCommentCell = (SendInfoGroupCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  327. SelectModel *model = self.usersSourceDataArray[indexPath.row];
  328. [detailCommentCell loadDataDepartUserModel:model indexWith:indexPath];
  329. [detailCommentCell.selectbuton setAction:^{
  330. model.hadSelected = !model.hadSelected;
  331. [weakSelf checkSelectCount:model];
  332. [weakSelf.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  333. }];
  334. detailCommentCell.rightImgeView.hidden = YES;
  335. return detailCommentCell;
  336. }else{
  337. if ([self checkAllSelect:1]) {
  338. [self.allSelectBtn setImage:IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  339. }else{
  340. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  341. }
  342. NSString *cellIdentifier2 = @"SendGroupBCell";
  343. SendGroupBCell * sendB = (SendGroupBCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier2];
  344. Department *model = self.departSourceDataArray[indexPath.row];
  345. [sendB loadDataModelDepartment: model WithIndex:indexPath];
  346. [sendB.selectbuton setAction:^{
  347. model.hadSelected = !model.hadSelected;
  348. [weakSelf checkSelectCount:model];
  349. [weakSelf.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  350. }];
  351. sendB.rightImgeView.hidden = NO;
  352. return sendB;
  353. }
  354. }
  355. }
  356. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  357. return 65.f;
  358. }
  359. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  360. {
  361. if (!self.IsSubVC && section > 0) {
  362. return 36.f;
  363. }else{
  364. return 0.01f;
  365. }
  366. }
  367. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  368. {
  369. return 0.01f;
  370. }
  371. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  372. {
  373. if (!self.IsSubVC && section > 0) {
  374. UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  375. view.backgroundColor = UIColorHex(0xF0EFF4);
  376. UILabel * titleL = [UILabel new];
  377. [view addSubview:titleL];
  378. titleL.textColor = UIColorHex(0x666666);
  379. titleL.font = Kfont(13);
  380. titleL.text = @"最近聊天";
  381. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  382. make.left.mas_offset(48);
  383. make.centerY.mas_equalTo(view);
  384. }];
  385. return view;
  386. }else{
  387. return [UIView new];
  388. }
  389. }
  390. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  391. if (self.IsSubVC) {
  392. if (self.isDefalutPage == 1) {
  393. if (indexPath.row == 0) { //
  394. Department *model = self.departSourceDataArray[indexPath.row];
  395. AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
  396. if (model.hadSelected) {
  397. model.hadSelected = !model.hadSelected;
  398. [self checkSelectCount:model];
  399. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  400. }else{
  401. vc.indexId = model.Id;
  402. vc.isDefalutPage = 2;
  403. vc.isMyGroup = 1;
  404. vc.SourceType = 1;
  405. vc.IsSubVC = YES;
  406. vc.isShow = self.isShow;
  407. vc.UserIds = self.UserIds;
  408. vc.titleStr = self.titleStr;
  409. vc.grouperArray = self.grouperArray;
  410. vc.isAllSelected = self.isAllSelected;
  411. [self.navigationController pushViewController:vc animated:YES];
  412. }
  413. }else{
  414. Department *model = self.departSourceDataArray[indexPath.row];
  415. AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
  416. if (model.hadSelected) {
  417. model.hadSelected = !model.hadSelected;
  418. [self checkSelectCount:model];
  419. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  420. }else{
  421. vc.indexId = model.Id;
  422. vc.isDefalutPage = 2;
  423. vc.isMyGroup = 2;
  424. vc.titleStr = self.titleStr;
  425. vc.SourceType = 3;
  426. vc.IsSubVC = YES;
  427. vc.isShow = self.isShow;
  428. vc.UserIds = self.UserIds;
  429. vc.grouperArray = self.grouperArray;
  430. vc.isAllSelected = self.isAllSelected;
  431. [self.navigationController pushViewController:vc animated:YES];
  432. }
  433. }
  434. }else{
  435. if (indexPath.section == 0) {
  436. Department *model = self.departSourceDataArray[indexPath.row];
  437. if (model.hadSelected) {
  438. model.hadSelected = !model.hadSelected;
  439. [self checkSelectCount:model];
  440. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  441. }else{
  442. AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
  443. vc.indexId = model.Id;
  444. vc.isDefalutPage = 2;
  445. vc.IsSubVC = YES;
  446. vc.isShow = self.isShow;
  447. vc.UserIds = self.UserIds;
  448. vc.titleStr = self.titleStr;
  449. vc.isMyGroup = self.isMyGroup;
  450. vc.SourceType = self.SourceType;
  451. vc.grouperArray = self.grouperArray;
  452. vc.isAllSelected = self.isAllSelected;
  453. [self.navigationController pushViewController:vc animated:YES];
  454. }
  455. }else{
  456. SelectModel *model = self.usersSourceDataArray[indexPath.row];
  457. model.hadSelected = !model.hadSelected;
  458. [self checkSelectCount:model];
  459. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  460. }
  461. }
  462. }else{
  463. NSArray * array = [self.dataSourceArray objectAtIndex:indexPath.section];
  464. MailModel * model = [array objectAtIndex:indexPath.row];
  465. switch (model.TypeId) {
  466. case MailListUserType:
  467. {
  468. SelectModel * smodel = [array objectAtIndex:indexPath.row];
  469. smodel.hadSelected = !smodel.hadSelected;
  470. [self checkSelectCount:smodel];
  471. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  472. }
  473. break;
  474. case MailListDesType:
  475. {
  476. if (model.IsSelect) {
  477. model.IsSelect = !model.IsSelect;
  478. [self checkSelectCount:model];
  479. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  480. }else{
  481. ShowDesVC * vc = [ShowDesVC initShowDesVC];
  482. vc.dataSourceArray = model.Items.mutableCopy;
  483. vc.IsSelect = YES;
  484. vc.IsSelectDes = self.isAllSelected;
  485. [self.navigationController pushViewController:vc animated:YES];
  486. }
  487. }
  488. break;
  489. case MailListSysType:
  490. {
  491. if (model.IsSelect) {
  492. model.IsSelect = !model.IsSelect;
  493. [self checkSelectCount:model];
  494. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  495. }else{
  496. ShowSysVC * vc = [ShowSysVC initShowSysVC];
  497. vc.dataSourceArray = model.Items.mutableCopy;
  498. vc.IsSelect = YES;
  499. vc.IsSelectDes = self.isAllSelected;
  500. [self.navigationController pushViewController:vc animated:YES];
  501. }
  502. }
  503. break;
  504. case MailListCusType:
  505. {
  506. if (model.IsSelect) {
  507. model.IsSelect = !model.IsSelect;
  508. [self checkSelectCount:model];
  509. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  510. }else{
  511. AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
  512. vc.indexId = self.departSourceDataArray[indexPath.row].Id;
  513. vc.isDefalutPage = 2;
  514. vc.isMyGroup = 2;
  515. vc.titleStr = self.titleStr;
  516. vc.SourceType = 3;
  517. vc.IsSubVC = YES;
  518. vc.isShow = self.isShow;
  519. vc.UserIds = self.UserIds;
  520. vc.grouperArray = self.grouperArray;
  521. vc.isAllSelected = self.isAllSelected;
  522. [self.navigationController pushViewController:vc animated:YES];
  523. }
  524. }
  525. break;
  526. case MailListOtherType:
  527. {
  528. if (model.IsSelect) {
  529. model.IsSelect = !model.IsSelect;
  530. [self checkSelectCount:model];
  531. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  532. }else{
  533. ShowUserVC * vc = [ShowUserVC initShowUserVC];
  534. vc.IsSelect = YES;
  535. vc.IsSelectDes = self.isAllSelected;
  536. vc.dataSourceArray = self.OtherArray.mutableCopy;
  537. [self.navigationController pushViewController:vc animated:YES];
  538. }
  539. }
  540. break;
  541. default:
  542. {
  543. if (model.IsSelect) {
  544. model.IsSelect = !model.IsSelect;
  545. [self checkSelectCount:model];
  546. [self.myTableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  547. }else{
  548. AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
  549. vc.indexId = self.departSourceDataArray[indexPath.row].Id;
  550. vc.isDefalutPage = 2;
  551. vc.isMyGroup = 2;
  552. vc.titleStr = self.titleStr;
  553. vc.SourceType = 3;
  554. vc.IsSubVC = YES;
  555. vc.isShow = self.isShow;
  556. vc.UserIds = self.UserIds;
  557. vc.grouperArray = self.grouperArray;
  558. vc.isAllSelected = self.isAllSelected;
  559. [self.navigationController pushViewController:vc animated:YES];
  560. }
  561. }
  562. break;
  563. }
  564. }
  565. }
  566. - (BOOL)checkAllSelect:(NSInteger)index
  567. {
  568. switch (index) {
  569. case 0:
  570. {
  571. for (SelectModel * model in self.usersSourceDataArray) {
  572. if (!model.hadSelected) {
  573. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  574. return NO;
  575. }
  576. }
  577. [self.allSelectBtn setImage:IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  578. return YES;
  579. }
  580. break;
  581. case 1:
  582. {
  583. for (Department * model in self.departSourceDataArray) {
  584. if (!model.hadSelected) {
  585. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  586. return NO;
  587. }
  588. }
  589. [self.allSelectBtn setImage:IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  590. return YES;
  591. }
  592. break;
  593. default:
  594. {
  595. for (NSArray * array in self.dataSourceArray) {
  596. for (id sub in array) {
  597. if ([sub isKindOfClass:[MailModel class]]) {
  598. MailModel * model = (MailModel *)sub;
  599. if (!model.IsSelect) {
  600. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  601. return NO;
  602. }
  603. }
  604. if ([sub isKindOfClass:[SelectModel class]]) {
  605. SelectModel * model = (SelectModel *)sub;
  606. if (!model.hadSelected) {
  607. [self.allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  608. return NO;
  609. }
  610. }
  611. }
  612. }
  613. [self.allSelectBtn setImage:IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  614. return YES;
  615. }
  616. break;
  617. }
  618. }
  619. - (void)checkSelectCount:(id)detail
  620. {
  621. NSInteger count = 0;
  622. for (SelectModel * model in self.usersSourceDataArray) {
  623. if (model.hadSelected) {
  624. count++;
  625. }
  626. }
  627. for (NSArray * subArray in self.dataSourceArray) {
  628. for (id sub in subArray) {
  629. if ([sub isKindOfClass:[MailModel class]]) {
  630. MailModel * model = (MailModel *)sub;
  631. if (model.IsSelect) {
  632. count++;
  633. }
  634. }
  635. if ([sub isKindOfClass:[SelectModel class]]) {
  636. SelectModel * model = (SelectModel *)sub;
  637. if (model.hadSelected) {
  638. count++;
  639. }
  640. }
  641. }
  642. }
  643. for (SelectModel * model in self.departSourceDataArray) {
  644. if (model.hadSelected) {
  645. count++;
  646. }
  647. }
  648. self.selectCountL.text = [NSString stringWithFormat:@"%ld",count];
  649. [self countMailArray:@[detail]];
  650. }
  651. - (void)countMailArray:(NSArray *)sssArray
  652. {
  653. NSMutableArray * mailArray = [NSMutableArray arrayWithArray:USERDEFAULTSGET(MAILSELECT)];
  654. for (id detail in sssArray) {
  655. SelectModel * ssmodel = [self addSelectModel:detail];
  656. __block BOOL isEque = NO;
  657. [mailArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  658. SelectModel * sModel = [SelectModel modelWithDictionary:(NSDictionary *)obj];
  659. if (sModel.SourceType == ssmodel.SourceType && sModel.SourceId == ssmodel.SourceId) {
  660. isEque = YES;
  661. if (!ssmodel.hadSelected) {
  662. [mailArray removeObject:obj];
  663. }
  664. }
  665. }];
  666. if (!isEque && ssmodel.hadSelected) {
  667. [mailArray addObject:@{@"SourceType":@(ssmodel.SourceType),@"SourceId":@(ssmodel.SourceId),@"SourceTypeValue":@(ssmodel.TypeValue),@"SourceName":ssmodel.SourceName}];
  668. }
  669. USERDEFAULTSSET(mailArray, MAILSELECT);
  670. }
  671. if (mailArray.count > 0) {
  672. self.myNavigationBar.rightButton.enabled = YES;
  673. [self.myNavigationBar.rightButton setTitleColor:UIColorHex(#3979D3) forState:UIControlStateNormal];
  674. [self.myNavigationBar.rightButton setTitle:[NSString stringWithFormat:@"确定(%ld)",(long)mailArray.count] forState:UIControlStateNormal];
  675. }else{
  676. self.myNavigationBar.rightButton.enabled = NO;
  677. [self.myNavigationBar.rightButton setTitle:@"确定" forState:UIControlStateNormal];
  678. [self.myNavigationBar.rightButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
  679. }
  680. }
  681. - (SelectModel *)addSelectModel:(id)model
  682. {
  683. if ([model isKindOfClass:[SelectModel class]]) {
  684. SelectModel * sModel = (SelectModel *)model;
  685. sModel.SourceType = 0;
  686. sModel.SourceId = sModel.UserId;
  687. sModel.SourceName = sModel.UserName;
  688. sModel.hadSelected = sModel.hadSelected;
  689. sModel.AvatarUrl = sModel.AvatarUrl;
  690. return sModel;
  691. }
  692. if ([model isKindOfClass:[MailModel class]]) {
  693. MailModel * mModel = (MailModel *)model;
  694. SelectModel * sModel = [[SelectModel alloc] init];
  695. sModel.SourceType = mModel.TypeId;
  696. sModel.SourceId = mModel.Id;
  697. sModel.SourceName = mModel.Name;
  698. sModel.TypeValue = mModel.TypeValue;
  699. sModel.hadSelected = mModel.IsSelect;
  700. return sModel;
  701. }
  702. if ([model isKindOfClass:[MailSubModel class]]) {
  703. MailSubModel * mModel = (MailSubModel *)model;
  704. SelectModel * sModel = [[SelectModel alloc] init];
  705. sModel.SourceType = mModel.TypeId;
  706. sModel.SourceId = mModel.Id;
  707. sModel.SourceName = mModel.Name;
  708. sModel.TypeValue = mModel.TypeValue;
  709. sModel.hadSelected = mModel.IsSelect;
  710. return sModel;
  711. }
  712. if ([model isKindOfClass:[Department class]]) {
  713. Department * mModel = (Department *)model;
  714. SelectModel * sModel = [[SelectModel alloc] init];
  715. if (self.isDefalutPage == 2 && self.isMyGroup == 2) {
  716. sModel.SourceType = 3;
  717. sModel.SourceName = mModel.GroupName;
  718. }else{
  719. sModel.SourceType = 1;
  720. sModel.SourceName = mModel.Name;
  721. }
  722. sModel.SourceId = mModel.Id;
  723. sModel.TypeValue = 0;
  724. sModel.hadSelected = mModel.hadSelected;
  725. return sModel;
  726. }
  727. return nil;
  728. }
  729. #pragma mark - 网络数据请求
  730. - (void)getdata{
  731. if (!self.IsSubVC) {
  732. [self getRootData];
  733. }
  734. if (self.isDefalutPage == 1) {
  735. return ;
  736. }
  737. if (self.isMyGroup == 1) {
  738. [self defaltGroupData];
  739. }
  740. if (self.isMyGroup == 2) {
  741. [self myGroupData];
  742. }
  743. }
  744. - (void)getRootData
  745. {
  746. SHOWLOADING
  747. WS(weakSelf);
  748. [self.dataSourceArray removeAllObjects];
  749. [self.OtherArray removeAllObjects];
  750. [[HttpManager sharedHttpManager] GETUrl:Host(API_APP_User_Link) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  751. NSLog(@"%@",responseObject);
  752. REMOVESHOW
  753. NSMutableArray * fArray = [NSMutableArray array];
  754. if ([responseObject[@"Items"] isKindOfClass:[NSArray class]]) {
  755. NSArray * array = responseObject[@"Items"];
  756. for (NSDictionary * dict in array) {
  757. MailModel * model = [MailModel modelWithDictionary:dict];
  758. [fArray addObject:model];
  759. }
  760. if ([responseObject[@"FriendUsers"] isKindOfClass:[NSArray class]]) {
  761. NSArray * array = responseObject[@"FriendUsers"];
  762. for (NSDictionary * dict in array) {
  763. SelectModel * smodel = [[SelectModel alloc] initDict:dict];
  764. smodel.SourceId = smodel.UserId;
  765. smodel.SourceName = smodel.UserName;
  766. smodel.SourceType = 0;
  767. [weakSelf.OtherArray addObject:smodel];
  768. }
  769. }
  770. NSMutableArray * sArray = [NSMutableArray array];
  771. if ([responseObject[@"LatelyChatUsers"] isKindOfClass:[NSArray class]]) {
  772. NSArray * array = responseObject[@"LatelyChatUsers"];
  773. for (NSDictionary * dict in array) {
  774. SelectModel * smodel = [[SelectModel alloc] initDict:dict];
  775. smodel.SourceId = smodel.UserId;
  776. smodel.SourceName = smodel.UserName;
  777. smodel.SourceType = 0;
  778. [sArray addObject:smodel];
  779. }
  780. }
  781. [weakSelf.dataSourceArray addObject:fArray];
  782. [weakSelf.dataSourceArray addObject:sArray];
  783. dispatch_async(dispatch_get_main_queue(), ^{
  784. [weakSelf.myTableView reloadData];
  785. });
  786. }
  787. } failure:^(NSError * _Nonnull error) {
  788. REMOVESHOW
  789. }];
  790. }
  791. - (void)defaltGroupData{
  792. SHOWLOADING
  793. NSDictionary * paraDict = @{@"DepartmentId":@(self.indexId),@"UserIds":self.UserIds,@"IsShow":@(self.isShow)};
  794. NSLog(@"%@",paraDict);
  795. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,AddressBookGroup_DepartemntDetail_Post] parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  796. REMOVESHOW;
  797. NSDictionary *dic = responseObject;
  798. NSArray *departMentArray = dic[@"Departments"];
  799. NSMutableArray *departMentMutableArray = [NSMutableArray array];
  800. for (NSDictionary *dic2 in departMentArray) {
  801. Department *model = [[Department alloc]initWithDictionary:dic2 error:nil];
  802. [departMentMutableArray addObject:model];
  803. }
  804. self.departSourceDataArray = departMentMutableArray;
  805. NSArray *userArray = dic[@"Users"];
  806. NSMutableArray *usersMutableArray = [NSMutableArray array];
  807. for (NSDictionary *dic2 in userArray) {
  808. SelectModel * model = [[SelectModel alloc] initDict:dic2];
  809. [usersMutableArray addObject:model];
  810. }
  811. for (SelectModel * model in self.grouperArray) {
  812. for (SelectModel * userModel in usersMutableArray) {
  813. if (userModel.UserId == model.UserId) {
  814. userModel.IsDelete = YES;
  815. }
  816. }
  817. }
  818. NSMutableArray * checkUserArray = [NSMutableArray array];
  819. for (SelectModel * model in usersMutableArray) {
  820. if (!model.IsDelete) {
  821. [checkUserArray addObject:model];
  822. }
  823. }
  824. self.usersSourceDataArray = checkUserArray;
  825. [self.myTableView reloadData];
  826. } failure:^(NSError * _Nonnull error) {
  827. SHOWERROR([ZYCTool handerResultData:error]);
  828. }];
  829. }
  830. - (void)myGroupData{
  831. SHOWLOADING
  832. NSDictionary * paraDict = @{@"AddressBookGroupId":@(self.indexId),@"UserIds":self.UserIds,@"IsShow":@(self.isShow)};
  833. NSLog(@"%@",paraDict);
  834. [[HttpManager sharedHttpManager] POSTUrl:[NSString stringWithFormat:@"%@%@",BaseUrl,AddressBookGroupUser_Get_Post] parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  835. REMOVESHOW;
  836. NSDictionary *dic = responseObject;
  837. NSArray *departMentArray = dic[@"AddressBookGroups"];
  838. NSMutableArray *departMentMutableArray = [NSMutableArray array];
  839. for (NSDictionary *dic2 in departMentArray) {
  840. Department *model = [[Department alloc]initWithDictionary:dic2 error:nil];
  841. [departMentMutableArray addObject:model];
  842. }
  843. self.departSourceDataArray = departMentMutableArray;
  844. NSArray *userArray = dic[@"AddressBookGroupUsers"];
  845. NSMutableArray *usersMutableArray = [NSMutableArray array];
  846. for (NSDictionary *dic2 in userArray) {
  847. SelectModel * model = [SelectModel modelWithDictionary:dic2];
  848. [usersMutableArray addObject:model];
  849. }
  850. for (SelectModel * model in self.grouperArray) {
  851. for (SelectModel * userModel in usersMutableArray) {
  852. if (userModel.UserId == model.UserId) {
  853. userModel.IsDelete = YES;
  854. }
  855. }
  856. }
  857. NSMutableArray * checkUserArray = [NSMutableArray array];
  858. for (SelectModel * model in usersMutableArray) {
  859. if (!model.IsDelete) {
  860. [checkUserArray addObject:model];
  861. }
  862. }
  863. self.usersSourceDataArray = checkUserArray;
  864. [self.myTableView reloadData];
  865. } failure:^(NSError * _Nonnull error) {
  866. SHOWERROR([ZYCTool handerResultData:error]);
  867. }];
  868. }
  869. #pragma mark - 搜索事件处理
  870. - (void)searchhander:(TDButton *)sedner{
  871. }
  872. -(void)getSearchKeyWord:(NSString *)searchWord{
  873. NSLog(@"%@",searchWord);
  874. if(searchWord.length > 0){
  875. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  876. [dict setObject:searchWord forKey:@"Key"];
  877. WEAKSELF
  878. [[HttpManager sharedHttpManager] POSTWithUrl:Host(AddressBookGroup_Search_Post) parameters:dict success:^(id _Nonnull responseObject) {
  879. STRONGSELF
  880. NSArray *array = responseObject;
  881. if (array.count == 0) {
  882. SHOWERROR(@"没有搜到结果");
  883. }else{
  884. NSArray *userArray = responseObject;
  885. NSMutableArray *usersMutableArray = [NSMutableArray array];
  886. for (NSDictionary *dic2 in userArray) {
  887. SelectModel * model = [[SelectModel alloc] initDict:dic2];
  888. [usersMutableArray addObject:model];
  889. }
  890. [strongSelf.departSourceDataArray removeAllObjects];
  891. strongSelf.usersSourceDataArray = usersMutableArray;
  892. [strongSelf.myTableView reloadData];
  893. [strongSelf.myTableView reloadData];
  894. }
  895. } failure:^(NSError * _Nonnull error) {
  896. SHOWERROR([ZYCTool handerResultData:error])
  897. }];
  898. }else{
  899. }
  900. }
  901. - (void)canCelAllSelect
  902. {
  903. for (SelectModel * model in self.usersSourceDataArray) {
  904. model.hadSelected = NO;
  905. }
  906. for (Department * model in self.departSourceDataArray) {
  907. model.hadSelected = NO;
  908. }
  909. }
  910. - (UIButton *)allSelectBtn
  911. {
  912. if (!_allSelectBtn) {
  913. _allSelectBtn = [UIButton new];
  914. [_allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  915. }
  916. return _allSelectBtn;
  917. }
  918. - (UILabel *)selectCountL
  919. {
  920. if (!_selectCountL) {
  921. _selectCountL = [UILabel new];
  922. _selectCountL.font = Kfont(13);
  923. _selectCountL.text = @"0";
  924. _selectCountL.textColor = UIColorHex(0x0F88EB);
  925. }
  926. return _selectCountL;
  927. }
  928. - (UIView *)SortView
  929. {
  930. if (!_SortView) {
  931. _SortView = [UIView new];
  932. _SortView.backgroundColor = UIColorHex(0xF0EFF4);
  933. }
  934. return _SortView;
  935. }
  936. - (void)addSortV
  937. {
  938. [self.view addSubview:self.SortView];
  939. [self.SortView mas_makeConstraints:^(MASConstraintMaker *make) {
  940. make.left.right.mas_equalTo(self.view);
  941. make.height.mas_offset(38);
  942. make.top.mas_equalTo(self.listHeaderVIew.mas_bottom);
  943. }];
  944. [self.SortView addSubview:self.allSelectBtn];
  945. [self.SortView addSubview:self.selectCountL];
  946. [self.allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  947. make.left.mas_offset(5);
  948. make.centerY.mas_equalTo(self.SortView);
  949. make.size.mas_offset(CGSizeMake(38, 38));
  950. }];
  951. UILabel * leftL = [UILabel new];
  952. leftL.text = @"已选:";
  953. leftL.textColor = UIColorHex(0x666666);
  954. leftL.font = Kfont(13);
  955. [self.SortView addSubview:leftL];
  956. [leftL mas_makeConstraints:^(MASConstraintMaker *make) {
  957. make.left.mas_equalTo(self.allSelectBtn.mas_right).offset(5);
  958. make.centerY.mas_equalTo(self.SortView);
  959. }];
  960. [self.selectCountL mas_makeConstraints:^(MASConstraintMaker *make) {
  961. make.left.mas_equalTo(leftL.mas_right).offset(8);
  962. make.centerY.mas_equalTo(self.SortView);
  963. }];
  964. WS(weakSelf);
  965. [self.allSelectBtn setAction:^{
  966. weakSelf.allSelected = !weakSelf.allSelected;
  967. [weakSelf selectedAction];
  968. }];
  969. }
  970. - (NSMutableArray *)dataSourceArray
  971. {
  972. if (!_dataSourceArray) {
  973. _dataSourceArray = [NSMutableArray array];
  974. }
  975. return _dataSourceArray;
  976. }
  977. - (NSMutableArray *)OtherArray
  978. {
  979. if (!_OtherArray) {
  980. _OtherArray = [NSMutableArray array];
  981. }
  982. return _OtherArray;
  983. }
  984. - (void)viewWillDisappear:(BOOL)animated
  985. {
  986. [super viewWillDisappear:animated];
  987. [self canCelAllSelect];
  988. [self.myTableView reloadData];
  989. }
  990. @end