From abac8765bf6a1f400c2377b9999ce7495ba34a3f Mon Sep 17 00:00:00 2001 From: zjf <zhangjf@probim.com.cn> Date: Fri, 10 Mar 2023 18:05:41 +0800 Subject: [PATCH] 人员、车辆 进出场 --- IphoneBIMe/IphoneBIMe/Classes/Project/Schedule/ViewControllers/PBSitePerViewController.m | 113 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 90 insertions(+), 23 deletions(-) diff --git a/IphoneBIMe/IphoneBIMe/Classes/Project/Schedule/ViewControllers/PBSitePerViewController.m b/IphoneBIMe/IphoneBIMe/Classes/Project/Schedule/ViewControllers/PBSitePerViewController.m index 8b19e69..4e99031 100644 --- a/IphoneBIMe/IphoneBIMe/Classes/Project/Schedule/ViewControllers/PBSitePerViewController.m +++ b/IphoneBIMe/IphoneBIMe/Classes/Project/Schedule/ViewControllers/PBSitePerViewController.m @@ -11,6 +11,7 @@ #import "PBSchedulePlanModel.h" #import "PBScheduleHeaderView.h" #import "PBNewPersonTableViewCell.h" +#import "PBNewVehicleTableViewCell.h" #import "PBPerPlanModel.h" #import "PBSitePerModel.h" #import "PBEditTimeView.h" @@ -21,6 +22,7 @@ #import <AMapLocationKit/AMapLocationKit.h> static NSString *const CellID = @"CellID"; +static NSString *const VCellID = @"VCellID"; @interface PBSitePerViewController ()<UITableViewDataSource, UITableViewDelegate, AMapLocationManagerDelegate> @property (nonatomic, strong) NSArray *dataList; @property (nonatomic, strong) NSArray *typeDataList; @@ -35,6 +37,7 @@ @property (nonatomic, assign) BOOL isAdd; @property (nonatomic, strong) AMapLocationManager *locationManager; @property (nonatomic, copy) NSString *place; +@property (nonatomic, copy) NSString *type; @end @implementation PBSitePerViewController @@ -57,7 +60,7 @@ } - (void)setupNav { - self.title = @"现场人员"; + self.title = @"填报"; PBBackNavItem *backNav = [PBBackNavItem backNacItem]; backNav.title = @"返回"; [backNav addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside]; @@ -68,7 +71,11 @@ // self.navigationItem.rightBarButtonItem = saveNavItem; } - (void)backItemAction { - [self.navigationController popViewControllerAnimated:YES]; + if (self.isFromLogin) { + [self dismissViewControllerAnimated:YES completion:nil]; + } else { + [self.navigationController popViewControllerAnimated:YES]; + } } //- (void)saveAction{ // [YJProgressHUD showProgress:@"正在保存..." inView:self.view]; @@ -188,6 +195,7 @@ self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.estimatedRowHeight = 100.f; [self.tableView registerClass:[PBNewPersonTableViewCell class] forCellReuseIdentifier:CellID]; + [self.tableView registerClass:[PBNewVehicleTableViewCell class] forCellReuseIdentifier:VCellID]; [self.view addSubview:self.tableView]; if (@available(iOS 15.0, *)) { @@ -265,7 +273,15 @@ NSLog(@"第一次授权成功"); QQQRCodeVC *VC = [[QQQRCodeVC alloc] init]; VC.getPersonBlock = ^(NSString * _Nonnull personId) { - [self getFillUserInfoWithID:personId]; + NSArray *array = [personId componentsSeparatedByString:@"&"]; + if (array.count == 2) { + self.type = array[1]; + if ([self.type isEqualToString:@"0"]) {// 人员 + [self getFillUserInfoWithID:array[0]]; + }else {// 车辆 + [self getFillCarInfoWithID:array[0]]; + } + } }; [self.navigationController pushViewController:VC animated:YES]; @@ -277,7 +293,15 @@ NSLog(@"SGPermissionStatusAuthorized"); QQQRCodeVC *VC = [[QQQRCodeVC alloc] init]; VC.getPersonBlock = ^(NSString * _Nonnull personId) { - [self getFillUserInfoWithID:personId]; + NSArray *array = [personId componentsSeparatedByString:@"&"]; + if (array.count == 2) { + self.type = array[1]; + if ([self.type isEqualToString:@"0"]) {// 人员 + [self getFillUserInfoWithID:array[0]]; + }else {// 车辆 + [self getFillCarInfoWithID:array[0]]; + } + } }; [self.navigationController pushViewController:VC animated:YES]; @@ -330,6 +354,23 @@ } }]; } +- (void)getFillCarInfoWithID:(NSString *)guid { + [[PBNetworkTools sharedTools] GetCarInfoWithID:guid andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) { + if (error) { + NSLog(@"%@",error); + [YJProgressHUD showMessage:@"加载失败" inView:self.view]; + return; + } + NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; + PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str]; + if (networkModel.Ret == 1) { + self.dataList = @[networkModel.Data]; + [self.tableView reloadData]; + }else { + [YJProgressHUD showMessage:networkModel.Msg inView:self.view]; + } + }]; +} - (void)getPositioning { [YJProgressHUD showProgress:@"" inView:self.view]; [AMapLocationManager updatePrivacyShow:(AMapPrivacyShowStatusDidShow) privacyInfo:AMapPrivacyInfoStatusDidContain]; @@ -366,21 +407,37 @@ NSInteger type = btn.tag - 90; NSDictionary *dict = self.dataList[0]; [YJProgressHUD showProgress:@"" inView:self.view]; - [[PBNetworkTools sharedTools] aEntryOrExitWithOrganizeId:self.projectModel.organizeid andFillingUserId:[dict valueForKey:@"Id"] andProgressParentId:@"" andProgressTreeId:@"" andProgressProjectId:@"" andAddress:self.place andType:type andCallBack:^(NSURLResponse *response, id responseObject, NSError *error) { - if (error) { - NSLog(@"%@",error); - [YJProgressHUD showMessage:@"操作失败" inView:self.view]; - return; - } - NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; - PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str]; - if (networkModel.Ret == 1) { - [YJProgressHUD showSuccess:@"操作成功" inview:self.view]; - }else { - [YJProgressHUD showMessage:networkModel.Msg inView:self.view]; - } - }]; - + if ([self.type isEqualToString:@"0"]) { + [[PBNetworkTools sharedTools] aEntryOrExitWithOrganizeId:self.projectModel.organizeid andFillingUserId:[dict valueForKey:@"Id"] andProgressParentId:@"" andProgressTreeId:@"" andProgressProjectId:@"" andAddress:self.place andType:type andCallBack:^(NSURLResponse *response, id responseObject, NSError *error) { + if (error) { + NSLog(@"%@",error); + [YJProgressHUD showMessage:@"操作失败" inView:self.view]; + return; + } + NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; + PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str]; + if (networkModel.Ret == 1) { + [YJProgressHUD showSuccess:@"操作成功" inview:self.view]; + }else { + [YJProgressHUD showMessage:networkModel.Msg inView:self.view]; + } + }]; + }else { + [[PBNetworkTools sharedTools] CarEntryOrExitWithOrganizeId:self.projectModel.organizeid andFillingId:[dict valueForKey:@"Id"] andProgressParentId:@"" andProgressTreeId:@"" andProgressProjectId:@"" andAddress:self.place andType:type andCallBack:^(NSURLResponse *response, id responseObject, NSError *error) { + if (error) { + NSLog(@"%@",error); + [YJProgressHUD showMessage:@"操作失败" inView:self.view]; + return; + } + NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; + PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str]; + if (networkModel.Ret == 1) { + [YJProgressHUD showSuccess:@"操作成功" inview:self.view]; + }else { + [YJProgressHUD showMessage:networkModel.Msg inView:self.view]; + } + }]; + } } @@ -391,10 +448,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *item = self.dataList[indexPath.row]; - PBNewPersonTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID forIndexPath:indexPath]; - cell.dict = item; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - return cell; + if ([self.type isEqualToString:@"0"]) { + PBNewPersonTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID forIndexPath:indexPath]; + cell.dict = item; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + }else { + PBNewVehicleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:VCellID forIndexPath:indexPath]; + cell.dict = item; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; + } } - (void)setSchedulePlanModel:(PBSchedulePlanModel *)schedulePlanModel{ @@ -440,6 +504,9 @@ } return _sitePersonArrM; } +- (void)setIsFromLogin:(BOOL)isFromLogin { + _isFromLogin = isFromLogin; +} /* #pragma mark - Navigation -- Gitblit v1.9.3