XueShiCheckList.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. //
  2. // XueShiCheckList.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/9.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "XueShiCheckList.h"
  9. #import "XueShiCheckCell.h"
  10. #import "MengBanView.h"
  11. #import "MJRefresh.h"
  12. #import "TeachLogForCheckVC.h"
  13. @interface XueShiCheckList ()<UISearchBarDelegate,UISearchControllerDelegate>
  14. {
  15. MengBanView * _mengBanView;
  16. //请求参数
  17. NSString * _kemu;
  18. NSString * _state;
  19. NSString *_stuName;
  20. NSInteger _currentPageNum;//记录页书
  21. UISearchController *_searchController;
  22. //正在加载的状态
  23. BOOL _IS_LOADING;
  24. //加载数据的类型
  25. MyGetDataType _getDataType;
  26. NSMutableArray *_selectedIndexPathes;//记录选中的cell
  27. UIButton * _notifyBtn;//审核学时
  28. UIButton *_allBtn;
  29. UIButton *_cancelBtn;
  30. BOOL _isEditing;
  31. }
  32. @end
  33. @implementation XueShiCheckList
  34. - (void)viewDidLoad {
  35. [super viewDidLoad];
  36. self.navigationItem.title = @"学时审核";
  37. if ([self.type isEqualToString:@"1"]) {
  38. [self changeBckBtn];
  39. }
  40. //实例化
  41. _kemu = @"";
  42. _state = @"待审核";
  43. _stuName = @"";
  44. _currentPageNum = 0;
  45. _getDataType = MyGetDataTypeNomal;
  46. _IS_LOADING = NO;
  47. _selectedIndexPathes = [[NSMutableArray alloc] init];
  48. _isEditing = NO;
  49. [self createSelectBtn];
  50. [self setRefreshAction];//设置刷新
  51. [self customRightBtn];//设置筛选
  52. [self creatSearchVC];//添加搜索栏
  53. [self getData];
  54. __weak typeof(self) weakSelf = self;
  55. self.block = ^{
  56. _currentPageNum = 0;
  57. [weakSelf getData];
  58. };
  59. }
  60. -(void)viewDidDisappear:(BOOL)animated{
  61. [super viewDidDisappear:animated];
  62. if (_allBtn) {
  63. [_allBtn removeFromSuperview];
  64. }
  65. if (_cancelBtn) {
  66. [_cancelBtn removeFromSuperview];
  67. }
  68. // if (_notifyBtn) {
  69. // [_notifyBtn removeFromSuperview];
  70. // }
  71. //这个一定要写 要不然会在退出去下一个页面时候 搜索栏有一定时间的存留
  72. [self.view endEditing:YES];
  73. if (_searchController.active) {
  74. _searchController.active = NO;
  75. if (_searchController.searchBar && _searchController.searchBar.superview) {
  76. [_searchController.searchBar removeFromSuperview];
  77. }
  78. }
  79. }
  80. -(void)changeBckBtn{
  81. UIBarButtonItem* backBbi = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(backBtnAction)];
  82. [backBbi setTintColor:COLOR_THEME];
  83. [self.navigationItem setLeftBarButtonItem:backBbi];
  84. }
  85. -(void)backBtnAction{
  86. [self dismissViewControllerAnimated:YES completion:nil];
  87. }
  88. -(void)createSelectBtn{
  89. _notifyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  90. _notifyBtn.backgroundColor = COLOR_THEME;
  91. _notifyBtn.frame = CGRectMake(kSize.width-80, kSize.height-90-kNavOffSet, 60, 60);
  92. [_notifyBtn setTitle:@"审核\n学时" forState:UIControlStateNormal];
  93. [_notifyBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  94. _notifyBtn.titleLabel.numberOfLines = 0;
  95. _notifyBtn.layer.masksToBounds = YES;
  96. _notifyBtn.layer.cornerRadius = 30;
  97. [_notifyBtn addTarget:self action:@selector(notifiBtnClick:) forControlEvents:UIControlEventTouchUpInside];
  98. _notifyBtn.hidden = YES;
  99. [self.view addSubview:_notifyBtn];
  100. [self.view bringSubviewToFront:self.holderV];
  101. }
  102. -(void)notifiBtnClick:(UIButton *)sender{
  103. if (self.dataurce.count == 0) {
  104. return;
  105. }
  106. if (!_isEditing) {
  107. _isEditing = YES;
  108. [self.tableView setEditing:YES];//进入编辑模式
  109. [self removeRefreshAction];
  110. [sender setTitle:@"提交\n审核" forState:UIControlStateNormal];
  111. CGRect frame = sender.frame;;
  112. _allBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  113. _allBtn.backgroundColor = [UIColor lightGrayColor];
  114. //_allBtn.backgroundColor = COLOR_THEME;
  115. _allBtn.frame = CGRectMake(frame.origin.x + 30, frame.origin.y, 0, 30);
  116. [_allBtn setTitle:@"全选" forState:UIControlStateNormal];
  117. [_allBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  118. [_allBtn setTitleColor:COLOR_THEME forState:UIControlStateSelected];
  119. [_allBtn addTarget:self action:@selector(allClick:) forControlEvents:UIControlEventTouchUpInside];
  120. [KWINDOW addSubview:_allBtn];
  121. _cancelBtn = [UIButton buttonWithType:UIButtonTypeSystem];
  122. _cancelBtn.backgroundColor = [UIColor lightGrayColor];
  123. _cancelBtn.frame = CGRectMake(frame.origin.x + 30, frame.origin.y + 30, 0, 30);
  124. [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
  125. [_cancelBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  126. [_cancelBtn addTarget:self action:@selector(cancelClick:) forControlEvents:UIControlEventTouchUpInside];
  127. [KWINDOW addSubview:_cancelBtn];
  128. [UIView animateWithDuration:.4 animations:^{
  129. _allBtn.frame = CGRectMake(frame.origin.x-100, frame.origin.y - 5, 80, 30);
  130. _cancelBtn.frame = CGRectMake(frame.origin.x-100, frame.origin.y + 35, 80, 30);
  131. }];
  132. return;
  133. }
  134. NSMutableArray * allId = [NSMutableArray new];
  135. for (NSIndexPath *indexPath in _selectedIndexPathes) {
  136. [allId addObject:self.dataurce[indexPath.row][@"ID"]];
  137. }
  138. if (allId.count > 0) {
  139. [self.tableView setEditing:NO];
  140. [self setRefreshAction];
  141. [sender setTitle:@"审核\n学时" forState:UIControlStateNormal];
  142. [_allBtn removeFromSuperview];
  143. [_cancelBtn removeFromSuperview];
  144. _isEditing = NO;
  145. if (allId.count == 1) {//单条审核
  146. [self shenheSingleXueshiWith:_selectedIndexPathes[0]];
  147. }else{//多条审核
  148. [self shenheXueshiWithIds:allId];
  149. }
  150. [_selectedIndexPathes removeAllObjects];
  151. }else{
  152. [self showMsgByAlertVCWithString:@"请选择学时"];
  153. }
  154. }
  155. -(void)allClick:(UIButton *)button{
  156. button.selected = !button.selected;
  157. //获取表格视图内容的尺寸
  158. CGSize size = self.tableView.contentSize;
  159. CGRect rect = CGRectMake(0, 0, size.width, size.height);
  160. //获取指定区域的cell的indexPath
  161. NSArray *indexPathes = [self.tableView indexPathsForRowsInRect:rect];
  162. if (button.selected) {
  163. for (NSIndexPath *indexPath in indexPathes) {
  164. //使用代码方式选中一行
  165. [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
  166. }
  167. //更新选中数组
  168. _selectedIndexPathes.array = indexPathes;
  169. } else {
  170. for (NSIndexPath *indexPath in indexPathes) {
  171. //使用代码方式取消选中一行
  172. [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
  173. }
  174. //清空选中cell的记录数组
  175. [_selectedIndexPathes removeAllObjects];
  176. }
  177. }
  178. - (void)cancelClick:(UIButton *)sender {
  179. [self.tableView setEditing:NO];
  180. [self setRefreshAction];
  181. [_notifyBtn setTitle:@"审核\n学时" forState:UIControlStateNormal];
  182. [_allBtn removeFromSuperview];
  183. [_cancelBtn removeFromSuperview];
  184. _isEditing = NO;
  185. [_selectedIndexPathes removeAllObjects];
  186. }
  187. -(void)shenheSingleXueshiWith:(NSIndexPath *)indexPath{
  188. NSDictionary * dic = self.dataurce[indexPath.row];
  189. NSString * message = [NSString stringWithFormat:@"姓名:%@ 训练时长:%@",dic[@"STUNAME"],dic[@"TIME"]];
  190. UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:@"审核学时" message:message preferredStyle:UIAlertControllerStyleAlert];
  191. [alertFind addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
  192. textField.placeholder = @"输入审核原因[二次审核不能为空]";
  193. }];
  194. [alertFind addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
  195. [alertFind addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
  196. UITextField *tf = alertFind.textFields[0];
  197. [self trainTimesCheckWithDic:dic withReason:tf.text];
  198. }]];
  199. [self presentViewController:alertFind animated:true completion:nil];
  200. }
  201. -(void)customRightBtn{
  202. UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithTitle:@"筛选" style:UIBarButtonItemStylePlain target:self action:@selector(setMengbanView)];
  203. item.tintColor = COLOR_THEME;
  204. self.navigationItem.rightBarButtonItem = item;
  205. }
  206. -(void)setMengbanView{
  207. //如果是编辑状态 就不弹出筛选条件框
  208. if (_isEditing) {
  209. [self showMsgByMBWithString:@"正在选择待审核学时,无法进行此操作!"];
  210. return;
  211. }
  212. if (_mengBanView) {
  213. [_mengBanView showView];
  214. return;
  215. }
  216. NSArray * btnarr1 = @[@"第一部分",@"第二部分",@"第三部分",@"第四部分"];
  217. NSArray * btnarr2 = @[@"待审核",@"审核通过",@"审核不通过"];
  218. __weak typeof(self) weakSelf = self;
  219. _mengBanView = [[MengBanView alloc]initWithTitileStr:nil buttonsArray:@[btnarr1,btnarr2] block:^(NSArray *array) {
  220. //array 是你已经选择好的内容
  221. _kemu = array[0];
  222. _state = array[1];
  223. [weakSelf headerRefresh];
  224. }];
  225. [_mengBanView showView];
  226. }
  227. - (void)creatSearchVC
  228. {
  229. _searchController = [[UISearchController alloc]initWithSearchResultsController:nil];
  230. _searchController.delegate = self;
  231. _searchController.searchBar.delegate = self;
  232. _searchController.searchBar.placeholder = @"请输入学员姓名";
  233. //设置UISearchController的显示属性,以下3个属性默认为YES
  234. //搜索时,背景变暗色
  235. // _searchController.dimsBackgroundDuringPresentation = NO;
  236. // //搜索时,背景变模糊
  237. // _searchController.obscuresBackgroundDuringPresentation = NO;
  238. // //隐藏导航栏
  239. // _searchController.hidesNavigationBarDuringPresentation = NO;
  240. // [_searchController.searchBar sizeToFit];
  241. _searchController.searchBar.frame = CGRectMake(_searchController.searchBar.frame.origin.x, _searchController.searchBar.frame.origin.y, _searchController.searchBar.frame.size.width, 44.0);
  242. self.tableView.tableHeaderView = _searchController.searchBar;
  243. }
  244. #pragma mark - 下拉刷新,上拉加载 -
  245. -(void)setRefreshAction{
  246. // 下拉加载更多
  247. __weak typeof(self) weakSelf = self;
  248. MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  249. [weakSelf headerRefresh];
  250. }];
  251. self.tableView.mj_header = header;
  252. MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
  253. [weakSelf footerRefresh];
  254. }];
  255. self.tableView.mj_footer = footer;
  256. }
  257. -(void)headerRefresh{
  258. //设置获取数据的方式
  259. _getDataType=MyGetDataTypeHeaderRefresh;
  260. //加载数据
  261. [self getData];
  262. [self.tableView.mj_header endRefreshing];
  263. }
  264. -(void)footerRefresh{
  265. //设置获取数据的方式
  266. _getDataType=MyGetDataTypeFooterRefresh;
  267. //加载数据
  268. [self getData];
  269. [self.tableView.mj_footer endRefreshing];
  270. }
  271. -(void)removeRefreshAction{
  272. self.tableView.mj_header = nil;
  273. self.tableView.mj_footer = nil;
  274. }
  275. #pragma mark 代理方法
  276. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  277. // if (_searchController.active) {
  278. // return _searchArr.count;//搜索结果
  279. // }else
  280. // {
  281. // return self.dataurce.count;//原始数据
  282. // }
  283. return self.dataurce.count;
  284. }
  285. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  286. return 100;
  287. }
  288. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath{
  289. XueShiCheckCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellXueShiCheck"];
  290. if (!cell) {
  291. //加载xib文件创建cell
  292. cell = [[[NSBundle mainBundle] loadNibNamed:@"XueShiCheckCell" owner:nil options:nil] lastObject];
  293. }
  294. [cell updataWithDic:self.dataurce[indexPath.row]];
  295. return cell;
  296. }
  297. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  298. //选择单元格
  299. if (_isEditing) {
  300. //当选中cell时,记录其indexPath
  301. if (![_selectedIndexPathes containsObject:indexPath]) {
  302. [_selectedIndexPathes addObject:indexPath];
  303. }
  304. return;
  305. }
  306. //[self showMsgByAlertVCWithString:@"点击右下角图标可选择学时进行审核"];
  307. //查看电子日志详细信息
  308. TeachLogForCheckVC *teachlogVC = [[TeachLogForCheckVC alloc] init];
  309. teachlogVC.checkDic = self.dataurce[indexPath.row];
  310. [self.navigationController pushViewController:teachlogVC animated:YES];
  311. // NSDictionary * dic = self.dataurce[indexPath.row];
  312. // NSString * message = [NSString stringWithFormat:@"姓名:%@ 训练时长:%@",dic[@"STUNAME"],dic[@"TIME"]];
  313. // UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:@"审核学时" message:message preferredStyle:UIAlertControllerStyleAlert];
  314. // [alertFind addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
  315. // textField.placeholder = @"输入审核原因[二次审核不能为空]";
  316. // }];
  317. // [alertFind addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
  318. // [alertFind addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
  319. // UITextField *tf = alertFind.textFields[0];
  320. // [self trainTimesCheckWithDic:dic withReason:tf.text];
  321. // }]];
  322. // [self presentViewController:alertFind animated:true completion:nil];
  323. }
  324. - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
  325. //当取消选中cell时,从记录的数组中删除其indexPath
  326. if ([_selectedIndexPathes containsObject:indexPath] && _isEditing) {
  327. [_selectedIndexPathes removeObject:indexPath];
  328. if (_allBtn.selected) {
  329. _allBtn.selected = NO;
  330. }
  331. }
  332. }
  333. - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
  334. return UITableViewCellEditingStyleInsert |UITableViewCellEditingStyleDelete;
  335. }
  336. #pragma mark searchbar代理相关
  337. -(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
  338. _stuName = searchBar.text;
  339. _currentPageNum = 0;
  340. [self getData];
  341. }
  342. #pragma mark searchcontroller代理
  343. -(void)willPresentSearchController:(UISearchController *)searchController{
  344. _searchController.searchBar.showsCancelButton = YES;
  345. UIButton *canceLBtn = [_searchController.searchBar valueForKey:@"cancelButton"];
  346. [canceLBtn setTitle:@"取消" forState:UIControlStateNormal];
  347. [canceLBtn setTitleColor:COLOR_THEME forState:UIControlStateNormal];
  348. }
  349. -(void)didDismissSearchController:(UISearchController *)searchController{
  350. _searchController.searchBar.frame = CGRectMake(0, 0, _searchController.searchBar.frame.size.width, 44.0);
  351. }
  352. #pragma mark 网络请求
  353. - (void)getData{
  354. //判断当前是否正在加载数据。如果正在加载数据,直接return。
  355. if (_IS_LOADING) {
  356. return;
  357. }
  358. _IS_LOADING=YES;
  359. //获取第一页数据
  360. NSInteger needLoadPage;
  361. needLoadPage=_currentPageNum+1;
  362. if (_getDataType==MyGetDataTypeHeaderRefresh) {
  363. needLoadPage=1;
  364. }
  365. //@[@"未审核",@"已审核",@"审核不通过"]
  366. NSString * statu = @"";
  367. if ([_state isEqualToString:@"待审核"]) {
  368. statu = @"0";
  369. }else if ([_state isEqualToString:@"审核通过"]){
  370. statu = @"1";
  371. }else if ([_state isEqualToString:@"审核不通过"]){
  372. statu = @"2";
  373. }
  374. NSString * kemuStr = @"";
  375. if ([_kemu isEqualToString:@"第一部分"]) {
  376. kemuStr = @"1";
  377. }else if ([_kemu isEqualToString:@"第二部分"]){
  378. kemuStr = @"2";
  379. }else if ([_kemu isEqualToString:@"第三部分"]){
  380. kemuStr = @"3";
  381. }else if ([_kemu isEqualToString:@"第四部分"]){
  382. kemuStr = @"4";
  383. }
  384. NSMutableDictionary * mdic = [NSMutableDictionary new];
  385. [mdic setValue:@"" forKey:@"dqbh"];
  386. [mdic setValue:@"" forKey:@"qxbh"];
  387. [mdic setValue:@"" forKey:@"inscode"];
  388. [mdic setValue:_stuName forKey:@"studentName"];
  389. [mdic setValue:kemuStr forKey:@"subject"];
  390. [mdic setValue:statu forKey:@"auditStatus"];
  391. [mdic setValue:@"1" forKey:@"isPage"];
  392. [mdic setValue:@"10" forKey:@"pageSize"];
  393. [mdic setValue:[NSString stringWithFormat:@"%d",(int)needLoadPage] forKey:@"currentPage"];
  394. __weak typeof(self) weakSelf = self;
  395. [self getDataWithDic:mdic method:@"trainTimes" block:^(NSDictionary *successDic) {
  396. //设置加载状态
  397. _IS_LOADING=NO;
  398. //处理数据
  399. //如果获取到了数据,而且是下拉刷新,清空数组。
  400. if (_getDataType==MyGetDataTypeHeaderRefresh){
  401. [weakSelf.dataurce removeAllObjects];
  402. }
  403. //如果是第一页 清空之前的数据
  404. if (_currentPageNum == 0) {
  405. [weakSelf.dataurce removeAllObjects];
  406. }
  407. //追加数据
  408. [weakSelf.dataurce addObjectsFromArray:successDic[@"body"]];
  409. if (weakSelf.dataurce.count != 0) {
  410. self.holderV.hidden = YES;
  411. _notifyBtn.hidden = NO;
  412. }
  413. //如果是切换筛选条件 就重新判断是否显示审核按钮
  414. _notifyBtn.hidden = YES;
  415. if ([_state isEqualToString:@"待审核"]) {
  416. _notifyBtn.hidden = NO;
  417. }
  418. //计数器+1
  419. _currentPageNum=needLoadPage;
  420. //刷新界面
  421. [weakSelf.tableView reloadData];
  422. //恢复初始状态。
  423. _getDataType=MyGetDataTypeNomal;
  424. }];
  425. }
  426. -(void)shenheXueshiWithIds:(NSMutableArray *)ids{
  427. if ([MYAPPDELEGATE.userDic[@"qz"] length] == 0) {
  428. [self showMsgByAlertVCWithString:@"审核失败,不具备审核权限"];
  429. return;
  430. }
  431. NSMutableString *str = [NSMutableString new];
  432. for (NSString *obj in ids) {
  433. [str appendFormat:@",%@",obj];
  434. }
  435. NSString * idsStr = [str substringFromIndex:1];
  436. NSMutableDictionary * mdic = [NSMutableDictionary new];
  437. [mdic setValue:idsStr forKey:@"ids"];
  438. [mdic setValue:MYAPPDELEGATE.userDic[@"id"] forKey:@"userId"];
  439. [mdic setValue:@"1" forKey:@"auditStatus"];
  440. [mdic setValue:@"" forKey:@"reason"];
  441. //判断网络是否连接
  442. if (![NetworkManager connectedToNetWork]) {
  443. [self showMsgByAlertVCWithString:@"网络连接异常"];
  444. return;
  445. }
  446. [MBProgressHUD hideHUDForView:self.view animated:NO];
  447. [MBProgressHUD showHUDAddedTo:self.view animated:YES];
  448. [NetworkManager requestWithMethod:@"trainTimesAudit" parameters:mdic type:0 handler:^(NSDictionary *successDic, NSString *failureStr) {
  449. [MBProgressHUD hideHUDForView:self.view animated:YES];
  450. //设置加载状态
  451. _IS_LOADING=NO;
  452. if (failureStr) {
  453. [self showMsgByAlertVCWithString:failureStr];
  454. return;
  455. }
  456. if ([successDic[@"code"] isEqualToString:@"1"]) {
  457. [self showMsgByAlertVCWithString:successDic[@"msg"]];
  458. return;
  459. }
  460. [self showMsgByMBWithString:@"审核成功"];
  461. [self getData];
  462. }];
  463. }
  464. -(void)trainTimesCheckWithDic:(NSDictionary *)dic withReason:(NSString *)reason{
  465. if ([MYAPPDELEGATE.userDic[@"qz"] length] == 0) {
  466. [self showMsgByAlertVCWithString:@"审核失败,不具备审核权限"];
  467. return;
  468. }
  469. NSMutableDictionary * mdic = [NSMutableDictionary new];
  470. [mdic setValue:@[dic[@"ID"]] forKey:@"ids"];
  471. [mdic setValue:MYAPPDELEGATE.userDic[@"id"] forKey:@"userId"];
  472. [mdic setValue:dic[@"STATUS"] forKey:@"auditStatus"];
  473. [mdic setValue:reason forKey:@"reason"];
  474. [self getDataWithDic:mdic method:@"trainTimesAudit" block:^(NSDictionary *successDic) {
  475. [self showMsgByMBWithString:@"审核成功"];
  476. [self getData];
  477. }];
  478. }
  479. - (void)didReceiveMemoryWarning {
  480. [super didReceiveMemoryWarning];
  481. // Dispose of any resources that can be recreated.
  482. }
  483. /*
  484. #pragma mark - Navigation
  485. // In a storyboard-based application, you will often want to do a little preparation before navigation
  486. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  487. // Get the new view controller using [segue destinationViewController].
  488. // Pass the selected object to the new view controller.
  489. }
  490. */
  491. @end