workVC.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. //
  2. // workVC.m
  3. // LN_School
  4. //
  5. // Created by apple on 2017/4/5.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "workVC.h"
  9. #import "SIcon_button.h"
  10. #import "SignUpVC.h"
  11. #import "CheckCourseVC.h"
  12. #import "TerminalMapVC.h"
  13. #import "StudentList.h"
  14. #import "CoachListVC.h"
  15. #import "SafeList.h"
  16. #import "AssessorList.h"
  17. #import "CarList.h"
  18. #import "payinRealityVC.h"
  19. #import "TrainPriceList.h"
  20. #import "QuitSch.h"
  21. #import "RepairViewController.h"
  22. #import "EvaluationListVC.h"
  23. #import "ComplaintsListVC.h"
  24. #import "RegionsList.h"
  25. #import "StuExamSearchSetVC.h"
  26. #import "AllCoachPlanVC.h"
  27. #import "FenceSiteVC.h"
  28. #import "WaringVC.h"
  29. #import "FaceColloectVC.h"
  30. #import "MessageList.h"
  31. #import "TCSListVC.h"
  32. #import "NBZOverCarListVC.h"
  33. #import "AdvertisingColumn.h"
  34. @interface workVC ()
  35. {
  36. //待办事项
  37. SIcon_button *btn1;
  38. SIcon_button *btn2;
  39. SIcon_button *btn3;
  40. SIcon_button *btn4;
  41. SIcon_button *btn5;
  42. UILabel *realNameLabel;
  43. }
  44. @end
  45. @implementation workVC
  46. - (void)viewDidLoad {
  47. [super viewDidLoad];
  48. self.title = @"工作";//某某驾校
  49. self.navigationController.navigationBar.translucent = NO;
  50. self.view.backgroundColor = KBackGroundColor;
  51. [self myInit];
  52. }
  53. -(void)viewDidAppear:(BOOL)animated {
  54. [super viewDidAppear:animated];
  55. self.tabBarController.tabBar.hidden = NO;
  56. //刷新待办事项
  57. [self getStatistics];
  58. NSString *nameString = @"欢迎您!";
  59. if ([defUser.userDict[@"realName"] length] > 0) {
  60. nameString = [NSString stringWithFormat:@" %@,欢迎您!",defUser.userDict[@"realName"]];
  61. }
  62. realNameLabel.text = nameString;
  63. }
  64. - (void)myInit {
  65. // UIView *noUseView = [UIView new];
  66. // [self.view addSubview:noUseView];
  67. CGFloat x, y, w, h, bd;
  68. x = 0;
  69. y = 0;
  70. w = kSize.width;
  71. h = kSize.height - kNavOffSet - kTabBarHeight;
  72. UIScrollView *mainScroll = [[UIScrollView alloc] initWithFrame:KSetDIYFrame];
  73. mainScroll.showsVerticalScrollIndicator = NO;
  74. [self.view addSubview:mainScroll];
  75. bd = 10;
  76. x = 0;
  77. y = 0;
  78. w = kSize.width;
  79. h = kSize.width*201/720;
  80. AdvertisingColumn *adview = [[AdvertisingColumn alloc] KSetxywh];
  81. [adview setImgArray:@[@"横幅广告1",@"横幅广告2",@"横幅广告3"]];
  82. [mainScroll addSubview:adview];
  83. y += h;
  84. h = 40;
  85. UILabel *label = [[UILabel alloc] KSetxywh];
  86. label.backgroundColor = [UIColor whiteColor];
  87. NSString *nameString = @"欢迎您!";
  88. if ([defUser.userDict[@"realName"] length] > 0) {
  89. nameString = [NSString stringWithFormat:@" %@,欢迎您!",defUser.userDict[@"realName"]];
  90. }
  91. [label setText:nameString Font:24 TextColor:KTitleColor];
  92. [mainScroll addSubview:label];
  93. realNameLabel = label;
  94. [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
  95. //待办事项
  96. y += h + bd;
  97. h = 30;
  98. label = [[UILabel alloc] KSetxywh];
  99. label.backgroundColor = [UIColor whiteColor];
  100. [label setText:@" 待办事项" Font:Font18 TextColor:KTitleColor];
  101. [mainScroll addSubview:label];
  102. [label addViewWithRect:CGRectMake(x, y, w, 1)];
  103. [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
  104. NSArray *imageArray = @[@"work_1",@"work_1",@"work_1",@"work_1",@"work_1"];
  105. NSArray *titleArray = @[@"年检到期",@"保险到期",@"综合检测",@"未读消息",@"终端在线"];
  106. y += h;
  107. w = h = kSize.width/titleArray.count;
  108. for (int i = 0; i < titleArray.count; i ++) {
  109. SIcon_button *btn = [[SIcon_button alloc] initWithFrame:CGRectMake(i*w, y, w, h)];
  110. [btn setImage:[UIImage imageNamed:imageArray[i]] withTitle:titleArray[i] textColor:KTitleColor Font:Font16 forState:UIControlStateNormal];
  111. [btn target:self Tag:i + 0];
  112. [mainScroll addSubview:btn];
  113. btn.contentLabel.text = @"0";
  114. switch (i) {
  115. case 0:
  116. btn1 = btn;
  117. break;
  118. case 1:
  119. btn2 = btn;
  120. break;
  121. case 2:
  122. btn3 = btn;
  123. break;
  124. case 3:
  125. btn4 = btn;
  126. break;
  127. case 4:
  128. btn5 = btn;
  129. break;
  130. default:
  131. break;
  132. }
  133. }
  134. //常用功能
  135. y += h + bd;
  136. w = kSize.width;
  137. h = 30;
  138. label = [[UILabel alloc] KSetxywh];
  139. label.backgroundColor = [UIColor whiteColor];
  140. [label setText:@" 常用功能" Font:Font18 TextColor:KTitleColor];
  141. [mainScroll addSubview:label];
  142. [label addViewWithRect:CGRectMake(x, y, w, 1)];
  143. [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
  144. y += h;
  145. w = h = kSize.width/4.0;
  146. //添加功能 直接在这里添加 注意:图片数要和title数一致 ,@"学时送审" ,@"work_6"
  147. titleArray = @[@"退学管理",@"线下支付",@"培训价格",@"教练车辆",@"终端管理",@"设备报修",@"预约管理",@"车辆报警"];//,@"人脸采集" @"学员报名",
  148. imageArray = @[@"work_5",@"work_7",@"work_8",@"work_9",@"work_10",@"work_Rep",@"work_Pla",@"work_waring"];//,@"work_face" @"work_4"
  149. int maxI = (int)ceilf(titleArray.count/4.0) * 4;
  150. for (int i = 0; i < maxI; i ++) {
  151. int row = i/4;
  152. int column = i%4;
  153. SIcon_button *btn = [[SIcon_button alloc] initWithFrame:CGRectMake(column*w, y + row*h, w, h)];
  154. if (i < titleArray.count) {
  155. [btn setImage:[UIImage imageNamed:imageArray[i]] withTitle:titleArray[i] textColor:KTitleColor Font:Font16 forState:UIControlStateNormal];
  156. [btn target:self Tag:i + 6];
  157. }else {
  158. btn.userInteractionEnabled = NO;
  159. }
  160. [mainScroll addSubview:btn];
  161. if (i%4 != 3) {
  162. [btn addViewWithRect:CGRectMake((column + 1) * w - 1, y + row * h, 1, h)];
  163. }else{
  164. [btn addViewWithRect:CGRectMake(0, y + (row + 1) * h - 1, kSize.width, 1)];
  165. }
  166. }
  167. //其他功能
  168. int maxRow = (int)ceilf(titleArray.count/4.0);
  169. y += maxRow * h + bd;
  170. w = kSize.width;
  171. h = 30;
  172. label = [[UILabel alloc] KSetxywh];
  173. label.backgroundColor = [UIColor whiteColor];
  174. [label setText:@" 其它功能" Font:Font18 TextColor:KTitleColor];
  175. [mainScroll addSubview:label];
  176. [label addViewWithRect:CGRectMake(x, y, w, 1)];
  177. [label addViewWithRect:CGRectMake(x, y + h - 1, w, 1)];
  178. y += h;
  179. w = h = kSize.width/4.0;
  180. //添加功能 直接在这里添加 注意:图片数要和title数一致
  181. titleArray = @[@"学员",@"教练员",@"安全员",@"考核员",@"评价管理",@"投诉管理",@"预考成绩",@"电子围栏",@"训练场地",@"理论教室",@"报名点"];
  182. imageArray = @[@"work_11",@"work_12",@"work_13",@"work_14",@"work_Eva",@"work_Com",@"work_Exa",@"work_Reg",@"work_Tra",@"work_Clsr",@"work_Bmd"];
  183. maxI = (int)ceilf(titleArray.count/4.0) * 4;
  184. for (int i = 0; i < maxI; i ++) {
  185. int row = i/4;
  186. int column = i%4;
  187. SIcon_button *btn = [[SIcon_button alloc] initWithFrame:CGRectMake(column*w, y + row*h, w, h)];
  188. if (i < titleArray.count) {
  189. [btn setImage:[UIImage imageNamed:imageArray[i]] withTitle:titleArray[i] textColor:KTitleColor Font:Font16 forState:UIControlStateNormal];
  190. [btn target:self Tag:i + 20];
  191. }else {
  192. btn.userInteractionEnabled = NO;
  193. }
  194. [mainScroll addSubview:btn];
  195. if (i%4 != 3) {
  196. [btn addViewWithRect:CGRectMake((column + 1) * w - 1, y + row * h, 1, h)];
  197. }else{
  198. [btn addViewWithRect:CGRectMake(0, y + (row + 1) * h - 1, kSize.width, 1)];
  199. }
  200. }
  201. UIView *lastView = mainScroll.subviews.lastObject;
  202. [mainScroll setContentSize:CGSizeMake(kSize.width, lastView.bottom + 2*bd)];
  203. }
  204. - (void)btnClick:(UIButton *)sender {
  205. // SIcon_button *btn = (SIcon_button *)sender;
  206. // NSLog(@"工作点击----><>%@",btn.contentLabel.text);
  207. switch (sender.tag) {
  208. case 0://年检到期
  209. case 1://保险到期
  210. case 2://综合性能检测到期
  211. {
  212. [Tools permissionValidationWithID:@"9" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  213. if (!isCan) {
  214. if (failureStr) {
  215. showMsgByAlert(self, failureStr);
  216. }
  217. return;
  218. }
  219. NBZOverCarListVC * vc = [[NBZOverCarListVC alloc]init];
  220. vc.vcType = sender.tag+1;
  221. [self navPushHideTabbarToVC:vc];
  222. }];
  223. }
  224. break;
  225. case 3://未读消息
  226. {
  227. MessageList *vc = [[MessageList alloc]init];
  228. [self navPushHideTabbarToVC:vc];
  229. }
  230. break;
  231. case 4://终端在线
  232. {
  233. [Tools permissionValidationWithID:@"81" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  234. if (!isCan) {
  235. if (failureStr) {
  236. showMsgByAlert(self, failureStr);
  237. }
  238. return;
  239. }
  240. TerminalMapVC *vc = [[TerminalMapVC alloc] init];
  241. [self navPushHideTabbarToVC:vc];
  242. }];
  243. }
  244. break;
  245. //常用功能
  246. // case 5://学员报名
  247. // {
  248. // SignUpVC *vc = [[SignUpVC alloc] init];
  249. // [self navPushHideTabbarToVC:vc];
  250. // }
  251. // break;
  252. case 6://退学管理
  253. {
  254. [Tools permissionValidationWithID:@"1102" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  255. if (!isCan) {
  256. if (failureStr) {
  257. showMsgByAlert(self, failureStr);
  258. }
  259. return;
  260. }
  261. QuitSch * vc = [[QuitSch alloc]init];
  262. [self navPushHideTabbarToVC:vc];
  263. }];
  264. }
  265. break;
  266. // case 7://学时送审
  267. // {
  268. // CheckCourseVC *vc = [[CheckCourseVC alloc] init];
  269. // [self navPushHideTabbarToVC:vc];
  270. // }
  271. // break;
  272. case 7://线下支付
  273. {
  274. payinRealityVC *vc = [[payinRealityVC alloc] init];
  275. [self navPushHideTabbarToVC:vc];
  276. }
  277. break;
  278. case 8://培训价格
  279. {
  280. [Tools permissionValidationWithID:@"12" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  281. if (!isCan) {
  282. if (failureStr) {
  283. showMsgByAlert(self, failureStr);
  284. }
  285. return;
  286. }
  287. TrainPriceList * vc = [[TrainPriceList alloc]init];
  288. [self navPushHideTabbarToVC:vc];
  289. }];
  290. }
  291. break;
  292. case 9://教练车辆
  293. {
  294. [Tools permissionValidationWithID:@"9" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  295. if (!isCan) {
  296. if (failureStr) {
  297. showMsgByAlert(self, failureStr);
  298. }
  299. return;
  300. }
  301. CarList * vc = [[CarList alloc]init];
  302. [self navPushHideTabbarToVC:vc];
  303. }];
  304. }
  305. break;
  306. case 10://终端管理
  307. {
  308. [Tools permissionValidationWithID:@"81" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  309. if (!isCan) {
  310. if (failureStr) {
  311. showMsgByAlert(self, failureStr);
  312. }
  313. return;
  314. }
  315. TerminalMapVC *vc = [[TerminalMapVC alloc] init];
  316. [self navPushHideTabbarToVC:vc];
  317. }];
  318. }
  319. break;
  320. case 11://设备报修
  321. {
  322. RepairViewController *vc = [[RepairViewController alloc]init];
  323. [self navPushHideTabbarToVC:vc];
  324. }
  325. break;
  326. case 12://预约管理
  327. {
  328. [Tools permissionValidationWithID:@"1082" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  329. if (!isCan) {
  330. if (failureStr) {
  331. showMsgByAlert(self, failureStr);
  332. }
  333. return;
  334. }
  335. [self getSchPlaces];
  336. }];
  337. }
  338. break;
  339. case 13://报警
  340. {
  341. [Tools permissionValidationWithID:@"81" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  342. if (!isCan) {
  343. if (failureStr) {
  344. showMsgByAlert(self, failureStr);
  345. }
  346. return;
  347. }
  348. WaringVC *vc = [[WaringVC alloc] init];
  349. [self navPushHideTabbarToVC:vc];
  350. }];
  351. }
  352. break;
  353. case 14://人脸采集
  354. {
  355. FaceColloectVC *vc = [[FaceColloectVC alloc] init];
  356. [self navPushHideTabbarToVC:vc];
  357. }
  358. break;
  359. //其他功能
  360. case 20://学员
  361. {
  362. [Tools permissionValidationWithID:@"52" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  363. if (!isCan) {
  364. if (failureStr) {
  365. showMsgByAlert(self, failureStr);
  366. }
  367. return;
  368. }
  369. StudentList * vc = [[StudentList alloc]init];
  370. [self navPushHideTabbarToVC:vc];
  371. }];
  372. }
  373. break;
  374. case 21://教练员
  375. {
  376. [Tools permissionValidationWithID:@"8" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  377. if (!isCan) {
  378. if (failureStr) {
  379. showMsgByAlert(self, failureStr);
  380. }
  381. return;
  382. }
  383. CoachListVC * vc = [[CoachListVC alloc]init];
  384. [self navPushHideTabbarToVC:vc];
  385. }];
  386. }
  387. break;
  388. case 22://安全员
  389. {
  390. [Tools permissionValidationWithID:@"11" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  391. if (!isCan) {
  392. if (failureStr) {
  393. showMsgByAlert(self, failureStr);
  394. }
  395. return;
  396. }
  397. SafeList *vc = [[SafeList alloc]init];
  398. [self navPushHideTabbarToVC:vc];
  399. }];
  400. }
  401. break;
  402. case 23://考核员
  403. {
  404. [Tools permissionValidationWithID:@"10" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  405. if (!isCan) {
  406. if (failureStr) {
  407. showMsgByAlert(self, failureStr);
  408. }
  409. return;
  410. }
  411. AssessorList * vc = [[AssessorList alloc]init];
  412. [self navPushHideTabbarToVC:vc];
  413. }];
  414. }
  415. break;
  416. case 24://评价
  417. {
  418. EvaluationListVC * vc = [[EvaluationListVC alloc]init];
  419. [self navPushHideTabbarToVC:vc];
  420. }
  421. break;
  422. case 25://投诉
  423. {
  424. ComplaintsListVC * vc = [[ComplaintsListVC alloc]init];
  425. [self navPushHideTabbarToVC:vc];
  426. }
  427. break;
  428. case 26://预考成绩
  429. {
  430. StuExamSearchSetVC * vc = [[StuExamSearchSetVC alloc]init];
  431. [self navPushHideTabbarToVC:vc];
  432. }
  433. break;
  434. case 27://电子围栏
  435. {
  436. [Tools permissionValidationWithID:@"13" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  437. if (!isCan) {
  438. if (failureStr) {
  439. showMsgByAlert(self, failureStr);
  440. }
  441. return;
  442. }
  443. RegionsList * vc = [[RegionsList alloc]init];
  444. [self navPushHideTabbarToVC:vc];
  445. }];
  446. }
  447. break;
  448. case 28://训练场地
  449. {
  450. [Tools permissionValidationWithID:@"2041" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  451. if (!isCan) {
  452. if (failureStr) {
  453. showMsgByAlert(self, failureStr);
  454. }
  455. return;
  456. }
  457. TCSListVC *vc = [[TCSListVC alloc]init];
  458. vc.vcType = @"T";
  459. [self navPushHideTabbarToVC:vc];
  460. }];
  461. }
  462. break;
  463. case 29://理论教室
  464. {
  465. [Tools permissionValidationWithID:@"1245" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  466. if (!isCan) {
  467. if (failureStr) {
  468. showMsgByAlert(self, failureStr);
  469. }
  470. return;
  471. }
  472. TCSListVC *vc = [[TCSListVC alloc]init];
  473. vc.vcType = @"C";
  474. [self navPushHideTabbarToVC:vc];
  475. }];
  476. }
  477. break;
  478. case 30://报名点
  479. {
  480. [Tools permissionValidationWithID:@"1146" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  481. if (!isCan) {
  482. if (failureStr) {
  483. showMsgByAlert(self, failureStr);
  484. }
  485. return;
  486. }
  487. TCSListVC *vc = [[TCSListVC alloc]init];
  488. vc.vcType = @"S";
  489. [self navPushHideTabbarToVC:vc];
  490. }];
  491. }
  492. break;
  493. default:
  494. break;
  495. }
  496. }
  497. #pragma mark 数据请求
  498. - (void)getStatistics {
  499. if (![NetManager connectedToNetWork]) {
  500. showMsgUnconnect();
  501. return;
  502. }
  503. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  504. [dic setObject:defUser.userDict[@"id"] forKey:@"userId"];
  505. [dic setObject:defUser.userDict[@"dqbh"] forKey:@"dqbh"];
  506. [dic setObject:defUser.userDict[@"qxbh"] forKey:@"qxbh"];
  507. NSString *method = @"getStatistics";
  508. [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
  509. if (!root) {
  510. return;
  511. }
  512. if ([root[@"code"] integerValue] == 1) {
  513. return;
  514. }
  515. NSDictionary * dic = root[@"body"];
  516. btn1.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"INSPECTION_CT"]];
  517. btn2.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"INSURANCE_CT"]];
  518. btn3.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"COMPREHENSIVE_CT"]];
  519. btn4.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"MSG_CT"]];
  520. btn5.contentLabel.text = [NSString stringWithFormat:@"%@",dic[@"CONNECT_CT"]];
  521. }];
  522. }
  523. #pragma mark 查是否有场地
  524. - (void)getSchPlaces
  525. {
  526. if (![NetManager connectedToNetWork]) {
  527. AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
  528. [self navPushHideTabbarToVC:vc];
  529. return;
  530. }
  531. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  532. [dic setObject:defUser.userDict[@"school"] forKey:@"schid"];
  533. NSString *method = @"getSchPlaces";
  534. [MBProgressHUD showLoadToView:self.view];
  535. [NetManager requestAnythingWithURL:method dictionary:dic dataArray:nil completion:^(NSDictionary *root) {
  536. [MBProgressHUD hideHUDForView:self.view];
  537. if (!root) {
  538. AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
  539. [self navPushHideTabbarToVC:vc];
  540. return;
  541. }
  542. if ([root[@"code"] integerValue] == 1) {
  543. AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
  544. [self navPushHideTabbarToVC:vc];
  545. return;
  546. }
  547. if ([root[@"body"] count] < 1) {
  548. AllCoachPlanVC *vc = [[AllCoachPlanVC alloc] init];
  549. [self navPushHideTabbarToVC:vc];
  550. }else {
  551. FenceSiteVC *vc = [[FenceSiteVC alloc] init];
  552. vc.dataArray = root[@"body"];
  553. [self navPushHideTabbarToVC:vc];
  554. }
  555. }];
  556. }
  557. - (void)didReceiveMemoryWarning {
  558. [super didReceiveMemoryWarning];
  559. }
  560. @end