| | |
| | | #import "PBSchedulePlanModel.h" |
| | | #import "PBScheduleHeaderView.h" |
| | | #import "PBNewPersonTableViewCell.h" |
| | | #import "PBNewVehicleTableViewCell.h" |
| | | #import "PBPerPlanModel.h" |
| | | #import "PBSitePerModel.h" |
| | | #import "PBEditTimeView.h" |
| | |
| | | #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; |
| | |
| | | @property (nonatomic, assign) BOOL isAdd; |
| | | @property (nonatomic, strong) AMapLocationManager *locationManager; |
| | | @property (nonatomic, copy) NSString *place; |
| | | @property (nonatomic, copy) NSString *type; |
| | | @end |
| | | |
| | | @implementation PBSitePerViewController |
| | |
| | | } |
| | | |
| | | - (void)setupNav { |
| | | self.title = @"现场人员"; |
| | | self.title = @"填报"; |
| | | PBBackNavItem *backNav = [PBBackNavItem backNacItem]; |
| | | backNav.title = @"返回"; |
| | | [backNav addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside]; |
| | |
| | | // 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]; |
| | |
| | | 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, *)) { |
| | |
| | | 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]; |
| | | |
| | |
| | | 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]; |
| | | |
| | |
| | | } |
| | | }]; |
| | | } |
| | | - (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]; |
| | |
| | | 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]; |
| | | } |
| | | }]; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | - (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{ |
| | |
| | | } |
| | | return _sitePersonArrM; |
| | | } |
| | | - (void)setIsFromLogin:(BOOL)isFromLogin { |
| | | _isFromLogin = isFromLogin; |
| | | } |
| | | |
| | | /* |
| | | #pragma mark - Navigation |