JobVC.m 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. //
  2. // JobVC.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/13.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "JobVC.h"
  9. #import "SchoolListVC.h"
  10. #import "RegionsList.h"
  11. #import "XueShiCheckList.h"
  12. #import "EvaluationListVC.h"
  13. #import "ComplaintsListVC.h"
  14. //#import "ReportListVC.h"
  15. #import "TerminalVC.h"
  16. #import "statisticsVC.h"
  17. #import "NotifySelectObjVC.h"
  18. @interface JobVC ()<UITableViewDelegate,UITableViewDataSource>
  19. {
  20. NSArray *_titleArr;
  21. UITableView * _tableView;
  22. NSMutableArray *_topLabArr;//存放需要更新显示的lab
  23. }
  24. @end
  25. @implementation JobVC
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. self.navigationItem.title = @"功能";
  29. _titleArr = @[@[@"待我审核",@"新增消息",@"待审区域",@"在线终端"],
  30. @[@"学时审核",@"教学日志",@"通知下发",@"终端管理"],
  31. @[@"机构管理",
  32. @"教练管理",
  33. @"考核员管理",
  34. @"安全员管理",
  35. @"教练车管理",
  36. @"学员管理",
  37. @"教学区域",
  38. @"评价管理",@"投诉管理",
  39. // @"举报管理",
  40. @"学员统计"]];
  41. _topLabArr = [NSMutableArray new];
  42. [self myInit];
  43. }
  44. -(void)viewDidAppear:(BOOL)animated{
  45. [super viewDidAppear:animated];
  46. [self getData];
  47. }
  48. -(void)viewWillDisappear:(BOOL)animated{
  49. // [self setHidesBottomBarWhenPushed:NO];
  50. [super viewWillDisappear:animated];
  51. }
  52. -(void)getData{
  53. NSMutableDictionary * mDic = [[NSMutableDictionary alloc]init];
  54. [mDic setValue:MYAPPDELEGATE.userDic[@"id"] forKey:@"userId"];
  55. [mDic setValue:MYAPPDELEGATE.userDic[@"qxbh"] forKey:@"qxbh"];
  56. [mDic setValue:MYAPPDELEGATE.userDic[@"dqbh"] forKey:@"dqbh"];
  57. [NetworkManager requestWithMethod:@"getStatistics" parameters:mDic type:0 handler:^(NSDictionary *successDic, NSString *failureStr) {
  58. if (failureStr) {
  59. return;
  60. }
  61. if ([successDic[@"code"] isEqualToString:@"1"]) {
  62. return;
  63. }
  64. NSArray * keys = @[@"auditRecCnt",@"msgCnt",@"auditRegionCnt",@"onlineDevCnt"];
  65. if (successDic) {
  66. NSDictionary * dic = successDic[@"body"];
  67. int i=0;
  68. for (UILabel *lab in _topLabArr) {
  69. lab.text = [NSString stringWithFormat:@"%@",dic[keys[i]]];
  70. i++;
  71. }
  72. }
  73. }];
  74. }
  75. -(void)myInit{
  76. _tableView = [[UITableView alloc]initWithFrame:kFrame style:UITableViewStylePlain];
  77. _tableView.backgroundColor = KBackGroundColor;
  78. _tableView.delegate = self;
  79. _tableView.dataSource = self;
  80. _tableView.showsVerticalScrollIndicator = NO;
  81. _tableView.estimatedSectionHeaderHeight = 0;
  82. _tableView.estimatedSectionFooterHeight = 0;
  83. [self.view addSubview:_tableView];
  84. // UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 100)];
  85. // _tableView.tableFooterView = view;
  86. }
  87. #pragma mark tableview代理相关
  88. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  89. return 3;
  90. }
  91. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  92. return 1;
  93. }
  94. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  95. CGFloat height = kSize.width/4;
  96. switch (indexPath.section) {
  97. case 0:
  98. return (height+40)+height + 20;
  99. break;
  100. case 1:
  101. return height+40 + 10;
  102. break;
  103. case 2:
  104. return height*3+40 + 20;
  105. break;
  106. default:
  107. break;
  108. }
  109. return 0;
  110. }
  111. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  112. NSArray * imgTitles = @[@[@"ic_check_train",@"ic_teach_log",@"ic_notify",@"ic_terminal_manager"],
  113. @[@"ic_school_manager",
  114. @"ic_coach_manager",
  115. @"ic_assessor_manager",
  116. @"ic_securitor_manager",
  117. @"ic_car_manager",
  118. @"ic_student_manager",
  119. @"ic_teach_area",
  120. @"ic_pingjia_manager",
  121. @"ic_tousu_manager",
  122. // @"ic_jubao_manager",
  123. @"ic_waring_manager",
  124. ]];
  125. NSString * cellId = [NSString stringWithFormat:@"cellId%ld",(long)indexPath.row];
  126. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
  127. if (cell) {
  128. return cell;
  129. }else{
  130. cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
  131. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  132. CGSize size = kSize;//cell.contentView.frame.size因为上面的特殊处理导致这个行不通了
  133. CGFloat height = kSize.width/4;
  134. if (indexPath.section == 0) {
  135. //顶部图片
  136. UIImageView *imgV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, size.width, height+40)];
  137. imgV.image = [UIImage imageNamed:@"job_top"];
  138. [cell.contentView addSubview:imgV];
  139. for (int i=0; i<[_titleArr[0] count]; i++) {
  140. UILabel *topLab = [[UILabel alloc]init];
  141. topLab.text = @"0";
  142. [_topLabArr addObject:topLab];
  143. UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
  144. button.frame = CGRectMake(i*size.width/4, height+50, size.width/4, height);
  145. [button setTitleUnderImgWithTitle:_titleArr[0][i] TitleColor:[UIColor grayColor] Image:nil label:topLab];
  146. button.tag = 10+i;
  147. [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  148. [cell.contentView addSubview:button];
  149. }
  150. }else if (indexPath.section == 1){
  151. // UILabel * lab2 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, kSize.width, 50)];
  152. // lab2.text = [NSString stringWithFormat:@" %@,欢迎您!",MYAPPDELEGATE.userDic[@"realName"]];
  153. // lab2.textColor = RGB_COLOR(70, 70, 70);
  154. // lab2.font = [UIFont systemFontOfSize:20];
  155. // lab2.layer.borderWidth = .7f;
  156. // lab2.layer.borderColor = [UIColor colorWithRed:230/255.0f green:230/255.0f blue:230/255.0f alpha:1].CGColor;
  157. // [cell.contentView addSubview:lab2];
  158. //
  159. UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 5, kSize.width, 40)];
  160. lab.text = @" 常用功能";
  161. lab.textColor = [UIColor darkGrayColor];
  162. lab.font = [UIFont systemFontOfSize:17];
  163. [cell.contentView addSubview:lab];
  164. //
  165. for (int i=0; i<[_titleArr[1] count]; i++) {
  166. UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
  167. button.frame = CGRectMake(i*size.width/4, 45, size.width/4, height);
  168. [button setTitleUnderImgWithTitle:_titleArr[1][i] TitleColor:[UIColor blackColor] Image:[UIImage imageNamed:imgTitles[0][i]] label:nil];
  169. button.tag = 100+i;
  170. [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  171. [cell.contentView addSubview:button];
  172. }
  173. }else if (indexPath.section == 2){
  174. UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(0, 5, kSize.width, 40)];
  175. lab.text = @" 其它功能";
  176. lab.textColor = [UIColor darkGrayColor];
  177. lab.font = [UIFont systemFontOfSize:17];
  178. [cell.contentView addSubview:lab];
  179. for (int i=0; i<[_titleArr[2] count]; i++) {
  180. UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
  181. button.frame = CGRectMake(i%4*size.width/4, 45+i/4*height, size.width/4, height);
  182. [button setTitleUnderImgWithTitle:_titleArr[2][i] TitleColor:[UIColor blackColor] Image:[UIImage imageNamed:imgTitles[1][i]] label:nil];
  183. button.tag = 1000+i;
  184. [button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  185. [cell.contentView addSubview:button];
  186. }
  187. }
  188. return cell;
  189. }
  190. }
  191. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  192. return 0.1f;
  193. }
  194. -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
  195. return .1;
  196. }
  197. -(void)btnClick:(UIButton *)sender{
  198. //type/@[@"驾校管理0",@"教练管理1",@"考核员管理2",@"安全员管理3",@"教练车管理5",@"学员管理4",@"学时审核6"] @"教学日志"7 @"通知下发"8 终端管理9 家学区域 10
  199. switch (sender.tag) {
  200. case 10:
  201. {
  202. XueShiCheckList * vc = [[XueShiCheckList alloc]init];
  203. [self.navigationController pushViewController:vc animated:YES];
  204. }
  205. break;
  206. case 11:
  207. {
  208. //未读消息
  209. self.tabBarController.selectedIndex = 0;
  210. }
  211. break;
  212. case 12:
  213. {
  214. //待审核教学区域
  215. RegionsList * vc = [[RegionsList alloc]init];
  216. vc.type = @"1";
  217. [self.navigationController pushViewController:vc animated:YES];
  218. }
  219. break;
  220. case 13:
  221. {
  222. //在线终端
  223. TerminalVC * vc = [[TerminalVC alloc]init];
  224. [self.navigationController pushViewController:vc animated:YES];
  225. }
  226. break;
  227. case 100:
  228. {
  229. XueShiCheckList * vc = [[XueShiCheckList alloc]init];
  230. vc.navigationItem.title = @"学时审核";
  231. [self.navigationController pushViewController:vc animated:YES];
  232. }
  233. break;
  234. case 101:
  235. {
  236. SchoolListVC *vc = [[SchoolListVC alloc]init];
  237. vc.navigationItem.title = @"教学日志";
  238. vc.type = 7;//教学日志
  239. [self.navigationController pushViewController:vc animated:YES];
  240. }
  241. break;
  242. case 102:
  243. {
  244. //通知下发
  245. NotifySelectObjVC *vc = [[NotifySelectObjVC alloc]init];
  246. vc.navigationItem.title = @"通知下发";
  247. [self.navigationController pushViewController:vc animated:YES];
  248. }
  249. break;
  250. case 103:
  251. {
  252. SchoolListVC *vc = [[SchoolListVC alloc]init];
  253. vc.navigationItem.title = @"终端管理";
  254. vc.type = 9;//终端管理
  255. [self.navigationController pushViewController:vc animated:YES];
  256. }
  257. break;
  258. case 1000:
  259. {
  260. SchoolListVC *vc = [[SchoolListVC alloc]init];
  261. vc.navigationItem.title = @"驾校管理";
  262. vc.type = 0;//驾校管理0
  263. [self.navigationController pushViewController:vc animated:YES];
  264. }
  265. break;
  266. case 1001:
  267. {
  268. SchoolListVC *vc = [[SchoolListVC alloc]init];
  269. vc.navigationItem.title = @"教练管理";
  270. vc.type = 1;//教练管理1
  271. [self.navigationController pushViewController:vc animated:YES];
  272. }
  273. break;
  274. case 1002:
  275. {
  276. SchoolListVC *vc = [[SchoolListVC alloc]init];
  277. vc.navigationItem.title = @"考核员管理";
  278. vc.type = 2;//考核员管理2
  279. [self.navigationController pushViewController:vc animated:YES];
  280. }
  281. break;
  282. case 1003:
  283. {
  284. SchoolListVC *vc = [[SchoolListVC alloc]init];
  285. vc.navigationItem.title = @"安全员管理";
  286. vc.type = 3;//安全员管理3
  287. [self.navigationController pushViewController:vc animated:YES];
  288. }
  289. break;
  290. case 1004:
  291. {
  292. SchoolListVC *vc = [[SchoolListVC alloc]init];
  293. vc.navigationItem.title = @"教练车管理";
  294. vc.type = 5;//@""教练车管理5
  295. [self.navigationController pushViewController:vc animated:YES];
  296. }
  297. break;
  298. case 1005:
  299. {
  300. SchoolListVC *vc = [[SchoolListVC alloc]init];
  301. vc.navigationItem.title = @"学员管理";
  302. vc.type = 4;//学员管理4
  303. [self.navigationController pushViewController:vc animated:YES];
  304. }
  305. break;
  306. case 1006:
  307. {
  308. //教学区域
  309. RegionsList *vc = [[RegionsList alloc]init];
  310. [self.navigationController pushViewController:vc animated:YES];
  311. }
  312. break;
  313. case 1007:
  314. {
  315. //评价管理
  316. EvaluationListVC *vc = [[EvaluationListVC alloc]init];
  317. vc.navigationItem.title = @"评价管理";
  318. [self.navigationController pushViewController:vc animated:YES];
  319. }
  320. break;
  321. case 1008:
  322. {
  323. //投诉管理
  324. ComplaintsListVC *vc = [[ComplaintsListVC alloc]init];
  325. vc.navigationItem.title = @"投诉管理";
  326. [self.navigationController pushViewController:vc animated:YES];
  327. }
  328. break;
  329. case 1009:
  330. {
  331. //学员统计
  332. statisticsVC *vc = [[statisticsVC alloc] init];
  333. [self.navigationController pushViewController:vc animated:YES];
  334. // WaringVC *vc = [[WaringVC alloc] init];
  335. // [self.navigationController pushViewController:vc animated:YES];
  336. }
  337. break;
  338. //举报管理
  339. // ReportListVC *vc = [[ReportListVC alloc]init];
  340. // vc.navigationItem.title = @"举报管理";
  341. // [self.navigationController pushViewController:vc animated:YES];
  342. default:
  343. break;
  344. }
  345. }
  346. - (void)didReceiveMemoryWarning {
  347. [super didReceiveMemoryWarning];
  348. // Dispose of any resources that can be recreated.
  349. }
  350. /*
  351. #pragma mark - Navigation
  352. // In a storyboard-based application, you will often want to do a little preparation before navigation
  353. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  354. // Get the new view controller using [segue destinationViewController].
  355. // Pass the selected object to the new view controller.
  356. }
  357. */
  358. @end