|
|
@@ -0,0 +1,512 @@
|
|
|
+//
|
|
|
+// ZeTianSignDetailVC.m
|
|
|
+// shiku_im
|
|
|
+//
|
|
|
+// Created by huangyp-pc on 2019/4/10.
|
|
|
+//
|
|
|
+
|
|
|
+#import "ZeTianSignDetailVC.h"
|
|
|
+#import "EmployeeModel.h"
|
|
|
+#import "PopSignatureView.h"
|
|
|
+
|
|
|
+@interface ZeTianSignDetailVC ()<UIScrollViewDelegate,PopSignatureViewDelegate>
|
|
|
+@property (nonatomic,strong) UIScrollView *scrollV;
|
|
|
+@property (strong , nonatomic) NSMutableArray *letterOfName;
|
|
|
+@property (strong , nonatomic) NSMutableArray *fd_dataArr;
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation ZeTianSignDetailVC
|
|
|
+{
|
|
|
+ MBProgressHUD *HUD;
|
|
|
+ UIView *_firstView;
|
|
|
+ UIView *_secondView;
|
|
|
+ int _height;
|
|
|
+
|
|
|
+ NSMutableArray *_formconfigs; //第一模块属性的数组
|
|
|
+ NSMutableArray *_formdata; //第一模块全部数据的数组
|
|
|
+
|
|
|
+ NSMutableArray *_dataArr; //tableview的数组(审批流)
|
|
|
+
|
|
|
+ UIButton *_upLoadAgain; //重新提交按钮
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)viewDidLoad {
|
|
|
+ [super viewDidLoad];
|
|
|
+ self.title = @"详情";
|
|
|
+ self.view.backgroundColor = BGKJ_COLOR;
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 创建UI
|
|
|
+-(void)createUI
|
|
|
+{
|
|
|
+ NSString * companyName=[[[NSUserDefaults standardUserDefaults] objectForKey:@"masterDic"]objectForKey:@"ma_function"];
|
|
|
+ companyName=[companyName stringByReplacingOccurrencesOfString:@"(" withString:@""];
|
|
|
+ companyName=[companyName stringByReplacingOccurrencesOfString:@")" withString:@""];
|
|
|
+
|
|
|
+ _scrollV = [[UIScrollView alloc]init];
|
|
|
+ _scrollV.showsHorizontalScrollIndicator = NO;
|
|
|
+ _scrollV.showsVerticalScrollIndicator = NO;
|
|
|
+ _scrollV.scrollsToTop = YES;
|
|
|
+ _scrollV.backgroundColor = BGKJ_COLOR;
|
|
|
+ [self.view addSubview:_scrollV];
|
|
|
+
|
|
|
+ [_scrollV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.top.right.equalTo(self.view);
|
|
|
+ make.bottom.equalTo(self.view).offset(-60);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _upLoadAgain = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [_upLoadAgain setTitle:@"签名" forState:UIControlStateNormal];
|
|
|
+ _upLoadAgain.layer.cornerRadius = 5;
|
|
|
+ _upLoadAgain.layer.masksToBounds = YES;
|
|
|
+ [_upLoadAgain setBackgroundColor:HexColor(@"#33A2EE") forState:UIControlStateNormal];
|
|
|
+ [_upLoadAgain setBackgroundColor:HexColor(@"#2D84C0") forState:UIControlStateHighlighted];
|
|
|
+ [_upLoadAgain setTitleColor:HexColor(@"#FFFFFF") forState:UIControlStateNormal];
|
|
|
+ _upLoadAgain.titleLabel.font = FONT_SIZE(15);
|
|
|
+ [_upLoadAgain addTarget:self action:@selector(submitAction) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.view addSubview:_upLoadAgain];
|
|
|
+
|
|
|
+ [_upLoadAgain mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.equalTo(self.view).offset(20);
|
|
|
+ make.right.equalTo(self.view).offset(-20);
|
|
|
+ make.bottom.equalTo(self.view.mas_bottom).offset(-10);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ }];
|
|
|
+
|
|
|
+ @weakify(self)
|
|
|
+ [self selectTableNameWithtableName:companyName completed:^(NSArray *array) {
|
|
|
+ @strongify(self)
|
|
|
+ _letterOfName = [[NSMutableArray alloc]initWithArray:array];
|
|
|
+
|
|
|
+ _height = 0;
|
|
|
+ _formconfigs = [[NSMutableArray alloc]init];
|
|
|
+ _formdata = [[NSMutableArray alloc]init];
|
|
|
+ _dataArr = [[NSMutableArray alloc]init];
|
|
|
+
|
|
|
+ [self buildFirstView];
|
|
|
+ [self getDataFromServerWithCaller];
|
|
|
+
|
|
|
+ if ((companyName==nil || [companyName isEqualToString:@""]) && self.serverId == nil)
|
|
|
+ {
|
|
|
+ [JOShowMessageFromNavi showDropViewWithMessage:@"ERP未登录" ToNavi:self.navigationController withColor:nil];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 提交签名
|
|
|
+-(void)submitAction
|
|
|
+{
|
|
|
+ PopSignatureView *socialSingnatureView = [[PopSignatureView alloc] initWithFrame:self.view.bounds];
|
|
|
+ socialSingnatureView.delegate = self;
|
|
|
+ [socialSingnatureView show];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- popSignview的代理方法
|
|
|
+- (void)onSubmitBtn:(UIImage*)signatureImg{
|
|
|
+
|
|
|
+ [self commitConfirmEnterPriseWageImage:signatureImg];
|
|
|
+}
|
|
|
+
|
|
|
+-(void)commitConfirmEnterPriseWageImage:(UIImage *)signatureImg{
|
|
|
+ NSDictionary * dic = @{
|
|
|
+ @"pi_id":self.dan_id,
|
|
|
+ @"emcode":g_emcode,
|
|
|
+ @"result":@"true",
|
|
|
+ @"master":g_master,
|
|
|
+ };
|
|
|
+
|
|
|
+ [[UASNetworkManager shareManager] request:FORMAT(@"%@mobile/scm/signProdInOutSale.action",g_id) method:POST parameters:dic constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
|
|
|
+ if (signatureImg) {
|
|
|
+ NSData *data = UIImageJPEGRepresentation(signatureImg,0.8);
|
|
|
+ [formData appendPartWithFileData:data name:@"img" fileName:@"file.jpg" mimeType:@"image/jpeg"];
|
|
|
+ }
|
|
|
+ } progress:nil
|
|
|
+ success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
+ SLog(@"成功上传附件");
|
|
|
+ [JOShowMessageFromNavi showDropViewWithMessage:@"签名成功" ToNavi:self.navigationController withColor:nil];
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+ } failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
+ SLog(@"失败上传附件");
|
|
|
+ [JOShowMessageFromNavi showDropViewWithMessage:@"签名失败" ToNavi:self.navigationController withColor:nil];
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 网络获取数据
|
|
|
+-(void)getDataFromServerWithCaller
|
|
|
+{
|
|
|
+ [_formdata removeAllObjects];
|
|
|
+ [_formconfigs removeAllObjects];
|
|
|
+
|
|
|
+ NSString *ip = [[NSUserDefaults standardUserDefaults] objectForKey:@"ipAndPort"];
|
|
|
+ NSString *sessionId = [[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
|
|
|
+
|
|
|
+ NSString *url = [NSString stringWithFormat:@"%@mobile/common/getformandgriddata.action?caller=%@&id=%@&sessionId=%@",ip,_caller,_dan_id,sessionId];
|
|
|
+ //21655,Ask4Leave
|
|
|
+ UASNetworkManager *manager = [UASNetworkManager shareManager];
|
|
|
+ manager.requestSerializer = [AFHTTPRequestSerializer serializer];
|
|
|
+ manager.responseSerializer = [AFJSONResponseSerializer serializer];
|
|
|
+ NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
|
|
|
+ //设置cookie
|
|
|
+ [manager.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
|
|
|
+ [manager.requestSerializer setValue:[NSString stringWithFormat:@"%@",g_sessionUser] forHTTPHeaderField:@"sessionUser"];
|
|
|
+ if (self.serverId.length > 0 && self.serverId != nil) {
|
|
|
+
|
|
|
+ url = [NSString stringWithFormat:@"%@api/serve/config.action?serve_id=%@&id=%@&sessionId=%@",ccIp,self.serverId,_dan_id,sessionId];
|
|
|
+ NSString *session = [[NSUserDefaults standardUserDefaults] stringForKey:b2bSession];
|
|
|
+ NSString *sessionId=[@"" stringByAppendingFormat:@"%@",session];
|
|
|
+ //设置cookie
|
|
|
+ [manager.requestSerializer setValue:sessionId forHTTPHeaderField:@"Cookie"];
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
+
|
|
|
+
|
|
|
+ //拼接sessionID
|
|
|
+
|
|
|
+ [manager request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
+ NSString *fb_attachName;
|
|
|
+ SLog(@"adfssadvfad:%@",responseObject);
|
|
|
+
|
|
|
+ responseObject = [NSDictionary changeType:responseObject];
|
|
|
+
|
|
|
+ NSArray *arr = responseObject[@"datas"][@"formdata"];
|
|
|
+ //主表的属性数组
|
|
|
+ NSMutableArray *formconfigsArr = [[NSMutableArray alloc]init];
|
|
|
+ for (id obj in responseObject[@"datas"][@"formconfigs"]) {
|
|
|
+
|
|
|
+ if ([[obj objectForKey:@"FD_CAPTION"] isEqualToString:@"附件"]) {
|
|
|
+ fb_attachName=[obj objectForKey:@"FD_FIELD"];
|
|
|
+ }
|
|
|
+ NSString *isDefault = [NSString stringWithFormat:@"%@",obj[@"MFD_ISDEFAULT"]];
|
|
|
+ if ([isDefault isEqualToString:@"-1"]) {
|
|
|
+ [formconfigsArr addObject:obj];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [_formconfigs addObject:formconfigsArr];
|
|
|
+
|
|
|
+ //从表的属性数组
|
|
|
+ NSMutableArray *gridconfigsArr = [[NSMutableArray alloc]init];
|
|
|
+ for (id obj in responseObject[@"datas"][@"gridconfigs"]) {
|
|
|
+ NSString *isDefault = [NSString stringWithFormat:@"%@",obj[@"MDG_ISDEFAULT"]];
|
|
|
+ if ([isDefault isEqualToString:@"-1"]) {
|
|
|
+ [gridconfigsArr addObject:obj];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //主表的值数组
|
|
|
+ for (id obj in responseObject[@"datas"][@"formdata"]) {
|
|
|
+ [_formdata addObject:obj];
|
|
|
+ }
|
|
|
+ //从表的值数组
|
|
|
+ for (id obj in responseObject[@"datas"][@"griddata"]) {
|
|
|
+ [_formdata addObject:obj];
|
|
|
+ if (gridconfigsArr.count != 0) {
|
|
|
+ [_formconfigs addObject:gridconfigsArr];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ _formdata = [NSDictionary changeType:_formdata];
|
|
|
+ _formconfigs = [NSDictionary changeType:_formconfigs];
|
|
|
+ DLog(@"总的值数组:%@",_formdata);
|
|
|
+ DLog(@"总的属性数组:%@",_formconfigs);
|
|
|
+ NSString *fb_attach;
|
|
|
+ if (arr.count != 0) {
|
|
|
+
|
|
|
+ NSDictionary *dic =[NSDictionary changeType:responseObject[@"datas"][@"formdata"][0]];
|
|
|
+
|
|
|
+ fb_attach = dic[fb_attachName];
|
|
|
+
|
|
|
+ }else{
|
|
|
+ fb_attach = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ [HUD hide:YES];
|
|
|
+ if (_formdata.count != 0) {
|
|
|
+ [self changeShowDataUI];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
+ DLog(@"请求失败:%@",error);
|
|
|
+ [HUD hide:YES];
|
|
|
+ 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];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [JOShowMessageFromNavi showDropViewWithMessage:@"请检查网络情况" ToNavi:self.navigationController withColor:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 改变页面结构
|
|
|
+-(void)changeShowDataUI
|
|
|
+{
|
|
|
+ for (int i = 0; i<_formconfigs.count; i++) {
|
|
|
+
|
|
|
+ if (i == 0) {
|
|
|
+ NSArray *a = _formconfigs[i];
|
|
|
+ NSDictionary *b = _formdata[i];
|
|
|
+ for (int j = 0; j < a.count; j++) {
|
|
|
+ NSDictionary *c = a[j];
|
|
|
+
|
|
|
+ NSString *upStr = [c objectForKey:@"FD_FIELD"];
|
|
|
+ NSString *str11;
|
|
|
+ if ([FORMAT(@"%@",[c objectForKey:@"FD_CAPTION"]) isEqualToString:@"报销总额"]) {
|
|
|
+ str11 =[NSString getkCFNumberFormatterCurrencyStyle:[NSString stringWithFormat:@"%.2f",[[b objectForKey:upStr] doubleValue]]] ;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ str11 = [NSString stringWithFormat:@"%@",[b objectForKey:upStr]];
|
|
|
+ }
|
|
|
+ UILabel *rightLbl = [self creatRightLabelWithHeight:j text:str11];
|
|
|
+ [_firstView addSubview:rightLbl];
|
|
|
+
|
|
|
+ /*泽天-出货单判断签名按钮是否显示*/
|
|
|
+ if ([upStr isEqualToString:@"pi_signstatus"]) {
|
|
|
+ NSString *str = [NSString stringWithFormat:@"%@",[b objectForKey:upStr]];
|
|
|
+ if ([str isEqualToString:@"已签名"]) {
|
|
|
+ _upLoadAgain.hidden = YES;
|
|
|
+ [_scrollV mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.equalTo(self.view);
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CGSize size = [self getSizeWithText:[NSString stringWithFormat:@"%@",str11]];
|
|
|
+
|
|
|
+ CGSize size1 = [self getleftWithText:[c objectForKey:@"FD_CAPTION"]];
|
|
|
+
|
|
|
+ UILabel *letfLbl = [self creatLeftLabelWithHeight:j text:[c objectForKey:@"FD_CAPTION"] withHeight:size.height+5];
|
|
|
+
|
|
|
+ [_firstView addSubview:letfLbl];
|
|
|
+
|
|
|
+ if (size.height < size1.height) {
|
|
|
+ letfLbl.height = size1.height;
|
|
|
+ _height += size1.height+5;
|
|
|
+ }else{
|
|
|
+ _height += size.height+5;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ UIImageView *line = [[UIImageView alloc]initWithFrame:CGRectMake(5, _height, SCREEN_WIDTH-5, 0.5)];
|
|
|
+ line.backgroundColor = [[UIColor lightGrayColor]colorWithAlphaComponent:0.3];
|
|
|
+ [_firstView addSubview:line];
|
|
|
+
|
|
|
+ UILabel *title = [self creatDetailLabelWithText:[NSString stringWithFormat:@"明细%d",i]];
|
|
|
+ [_firstView addSubview:title];
|
|
|
+ _height += 30;
|
|
|
+
|
|
|
+ NSArray *a = _formconfigs[i];
|
|
|
+
|
|
|
+ NSDictionary *b = @{};
|
|
|
+
|
|
|
+ if (_formdata.count > i) {
|
|
|
+
|
|
|
+ b = _formdata[i];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int j = 0; j < a.count; j++) {
|
|
|
+ NSDictionary *c = a[j];
|
|
|
+
|
|
|
+ NSString *upStr = [c objectForKey:@"DG_FIELD"];
|
|
|
+ NSString *str;
|
|
|
+ str = [b objectForKey:upStr];
|
|
|
+ upStr = [upStr uppercaseString];
|
|
|
+ UILabel *rightLbl = [self creatRightLabelWithHeight:j text:str];
|
|
|
+ [_firstView addSubview:rightLbl];
|
|
|
+
|
|
|
+ CGSize size = [self getSizeWithText:[NSString stringWithFormat:@"%@",str]];
|
|
|
+ SLog(@"这是什么东:%f -- %@",size.height,str);
|
|
|
+ CGSize size1 = [self getleftWithText:[c objectForKey:@"DG_CAPTION"]];
|
|
|
+ UILabel *letfLbl = [self creatLeftLabelWithHeight:j text:[c objectForKey:@"DG_CAPTION"] withHeight:size.height+5];
|
|
|
+
|
|
|
+ [_firstView addSubview:letfLbl];
|
|
|
+ if (size.height < size1.height) {
|
|
|
+ letfLbl.height = size1.height;
|
|
|
+ _height += size1.height+5;
|
|
|
+ }else{
|
|
|
+ _height += size.height+5;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CGRect frame = _firstView.frame;
|
|
|
+ frame.size.height = _height;
|
|
|
+ _firstView.frame = frame;
|
|
|
+
|
|
|
+ _scrollV.contentSize = CGSizeMake(frame.size.width, frame.size.height + 10);
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 第一个View
|
|
|
+-(void)buildFirstView
|
|
|
+{
|
|
|
+ _firstView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-100)];
|
|
|
+ _firstView.backgroundColor = BGKJ_COLOR;
|
|
|
+ [_scrollV addSubview:_firstView];
|
|
|
+
|
|
|
+ UIImageView *headImageV = [[UIImageView alloc]initWithFrame:CGRectMake(10, 11, 40, 40)];
|
|
|
+ headImageV.layer.cornerRadius = 4;
|
|
|
+ headImageV.layer.masksToBounds = YES;
|
|
|
+ [g_server getHeadImageSmall:g_server.myself.userId imageView:headImageV];
|
|
|
+
|
|
|
+ [_firstView addSubview:headImageV];
|
|
|
+
|
|
|
+ DLog(@"savboaebo:%@",g_server.myself.userId);
|
|
|
+
|
|
|
+ UILabel *name = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(headImageV.frame)+15, 11, 100, 20)];
|
|
|
+ name.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"personName"];
|
|
|
+ name.textColor = Color(87, 87, 87, 1);
|
|
|
+ name.font = FONT_SIZE(15);
|
|
|
+ [_firstView addSubview:name];
|
|
|
+
|
|
|
+ UILabel *depart = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(headImageV.frame)+15, CGRectGetMaxY(name.frame), 300, 20)];
|
|
|
+ depart.text = [NSString stringWithFormat:@"%@ > %@",[[NSUserDefaults standardUserDefaults] stringForKey:@"personDepartment"],[[NSUserDefaults standardUserDefaults] stringForKey:@"personPosition"]];
|
|
|
+ depart.textColor = Color(87, 87, 87, 1);
|
|
|
+ depart.font = FONT_SIZE(12);
|
|
|
+ [_firstView addSubview:depart];
|
|
|
+
|
|
|
+ UIImageView *line = [[UIImageView alloc]initWithFrame:CGRectMake(5, 63.5, SCREEN_WIDTH-5, 0.5)];
|
|
|
+ line.backgroundColor = [[UIColor lightGrayColor]colorWithAlphaComponent:0.3];
|
|
|
+ [_firstView addSubview:line];
|
|
|
+
|
|
|
+ UILabel *status = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-70, 11, 60, 20)];
|
|
|
+ status.text = _danjuStatus;
|
|
|
+ if ([_danjuStatus isEqualToString:@"已审核"]) {
|
|
|
+ status.textColor = Color(38, 133, 9, 1);
|
|
|
+ }else{
|
|
|
+ status.textColor = [UIColor redColor];
|
|
|
+ }
|
|
|
+ status.textAlignment = NSTextAlignmentRight;
|
|
|
+ status.font = FONT_SIZE(12);
|
|
|
+ [_firstView addSubview:status];
|
|
|
+
|
|
|
+ _height += 64;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark --- 数据库找数据
|
|
|
+-(void)selectTableNameWithtableName:(NSString *)tableName completed:(completedBlock)completed{
|
|
|
+
|
|
|
+ [[TIFmdbManager shareManager] createOrOpenDatabasaWithDbName:TONGXUNLUDATA completed:^(BOOL result) {
|
|
|
+
|
|
|
+ if(result){
|
|
|
+
|
|
|
+ NSMutableArray *dataArr = [NSMutableArray new];
|
|
|
+
|
|
|
+ [[TIFmdbManager shareManager] executeWithDb:TONGXUNLUDATA excuteDbBlock:^(FMDatabase *db) {
|
|
|
+
|
|
|
+ NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@",tableName];
|
|
|
+ FMResultSet *rs = [db executeQuery:sql];
|
|
|
+
|
|
|
+ while ([rs next])
|
|
|
+ {
|
|
|
+ EmployeeModel *model = [[EmployeeModel alloc] init];
|
|
|
+
|
|
|
+ model.em_name = [rs stringForColumn:_em_name];
|
|
|
+ model.em_code = [rs stringForColumn:_em_code];
|
|
|
+ model.em_imid = [[rs stringForColumn:_em_imid] integerValue];
|
|
|
+ [dataArr addObject:model];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } completed:^{
|
|
|
+
|
|
|
+ if(completed){
|
|
|
+
|
|
|
+ completed(dataArr);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 一些类方法
|
|
|
+-(UILabel *)creatLeftLabelWithHeight:(int)hang text:(NSString *)text withHeight:(float)high
|
|
|
+{
|
|
|
+ UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(10, _height, 90, high)];
|
|
|
+ lbl.textColor = Color(87, 87, 87, 1);
|
|
|
+ if ([text isKindOfClass:[NSNull class]]) {
|
|
|
+ text = @"";
|
|
|
+ }
|
|
|
+ lbl.numberOfLines = 0;
|
|
|
+ lbl.text = text;
|
|
|
+ lbl.font = FONT_SIZE(12);
|
|
|
+ return lbl;
|
|
|
+}
|
|
|
+
|
|
|
+-(UILabel *)creatRightLabelWithHeight:(int)hang text:(NSString *)text
|
|
|
+{
|
|
|
+ CGSize size = [self getSizeWithText:text];
|
|
|
+ UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(100, _height, size.width, size.height+5)];
|
|
|
+ lbl.textColor = Color(150, 149, 149, 1);
|
|
|
+ if ([FORMAT(@"%@",text) isEqualToString:@"(null)"]) {
|
|
|
+ text = @"";
|
|
|
+ }
|
|
|
+ lbl.text = FORMAT(@"%@",text);
|
|
|
+ lbl.font = FONT_SIZE(12);
|
|
|
+ lbl.numberOfLines = 0;
|
|
|
+
|
|
|
+ return lbl;
|
|
|
+}
|
|
|
+
|
|
|
+-(UILabel *)creatDetailLabelWithText:(NSString *)text
|
|
|
+{
|
|
|
+ UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(10, _height, SCREEN_WIDTH-10, 30)];
|
|
|
+ lbl.textColor = Color(250, 85, 4, 1);
|
|
|
+ if ([text isEqualToString:@"(null)"]) {
|
|
|
+ text = @"";
|
|
|
+ }
|
|
|
+ lbl.text = text;
|
|
|
+ lbl.font = FONT_SIZE(14);
|
|
|
+ return lbl;
|
|
|
+}
|
|
|
+
|
|
|
+//自动获取文本高度
|
|
|
+- (CGSize)getSizeWithText:(NSString *)text
|
|
|
+{
|
|
|
+ /**
|
|
|
+ 参数1:Size 文本显示的最大区域
|
|
|
+ 参数2:options 用什么来的换行模式来计算
|
|
|
+ 参数3:attributes 文字的大小
|
|
|
+ 参数4:context 上下文
|
|
|
+ */
|
|
|
+
|
|
|
+ return [FORMAT(@"%@",text) boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 100, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : FONT_SIZE(12)} context:NULL].size;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGSize)getleftWithText:(NSString *)text
|
|
|
+{
|
|
|
+ /**
|
|
|
+ 参数1:Size 文本显示的最大区域
|
|
|
+ 参数2:options 用什么来的换行模式来计算
|
|
|
+ 参数3:attributes 文字的大小
|
|
|
+ 参数4:context 上下文
|
|
|
+ */
|
|
|
+
|
|
|
+ return [FORMAT(@"%@",text) boundingRectWithSize:CGSizeMake(90, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : FONT_SIZE(12)} context:NULL].size;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)backAction
|
|
|
+{
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
+}
|
|
|
+@end
|