|
|
@@ -18,6 +18,8 @@
|
|
|
|
|
|
@property(nonatomic,strong)UITableView * tableView;
|
|
|
|
|
|
+@property(nonatomic,strong)NSMutableArray *dataArr;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation OutWorkingSettingViewController
|
|
|
@@ -25,6 +27,7 @@
|
|
|
//增加一个自动打卡的按钮
|
|
|
UISwitch * _switch1;
|
|
|
UISwitch * _switch2;
|
|
|
+ UISwitch * _switch3;//是否开启人脸打卡
|
|
|
|
|
|
UILabel * _remindTime;
|
|
|
UILabel * _legDistance;
|
|
|
@@ -46,6 +49,9 @@
|
|
|
//是否需要审批
|
|
|
NSString *_returnNeedProcess;
|
|
|
|
|
|
+ //是否开启人脸打卡
|
|
|
+ NSString *_returnNeedFace;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
@@ -56,6 +62,13 @@
|
|
|
_returnStatus = @"";
|
|
|
_returnTime = @"";
|
|
|
_returnNeedProcess = @"0";
|
|
|
+ _returnNeedFace = @"0";
|
|
|
+
|
|
|
+ NSArray * ERPtitleArr=@[Localized(@"UU_me_set_outsideWorkSet_autoOutsideWork"),Localized(@"UU_me_set_outsideWorkSet_effectiveDistance"),Localized(@"UU_me_set_outsideWorkSet_reserveTime"),Localized(@"UU_me_set_outsideWorkSet_needApprove")];
|
|
|
+ for (int i = 0; i < ERPtitleArr.count; i++) {
|
|
|
+ [self.dataArr addObject:ERPtitleArr[i]];
|
|
|
+ }
|
|
|
+
|
|
|
//设置UI
|
|
|
[self setNavi];
|
|
|
|
|
|
@@ -89,10 +102,10 @@
|
|
|
NSString *sessionId = [[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
|
|
|
NSString *url;
|
|
|
if (g_B2BUser) {
|
|
|
- url= [NSString stringWithFormat:@"%@mobile/outplan/getOutSet?master=%@&emcode=%@&sessionId=%@&enuu=%@",ipStr,@"(null)",g_emcode,sessionId,g_B2B_enuu];
|
|
|
+ url= [NSString stringWithFormat:@"%@mobile/outplan/getOutSet?master=%@&emcode=%@&sessionId=%@&enuu=%@",g_id,@"(null)",g_emcode,sessionId,g_B2B_enuu];
|
|
|
}else{
|
|
|
|
|
|
- url = [NSString stringWithFormat:@"%@/mobile/getOutSetInfo.action?master=%@&sessionUser=%@&sessionId=%@",ipStr,g_master,g_sessionUser,sessionId];
|
|
|
+ url = [NSString stringWithFormat:@"%@/mobile/getOutSetInfo.action?master=%@&sessionUser=%@&sessionId=%@",g_id,g_master,g_sessionUser,sessionId];
|
|
|
|
|
|
}
|
|
|
DLog(@"拼接的URL是什么呢:%@",url);
|
|
|
@@ -128,6 +141,11 @@
|
|
|
_returnStatus = [NSString stringWithFormat:@"%@",obj[@"MO_AUTOSIGN"]];
|
|
|
_returnTime = [NSString stringWithFormat:@"%@",obj[@"MO_TIME"]];
|
|
|
_returnNeedProcess = FORMAT(@"%@",obj[@"MO_NEEDPROCESS"]);
|
|
|
+
|
|
|
+ if ([[obj allKeys] containsObject:@"MO_FACESIGN"]) {
|
|
|
+ _returnNeedFace = FORMAT(@"%@",obj[@"MO_FACESIGN"]);
|
|
|
+ [self.dataArr addObject:@"人脸打卡"];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
DLog(@"获取的服务器的数据分别是:%@%@",_returnDistance,_returnTime);
|
|
|
@@ -242,7 +260,7 @@
|
|
|
NSDictionary * dic;
|
|
|
if (g_B2BUser) {
|
|
|
dic = @{
|
|
|
-// @"mo_autosign":_YNAutoSign,
|
|
|
+ // @"mo_autosign":_YNAutoSign,
|
|
|
@"mo_distance":[_legDistance.text substringToIndex:_legDistance.text.length-1],
|
|
|
@"mo_time":[_preTime.text substringToIndex:_preTime.text.length-2],
|
|
|
@"enuu":g_B2B_enuu,
|
|
|
@@ -255,69 +273,78 @@
|
|
|
@"mo_time":[_preTime.text substringToIndex:_preTime.text.length-2],
|
|
|
@"mo_needprocess":_returnNeedProcess,
|
|
|
};
|
|
|
+ if (self.dataArr.count > 4) {
|
|
|
+ dic = @{
|
|
|
+ @"mo_autosign":_YNAutoSign,
|
|
|
+ @"mo_distance":[_legDistance.text substringToIndex:_legDistance.text.length-1],
|
|
|
+ @"mo_time":[_preTime.text substringToIndex:_preTime.text.length-2],
|
|
|
+ @"mo_needprocess":_returnNeedProcess,
|
|
|
+ @"mo_facesign":_returnNeedFace,
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:nil];
|
|
|
- NSString *str=[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
- NSString * url;
|
|
|
- if (g_B2BUser) {
|
|
|
- url = [NSString stringWithFormat:@"%@mobile/outplan/saveOutSet?caller=OUTSET&formStore=%@&emcode=%@&enuu=%@&sessionId=%@",ipStr,str,g_emcode,g_B2B_enuu,sessionId];
|
|
|
- }else{
|
|
|
-
|
|
|
- url = [NSString stringWithFormat:@"%@/mobile/addOutSet.action?caller=OUTSET&formStore=%@&master=%@&sessionUser=%@&sessionId=%@",ipStr,str,g_master,g_sessionUser,sessionId];
|
|
|
- }
|
|
|
- DLog(@"保存的url是:%@",url);
|
|
|
+ NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:nil];
|
|
|
+ NSString *str=[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
+ NSString * url;
|
|
|
+ if (g_B2BUser) {
|
|
|
+ url = [NSString stringWithFormat:@"%@mobile/outplan/saveOutSet?caller=OUTSET&formStore=%@&emcode=%@&enuu=%@&sessionId=%@",ipStr,str,g_emcode,g_B2B_enuu,sessionId];
|
|
|
+ }else{
|
|
|
|
|
|
- url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
+ url = [NSString stringWithFormat:@"%@/mobile/addOutSet.action?caller=OUTSET&formStore=%@&master=%@&sessionUser=%@&sessionId=%@",ipStr,str,g_master,g_sessionUser,sessionId];
|
|
|
+ }
|
|
|
+ DLog(@"保存的url是:%@",url);
|
|
|
+
|
|
|
+ url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
+
|
|
|
+ UASNetworkManager *mannage = [UASNetworkManager shareManager]; //拼接sessionID
|
|
|
+ NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
|
|
|
+ //设置cookie
|
|
|
+ if (g_ERPUser) {
|
|
|
+ [mannage.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
|
|
|
+ [mannage.requestSerializer setValue:[NSString stringWithFormat:@"%@",g_sessionUser] forHTTPHeaderField:@"sessionUser"];
|
|
|
|
|
|
- UASNetworkManager *mannage = [UASNetworkManager shareManager]; //拼接sessionID
|
|
|
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
|
|
|
- //设置cookie
|
|
|
+ }
|
|
|
+ mannage.responseSerializer = [AFJSONResponseSerializer serializer];
|
|
|
+ [mannage request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
if (g_ERPUser) {
|
|
|
- [mannage.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
|
|
|
- [mannage.requestSerializer setValue:[NSString stringWithFormat:@"%@",g_sessionUser] forHTTPHeaderField:@"sessionUser"];
|
|
|
-
|
|
|
- }
|
|
|
- mannage.responseSerializer = [AFJSONResponseSerializer serializer];
|
|
|
- [mannage request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
- if (g_ERPUser) {
|
|
|
- if (_switch1.isOn == NO) {
|
|
|
- [self.navigationController popViewControllerAnimated:YES];
|
|
|
-
|
|
|
- }
|
|
|
- else{
|
|
|
- [self.navigationController popViewControllerAnimated:YES];
|
|
|
- }
|
|
|
- }
|
|
|
- else{
|
|
|
-
|
|
|
+ if (_switch1.isOn == NO) {
|
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
|
- }
|
|
|
-
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:@"kaiqizidongwaiqing" object:nil];
|
|
|
-
|
|
|
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
- DLog(@"返回的错误是什么呢:%@",error);
|
|
|
- NSData *returnData = [[error userInfo] objectForKey:@"com.alamofire.serialization.response.error.data"];
|
|
|
- if (returnData)
|
|
|
- {
|
|
|
- NSDictionary *content = [NSJSONSerialization JSONObjectWithData:returnData options:NSJSONReadingMutableContainers error:nil];//转换数据格式
|
|
|
-
|
|
|
- NSString *errorStr = [NSString stringWithFormat:@"%@",[content objectForKey:@"exceptionInfo"]];
|
|
|
- DLog(@"错误信息是:%@",errorStr);
|
|
|
-
|
|
|
- [JOShowMessageFromNavi showDropViewWithMessage:errorStr ToNavi:self.navigationController withColor:nil];
|
|
|
- [MBProgressHUD showError:@"设置失败"];
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
-
|
|
|
- [MBProgressHUD showError:@"网络错误"];
|
|
|
-
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
}
|
|
|
+ }
|
|
|
+ else{
|
|
|
+
|
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
|
-
|
|
|
- }];
|
|
|
+ }
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"kaiqizidongwaiqing" object:nil];
|
|
|
+
|
|
|
+ } failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
+ DLog(@"返回的错误是什么呢:%@",error);
|
|
|
+ NSData *returnData = [[error userInfo] objectForKey:@"com.alamofire.serialization.response.error.data"];
|
|
|
+ if (returnData)
|
|
|
+ {
|
|
|
+ NSDictionary *content = [NSJSONSerialization JSONObjectWithData:returnData options:NSJSONReadingMutableContainers error:nil];//转换数据格式
|
|
|
+
|
|
|
+ NSString *errorStr = [NSString stringWithFormat:@"%@",[content objectForKey:@"exceptionInfo"]];
|
|
|
+ DLog(@"错误信息是:%@",errorStr);
|
|
|
+
|
|
|
+ [JOShowMessageFromNavi showDropViewWithMessage:errorStr ToNavi:self.navigationController withColor:nil];
|
|
|
+ [MBProgressHUD showError:@"设置失败"];
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+
|
|
|
+ [MBProgressHUD showError:@"网络错误"];
|
|
|
+
|
|
|
+ }
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+
|
|
|
+ }];
|
|
|
}
|
|
|
|
|
|
/**判断是否管理员*/
|
|
|
@@ -346,13 +373,14 @@
|
|
|
_btn2.userInteractionEnabled = YES;
|
|
|
_btn3.userInteractionEnabled = YES;
|
|
|
_switch1.enabled = YES;
|
|
|
- _switch2.enabled=YES;
|
|
|
-
|
|
|
+ _switch2.enabled = YES;
|
|
|
+ _switch3.enabled = YES;
|
|
|
}else{
|
|
|
_btn2.userInteractionEnabled = NO;
|
|
|
_btn3.userInteractionEnabled = NO;
|
|
|
_switch1.enabled = NO;
|
|
|
- _switch2.enabled=NO;
|
|
|
+ _switch2.enabled = NO;
|
|
|
+ _switch3.enabled = NO;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -399,6 +427,10 @@
|
|
|
// _switch2.transform = CGAffineTransformMakeScale(0.8, 0.75);
|
|
|
[_switch2 addTarget:self action:@selector(swicthOn2:) forControlEvents:UIControlEventValueChanged];
|
|
|
// _switch1.enabled = NO;
|
|
|
+ _switch3 = [[UISwitch alloc]initWithFrame:CGRectMake(self_width-60,6.5, 30, 10)];
|
|
|
+ // _switch1.transform = CGAffineTransformMakeScale(0.8, 0.75);
|
|
|
+ [_switch3 addTarget:self action:@selector(swicthOn3:) forControlEvents:UIControlEventValueChanged];
|
|
|
+
|
|
|
|
|
|
_preTime =[[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-150, 0, 120, 45)];
|
|
|
_preTime.textAlignment = NSTextAlignmentRight;
|
|
|
@@ -501,6 +533,17 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+-(void)swicthOn3:(id)sender
|
|
|
+{
|
|
|
+ if (_switch3.isOn == YES)
|
|
|
+ {
|
|
|
+ _returnNeedFace = @"1";
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _returnNeedFace = @"0";
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//点击选择时间按钮
|
|
|
- (void)getSelectTime:(UIButton *)btn
|
|
|
{
|
|
|
@@ -540,12 +583,12 @@
|
|
|
UITableViewCell * cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:ID];
|
|
|
cell.selectionStyle=UITableViewCellSelectionStyleNone;
|
|
|
|
|
|
- NSArray * ERPtitleArr=@[Localized(@"UU_me_set_outsideWorkSet_autoOutsideWork"),Localized(@"UU_me_set_outsideWorkSet_effectiveDistance"),Localized(@"UU_me_set_outsideWorkSet_reserveTime"),Localized(@"UU_me_set_outsideWorkSet_needApprove")];
|
|
|
+
|
|
|
NSUserDefaults * user=[NSUserDefaults standardUserDefaults];
|
|
|
NSString * yeorno=[user objectForKey:ZIDONG_WAIQING];
|
|
|
if (indexPath.row==0) {
|
|
|
UILabel * signLable = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 150, 45)];
|
|
|
- signLable.text = ERPtitleArr[indexPath.row];
|
|
|
+ signLable.text = self.dataArr[indexPath.row];
|
|
|
signLable.font =FONT_SIZE(14);
|
|
|
[cell.contentView addSubview:signLable];
|
|
|
|
|
|
@@ -583,7 +626,7 @@
|
|
|
else if (indexPath.row==1)
|
|
|
{
|
|
|
UILabel * propertyDis = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 150, 45)];
|
|
|
- propertyDis.text =[NSString stringWithFormat:@"%@",ERPtitleArr[indexPath.row]];
|
|
|
+ propertyDis.text =[NSString stringWithFormat:@"%@",self.dataArr[indexPath.row]];
|
|
|
propertyDis.font = FONT_SIZE(14);
|
|
|
[cell.contentView addSubview:propertyDis];
|
|
|
if (_returnDistance.length!=0) {
|
|
|
@@ -610,7 +653,7 @@
|
|
|
else if (indexPath.row==2)
|
|
|
{
|
|
|
UILabel * yuliushjian = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 150, 45)];
|
|
|
- yuliushjian.text = ERPtitleArr[indexPath.row];
|
|
|
+ yuliushjian.text = self.dataArr[indexPath.row];
|
|
|
yuliushjian.font = FONT_SIZE(14);
|
|
|
[cell.contentView addSubview:yuliushjian];
|
|
|
if (_returnTime.length!=0) {
|
|
|
@@ -636,8 +679,8 @@
|
|
|
}else if (indexPath.row == 3)
|
|
|
{
|
|
|
UILabel * signLable = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 150, 45)];
|
|
|
- signLable.text = ERPtitleArr[indexPath.row];
|
|
|
- signLable.font =FONT_SIZE(14);
|
|
|
+ signLable.text = self.dataArr[indexPath.row];
|
|
|
+ signLable.font = FONT_SIZE(14);
|
|
|
[cell.contentView addSubview:signLable];
|
|
|
|
|
|
[cell.contentView addSubview:_switch2];
|
|
|
@@ -651,18 +694,34 @@
|
|
|
|
|
|
[_switch2 setOn:NO];
|
|
|
}
|
|
|
+ }else if (indexPath.row == 4)
|
|
|
+ {
|
|
|
+ UILabel * faceLable = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 150, 45)];
|
|
|
+ faceLable.text = self.dataArr[indexPath.row];
|
|
|
+ faceLable.font = FONT_SIZE(14);
|
|
|
+ [cell.contentView addSubview:faceLable];
|
|
|
+
|
|
|
+ [cell.contentView addSubview:_switch3];
|
|
|
+
|
|
|
+
|
|
|
+ if ([_returnNeedFace isEqualToString:@"1"]) {
|
|
|
+
|
|
|
+ [_switch3 setOn:YES];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ [_switch3 setOn:NO];
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
if (g_B2BUser&&indexPath.row==0) {
|
|
|
|
|
|
cell.hidden = YES;
|
|
|
_tableView.frame = CGRectMake(0, -45, SCREEN_WIDTH, SCREEN_HEIGHT+45);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
return cell;
|
|
|
}
|
|
|
|
|
|
@@ -673,7 +732,7 @@
|
|
|
}
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
|
|
{
|
|
|
- return 4;
|
|
|
+ return self.dataArr.count;
|
|
|
}
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
{
|
|
|
@@ -693,4 +752,13 @@
|
|
|
[tableView setTableFooterView:view];
|
|
|
}
|
|
|
|
|
|
+#pragma mark --- lazy
|
|
|
+-(NSMutableArray *)dataArr
|
|
|
+{
|
|
|
+ if (!_dataArr) {
|
|
|
+ _dataArr = [NSMutableArray new];
|
|
|
+ }
|
|
|
+ return _dataArr;
|
|
|
+}
|
|
|
+
|
|
|
@end
|