workVC.m 16 KB

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