StudentDetail.m 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. //
  2. // StudentDetail.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/10.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "StudentDetail.h"
  9. #import "TeachLogCell.h"
  10. #import "SignsCell.h"
  11. #import "ShenHeCell.h"
  12. #import "FaceColloectVC.h"
  13. @interface StudentDetail ()
  14. {
  15. NSArray *_teachLogDataArr;//教学日志
  16. NSArray *_signDataArr;// 签到记录
  17. NSArray *_shenheDataArr;//审核记录
  18. HolderView * _holderV1;
  19. HolderView * _holderV2;
  20. HolderView * _holderV3;
  21. BOOL _isPermission;//权限
  22. }
  23. @end
  24. @implementation StudentDetail
  25. - (void)viewDidLoad {
  26. [super viewDidLoad];
  27. self.navigationItem.title = @"学员详情";
  28. _teachLogDataArr = [[NSArray alloc]init];
  29. _signDataArr = [[NSArray alloc]init];
  30. _shenheDataArr = [[NSArray alloc]init];
  31. [Tools permissionValidationWithID:@"2005" view:self.view result:^(BOOL isCan, NSString *failureStr) {
  32. _isPermission = isCan;
  33. if (isCan) {
  34. [self setSegmentControllWithTitles:@[@"基本信息",@"教学日志",@"培训记录表"] isBttomBar:YES]; //,@"打卡记录",@"学时审核记录",@"锁定历史记录" 教学日志可能要gg
  35. [self createBottomBarWithtoolTitle:@"采集人脸"];
  36. }else{
  37. [self setSegmentControllWithTitles:@[@"基本信息",@"教学日志",@"培训记录表"] isBttomBar:NO]; //,@"打卡记录",@"学时审核记录",@"锁定历史记录" 教学日志可能要gg
  38. }
  39. // 第一次进来请求除基本信息[由上一级传进来]以外的数据
  40. [self getTrainTimesRecords];
  41. // [self getStudentSigns];
  42. // [self getStudentAuditRecords];
  43. UITableView * tabV = _tableViews[1];
  44. [self createHeaderViewWithTableView:tabV];
  45. }];
  46. }
  47. -(void)setData{
  48. _keysArr = @[
  49. // @[@"所属机构",@""],
  50. @[@"证件类型",@"TSO_CARDTYPE"],
  51. @[@"证件号码",@"TSO_IDCARD"],
  52. @[@"姓名",@"TSO_NAME"],
  53. @[@"性别",@"TSO_SEX"],
  54. @[@"手机号码",@"TSO_PHONE"],
  55. @[@"来源(推荐人)",@"TSO_SOURCE"],
  56. @[@"国籍",@"TSO_NATIONALITY"],
  57. @[@"业务类型",@"TSO_BUSITYPE"],
  58. @[@"培训车型",@"TSO_TRAINTYPE"],
  59. @[@"原准驾车型",@"TSO_PERDRITYPE"],
  60. @[@"驾驶证号",@"TSO_DRILICNUM"],
  61. @[@"驾驶证初领日期",@"TSO_FSTDRILICDATE"],
  62. @[@"培训模式",@"TSO_TRAIN_MODE"],
  63. @[@"报名日期",@"TSO_APPLYDATE"],
  64. @[@"全国统一编号",@"TSO_STUNUM"],
  65. @[@"备案时间",@"TSO_RECORD_DATE"],
  66. @[@"联系地址",@"TSO_ADDRESS"]
  67. ];
  68. [super setData];
  69. }
  70. -(void)createHeaderViewWithTableView:(UITableView *)tabV{
  71. UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kSize.width, 200)];
  72. view.backgroundColor = [UIColor whiteColor];
  73. tabV.tableHeaderView = view;
  74. NSArray *titles = @[@"科目",@"总计时长"];
  75. NSArray *kemuArr = @[@"科一",@"科二",@"科三",@"科四"];
  76. NSArray *keys = @[@"ONETIME",@"TWOTIME",@"THREETIME",@"FOURTIME"];
  77. CGFloat x = kSize.width/3;
  78. CGFloat height = 40;
  79. for (int i=0; i<4; i++) {
  80. if (i<2) {
  81. UILabel *lab1 = [[UILabel alloc]initWithFrame:CGRectMake(i*x, 0, x*(i+1), height)];
  82. [lab1 setText:titles[i] Font:14 TextColor:KTitleColor Alignment:NSTextAlignmentCenter];
  83. [view addSubview:lab1];
  84. }
  85. UILabel *lab2 = [[UILabel alloc]initWithFrame:CGRectMake(0, height*(i+1), x, height)];
  86. [lab2 setText:kemuArr[i] Font:14 TextColor:KSubTitleColor Alignment:NSTextAlignmentCenter];
  87. [view addSubview:lab2];
  88. UILabel *lab3 = [[UILabel alloc]initWithFrame:CGRectMake(x, height*(i+1), x*2, height)];
  89. [lab3 setText:self.dataSource[keys[i]] Font:14 TextColor:KSubTitleColor Alignment:NSTextAlignmentCenter];
  90. [view addSubview:lab3];
  91. }
  92. for (int i=0; i<6; i++) {
  93. if (i<2) {
  94. UILabel *vLine = [[UILabel alloc]initWithFrame:CGRectMake(1+(x-2/4)*i, 0, 1, 200)];
  95. vLine.backgroundColor = kLineColor;
  96. [view addSubview:vLine];
  97. }
  98. UILabel *vLine = [[UILabel alloc]initWithFrame:CGRectMake(2, height*i, kSize.width-4, 1)];
  99. vLine.backgroundColor = kLineColor;
  100. [view addSubview:vLine];
  101. }
  102. }
  103. #pragma mark 创建BottomBarButton
  104. -(void)createBottomBarWithtoolTitle:(NSString *)title{
  105. UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
  106. button.frame = CGRectMake(0, kSize.height-kNavOffSet-JOb_DETAIL_BOTTOMBAR_HEIGHT-SafeAreaBottomHeight, kSize.width, JOb_DETAIL_BOTTOMBAR_HEIGHT);
  107. button.backgroundColor = defGreen;
  108. [button setTitle:title textColor:[UIColor whiteColor] font:Font18 fotState:UIControlStateNormal];
  109. [button addTarget:self action:@selector(goToFaceColloectVC) forControlEvents:UIControlEventTouchUpInside];
  110. [self.view addSubview:button];
  111. }
  112. -(void)goToFaceColloectVC {
  113. FaceColloectVC *faceVC = [[FaceColloectVC alloc] init];
  114. faceVC.keyWord = self.dataSource[@"TSO_IDCARD"];
  115. [self navPushHideTabbarToVC:faceVC];
  116. }
  117. #pragma mark 重写代理方法
  118. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  119. NSInteger index = [_tableViews indexOfObject:tableView];
  120. if (index == 1) {
  121. return _teachLogDataArr.count;
  122. }else if (index == 2+4396){
  123. return _signDataArr.count;
  124. }else if (index == 3+4396){
  125. return _shenheDataArr.count;
  126. }else if (index == 4-2){
  127. return 1;
  128. }
  129. return [_keysArr count];
  130. }
  131. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  132. NSInteger index = [_tableViews indexOfObject:tableView];
  133. if (index == 1) {
  134. return [TeachLogCell heightForDic:_teachLogDataArr[indexPath.row]];;
  135. }else if (index == 4-2){
  136. return kSize.height-kNavOffSet-JOb_DETAIL_SEGBAR_HEIGHT-SafeAreaBottomHeight-(_isPermission?JOb_DETAIL_BOTTOMBAR_HEIGHT:0);
  137. }
  138. return [super tableView:tableView heightForRowAtIndexPath:indexPath];
  139. }
  140. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  141. {
  142. if ([_tableViews indexOfObject:tableView] == 1) {
  143. TeachLogCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellTeach"];
  144. if (!cell) {
  145. //加载xib文件创建cell
  146. cell = [[[NSBundle mainBundle] loadNibNamed:@"TeachLogCell" owner:nil options:nil] lastObject];
  147. }
  148. [cell setDataWithDic:_teachLogDataArr[indexPath.row]];
  149. return cell;
  150. }
  151. if ([_tableViews indexOfObject:tableView] == 2+4396) {
  152. SignsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellSign"];
  153. if (!cell) {
  154. //加载xib文件创建cell
  155. cell = [[[NSBundle mainBundle] loadNibNamed:@"SignsCell" owner:nil options:nil] lastObject];
  156. }
  157. [cell updataWithDic:_signDataArr[indexPath.row]];
  158. return cell;
  159. }
  160. if ([_tableViews indexOfObject:tableView] == 3+4396) {
  161. ShenHeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cellTShenhe"];
  162. if (!cell) {
  163. //加载xib文件创建cell
  164. cell = [[[NSBundle mainBundle] loadNibNamed:@"ShenHeCell" owner:nil options:nil] lastObject];
  165. }
  166. [cell updataWithDic:_shenheDataArr[indexPath.row]];
  167. return cell;
  168. }
  169. if ([_tableViews indexOfObject:tableView] == 4-2) {
  170. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"pxjlbCellId"];
  171. if (!cell) {
  172. cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"pxjlbCellId"];
  173. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  174. }
  175. //培训记录表
  176. if ([self.dataSource[@"PDFPATH"] length] > 0) {
  177. CGFloat height = _isPermission?JOb_DETAIL_BOTTOMBAR_HEIGHT:0;
  178. UIWebView *webV = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kSize.width, kSize.height-kNavOffSet-SafeAreaBottomHeight-height)];
  179. //
  180. // webV.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);某种比例不变
  181. webV.scalesPageToFit=YES;
  182. webV.multipleTouchEnabled=YES;
  183. webV.userInteractionEnabled=YES;
  184. webV.backgroundColor = [UIColor whiteColor];
  185. [cell.contentView addSubview:webV];
  186. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.dataSource[@"PDFPATH"]]];
  187. [webV loadRequest:request];
  188. }else{
  189. cell.textLabel.text = @"暂无数据";
  190. cell.textLabel.textColor = [UIColor darkGrayColor];
  191. cell.textLabel.textAlignment = NSTextAlignmentCenter;
  192. }
  193. return cell;
  194. }
  195. //这里面有很多自己独有的key类型,所以就不麻烦父类去判定了
  196. UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellId"];
  197. if (!cell) {
  198. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cellId"];
  199. }
  200. if ([_statusArr[indexPath.row] isEqualToNumber:@1]) {
  201. cell.detailTextLabel.numberOfLines = 0;
  202. cell.detailTextLabel.textAlignment = NSTextAlignmentLeft;
  203. }else{
  204. cell.detailTextLabel.numberOfLines = 1;
  205. cell.detailTextLabel.textAlignment = NSTextAlignmentRight;
  206. }
  207. NSString * key = _keysArr[indexPath.row][1];
  208. cell.textLabel.text = _keysArr[indexPath.row][0];
  209. if ([key isEqualToString:@"TSO_SEX"]) {
  210. NSString *sex = [NSString stringWithFormat:@"%@",self.dataSource[key]];
  211. cell.detailTextLabel.text = [sex isEqualToString:@"1"] ? @"男" : @"女" ;
  212. }else if ([key isEqualToString:@"TSO_BUSITYPE"]){
  213. NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
  214. switch ([status integerValue]) {
  215. case 0:
  216. cell.detailTextLabel.text = @"初领";
  217. break;
  218. case 1:
  219. cell.detailTextLabel.text = @"增领";
  220. break;
  221. case 9:
  222. cell.detailTextLabel.text = @"其它";
  223. break;
  224. default:
  225. break;
  226. }
  227. }else if ([key isEqualToString:@"TSO_CARDTYPE"]){
  228. NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
  229. switch ([status integerValue]) {
  230. case 1:
  231. cell.detailTextLabel.text = @"身份证";
  232. break;
  233. case 2:
  234. cell.detailTextLabel.text = @"护照";
  235. break;
  236. case 3:
  237. cell.detailTextLabel.text = @"军官证";
  238. break;
  239. case 0:
  240. cell.detailTextLabel.text = @"其它";
  241. break;
  242. default:
  243. break;
  244. }
  245. }else if ([key isEqualToString:@"TSO_TRAIN_MODE"]){//培训模式 0 传统模式 1 先学后付 2 分段式收费
  246. NSString *status = [NSString stringWithFormat:@"%@",self.dataSource[key]];
  247. switch ([status integerValue]) {
  248. case 0:
  249. cell.detailTextLabel.text = @"传统模式";
  250. break;
  251. case 1:
  252. cell.detailTextLabel.text = @"先学后付";
  253. break;
  254. case 2:
  255. cell.detailTextLabel.text = @"分段式收费";
  256. break;
  257. default:
  258. break;
  259. }
  260. }else{
  261. cell.detailTextLabel.text = [NSString stringWithFormat:@"%@",self.dataSource[_keysArr[indexPath.row][1]]];
  262. }
  263. return cell;
  264. }
  265. #pragma mark 数据请求
  266. -(void)getTrainTimesRecords{
  267. NSMutableDictionary * mdic = [[NSMutableDictionary alloc]init];
  268. [mdic setValue:@"" forKey:@"isPage"];
  269. [mdic setValue:@"" forKey:@"pageSize"];
  270. [mdic setValue:@"" forKey:@"currentPage"];
  271. [mdic setValue:defUser.userDict[@"dqbh"] forKey:@"dqbh"];
  272. [mdic setValue:defUser.userDict[@"qxbh"] forKey:@"qxbh"];
  273. [mdic setObject:defUser.userDict[@"school"] forKey:@"schoolId"];
  274. [mdic setObject:@"" forKey:@"isReport"];
  275. [mdic setObject:@"" forKey:@"trainSubject"];
  276. [mdic setObject:self.dataSource[@"TSO_NAME"] forKey:@"studentName"];
  277. [mdic setObject:@"" forKey:@"coachName"];
  278. [mdic setObject:defUser.userDict[@"id"] forKey:@"userId"];
  279. NSString *method = @"trainRecords";
  280. [MBProgressHUD showLoadToView:self.view];
  281. [NetManager requestAnythingWithURL:method dictionary:mdic dataArray:nil completion:^(NSDictionary *root) {
  282. [MBProgressHUD hideHUDForView:self.view];
  283. if (!root) {
  284. return;
  285. }
  286. if ([root[@"code"] integerValue] == 1) {
  287. return;
  288. }
  289. _teachLogDataArr = root[@"body"];
  290. [_tableViews[1] reloadData];
  291. }];
  292. }
  293. -(void)getStudentSigns{
  294. // NSMutableDictionary * mdic = [NSMutableDictionary new];
  295. // [mdic setValue:self.requesetDic[@"stunum"] forKey:@"stunum"];
  296. // [mdic setValue:@"" forKey:@"isPage"];
  297. // [mdic setValue:@"" forKey:@"pageSize"];
  298. // [mdic setValue:@"" forKey:@"currentPage"];
  299. //
  300. // [self getDataWithDic:mdic method:@"getStudentSigns" block:^(NSDictionary *successdic) {
  301. //
  302. // _signDataArr = successdic[@"body"];
  303. // [_tableViews[2] reloadData];
  304. // }];
  305. }
  306. -(void)getStudentAuditRecords{
  307. // NSMutableDictionary * mdic = [NSMutableDictionary new];
  308. // [mdic setValue:self.requesetDic[@"stunum"] forKey:@"stunum"];
  309. // [mdic setValue:@"" forKey:@"isPage"];
  310. // [mdic setValue:@"" forKey:@"pageSize"];
  311. // [mdic setValue:@"" forKey:@"currentPage"];
  312. //
  313. // [self getDataWithDic:mdic method:@"getStudentAuditRecords" block:^(NSDictionary *successdic) {
  314. //
  315. // _shenheDataArr = successdic[@"body"];
  316. // [_tableViews[3] reloadData];
  317. // }];
  318. }
  319. - (void)didReceiveMemoryWarning {
  320. [super didReceiveMemoryWarning];
  321. // Dispose of any resources that can be recreated.
  322. }
  323. /*
  324. #pragma mark - Navigation
  325. // In a storyboard-based application, you will often want to do a little preparation before navigation
  326. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  327. // Get the new view controller using [segue destinationViewController].
  328. // Pass the selected object to the new view controller.
  329. }
  330. */
  331. @end