TDInterLeterHomeViewController.m 123 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290
  1. //
  2. // TDInterLeterHomeViewController.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/9.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "TDInterLeterHomeViewController.h"
  9. #import "ChatMsgNoticeCell.h"
  10. #import "YCMenuView.h"
  11. #import "ShowNewGroupAlert.h"
  12. #import "TDInterLeterTypeVC.h"
  13. #import "TDInterLeterSearchVC.h"
  14. #import "NoticeNewGroupVC.h"
  15. #import "MoveViewController.h"
  16. #import "CreateInterLeterVC.h"
  17. #import "MyTDTopicCreateVC.h"
  18. #import "MyTDTopicDetailVC.h"
  19. #import "NSDate+Extension.h"
  20. #import "ShowBtn.h"
  21. #import "MyTDGroupView.h"
  22. #import "NoticeListModel.h"
  23. #import "MyApprovalPageDetail.h"
  24. @interface TDInterLeterHomeViewController ()<UITableViewDelegate,UITableViewDataSource,TDInterLeterTypeVCDelegate>
  25. //@property (weak, nonatomic) IBOutlet UITableView *tableView;
  26. @property (strong, nonatomic) UITableView *tableView;
  27. @property (weak, nonatomic) IBOutlet ShowBtn *titleBtn;
  28. @property (weak, nonatomic) IBOutlet UIButton *rightAddBtn;
  29. @property (weak, nonatomic) IBOutlet UIButton *rightEditBtn;
  30. @property (weak, nonatomic) IBOutlet UILabel *titleLable;
  31. @property (weak, nonatomic) IBOutlet UIButton *deleteSelectBtn;
  32. @property (weak, nonatomic) IBOutlet UIView *NavBar;
  33. @property (weak, nonatomic) IBOutlet UIView *HeadView;
  34. @property (strong, nonatomic) MyTDGroupView *SearchView;
  35. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *HeadHight;
  36. @property (strong, nonatomic) UIButton *leftCloseBtn;
  37. @property (strong, nonatomic) UIButton *rightMoveBtn;
  38. @property (strong, nonatomic) UILabel *LineL;
  39. @property (strong, nonatomic) NSMutableArray *taskActionArray;
  40. @property (strong, nonatomic) TDInterLeterTypeVC *tDInterLeterTypeVC;
  41. @property (assign, nonatomic) PageTypeFromShou pageType;
  42. @property (assign, nonatomic) NSUInteger currentPage;
  43. @property (assign, nonatomic) BOOL isFresh;
  44. @property (assign, nonatomic) NSInteger totalRecord;
  45. @property (strong, nonatomic) NSMutableArray<NoticeModel * >*interLetterArray;
  46. //界面操作状态参数
  47. @property (assign,nonatomic) OperationStateEnum operationStateEnum;
  48. //界面操作视图
  49. @property (strong,nonatomic) UIView *operationBottomBgView;
  50. @property (weak, nonatomic) IBOutlet UIButton *operationAllSelectButton;
  51. @property (nonatomic, assign) BOOL iSViewEditor;
  52. @property (strong,nonatomic) UIButton *opearateLeftBtn;
  53. @property (strong,nonatomic) UIButton *opearateRightBtn;
  54. @property (assign,nonatomic) BOOL isAllselect;
  55. @property (assign,nonatomic) BOOL addTableH;
  56. @property (assign,nonatomic) BOOL removeTableH;
  57. @property (strong,nonatomic) UIView *deleteView;
  58. @property (nonatomic, strong) UIView *SortView;
  59. @property (nonatomic, strong) UIButton *allSelectBtn;
  60. @property (nonatomic, strong) UILabel *selectCountL;
  61. @end
  62. @implementation TDInterLeterHomeViewController
  63. +(TDInterLeterHomeViewController *)initChatMsgNoticeVC{
  64. TDInterLeterHomeViewController *controller = [StoryboardManager.shared.interLeterHome instantiateViewControllerWithIdentifier:@"TDInterLeterHome"];
  65. return controller;
  66. }
  67. - (void)viewWillAppear:(BOOL)animated{
  68. [super viewWillAppear:animated];
  69. [self headRefresh];
  70. }
  71. - (MyTDGroupView *)SearchView
  72. {
  73. if (!_SearchView) {
  74. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  75. }
  76. return _SearchView;
  77. }
  78. - (UITableView *)tableView
  79. {
  80. if (!_tableView) {
  81. _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  82. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  83. }
  84. return _tableView;
  85. }
  86. - (void)autoSizeBtn:(NSString *)title
  87. {
  88. [self.titleBtn setLabelTitle:title];
  89. }
  90. - (void)viewDidLoad {
  91. [super viewDidLoad];
  92. self.fd_prefersNavigationBarHidden = YES;
  93. self.fd_interactivePopDisabled = YES;
  94. self.view.backgroundColor = RGB(255, 255, 255);
  95. [self addSortV];
  96. self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  97. [self.HeadView addSubview:self.SearchView];
  98. [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
  99. make.top.mas_offset(6);
  100. make.left.right.mas_equalTo(self.HeadView);
  101. make.height.mas_offset(36);
  102. }];
  103. WS(weakSelf);
  104. [self.SearchView.button setAction:^{
  105. TDInterLeterSearchVC *vc = [[TDInterLeterSearchVC alloc] init];
  106. vc.FolderId = weakSelf.interLeterFolderId;
  107. vc.type = weakSelf.pageType;
  108. [weakSelf.navigationController pushViewController:vc animated:YES];
  109. }];
  110. [self.view addSubview:self.tableView];
  111. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  112. make.left.right.mas_equalTo(self.view);
  113. make.top.mas_equalTo(self.HeadView.mas_bottom);
  114. if (@available(iOS 11.0, *)) {
  115. make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
  116. } else {
  117. make.bottom.equalTo(self.view.mas_bottom);
  118. }
  119. }];
  120. self.tableView.delegate = self;
  121. self.tableView.dataSource = self;
  122. self.tableView.backgroundColor = [UIColor clearColor];
  123. self.pageType = PageTypeFromTitleAll;
  124. [self autoSizeBtn:@"全部"];
  125. [self.titleBtn setAction:^{
  126. weakSelf.tDInterLeterTypeVC.view.hidden = !weakSelf.tDInterLeterTypeVC.view.hidden;
  127. if(weakSelf.tDInterLeterTypeVC.view.hidden){
  128. [weakSelf.titleBtn dismiss];
  129. }else{
  130. [weakSelf.titleBtn show];
  131. }
  132. }];
  133. [self.rightAddBtn setAction:^{
  134. NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
  135. YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
  136. view.menuColor = RGB(255, 255, 255);
  137. view.separatorColor = RGB(234, 234, 234);
  138. view.textColor = RGB(102, 102, 102);
  139. view.textFont = [UIFont systemFontOfSize:16.0];
  140. view.menuCellHeight = 43.5;
  141. view.maxDisplayCount = 10;
  142. view.offset = -6;
  143. [view show];
  144. }];
  145. [self.rightEditBtn setAction:^{
  146. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  147. vc.type = CollectModel_Notice;
  148. vc.replayType = MailReplayCreate;
  149. vc.FolderId = weakSelf.interLeterFolderId;
  150. [weakSelf.navigationController pushViewController:vc animated:YES];
  151. }];
  152. [self.deleteSelectBtn setAction:^{
  153. [weakSelf changeToOperation:YES];
  154. }];
  155. [self.view addSubview:self.tDInterLeterTypeVC.view];
  156. [self initBottomBgView];
  157. [self initDeleteView];
  158. [self changeToOperation:NO];
  159. self.iSViewEditor = NO;
  160. }
  161. #pragma mark - 批量编辑
  162. -(UIView *)deleteView{
  163. if(!_deleteView){
  164. _deleteView = [[UIView alloc] init];
  165. CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
  166. _deleteView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
  167. _deleteView.backgroundColor = RGB(255, 255, 255);
  168. _deleteView.hidden = YES;
  169. }
  170. return _deleteView;
  171. }
  172. -(void)initDeleteView
  173. {
  174. UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  175. [leftCloseBtn setTitle:@"全部删除" forState:UIControlStateNormal];
  176. [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
  177. leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  178. [self.deleteView addSubview:leftCloseBtn];
  179. leftCloseBtn.frame = CGRectMake(0, 0, SCREEN_WIDTH/2, self.deleteView.height);
  180. UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  181. [rightMoveBtn setTitle:@"全部恢复" forState:UIControlStateNormal];
  182. [rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
  183. rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  184. [self.deleteView addSubview:rightMoveBtn];
  185. rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, self.deleteView.height);
  186. UILabel * topLine = [[UILabel alloc] init];
  187. topLine.backgroundColor = RGB(240, 239, 244);
  188. [self.deleteView addSubview:topLine];
  189. topLine.frame = CGRectMake(0, 0, SCREEN_WIDTH, 0.5);
  190. UILabel *line = [[UILabel alloc] init];
  191. line.backgroundColor = RGB(240, 239, 244);
  192. [self.deleteView addSubview:line];
  193. line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.deleteView.height);
  194. WS(weakSelf);
  195. [leftCloseBtn setAction:^{
  196. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部删除" preferredStyle:UIAlertControllerStyleAlert];
  197. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  198. }];
  199. [ok setValue:k9 forKey:@"_titleTextColor"];
  200. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  201. SHOWLOADING
  202. NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_DeleteRecord_All),5];
  203. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  204. REMOVESHOW
  205. [weakSelf headRefresh];
  206. } failure:^(NSError * _Nonnull error) {
  207. SHOWERROR([ZYCTool handerResultData:error]);
  208. }];
  209. }];
  210. [alertVC addAction:ok];
  211. [alertVC addAction:noOk];
  212. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  213. }];
  214. [rightMoveBtn setAction:^{
  215. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部恢复" preferredStyle:UIAlertControllerStyleAlert];
  216. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  217. }];
  218. [ok setValue:k9 forKey:@"_titleTextColor"];
  219. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  220. SHOWLOADING
  221. NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_Recover_All),5];
  222. [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  223. REMOVESHOW
  224. [weakSelf headRefresh];
  225. } failure:^(NSError * _Nonnull error) {
  226. SHOWERROR([ZYCTool handerResultData:error]);
  227. }];
  228. }];
  229. [alertVC addAction:ok];
  230. [alertVC addAction:noOk];
  231. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  232. }];
  233. [[UtilsTools getWindow] addSubview:self.deleteView];
  234. }
  235. - (void)changeBarBtn:(BOOL)isHidden
  236. {
  237. self.rightAddBtn.hidden = isHidden;
  238. self.rightEditBtn.hidden = isHidden;
  239. self.deleteSelectBtn.hidden = !isHidden;
  240. self.deleteView.hidden = !isHidden;
  241. if(isHidden){
  242. if (!self.removeTableH) {
  243. self.addTableH = YES;
  244. self.removeTableH = YES;
  245. self.view.height -= self.tabBarController.tabBar.height;
  246. self.tableView.height -= self.tabBarController.tabBar.height;
  247. [self.view layoutIfNeeded];
  248. [self.tableView layoutIfNeeded];
  249. }
  250. }else{
  251. if (self.addTableH) {
  252. self.addTableH = NO;
  253. self.removeTableH = NO;
  254. self.tableView.height += self.tabBarController.tabBar.height;
  255. self.view.height += self.tabBarController.tabBar.height;
  256. [self.view layoutIfNeeded];
  257. [self.tableView layoutIfNeeded];
  258. }
  259. }
  260. }
  261. - (void)addRefresh
  262. {
  263. WS(weakSelf);
  264. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  265. [weakSelf headRefresh];
  266. }];
  267. // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
  268. // [weakSelf footerRefresh];
  269. // }];
  270. }
  271. - (void)removeRefresh
  272. {
  273. [self.tableView.mj_header endRefreshing];
  274. [self.tableView.mj_header removeFromSuperview];
  275. [self.tableView.mj_footer endRefreshing];
  276. [self.tableView.mj_footer removeFromSuperview];
  277. }
  278. - (void)headRefresh{
  279. self.currentPage = 1;
  280. self.totalRecord = 0;
  281. [self.interLetterArray removeAllObjects];
  282. [self getInterListData];
  283. }
  284. - (void)footerRefresh{
  285. self.currentPage += 1;
  286. if (self.totalRecord == self.interLetterArray.count) {
  287. [self.tableView.mj_footer endRefreshing];
  288. return ;
  289. }
  290. [self getInterListData];
  291. }
  292. - (void)getInterListData{
  293. NSLog(@"%@",@"刷新数据");
  294. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  295. if (self.pageType == PageTypeFromTitleDeleted) {
  296. [self changeBarBtn:YES];
  297. }else{
  298. [self changeBarBtn:NO];
  299. }
  300. [dict setObject:@(self.currentPage) forKey:@"Page"];
  301. [dict setObject:@"99999999" forKey:@"PerPage"];
  302. [dict setObject:@(self.pageType) forKey:@"SearchType"];
  303. [dict setObject:@"" forKey:@"Keyword"];
  304. [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  305. WS(weakSelf);
  306. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  307. NSLog(@"站内信返回数据%@",responseObject);
  308. NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  309. [weakSelf.tableView.mj_header endRefreshing];
  310. [weakSelf.tableView.mj_footer endRefreshing];
  311. weakSelf.totalRecord = listModel.Total;
  312. [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  313. if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  314. [weakSelf.tableView.mj_footer resetNoMoreData];
  315. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  316. }
  317. [weakSelf.tableView reloadData];
  318. } failure:^(NSError * _Nonnull error) {
  319. SHOWERROR([ZYCTool handerResultData:error]);
  320. [weakSelf.tableView.mj_header endRefreshing];
  321. [weakSelf.tableView.mj_footer endRefreshing];
  322. }];
  323. }
  324. - (TDInterLeterTypeVC *)tDInterLeterTypeVC{
  325. if (_tDInterLeterTypeVC == nil) {
  326. _tDInterLeterTypeVC = [TDInterLeterTypeVC initTDInterLeterTypeVC];
  327. [_tDInterLeterTypeVC.view setFrame:CGRectMake(0, kNavigationHeight, SCREEN_WIDTH, SCREEN_HEIGHT - kNavigationHeight)];
  328. [_tDInterLeterTypeVC.view setHidden:YES];
  329. _tDInterLeterTypeVC.delegate = self;
  330. }
  331. return _tDInterLeterTypeVC;
  332. }
  333. -(void)userSelectType:(NSString *)typeName{
  334. self.tDInterLeterTypeVC.view.hidden = !self.tDInterLeterTypeVC.view.hidden;
  335. if(self.tDInterLeterTypeVC.view.hidden){
  336. [self.titleBtn dismiss];
  337. }else{
  338. [self.titleBtn show];
  339. }
  340. if(typeName.length > 0){
  341. [self autoSizeBtn:typeName];
  342. if([@"全部" isEqualToString:typeName]){
  343. self.pageType = PageTypeFromTitleAll;
  344. }else if([@"通知" isEqualToString:typeName]){
  345. self.pageType = PageTypeFromTitleNotice;
  346. }else if([@"站内信" isEqualToString:typeName]){
  347. self.pageType = PageTypeFromTitleMail;
  348. }else if([@"匿名信" isEqualToString:typeName]){
  349. self.pageType = PageTypeFromTitleNoSign;
  350. }else if([@"我审批的" isEqualToString:typeName]){
  351. self.pageType = PageTypeFromTitleMeShen;
  352. }else if([@"我发出的" isEqualToString:typeName]){
  353. self.pageType = PageTypeFromTitleMeSend;
  354. }else if([@"抄送我的" isEqualToString:typeName]){
  355. self.pageType = PageTypeFromTitleChao;
  356. }else if([@"草稿箱" isEqualToString:typeName]){
  357. self.pageType = PageTypeFromTitleDraftBox;
  358. }else if([@"已删除" isEqualToString:typeName]){
  359. self.pageType = PageTypeFromTitleDeleted;
  360. }
  361. [self headRefresh];
  362. }
  363. }
  364. #pragma Mark 左滑按钮 iOS8以上
  365. - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
  366. NoticeModel *model = self.interLetterArray[indexPath.row];
  367. WS(weakSelf);
  368. if (self.operationStateEnum == OperationStateEnum0) {
  369. switch (model.NoticeStatus) {
  370. case 1:{
  371. switch (model.AttributeValue) {
  372. case 2:{
  373. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  374. [tableView setEditing:NO animated:YES];
  375. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  376. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  377. [tableView reloadData];
  378. }];
  379. [ok setValue:k9 forKey:@"_titleTextColor"];
  380. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  381. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  382. }];
  383. [alertVC addAction:ok];
  384. [alertVC addAction:noOk];
  385. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  386. }];
  387. action1.backgroundColor = RGB(255, 59, 47);
  388. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  389. [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"修改文件夹名称" changeStr:model.FolderName confirm:^(NSString * _Nonnull groupName) {
  390. NSLog(@"%@",groupName);
  391. [weakSelf reNameFind:model withReNameString:groupName];
  392. } cancle:^{
  393. }] show];
  394. }];
  395. action2.backgroundColor = RGB(255, 149, 3);
  396. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  397. [weakSelf topFind:model];
  398. }];
  399. action3.backgroundColor = RGB(197, 201, 204);
  400. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
  401. actions.performsFirstActionWithFullSwipe = NO;
  402. return actions;
  403. }break;
  404. case 3:{
  405. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  406. [weakSelf topFind:model];
  407. }];
  408. action1.backgroundColor = RGB(197, 201, 204);
  409. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
  410. actions.performsFirstActionWithFullSwipe = NO;
  411. return actions;
  412. }break;
  413. default:{
  414. WEAKSELF
  415. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  416. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  417. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  418. [tableView reloadData];
  419. }];
  420. [ok setValue:k9 forKey:@"_titleTextColor"];
  421. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  422. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  423. }];
  424. [alertVC addAction:ok];
  425. [alertVC addAction:noOk];
  426. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  427. }];
  428. action1.backgroundColor = RGB(255, 59, 47);
  429. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  430. STRONGSELF
  431. [strongSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  432. }];
  433. action2.backgroundColor = UIColorHex(0x589AF1);
  434. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  435. STRONGSELF
  436. [strongSelf topFind:model];
  437. }];
  438. action3.backgroundColor = RGB(197, 201, 204);
  439. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
  440. actions.performsFirstActionWithFullSwipe = NO;
  441. return actions;
  442. }
  443. break;
  444. }
  445. }break;
  446. case 0:
  447. {
  448. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"彻底删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  449. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  450. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  451. [tableView reloadData];
  452. }];
  453. [ok setValue:k9 forKey:@"_titleTextColor"];
  454. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  455. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:YES];
  456. }];
  457. [alertVC addAction:ok];
  458. [alertVC addAction:noOk];
  459. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  460. }];
  461. action1.backgroundColor = RGB(255, 59, 47);
  462. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
  463. actions.performsFirstActionWithFullSwipe = NO;
  464. return actions;
  465. }
  466. break;
  467. default:
  468. {
  469. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  470. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  471. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  472. [tableView reloadData];
  473. }];
  474. [ok setValue:k9 forKey:@"_titleTextColor"];
  475. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  476. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  477. }];
  478. [alertVC addAction:ok];
  479. [alertVC addAction:noOk];
  480. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  481. }];
  482. action1.backgroundColor = RGB(255, 59, 47);
  483. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  484. [weakSelf topFind:model];
  485. }];
  486. action2.backgroundColor = RGB(197, 201, 204);
  487. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
  488. actions.performsFirstActionWithFullSwipe = NO;
  489. return actions;
  490. }
  491. break;
  492. }
  493. }
  494. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
  495. actions.performsFirstActionWithFullSwipe = NO;
  496. return actions;
  497. }
  498. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  499. return 1;
  500. }
  501. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  502. return self.interLetterArray.count;
  503. }
  504. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  505. // NoticeModel *model = self.interLetterArray[indexPath.row];
  506. // switch (model.AttributeValue) {
  507. // case 1:
  508. // return [ChatMsgNoticeCell configCell2Height];
  509. // case 2:
  510. // return [ChatMsgNoticeCell configCell1Height];
  511. // default:
  512. // return 0;
  513. // }
  514. return UITableViewAutomaticDimension;
  515. }
  516. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  517. WS(weakSelf);
  518. NoticeModel *model = self.interLetterArray[indexPath.row];
  519. switch (self.operationStateEnum) {
  520. case OperationStateEnum0:{
  521. switch (model.AttributeValue) {
  522. case 1:{
  523. switch (model.NoticeStatus) {
  524. case 1:///正常
  525. {
  526. switch (model.TypeValue){
  527. case PageTypeFromTitleMail:
  528. {
  529. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  530. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  531. cell.cell2TitleLabel.text = model.Title;
  532. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  533. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  534. cell.IsTopImgV.hidden = !model.IsTop;
  535. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  536. cell.cell2RedBgView.hidden = model.IsRead;
  537. return cell;
  538. }
  539. break;
  540. case PageTypeFromTitleNotice:
  541. {
  542. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  543. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  544. cell.cell2TitleLabel.text = model.Title;
  545. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  546. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  547. cell.cell2RedBgView.hidden = model.IsRead;
  548. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  549. cell.IsTopImgV.hidden = !model.IsTop;
  550. return cell;
  551. }
  552. break;
  553. case PageTypeFromTitleMeShen:
  554. {
  555. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  556. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  557. cell.cell2TitleLabel.text = model.Title;
  558. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  559. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  560. cell.cell2RedBgView.hidden = model.IsRead;
  561. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  562. cell.IsTopImgV.hidden = !model.IsTop;
  563. return cell;
  564. }
  565. break;
  566. case PageTypeFromTitleMeSend:
  567. {
  568. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  569. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  570. cell.cell2TitleLabel.text = model.Title;
  571. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  572. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  573. cell.cell2RedBgView.hidden = model.IsRead;
  574. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  575. cell.IsTopImgV.hidden = !model.IsTop;
  576. return cell;
  577. }
  578. break;
  579. case PageTypeFromTitleChao:
  580. {
  581. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  582. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  583. cell.cell2TitleLabel.text = model.Title;
  584. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  585. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  586. cell.cell2RedBgView.hidden = model.IsRead;
  587. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  588. cell.IsTopImgV.hidden = !model.IsTop;
  589. return cell;
  590. }
  591. break;
  592. default:///匿名
  593. {
  594. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  595. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  596. cell.cell2TitleLabel.text = model.Title;
  597. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  598. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  599. cell.cell2RedBgView.hidden = model.IsRead;
  600. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  601. cell.IsTopImgV.hidden = !model.IsTop;
  602. return cell;
  603. }
  604. break;
  605. }
  606. }
  607. break;
  608. case 0:///删除
  609. {
  610. switch (model.TypeValue) {
  611. case PageTypeFromTitleMail:{
  612. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  613. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  614. cell.cell2TitleLabel.text = model.Title;
  615. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  616. cell.IsTopImgV.hidden = !model.IsTop;
  617. cell.cell2EditBtn.hidden = NO;
  618. cell.cell2RedBgView.hidden = YES;
  619. cell.cell2TimeLabel.hidden = YES;
  620. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  621. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  622. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  623. [cell.cell2EditBtn setAction:^{
  624. NSLog(@"恢复已删除站内信");
  625. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  626. }];
  627. return cell;
  628. }
  629. break;
  630. case PageTypeFromTitleNotice:
  631. {
  632. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  633. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  634. cell.cell2TitleLabel.text = model.Title;
  635. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  636. cell.IsTopImgV.hidden = !model.IsTop;
  637. cell.cell2EditBtn.hidden = NO;
  638. cell.cell2RedBgView.hidden = YES;
  639. cell.cell2TimeLabel.hidden = YES;
  640. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  641. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  642. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  643. [cell.cell2EditBtn setAction:^{
  644. NSLog(@"恢复已删除站内信");
  645. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  646. }];
  647. return cell;
  648. }
  649. break;
  650. case PageTypeFromTitleMeShen:
  651. {
  652. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  653. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  654. cell.cell2TitleLabel.text = model.Title;
  655. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  656. cell.IsTopImgV.hidden = !model.IsTop;
  657. cell.cell2EditBtn.hidden = NO;
  658. cell.cell2RedBgView.hidden = YES;
  659. cell.cell2TimeLabel.hidden = YES;
  660. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  661. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  662. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  663. [cell.cell2EditBtn setAction:^{
  664. NSLog(@"恢复已删除站内信");
  665. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  666. }];
  667. return cell;
  668. }
  669. break;
  670. case PageTypeFromTitleMeSend:
  671. {
  672. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  673. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  674. cell.cell2TitleLabel.text = model.Title;
  675. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  676. cell.IsTopImgV.hidden = !model.IsTop;
  677. cell.cell2EditBtn.hidden = NO;
  678. cell.cell2RedBgView.hidden = YES;
  679. cell.cell2TimeLabel.hidden = YES;
  680. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  681. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  682. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  683. [cell.cell2EditBtn setAction:^{
  684. NSLog(@"恢复已删除站内信");
  685. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  686. }];
  687. return cell;
  688. }
  689. break;
  690. case PageTypeFromTitleChao:
  691. {
  692. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  693. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  694. cell.cell2TitleLabel.text = model.Title;
  695. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  696. cell.IsTopImgV.hidden = !model.IsTop;
  697. cell.cell2EditBtn.hidden = NO;
  698. cell.cell2RedBgView.hidden = YES;
  699. cell.cell2TimeLabel.hidden = YES;
  700. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  701. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  702. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  703. [cell.cell2EditBtn setAction:^{
  704. NSLog(@"恢复已删除站内信");
  705. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  706. }];
  707. return cell;
  708. }
  709. break;
  710. default:///匿名
  711. {
  712. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  713. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  714. cell.cell2TitleLabel.text = model.Title;
  715. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  716. cell.IsTopImgV.hidden = !model.IsTop;
  717. cell.cell2EditBtn.hidden = NO;
  718. cell.cell2RedBgView.hidden = YES;
  719. cell.cell2TimeLabel.hidden = YES;
  720. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  721. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  722. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  723. [cell.cell2EditBtn setAction:^{
  724. NSLog(@"恢复已删除站内信");
  725. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  726. }];
  727. return cell;
  728. }
  729. break;
  730. }
  731. }
  732. break;
  733. default:
  734. {
  735. switch (model.TypeValue) {
  736. case PageTypeFromTitleMail:{
  737. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  738. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  739. cell.cell2TitleLabel.text = model.Title;
  740. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  741. cell.IsTopImgV.hidden = !model.IsTop;
  742. cell.cell2EditBtn.hidden = NO;
  743. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  744. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  745. [cell.cell2EditBtn setAction:^{
  746. [weakSelf editorButtonHander:indexPath];
  747. }];
  748. cell.cell2RedBgView.hidden = model.IsRead;
  749. cell.cell2TimeLabel.hidden = YES;
  750. return cell;
  751. }
  752. break;
  753. case PageTypeFromTitleNotice:
  754. {
  755. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  756. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  757. cell.cell2TitleLabel.text = model.Title;
  758. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  759. cell.IsTopImgV.hidden = !model.IsTop;
  760. cell.cell2EditBtn.hidden = NO;
  761. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  762. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  763. [cell.cell2EditBtn setAction:^{
  764. [weakSelf editorButtonHander:indexPath];
  765. }];
  766. cell.cell2RedBgView.hidden = model.IsRead;
  767. cell.cell2TimeLabel.hidden = YES;
  768. return cell;
  769. }
  770. break;
  771. case PageTypeFromTitleMeShen:
  772. {
  773. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  774. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  775. cell.cell2TitleLabel.text = model.Title;
  776. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  777. cell.IsTopImgV.hidden = !model.IsTop;
  778. cell.cell2EditBtn.hidden = NO;
  779. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  780. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  781. [cell.cell2EditBtn setAction:^{
  782. [weakSelf editorButtonHander:indexPath];
  783. }];
  784. cell.cell2RedBgView.hidden = model.IsRead;
  785. cell.cell2TimeLabel.hidden = YES;
  786. return cell;
  787. }
  788. break;
  789. case PageTypeFromTitleMeSend:
  790. {
  791. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  792. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  793. cell.cell2TitleLabel.text = model.Title;
  794. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  795. cell.IsTopImgV.hidden = !model.IsTop;
  796. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  797. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  798. cell.cell2EditBtn.hidden = NO;
  799. [cell.cell2EditBtn setAction:^{
  800. [weakSelf editorButtonHander:indexPath];
  801. }];
  802. cell.cell2RedBgView.hidden = model.IsRead;
  803. cell.cell2TimeLabel.hidden = YES;
  804. return cell;
  805. }
  806. break;
  807. case PageTypeFromTitleChao:
  808. {
  809. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  810. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  811. cell.cell2TitleLabel.text = model.Title;
  812. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  813. cell.IsTopImgV.hidden = !model.IsTop;
  814. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  815. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  816. cell.cell2EditBtn.hidden = NO;
  817. [cell.cell2EditBtn setAction:^{
  818. [weakSelf editorButtonHander:indexPath];
  819. }];
  820. cell.cell2RedBgView.hidden = model.IsRead;
  821. cell.cell2TimeLabel.hidden = YES;
  822. return cell;
  823. }
  824. break;
  825. default:///匿名
  826. {
  827. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  828. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  829. cell.cell2TitleLabel.text = model.Title;
  830. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  831. cell.IsTopImgV.hidden = !model.IsTop;
  832. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  833. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  834. cell.cell2EditBtn.hidden = NO;
  835. [cell.cell2EditBtn setAction:^{
  836. [weakSelf editorButtonHander:indexPath];
  837. }];
  838. cell.cell2RedBgView.hidden = model.IsRead;
  839. cell.cell2TimeLabel.hidden = YES;
  840. return cell;
  841. }
  842. break;
  843. }
  844. }
  845. break;
  846. }
  847. }
  848. break;
  849. case 2:{
  850. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell1:tableView indexPath:indexPath];
  851. cell.cell1TitleLabel.text = model.FolderName;
  852. cell.IsTopImgV.hidden = !model.IsTop;
  853. cell.cell1TimeLabel.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount];
  854. return cell;
  855. }break;
  856. default:{
  857. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  858. return cell;
  859. }
  860. break;
  861. }
  862. }break;
  863. default:{
  864. self.isAllselect = [self checkNoticeArray];
  865. [self setingMoveButton];
  866. [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
  867. switch (model.AttributeValue) {
  868. case 1:{
  869. switch (model.NoticeStatus) {
  870. case 1:///正常
  871. {
  872. switch (model.TypeValue){
  873. case PageTypeFromTitleMail:
  874. {
  875. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  876. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  877. cell.cell2TitleLabel.text = model.Title;
  878. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  879. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  880. cell.IsTopImgV.hidden = !model.IsTop;
  881. cell.cell2TimeLabel.hidden = YES;
  882. cell.cell2RedBgView.hidden = YES;
  883. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  884. cell.cell1SelectButton.selected = model.IsSelect;
  885. [cell.cell1SelectButton setAction:^{
  886. model.IsSelect = !model.IsSelect;
  887. [weakSelf sumCount];
  888. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  889. }];
  890. cell.isShow = model.IsTop;
  891. return cell;
  892. }
  893. break;
  894. case PageTypeFromTitleNotice:
  895. {
  896. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  897. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  898. cell.cell2TitleLabel.text = model.Title;
  899. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  900. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  901. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  902. cell.cell2RedBgView.hidden = YES;
  903. cell.IsTopImgV.hidden = !model.IsTop;
  904. cell.cell2TimeLabel.hidden = YES;
  905. cell.cell1SelectButton.selected = model.IsSelect;
  906. [cell.cell1SelectButton setAction:^{
  907. model.IsSelect = !model.IsSelect;
  908. [weakSelf sumCount];
  909. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  910. }];
  911. cell.isShow = model.IsTop;
  912. return cell;
  913. }
  914. break;
  915. case PageTypeFromTitleMeShen:
  916. {
  917. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  918. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  919. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  920. cell.cell2TitleLabel.text = model.Title;
  921. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  922. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  923. cell.IsTopImgV.hidden = !model.IsTop;
  924. cell.cell2TimeLabel.hidden = YES;
  925. cell.cell2RedBgView.hidden = YES;
  926. cell.cell1SelectButton.selected = model.IsSelect;
  927. [cell.cell1SelectButton setAction:^{
  928. model.IsSelect = !model.IsSelect;
  929. [weakSelf sumCount];
  930. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  931. }];
  932. cell.isShow = model.IsTop;
  933. return cell;
  934. }
  935. break;
  936. case PageTypeFromTitleMeSend:
  937. {
  938. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  939. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  940. cell.cell2TitleLabel.text = model.Title;
  941. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  942. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  943. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  944. cell.IsTopImgV.hidden = !model.IsTop;
  945. cell.cell2TimeLabel.hidden = YES;
  946. cell.cell2RedBgView.hidden = YES;
  947. cell.cell1SelectButton.selected = model.IsSelect;
  948. [cell.cell1SelectButton setAction:^{
  949. model.IsSelect = !model.IsSelect;
  950. [weakSelf sumCount];
  951. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  952. }];
  953. cell.isShow = model.IsTop;
  954. return cell;
  955. }
  956. break;
  957. case PageTypeFromTitleChao:
  958. {
  959. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  960. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  961. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  962. cell.cell2TitleLabel.text = model.Title;
  963. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  964. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  965. cell.IsTopImgV.hidden = !model.IsTop;
  966. cell.cell2TimeLabel.hidden = YES;
  967. cell.cell2RedBgView.hidden = YES;
  968. cell.cell1SelectButton.selected = model.IsSelect;
  969. [cell.cell1SelectButton setAction:^{
  970. model.IsSelect = !model.IsSelect;
  971. [weakSelf sumCount];
  972. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  973. }];
  974. cell.isShow = model.IsTop;
  975. return cell;
  976. }
  977. break;
  978. default:///匿名
  979. {
  980. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  981. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  982. cell.cell2TitleLabel.text = model.Title;
  983. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  984. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  985. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  986. cell.IsTopImgV.hidden = !model.IsTop;
  987. cell.cell2TimeLabel.hidden = YES;
  988. cell.cell2RedBgView.hidden = YES;
  989. cell.cell1SelectButton.selected = model.IsSelect;
  990. [cell.cell1SelectButton setAction:^{
  991. model.IsSelect = !model.IsSelect;
  992. [weakSelf sumCount];
  993. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  994. }];
  995. cell.isShow = model.IsTop;
  996. return cell;
  997. }
  998. break;
  999. }
  1000. }
  1001. break;
  1002. case 0:///删除
  1003. {
  1004. switch (model.TypeValue) {
  1005. case PageTypeFromTitleMail:{
  1006. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1007. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  1008. cell.cell2TitleLabel.text = model.Title;
  1009. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1010. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1011. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1012. cell.IsTopImgV.hidden = !model.IsTop;
  1013. cell.cell2EditBtn.hidden = NO;
  1014. cell.cell2RedBgView.hidden = YES;
  1015. cell.cell2TimeLabel.hidden = YES;
  1016. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1017. [cell.cell2EditBtn setAction:^{
  1018. NSLog(@"恢复已删除站内信");
  1019. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1020. }];
  1021. cell.isShow = model.IsTop;
  1022. cell.cell1SelectButton.selected = model.IsSelect;
  1023. [cell.cell1SelectButton setAction:^{
  1024. model.IsSelect = !model.IsSelect;
  1025. dispatch_async(dispatch_get_main_queue(), ^{
  1026. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1027. });
  1028. }];
  1029. return cell;
  1030. }
  1031. break;
  1032. case PageTypeFromTitleNotice:
  1033. {
  1034. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1035. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  1036. cell.cell2TitleLabel.text = model.Title;
  1037. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1038. cell.IsTopImgV.hidden = !model.IsTop;
  1039. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1040. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1041. cell.cell2EditBtn.hidden = NO;
  1042. cell.cell2RedBgView.hidden = YES;
  1043. cell.cell2TimeLabel.hidden = YES;
  1044. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1045. [cell.cell2EditBtn setAction:^{
  1046. NSLog(@"恢复已删除站内信");
  1047. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1048. }];
  1049. cell.isShow = model.IsTop;
  1050. cell.cell1SelectButton.selected = model.IsSelect;
  1051. [cell.cell1SelectButton setAction:^{
  1052. model.IsSelect = !model.IsSelect;
  1053. dispatch_async(dispatch_get_main_queue(), ^{
  1054. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1055. });
  1056. }];
  1057. return cell;
  1058. }
  1059. break;
  1060. case PageTypeFromTitleMeShen:
  1061. {
  1062. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1063. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1064. cell.cell2TitleLabel.text = model.Title;
  1065. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1066. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1067. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1068. cell.IsTopImgV.hidden = !model.IsTop;
  1069. cell.cell2EditBtn.hidden = NO;
  1070. cell.cell2RedBgView.hidden = YES;
  1071. cell.cell2TimeLabel.hidden = YES;
  1072. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1073. [cell.cell2EditBtn setAction:^{
  1074. NSLog(@"恢复已删除站内信");
  1075. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1076. }];
  1077. cell.isShow = model.IsTop;
  1078. cell.cell1SelectButton.selected = model.IsSelect;
  1079. [cell.cell1SelectButton setAction:^{
  1080. model.IsSelect = !model.IsSelect;
  1081. dispatch_async(dispatch_get_main_queue(), ^{
  1082. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1083. });
  1084. }];
  1085. return cell;
  1086. }
  1087. break;
  1088. case PageTypeFromTitleMeSend:
  1089. {
  1090. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1091. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1092. cell.cell2TitleLabel.text = model.Title;
  1093. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1094. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1095. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1096. cell.IsTopImgV.hidden = !model.IsTop;
  1097. cell.cell2EditBtn.hidden = NO;
  1098. cell.cell2RedBgView.hidden = YES;
  1099. cell.cell2TimeLabel.hidden = YES;
  1100. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1101. [cell.cell2EditBtn setAction:^{
  1102. NSLog(@"恢复已删除站内信");
  1103. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1104. }];
  1105. cell.isShow = model.IsTop;
  1106. cell.cell1SelectButton.selected = model.IsSelect;
  1107. [cell.cell1SelectButton setAction:^{
  1108. model.IsSelect = !model.IsSelect;
  1109. dispatch_async(dispatch_get_main_queue(), ^{
  1110. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1111. });
  1112. }];
  1113. return cell;
  1114. }
  1115. break;
  1116. case PageTypeFromTitleChao:
  1117. {
  1118. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1119. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1120. cell.cell2TitleLabel.text = model.Title;
  1121. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1122. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1123. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1124. cell.IsTopImgV.hidden = !model.IsTop;
  1125. cell.cell2EditBtn.hidden = NO;
  1126. cell.cell2RedBgView.hidden = YES;
  1127. cell.cell2TimeLabel.hidden = YES;
  1128. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1129. [cell.cell2EditBtn setAction:^{
  1130. NSLog(@"恢复已删除站内信");
  1131. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1132. }];
  1133. cell.isShow = model.IsTop;
  1134. cell.cell1SelectButton.selected = model.IsSelect;
  1135. [cell.cell1SelectButton setAction:^{
  1136. model.IsSelect = !model.IsSelect;
  1137. dispatch_async(dispatch_get_main_queue(), ^{
  1138. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1139. });
  1140. }];
  1141. return cell;
  1142. }
  1143. break;
  1144. default:///匿名
  1145. {
  1146. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1147. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  1148. cell.cell2TitleLabel.text = model.Title;
  1149. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1150. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1151. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1152. cell.IsTopImgV.hidden = !model.IsTop;
  1153. cell.cell2EditBtn.hidden = NO;
  1154. cell.cell2RedBgView.hidden = YES;
  1155. cell.cell2TimeLabel.hidden = YES;
  1156. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1157. [cell.cell2EditBtn setAction:^{
  1158. NSLog(@"恢复已删除站内信");
  1159. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1160. }];
  1161. cell.isShow = model.IsTop;
  1162. cell.cell1SelectButton.selected = model.IsSelect;
  1163. [cell.cell1SelectButton setAction:^{
  1164. model.IsSelect = !model.IsSelect;
  1165. dispatch_async(dispatch_get_main_queue(), ^{
  1166. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1167. });
  1168. }];
  1169. return cell;
  1170. }
  1171. break;
  1172. }
  1173. }
  1174. break;
  1175. default:
  1176. {
  1177. switch (model.TypeValue) {
  1178. case PageTypeFromTitleMail:{
  1179. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1180. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  1181. cell.cell2TitleLabel.text = model.Title;
  1182. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1183. cell.cell2TimeLabel.hidden = YES;
  1184. cell.cell1TimeLabel.hidden = YES;
  1185. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1186. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1187. cell.IsTopImgV.hidden = !model.IsTop;
  1188. cell.enterBtn.hidden = YES;
  1189. cell.cell1SelectButton.selected = model.IsSelect;
  1190. [cell.cell1SelectButton setAction:^{
  1191. model.IsSelect = !model.IsSelect;
  1192. [weakSelf sumCount];
  1193. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1194. }];
  1195. cell.isShow = model.IsTop;
  1196. return cell;
  1197. }
  1198. break;
  1199. case PageTypeFromTitleNotice:
  1200. {
  1201. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1202. cell.cell2UserImgView.image = [UIImage imageNamed:@"通知图标"];
  1203. cell.cell2TitleLabel.text = model.Title;
  1204. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1205. cell.cell2TimeLabel.hidden = YES;
  1206. cell.cell1TimeLabel.hidden = YES;
  1207. cell.IsTopImgV.hidden = !model.IsTop;
  1208. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1209. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1210. cell.enterBtn.hidden = YES;
  1211. cell.cell1SelectButton.selected = model.IsSelect;
  1212. [cell.cell1SelectButton setAction:^{
  1213. model.IsSelect = !model.IsSelect;
  1214. [weakSelf sumCount];
  1215. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1216. }];
  1217. cell.isShow = model.IsTop;
  1218. return cell;
  1219. }
  1220. break;
  1221. case PageTypeFromTitleMeShen:
  1222. {
  1223. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1224. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1225. cell.cell2TitleLabel.text = model.Title;
  1226. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1227. cell.cell2TimeLabel.hidden = YES;
  1228. cell.cell1TimeLabel.hidden = YES;
  1229. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1230. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1231. cell.IsTopImgV.hidden = !model.IsTop;
  1232. cell.enterBtn.hidden = YES;
  1233. cell.cell1SelectButton.selected = model.IsSelect;
  1234. [cell.cell1SelectButton setAction:^{
  1235. model.IsSelect = !model.IsSelect;
  1236. [weakSelf sumCount];
  1237. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1238. }];
  1239. cell.isShow = model.IsTop;
  1240. return cell;
  1241. }
  1242. break;
  1243. case PageTypeFromTitleMeSend:
  1244. {
  1245. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1246. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1247. cell.cell2TitleLabel.text = model.Title;
  1248. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1249. cell.cell2TimeLabel.hidden = YES;
  1250. cell.cell1TimeLabel.hidden = YES;
  1251. cell.IsTopImgV.hidden = !model.IsTop;
  1252. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1253. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1254. cell.enterBtn.hidden = YES;
  1255. cell.cell1SelectButton.selected = model.IsSelect;
  1256. [cell.cell1SelectButton setAction:^{
  1257. model.IsSelect = !model.IsSelect;
  1258. [weakSelf sumCount];
  1259. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1260. }];
  1261. cell.isShow = model.IsTop;
  1262. return cell;
  1263. }
  1264. break;
  1265. case PageTypeFromTitleChao:
  1266. {
  1267. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1268. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1269. cell.cell2TitleLabel.text = model.Title;
  1270. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1271. cell.cell2TimeLabel.hidden = YES;
  1272. cell.cell1TimeLabel.hidden = YES;
  1273. cell.IsTopImgV.hidden = !model.IsTop;
  1274. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1275. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1276. cell.enterBtn.hidden = YES;
  1277. cell.cell1SelectButton.selected = model.IsSelect;
  1278. [cell.cell1SelectButton setAction:^{
  1279. model.IsSelect = !model.IsSelect;
  1280. [weakSelf sumCount];
  1281. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1282. }];
  1283. cell.isShow = model.IsTop;
  1284. return cell;
  1285. }
  1286. break;
  1287. default:///匿名
  1288. {
  1289. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1290. cell.cell2UserImgView.image = [UIImage imageNamed:@"站内信图"];
  1291. cell.cell2TitleLabel.text = model.Title;
  1292. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1293. cell.cell2TimeLabel.hidden = YES;
  1294. cell.cell1TimeLabel.hidden = YES;
  1295. cell.IsTopImgV.hidden = !model.IsTop;
  1296. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1297. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1298. cell.enterBtn.hidden = YES;
  1299. cell.cell1SelectButton.selected = model.IsSelect;
  1300. [cell.cell1SelectButton setAction:^{
  1301. model.IsSelect = !model.IsSelect;
  1302. [weakSelf sumCount];
  1303. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1304. }];
  1305. cell.isShow = model.IsTop;
  1306. return cell;
  1307. }
  1308. break;
  1309. }
  1310. }
  1311. break;
  1312. }
  1313. }
  1314. break;
  1315. default:{
  1316. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell10:tableView indexPath:indexPath];
  1317. cell.cell1TitleLabel.text = model.FolderName;
  1318. cell.cell1TimeLabel.hidden = YES;
  1319. cell.enterBtn.hidden = YES;
  1320. cell.IsTopImgV.hidden = !model.IsTop;
  1321. cell.cell2TimeLabel.hidden = YES;
  1322. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1323. cell.cell1SelectButton.selected = model.IsSelect;
  1324. [cell.cell1SelectButton setAction:^{
  1325. model.IsSelect = !model.IsSelect;
  1326. [weakSelf sumCount];
  1327. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1328. }];
  1329. return cell;
  1330. }break;
  1331. }
  1332. }break;
  1333. }
  1334. }
  1335. - (BOOL)checkNoticeArray
  1336. {
  1337. BOOL isFloder = NO;
  1338. for (NoticeModel * model in self.interLetterArray) {
  1339. if (model.AttributeValue == 2) {
  1340. if (model.IsSelect) {
  1341. SHOWERROR(@"文件夹不能移动");
  1342. isFloder = YES;
  1343. }
  1344. }
  1345. }
  1346. [self.rightMoveBtn setEnabled:!isFloder];
  1347. if(self.interLetterArray.count == 0)
  1348. {
  1349. return NO;
  1350. }else{
  1351. for (NoticeModel * model in self.interLetterArray) {
  1352. if (!model.IsSelect) {
  1353. return NO;
  1354. }
  1355. }
  1356. return YES;
  1357. }
  1358. }
  1359. - (void)setIntroLabelWithModel:(NoticeModel *)model introLabel:(UILabel *)introLabel unreadNumberLabel:(UILabel *)unreadNumberLabel {
  1360. //判断是否匿名
  1361. if (model.IsAdmin) {
  1362. if (model.TypeValue == 18) {
  1363. introLabel.text = @"匿名";
  1364. unreadNumberLabel.text = nil;
  1365. }else{
  1366. if (model.EnjoyUser.length > 10) {
  1367. NSRange range1 = NSMakeRange(10, (model.EnjoyUser.length - 10));
  1368. NSString *resultStr1 = [model.EnjoyUser stringByReplacingCharactersInRange:range1 withString:@"..."];
  1369. introLabel.text = [NSString stringWithFormat:@"收件人:%@",resultStr1];
  1370. }else{
  1371. introLabel.text = [NSString stringWithFormat:@"收件人:%@",model.EnjoyUser];
  1372. }
  1373. unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
  1374. }
  1375. }else {
  1376. if (model.TypeValue == 18) {
  1377. introLabel.text = @"匿名";
  1378. unreadNumberLabel.text = nil;
  1379. }else{
  1380. introLabel.text = [NSString stringWithFormat:@"发件人:%@",model.UserName];
  1381. unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
  1382. }
  1383. }
  1384. }
  1385. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  1386. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  1387. NoticeModel *model = self.interLetterArray[indexPath.row];
  1388. switch (self.operationStateEnum) {
  1389. case OperationStateEnum0:
  1390. {
  1391. switch (model.AttributeValue) {
  1392. case 2:{
  1393. TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
  1394. vc.interLeterFolderId = model.Id;
  1395. vc.interLeterFoldName = model.FolderName;
  1396. [self.navigationController pushViewController:vc animated:YES];
  1397. }break;
  1398. default:{
  1399. if (self.pageType == PageTypeFromTitleDraftBox) {
  1400. [self editorButtonHander:indexPath];
  1401. }else{
  1402. switch (model.TypeValue) {
  1403. case PageTypeFromTitleNoSign:
  1404. {
  1405. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1406. vc.Id = model.MiddleId;
  1407. vc.type = CollectModel_NoSignMail;
  1408. [self.navigationController pushViewController:vc animated:YES];
  1409. }break;
  1410. case PageTypeFromTitleMail:
  1411. {
  1412. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1413. vc.Id = model.MiddleId;
  1414. vc.type = CollectModel_InterMail;
  1415. [self.navigationController pushViewController:vc animated:YES];
  1416. }break;
  1417. case PageTypeFromTitleNotice:
  1418. {
  1419. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1420. vc.Id = model.MiddleId;
  1421. vc.type = CollectModel_Notice;
  1422. [self.navigationController pushViewController:vc animated:YES];
  1423. }break;
  1424. case PageTypeFromTitleMeShen:
  1425. {
  1426. [self pushWorkVCwithModel:model];
  1427. }break;
  1428. case PageTypeFromTitleMeSend:
  1429. {
  1430. [self pushWorkVCwithModel:model];
  1431. }break;
  1432. case PageTypeFromTitleChao:
  1433. {
  1434. [self pushWorkVCwithModel:model];
  1435. }break;
  1436. default:
  1437. {
  1438. // MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1439. // vc.detailType = (model.MissiveType == 1)? InterLeterDetialType_Sign : InterLeterDetialType_NoSign;
  1440. // vc.Id = model.MiddleId;
  1441. // vc.type = CollectModel_InterMail;
  1442. // [self.navigationController pushViewController:vc animated:YES];
  1443. }break;
  1444. }
  1445. }
  1446. }break;
  1447. }
  1448. }break;
  1449. default:{
  1450. model.IsSelect = !model.IsSelect;
  1451. [self sumCount];
  1452. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1453. }break;
  1454. }
  1455. }
  1456. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
  1457. return tableView.editing;
  1458. }
  1459. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
  1460. NoticeModel *model = self.interLetterArray[sourceIndexPath.row];
  1461. NoticeModel *toModel = self.interLetterArray[destinationIndexPath.row];
  1462. WS(weakSelf);
  1463. if (model.AttributeValue == toModel.AttributeValue && model.IsTop && toModel.IsTop) {
  1464. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Sort) parameters:@{@"MiddleIdFirst":@(model.Id),@"MiddleIdSecond":@(toModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1465. [weakSelf.interLetterArray removeObject:model];
  1466. [weakSelf.interLetterArray insertObject:model atIndex:destinationIndexPath.row];
  1467. dispatch_async(dispatch_get_main_queue(), ^{
  1468. [weakSelf.tableView reloadData];
  1469. });
  1470. } failure:^(NSError * _Nonnull error) {
  1471. }];
  1472. }else{
  1473. [weakSelf.interLetterArray removeObject:model];
  1474. [weakSelf.interLetterArray insertObject:model atIndex:sourceIndexPath.row];
  1475. dispatch_async(dispatch_get_main_queue(), ^{
  1476. [weakSelf.tableView reloadData];
  1477. });
  1478. }
  1479. }
  1480. - (void)sumCount
  1481. {
  1482. NSInteger count = 0;
  1483. for (NoticeModel * smodel in self.interLetterArray) {
  1484. if (smodel.IsSelect) {
  1485. count ++;
  1486. }
  1487. }
  1488. [self.allSelectBtn setImage:count == self.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
  1489. self.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
  1490. }
  1491. #pragma mark - 设置 移动按钮 样式
  1492. - (void)setingMoveButton{
  1493. BOOL flag = NO;
  1494. BOOL use = NO;
  1495. for (NoticeModel *model in self.interLetterArray) {
  1496. if (model.IsSelect) {
  1497. if (model.AttributeValue == 2) {
  1498. flag = YES;
  1499. }else{
  1500. use = YES;
  1501. }
  1502. }
  1503. }
  1504. if (flag) {
  1505. [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
  1506. self.rightMoveBtn.enabled = NO;
  1507. }else{
  1508. if (!use) {
  1509. [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
  1510. self.rightMoveBtn.enabled = NO;
  1511. }else{
  1512. [self.rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
  1513. self.rightMoveBtn.enabled = YES;
  1514. }
  1515. }
  1516. }
  1517. -(NSMutableArray *)getMenuDataSource:(NSMutableArray *)titleArray{
  1518. NSMutableArray *menuDataSourceArray = [[NSMutableArray alloc] init];
  1519. for(int i=0;i<titleArray.count;i++){
  1520. NSString *titleStr = [titleArray objectAtIndex:i];
  1521. WS(weakSelf);
  1522. YCMenuAction *actionMenu = [YCMenuAction actionWithTitle:titleStr image:nil handler:^(YCMenuAction *action) {
  1523. if([@"建文件夹" isEqualToString:action.title]){
  1524. [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"建文件夹" placeholder:@"请输入文件夹名称" confirm:^(NSString * _Nonnull groupName) {
  1525. NSLog(@"%@",groupName);
  1526. [weakSelf addFind:groupName];
  1527. } cancle:^{
  1528. }] show];
  1529. }
  1530. else if ([@"批量编辑" isEqualToString:action.title]){
  1531. [weakSelf changeToOperation:YES];
  1532. }
  1533. }];
  1534. [menuDataSourceArray addObject:actionMenu];
  1535. }
  1536. return menuDataSourceArray;
  1537. }
  1538. -(NSMutableArray *)taskActionArray{
  1539. if(!_taskActionArray){
  1540. if (self.isHome) {
  1541. _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"建文件夹",@"批量编辑", nil];
  1542. }else{
  1543. _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"批量编辑", nil];
  1544. }
  1545. }
  1546. return _taskActionArray;
  1547. }
  1548. - (NSMutableArray<NoticeModel *> *)interLetterArray{
  1549. if (!_interLetterArray) {
  1550. _interLetterArray = [NSMutableArray array];
  1551. }
  1552. return _interLetterArray;
  1553. }
  1554. #pragma mark - 批量编辑
  1555. -(void)initBottomBgView{
  1556. UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1557. [leftCloseBtn setTitle:@"删除" forState:UIControlStateNormal];
  1558. [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
  1559. leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  1560. [self.operationBottomBgView addSubview:leftCloseBtn];
  1561. leftCloseBtn.frame = CGRectMake(0, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
  1562. self.opearateLeftBtn = leftCloseBtn;
  1563. UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1564. [rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
  1565. [rightMoveBtn setTitleColor:UIColorHex(#BBBBBB) forState:UIControlStateNormal];
  1566. // [rightMoveBtn setTitleColor:UIColorHex(#BBBBBB) forState:UIControlStateDisabled];
  1567. rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  1568. [self.operationBottomBgView addSubview:rightMoveBtn];
  1569. rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
  1570. self.opearateRightBtn = rightMoveBtn;
  1571. UILabel *line = [[UILabel alloc] init];
  1572. line.backgroundColor = RGB(240, 239, 244);
  1573. [self.operationBottomBgView addSubview:line];
  1574. line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.operationBottomBgView.height);
  1575. self.leftCloseBtn = leftCloseBtn;
  1576. self.rightMoveBtn = rightMoveBtn;
  1577. self.LineL = line;
  1578. WS(weakSelf);
  1579. [leftCloseBtn setAction:^{
  1580. NSMutableArray *selectIDArray = [NSMutableArray array];
  1581. for (NoticeModel * model in weakSelf.interLetterArray) {
  1582. if (model.IsSelect) {
  1583. [selectIDArray addObject:model];
  1584. }
  1585. }
  1586. if (selectIDArray.count == 0) {
  1587. SHOWERROR(@"请选择要删除的站内信");
  1588. return ;
  1589. }else{
  1590. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  1591. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1592. }];
  1593. [ok setValue:k9 forKey:@"_titleTextColor"];
  1594. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1595. [weakSelf thoroughDelete:selectIDArray isDelete:weakSelf.pageType == PageTypeFromTitleDeleted ? YES : NO];
  1596. }];
  1597. [alertVC addAction:ok];
  1598. [alertVC addAction:noOk];
  1599. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  1600. }
  1601. }];
  1602. [rightMoveBtn setAction:^{
  1603. NSMutableArray *selectIDArray = [NSMutableArray array];
  1604. for (NoticeModel * model in weakSelf.interLetterArray) {
  1605. if (model.IsSelect) {
  1606. [selectIDArray addObject:@(model.Id)];
  1607. }
  1608. }
  1609. if (selectIDArray.count == 0) {
  1610. SHOWERROR(@"请选择要移动的站内信或者文件夹");
  1611. return ;
  1612. }
  1613. [weakSelf launchMoveVC:selectIDArray];
  1614. }];
  1615. [[UtilsTools getWindow] addSubview:self.operationBottomBgView];
  1616. }
  1617. - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
  1618. MoveViewController * vc = [MoveViewController initMoveViewController];
  1619. vc.TypeId = CreateShouType;
  1620. vc.collectType = CollectHanderType_Move;
  1621. vc.ParentId = 0;
  1622. vc.titleStr = @"移动到";
  1623. vc.FolderIds = selectIDArray;
  1624. [self.navigationController pushViewController:vc animated:YES];
  1625. [self changeToOperation:NO];
  1626. }
  1627. -(UIView *)operationBottomBgView{
  1628. if(!_operationBottomBgView){
  1629. _operationBottomBgView = [[UIView alloc] init];
  1630. CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
  1631. _operationBottomBgView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
  1632. _operationBottomBgView.backgroundColor = RGB(255, 255, 255);
  1633. _operationBottomBgView.hidden = YES;
  1634. }
  1635. return _operationBottomBgView;
  1636. }
  1637. #pragma mark 批量操作与正常操作界面切换
  1638. -(void)changeToOperation:(BOOL)operation{
  1639. WS(weakSelf);
  1640. if(self.pageType == PageTypeFromTitleDeleted){
  1641. [self.rightMoveBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1642. [self.rightMoveBtn setAction:^{
  1643. NSMutableArray *MiddleIds = [NSMutableArray array];
  1644. for (NoticeModel *model in weakSelf.interLetterArray) {
  1645. if (model.IsSelect) {
  1646. [MiddleIds addObject:@(model.Id)];
  1647. }
  1648. }
  1649. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1650. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  1651. [dic setValue:@(800) forKey:@"FolderType"];
  1652. [dic setValue:@(0) forKey:@"IsDelete"];
  1653. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1654. SHOWLOADING
  1655. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord_Redo) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1656. REMOVESHOW
  1657. [weakSelf.interLetterArray enumerateObjectsUsingBlock:^(NoticeModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  1658. if (obj.IsSelect) {
  1659. [weakSelf.interLetterArray removeObject:obj];
  1660. }
  1661. }];
  1662. dispatch_async(dispatch_get_main_queue(), ^{
  1663. [weakSelf.tableView reloadData];
  1664. });
  1665. } failure:^(NSError * _Nonnull error) {
  1666. SHOWERROR([ZYCTool handerResultData:error]);
  1667. }];
  1668. }];
  1669. }else{
  1670. [self.rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
  1671. [self.rightMoveBtn setAction:^{
  1672. NSMutableArray *selectIDArray = [NSMutableArray array];
  1673. for (NoticeModel * model in weakSelf.interLetterArray) {
  1674. if (model.IsSelect) {
  1675. [selectIDArray addObject:@(model.Id)];
  1676. }
  1677. }
  1678. if (selectIDArray.count == 0) {
  1679. SHOWERROR(@"请选择要移动的站内信或者文件夹");
  1680. return ;
  1681. }
  1682. [weakSelf launchMoveVC:selectIDArray];
  1683. }];
  1684. }
  1685. if(operation){
  1686. self.deleteView.hidden = YES;
  1687. self.iSViewEditor = YES;
  1688. self.SearchView.hidden = YES;
  1689. self.HeadHight.constant = 36.f;
  1690. self.rightAddBtn.hidden = YES;
  1691. self.rightEditBtn.hidden = YES;
  1692. self.SortView.hidden = NO;
  1693. //默认操作状态为批量编辑状态
  1694. [self removeRefresh];
  1695. [self.tableView setEditing:YES];
  1696. self.operationStateEnum = OperationStateEnum1;
  1697. self.operationAllSelectButton.hidden = NO;
  1698. [self.operationAllSelectButton setTitleColor:UIColorHex(#0F88EB) forState:UIControlStateNormal];
  1699. [self.operationAllSelectButton setImage:nil forState:UIControlStateNormal];
  1700. WS(weakSelf);
  1701. self.isAllselect = [self checkNoticeArray];
  1702. self.titleLable.text = @"批量编辑";
  1703. self.titleLable.hidden = NO;
  1704. self.titleBtn.hidden = YES;
  1705. [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
  1706. [self.operationAllSelectButton setAction:^{
  1707. for (NoticeModel *model in weakSelf.interLetterArray) {
  1708. model.IsSelect = !weakSelf.isAllselect;
  1709. }
  1710. [weakSelf.allSelectBtn setImage:weakSelf.isAllselect ? IMG(@"sendinfo_no") : IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  1711. weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",weakSelf.isAllselect ? 0 : (long)weakSelf.interLetterArray.count];
  1712. [weakSelf.tableView reloadData];
  1713. }];
  1714. self.operationBottomBgView.hidden = NO;
  1715. if(self.pageType != PageTypeFromTitleDeleted){
  1716. self.tabBarController.tabBar.hidden = YES;
  1717. self.view.height -= self.tabBarController.tabBar.height;
  1718. self.tableView.height -= (self.tabBarController.tabBar.height + 36);
  1719. [self.view layoutIfNeeded];
  1720. [self.tableView layoutIfNeeded];
  1721. }else{
  1722. self.deleteSelectBtn.hidden = YES;
  1723. }
  1724. self.fd_interactivePopDisabled = YES;
  1725. self.tableView.allowsSelectionDuringEditing = YES;
  1726. }else{
  1727. [self addRefresh];
  1728. if(self.pageType == PageTypeFromTitleDeleted){
  1729. self.deleteView.hidden = NO;
  1730. self.rightAddBtn.hidden = YES;
  1731. self.rightEditBtn.hidden = YES;
  1732. self.deleteSelectBtn.hidden = NO;
  1733. }else{
  1734. self.deleteView.hidden = YES;
  1735. self.rightAddBtn.hidden = NO;
  1736. self.rightEditBtn.hidden = NO;
  1737. self.deleteSelectBtn.hidden = YES;
  1738. self.tabBarController.tabBar.hidden = YES;
  1739. self.tableView.height += self.tabBarController.tabBar.height;
  1740. self.view.height += self.tabBarController.tabBar.height;
  1741. [self.view layoutIfNeeded];
  1742. [self.tableView layoutIfNeeded];
  1743. }
  1744. [self.tableView setEditing:NO];
  1745. self.operationBottomBgView.hidden = YES;
  1746. self.iSViewEditor = NO;
  1747. self.HeadHight.constant = 46.f;
  1748. self.SortView.hidden = YES;
  1749. self.SearchView.hidden = NO;
  1750. [self.SortView mas_updateConstraints:^(MASConstraintMaker *make) {
  1751. make.height.mas_offset(0);
  1752. }];
  1753. //默认操作状态为无状态
  1754. self.operationStateEnum = OperationStateEnum0;
  1755. self.operationAllSelectButton.hidden = NO;
  1756. if (self.isHome) {
  1757. self.titleBtn.hidden = NO;
  1758. self.titleLable.hidden = YES;
  1759. }else{
  1760. self.titleLable.hidden = NO;
  1761. self.titleBtn.hidden = YES;
  1762. self.titleLable.text = self.interLeterFoldName;
  1763. }
  1764. [self.operationAllSelectButton setImage:IMG(@"menu_black_icon") forState:UIControlStateNormal];
  1765. [self.operationAllSelectButton setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
  1766. self.fd_interactivePopDisabled = NO;
  1767. }
  1768. [self.tableView reloadData];
  1769. }
  1770. #pragma mark 移动 isEdit:当前是否为编辑状态
  1771. -(void)userDidMove:(BOOL)move isEdit:(BOOL)isEdit{
  1772. //移动
  1773. if(move){
  1774. //默认操作状态为移动状态
  1775. self.operationStateEnum = OperationStateEnum2;
  1776. self.rightAddBtn.hidden = NO;
  1777. [self resetRightBtnAction:NO];
  1778. //隐藏tabBar - 并将TableView至底端
  1779. self.tabBarController.tabBar.hidden = YES;
  1780. self.view.height += self.tabBarController.tabBar.height;
  1781. self.tableView.height += self.tabBarController.tabBar.height;
  1782. [self.view layoutIfNeeded];
  1783. [self.tableView layoutIfNeeded];
  1784. //隐藏operationBottomBgView
  1785. self.operationBottomBgView.hidden = YES;
  1786. }
  1787. else{
  1788. //隐藏tabBar - 并将TableView至底端有tabBar.height的高
  1789. self.tabBarController.tabBar.hidden = YES;
  1790. self.view.height -= self.tabBarController.tabBar.height;
  1791. self.tableView.height -= self.tabBarController.tabBar.height;
  1792. [self.view layoutIfNeeded];
  1793. [self.tableView layoutIfNeeded];
  1794. //显示operationBottomBgView
  1795. self.operationBottomBgView.hidden = NO;
  1796. if(isEdit){
  1797. self.operationStateEnum = OperationStateEnum1;
  1798. self.rightAddBtn.hidden = YES;
  1799. [self resetRightBtnAction:YES];
  1800. }else{
  1801. [self changeToOperation:NO];
  1802. }
  1803. }
  1804. [self.tableView reloadData];
  1805. }
  1806. - (void)reSettingIsSelect{
  1807. for (NoticeModel *model in self.interLetterArray) {
  1808. model.IsSelect = NO;
  1809. }
  1810. }
  1811. -(void)resetRightBtnAction:(BOOL)isShowMenu{
  1812. WS(weakSelf);
  1813. if(isShowMenu){
  1814. [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_add_icon"] forState:UIControlStateNormal];
  1815. [self.rightAddBtn setAction:^{
  1816. NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
  1817. YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
  1818. view.menuColor = RGB(255, 255, 255);
  1819. view.separatorColor = RGB(234, 234, 234);
  1820. view.textColor = RGB(102, 102, 102);
  1821. view.textFont = [UIFont systemFontOfSize:16.0];
  1822. view.menuCellHeight = 43.5;
  1823. view.maxDisplayCount = 10;
  1824. view.offset = -6;
  1825. [view show];
  1826. }];
  1827. }else{
  1828. [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_fileadd_icon"] forState:UIControlStateNormal];
  1829. [self.rightAddBtn setAction:^{
  1830. [ShowtipTool showErrorWithStatus:@"未做"];
  1831. }];
  1832. }
  1833. }
  1834. - (void)backAction:(id)sender{
  1835. [self changeBarBtn:NO];
  1836. self.deleteView.hidden = YES;
  1837. if (self.iSViewEditor) {
  1838. [self headRefresh];
  1839. [self changeSelectStatus];
  1840. [self changeToOperation:NO];
  1841. }else{
  1842. [self.navigationController popViewControllerAnimated:true];
  1843. }
  1844. }
  1845. - (void)changeSelectStatus
  1846. {
  1847. for (NoticeModel * model in self.interLetterArray) {
  1848. model.IsSelect = NO;
  1849. }
  1850. }
  1851. - (void)menuAction:(id)sender{
  1852. switch (self.operationStateEnum) {
  1853. case OperationStateEnum1:
  1854. {
  1855. for (NoticeModel *model in self.interLetterArray) {
  1856. model.IsSelect = !self.isAllselect;
  1857. }
  1858. [self.tableView reloadData];
  1859. [self setingMoveButton];
  1860. }
  1861. break;
  1862. default:{
  1863. [super menuAction:sender];
  1864. self.deleteView.hidden = YES;
  1865. self.operationBottomBgView.hidden = YES;
  1866. }
  1867. break;
  1868. }
  1869. }
  1870. #pragma mark - 文件夹操作 创建 | 修改 | 置顶 | 取消置顶 | 删除 | 恢复已删除 | 移动
  1871. /// 创建文件夹
  1872. - (void)addFind:(NSString *)groupname{
  1873. SHOWLOADING
  1874. WEAKSELF
  1875. [[HttpManager sharedHttpManager] PUTUrl:Host(APP_Middle_Add_Folder) parameters:@{@"FolderName":groupname,@"ParentId":@(self.interLeterFolderId),@"TypeId":@(800)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1876. STRONGSELF
  1877. REMOVESHOW
  1878. [strongSelf headRefresh];
  1879. } failure:^(NSError * _Nonnull error) {
  1880. SHOWERROR([ZYCTool handerResultData:error]);
  1881. }];
  1882. }
  1883. /// 修改文件夹名称
  1884. - (void)reNameFind:(NoticeModel*)findModel withReNameString:(NSString *)renameString{
  1885. SHOWLOADING
  1886. WEAKSELF
  1887. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_ReName) parameters:@{@"FolderName":renameString,@"Id":@(findModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1888. STRONGSELF
  1889. REMOVESHOW
  1890. [strongSelf headRefresh];
  1891. } failure:^(NSError * _Nonnull error) {
  1892. SHOWERROR([ZYCTool handerResultData:error]);
  1893. }];
  1894. }
  1895. /// 文件夹 置顶 和 取消置顶
  1896. - (void)topFind:(NoticeModel*)findModel{
  1897. NSLog(@"文件夹---%@%@",findModel.IsTop ? @"置顶":@"取消置顶",findModel.FolderName);
  1898. SHOWLOADING
  1899. WEAKSELF
  1900. [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  1901. REMOVESHOW
  1902. [weakSelf reCreateTable];
  1903. } failure:^(NSError * _Nonnull error) {
  1904. SHOWERROR([ZYCTool handerResultData:error]);
  1905. }];
  1906. }
  1907. - (void)reCreateTable
  1908. {
  1909. self.currentPage = 1;
  1910. self.totalRecord = 0;
  1911. [self.interLetterArray removeAllObjects];
  1912. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  1913. if (self.pageType == PageTypeFromTitleDeleted) {
  1914. [self changeBarBtn:YES];
  1915. }else{
  1916. [self changeBarBtn:NO];
  1917. }
  1918. // [dict setObject:@(self.currentPage) forKey:@"Page"];
  1919. // [dict setObject:@"99999999" forKey:@"PerPage"];
  1920. // [dict setObject:@(self.pageType) forKey:@"SearchType"];
  1921. // [dict setObject:@"" forKey:@"Keyword"];
  1922. // [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  1923. // WS(weakSelf);
  1924. // [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1925. // NSLog(@"站内信返回数据%@",responseObject);
  1926. // NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  1927. // [weakSelf.tableView.mj_header endRefreshing];
  1928. // [weakSelf.tableView.mj_footer endRefreshing];
  1929. // weakSelf.totalRecord = listModel.Total;
  1930. // [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  1931. // if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  1932. // [weakSelf.tableView.mj_footer resetNoMoreData];
  1933. // [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  1934. // }
  1935. // [weakSelf.tableView reloadData];
  1936. // } failure:^(NSError * _Nonnull error) {
  1937. // SHOWERROR([ZYCTool handerResultData:error]);
  1938. // [weakSelf.tableView.mj_header endRefreshing];
  1939. // [weakSelf.tableView.mj_footer endRefreshing];
  1940. // }];
  1941. [dict setObject:@(self.currentPage) forKey:@"Page"];
  1942. [dict setObject:@"99999999" forKey:@"PerPage"];
  1943. [dict setObject:@(self.pageType) forKey:@"SearchType"];
  1944. [dict setObject:@"" forKey:@"Key"];
  1945. [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  1946. WS(weakSelf);
  1947. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1948. NSLog(@"站内信返回数据%@",responseObject);
  1949. NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  1950. [weakSelf.tableView.mj_header endRefreshing];
  1951. [weakSelf.tableView.mj_footer endRefreshing];
  1952. weakSelf.totalRecord = listModel.Total;
  1953. [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  1954. if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  1955. [weakSelf.tableView.mj_footer resetNoMoreData];
  1956. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  1957. }
  1958. dispatch_async(dispatch_get_main_queue(), ^{
  1959. [weakSelf.tableView removeFromSuperview];
  1960. weakSelf.tableView = nil;
  1961. [weakSelf.view addSubview:weakSelf.tableView];
  1962. weakSelf.tableView.delegate = weakSelf;
  1963. weakSelf.tableView.dataSource = weakSelf;
  1964. weakSelf.tableView.backgroundColor = [UIColor clearColor];
  1965. [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  1966. make.left.right.mas_equalTo(weakSelf.view);
  1967. make.top.mas_equalTo(weakSelf.HeadView.mas_bottom);
  1968. if (@available(iOS 11.0, *)) {
  1969. make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
  1970. } else {
  1971. make.bottom.equalTo(weakSelf.view.mas_bottom);
  1972. }
  1973. }];
  1974. [weakSelf.tableView reloadData];
  1975. });
  1976. } failure:^(NSError * _Nonnull error) {
  1977. SHOWERROR([ZYCTool handerResultData:error]);
  1978. [weakSelf.tableView.mj_header endRefreshing];
  1979. [weakSelf.tableView.mj_footer endRefreshing];
  1980. }];
  1981. }
  1982. /// 删除文件夹
  1983. //- (void)deleteFind:(NSMutableArray<NoticeModel *>*)findModelArray{
  1984. // NSMutableArray *MiddleIds = [NSMutableArray array];
  1985. //
  1986. // for (NoticeModel *model in findModelArray) {
  1987. // [MiddleIds addObject:@(model.Id)];
  1988. // }
  1989. // NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1990. // [dic setValue:MiddleIds forKey:@"MiddleIds"];
  1991. // [dic setValue:@(5) forKey:@"FolderType"];
  1992. // [dic setValue:@(0) forKey:@"IsDelete"];
  1993. // [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1994. //
  1995. // SHOWLOADING
  1996. // WEAKSELF
  1997. // [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1998. // STRONGSELF
  1999. // REMOVESHOW
  2000. // [strongSelf headRefresh];
  2001. // } failure:^(NSError * _Nonnull error) {
  2002. // SHOWERROR([ZYCTool handerResultData:error]);
  2003. // }];
  2004. //
  2005. //}
  2006. - (void)thoroughDelete:(NSMutableArray<NoticeModel *>*)array isDelete:(BOOL)isDelete
  2007. {
  2008. NSMutableArray * addArray = [NSMutableArray array];
  2009. for (NoticeModel *model in array) {
  2010. [addArray addObject:@(model.Id)];
  2011. }
  2012. NSDictionary * dict = @{@"MiddleIds":addArray,
  2013. @"FolderType":@(800), ///1 通知
  2014. @"IsDelete":@(isDelete)
  2015. };
  2016. WS(weakSelf);
  2017. SHOWLOADING
  2018. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dict responseStyle:DATA success:^(id _Nonnull responseObject) {
  2019. REMOVESHOW
  2020. SHOWSUCCESS(@"删除成功");
  2021. [weakSelf.interLetterArray removeObjectsInArray:array];
  2022. dispatch_async(dispatch_get_main_queue(), ^{
  2023. [weakSelf.tableView reloadData];
  2024. });
  2025. } failure:^(NSError * _Nonnull error) {
  2026. REMOVESHOW
  2027. }];
  2028. }
  2029. /// 恢复文件夹
  2030. - (void)reDoDeleteFind:(NSMutableArray<NoticeModel *>*)findModelArray{
  2031. NSMutableArray *MiddleIds = [NSMutableArray array];
  2032. for (NoticeModel *model in findModelArray) {
  2033. [MiddleIds addObject:@(model.Id)];
  2034. }
  2035. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  2036. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  2037. [dic setValue:@(800) forKey:@"FolderType"];
  2038. [dic setValue:@(0) forKey:@"IsDelete"];
  2039. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  2040. SHOWLOADING
  2041. WEAKSELF
  2042. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord_Redo) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  2043. STRONGSELF
  2044. REMOVESHOW
  2045. [strongSelf headRefresh];
  2046. } failure:^(NSError * _Nonnull error) {
  2047. SHOWERROR([ZYCTool handerResultData:error]);
  2048. }];
  2049. }
  2050. /// 移动文件夹
  2051. - (void)moveFind:(NSMutableArray<NoticeModel *>*)findModelArray withSuperModel:(NoticeModel *)supermodel{
  2052. NSMutableArray *MiddleIds = [NSMutableArray array];
  2053. for (NoticeModel *model in findModelArray) {
  2054. [MiddleIds addObject:@(model.Id)];
  2055. }
  2056. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  2057. [dic setValue:MiddleIds forKey:@"Ids"];
  2058. [dic setValue:@(0) forKey:@"ParentId"];
  2059. SHOWLOADING
  2060. WEAKSELF
  2061. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Move) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  2062. STRONGSELF
  2063. REMOVESHOW
  2064. [strongSelf headRefresh];
  2065. } failure:^(NSError * _Nonnull error) {
  2066. SHOWERROR([ZYCTool handerResultData:error]);
  2067. }];
  2068. }
  2069. - (void)editorButtonHander:(NSIndexPath *)indexpath{
  2070. WS(weakSelf);
  2071. NoticeModel *model = self.interLetterArray[indexpath.row];
  2072. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  2073. vc.type = CollectModel_InterMail;
  2074. vc.isEdit = YES;
  2075. vc.replayType = MailReplayEdit;
  2076. vc.Id = model.MiddleId;
  2077. vc.isFromDraft = (model.SourceId == 0 ? YES : NO);
  2078. vc.MailType = model.TypeValue;
  2079. vc.upDateBlock = ^{
  2080. [weakSelf headRefresh];
  2081. };
  2082. [self.navigationController pushViewController:vc animated:YES];
  2083. }
  2084. - (void)pushWorkVCwithModel:(NoticeModel *)model
  2085. {
  2086. WS(weakSelf);
  2087. MyApprovalPageDetail *myApprovalPageDetail = [[MyApprovalPageDetail alloc] init];
  2088. [myApprovalPageDetail setActionSussBlock:^{
  2089. [weakSelf headRefresh];
  2090. }];
  2091. switch (model.TypeValue) {
  2092. case PageTypeFromTitleMeShen:
  2093. {
  2094. myApprovalPageDetail.pageType = Type_ONEA;
  2095. }
  2096. break;
  2097. case PageTypeFromTitleMeSend:
  2098. {
  2099. myApprovalPageDetail.pageType = Type_ONEB;
  2100. }
  2101. break;
  2102. default:
  2103. {
  2104. myApprovalPageDetail.pageType = Type_ONEC;
  2105. }
  2106. break;
  2107. }
  2108. myApprovalPageDetail.Stats = model.FlowState;
  2109. myApprovalPageDetail.userId = model.UserId;
  2110. myApprovalPageDetail.indexId = model.MiddleId;
  2111. myApprovalPageDetail.TodoId = model.TodoId;
  2112. myApprovalPageDetail.title = model.Title;
  2113. [self.navigationController pushViewController:myApprovalPageDetail animated:YES];
  2114. }
  2115. - (void)setShenIcon:(NoticeModel *)model withCellImgV:(UIImageView *)imagV
  2116. {
  2117. if (model.IsRecall) {
  2118. imagV.image = IMG(@"shenpi_reCall");
  2119. }else{
  2120. if ([model.FlowState isEqualToString:@"Checking"]) {
  2121. imagV.image = IMG(@"审批");
  2122. }else{
  2123. imagV.image = IMG(@"shenpi_icon");
  2124. }
  2125. }
  2126. }
  2127. - (UIButton *)allSelectBtn
  2128. {
  2129. if (!_allSelectBtn) {
  2130. _allSelectBtn = [UIButton new];
  2131. _allSelectBtn.hidden = YES;
  2132. [_allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  2133. }
  2134. return _allSelectBtn;
  2135. }
  2136. - (UILabel *)selectCountL
  2137. {
  2138. if (!_selectCountL) {
  2139. _selectCountL = [UILabel new];
  2140. _selectCountL.font = Kfont(13);
  2141. _selectCountL.text = @"0";
  2142. _selectCountL.hidden = YES;
  2143. _selectCountL.textColor = UIColorHex(0x0F88EB);
  2144. }
  2145. return _selectCountL;
  2146. }
  2147. - (UIView *)SortView
  2148. {
  2149. if (!_SortView) {
  2150. _SortView = [UIView new];
  2151. _SortView.backgroundColor = UIColorHex(0xF0EFF4);
  2152. _SortView.hidden = YES;
  2153. }
  2154. return _SortView;
  2155. }
  2156. - (void)addSortV
  2157. {
  2158. [self.HeadView addSubview:self.SortView];
  2159. [self.SortView mas_makeConstraints:^(MASConstraintMaker *make) {
  2160. make.edges.mas_offset(UIEdgeInsetsZero);
  2161. }];
  2162. [self.SortView addSubview:self.allSelectBtn];
  2163. // [self.SortView addSubview:self.selectCountL];
  2164. [self.allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  2165. make.left.mas_offset(5);
  2166. make.centerY.mas_equalTo(self.SortView);
  2167. make.size.mas_offset(CGSizeMake(36, 36));
  2168. }];
  2169. // UILabel * leftL = [UILabel new];
  2170. // leftL.text = @"已选:";
  2171. // leftL.textColor = UIColorHex(0x666666);
  2172. // leftL.font = Kfont(13);
  2173. // [self.SortView addSubview:leftL];
  2174. // [leftL mas_makeConstraints:^(MASConstraintMaker *make) {
  2175. // make.left.mas_equalTo(self.allSelectBtn.mas_right).offset(5);
  2176. // make.centerY.mas_equalTo(self.SortView);
  2177. // }];
  2178. // [self.selectCountL mas_makeConstraints:^(MASConstraintMaker *make) {
  2179. // make.left.mas_equalTo(leftL.mas_right).offset(8);
  2180. // make.centerY.mas_equalTo(self.SortView);
  2181. // }];
  2182. UILabel * rightL = [UILabel new];
  2183. rightL.text = @"长按右侧三横,拖动可进行排序";
  2184. rightL.textColor = UIColorHex(0x666666);
  2185. rightL.font = Kfont(13);
  2186. [self.SortView addSubview:rightL];
  2187. [rightL mas_makeConstraints:^(MASConstraintMaker *make) {
  2188. // make.left.mas_equalTo(self.selectCountL.mas_right).offset(5);
  2189. // make.centerY.mas_equalTo(self.SortView);
  2190. make.center.mas_equalTo(self.SortView);
  2191. }];
  2192. WS(weakSelf);
  2193. [self.allSelectBtn setAction:^{
  2194. for (NoticeModel *model in weakSelf.interLetterArray) {
  2195. model.IsSelect = !weakSelf.isAllselect;
  2196. if (model.IsSelect && model.AttributeValue == 2) {
  2197. SHOWERROR(@"文件夹不能移动");
  2198. }
  2199. }
  2200. NSInteger count = 0;
  2201. for (NoticeModel * smodel in weakSelf.interLetterArray) {
  2202. if (smodel.IsSelect) {
  2203. count ++;
  2204. }
  2205. }
  2206. [weakSelf.allSelectBtn setImage:count == weakSelf.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
  2207. weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
  2208. dispatch_async(dispatch_get_main_queue(), ^{
  2209. [weakSelf.tableView reloadData];
  2210. });
  2211. }];
  2212. }
  2213. - (void)viewDidDisappear:(BOOL)animated
  2214. {
  2215. [super viewDidDisappear:animated];
  2216. [self changeBarBtn:NO];
  2217. self.deleteView.hidden = YES;
  2218. self.operationBottomBgView.hidden = YES;
  2219. }
  2220. @end