StudentDetail.m 14 KB

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