// // UnInstallationInfoFrame.m // IBOSS // // Created by guan hong hou on 16/4/15. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved. // 功能描述:安装未回执frame #import "UnInstallationInfoFrame.h" #import "NSString+Tools.h" #import "DateFormat.h" #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize] #define kTitleFont [UIFont systemFontOfSize:14] @implementation UnInstallationInfoFrame #pragma mark - 私有函数 /** 设置安装未回执frame @param unInstallationInfoModel <#unInstallationInfoModel description#> */ - (void)setUnInstallationListFrame:(UnInstallationInfoModel *)unInstallationInfoModel{ _unInstallationInfoModel=unInstallationInfoModel; NSDictionary *unInstallationDict = @{NSFontAttributeName:kTitleFont}; CGFloat xpadding =10; NSString *installationNoTitle = @"安装单号:"; CGRect lblInstallationNoFrame = [installationNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblInstallationNoFrame.origin.x=xpadding; lblInstallationNoFrame.origin.y=15; _lblInstallationNoF=lblInstallationNoFrame; NSString *installationNo = [_unInstallationInfoModel installationNo]; if(installationNo != nil&&installationNo.length > 0){ CGRect installationNoFrame = CGRectMake(CGRectGetMaxX(_lblInstallationNoF), 15, SCREENWIDTH - 20 - CGRectGetMaxX(_lblInstallationNoF), 16); _installationNoF=installationNoFrame; } _btnDialTelephoneF=CGRectMake(Screen_Width-56,8,32,32); _separatorF=CGRectMake(0,CGRectGetMaxY(_lblInstallationNoF)+15, Screen_Width, 1); NSString *arrangementNoTitle = @"安排单号:"; CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblArrangementNoFrame.origin.x=xpadding; lblArrangementNoFrame.origin.y=CGRectGetMaxY(_separatorF)+15; _lblArrangementNoF= lblArrangementNoFrame; NSString *arrangementNo = [_unInstallationInfoModel arrangementNo]; if(arrangementNo != nil&&arrangementNo.length>0){ CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict]; arrangementNoFrame.origin.x =CGRectGetMaxX(_lblArrangementNoF); arrangementNoFrame.origin.y =CGRectGetMaxY(_separatorF)+15; _arrangementNoF= arrangementNoFrame; } NSString *customerNameTitle = @"客户名称:"; CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblCustomerNameFrame.origin.x=xpadding; lblCustomerNameFrame.origin.y=CGRectGetMaxY(_lblArrangementNoF)+15; _lblCustomerNameF=lblCustomerNameFrame; NSString *customerName = [_unInstallationInfoModel customerName]; if(customerName != nil &&customerName.length>0){ CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerNameF)-5, MAXFLOAT) attributes:unInstallationDict]; customerNameFrame.origin.x =CGRectGetMaxX(_lblCustomerNameF); customerNameFrame.origin.y =CGRectGetMaxY(_lblArrangementNoF)+15; _customerNameF= customerNameFrame; } NSString *customerTelephoneTitle = @"客户电话:"; CGRect lblCustomerTelephoneFrame = [customerTelephoneTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblCustomerTelephoneFrame.origin.x= xpadding; lblCustomerTelephoneFrame.origin.y=CGRectGetMaxY(_lblCustomerNameF)+15; _lblCustomerTelephoneF= lblCustomerTelephoneFrame; NSString *customerTelephone = [unInstallationInfoModel telephone]; if(customerTelephone != nil&&customerTelephone.length>0){ CGRect customerTelephoneFrame = [customerTelephone textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict]; customerTelephoneFrame.origin.x =CGRectGetMaxX(_lblCustomerTelephoneF); customerTelephoneFrame.origin.y =CGRectGetMaxY(_lblCustomerNameF)+15; _customerTelephoneF= customerTelephoneFrame; } NSString *installationDateTitle = @"安装日期:"; CGRect lblInstallationDateFrame = [installationDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblInstallationDateFrame.origin.x=xpadding; lblInstallationDateFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15; _lblInstallationDateF= lblInstallationDateFrame; NSString *installationDate = [unInstallationInfoModel installationDate]; installationDate= [DateFormat dateFormatSplit:installationDate]; if(installationDate != nil&&installationDate.length>0){ CGRect installationDateFrame = [installationDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict]; installationDateFrame.origin.x =CGRectGetMaxX(_lblInstallationDateF); installationDateFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15; _installationDateF= installationDateFrame; } NSString *customerAddressTitle = @"客户地址:"; CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblCustomerAddressFrame.origin.x=xpadding; lblCustomerAddressFrame.origin.y=CGRectGetMaxY(_lblInstallationDateF)+15; _lblCustomerAddressF= lblCustomerAddressFrame; NSString *customerAddress = [unInstallationInfoModel customerAddress]; if(customerAddress != nil&&customerAddress.length>0){ CGRect customerAddressFrame = [customerAddress textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerAddressF)-15, MAXFLOAT) attributes:unInstallationDict]; customerAddressFrame.origin.x =CGRectGetMaxX(_lblCustomerAddressF); customerAddressFrame.origin.y =CGRectGetMaxY(_lblInstallationDateF)+15; _customerAddressF= customerAddressFrame; } NSString *staffName =[unInstallationInfoModel staffName]; NSString *organizationName = [unInstallationInfoModel organizationName]; if((organizationName==nil||[organizationName isEqualToString:@""])&&(staffName==nil||[staffName isEqualToString:@""])){ _cellHeight = CGRectGetMaxY(_lblCustomerAddressF)+5; } else{ NSString *organizationNameTitle = @"业务部门:"; CGRect lblOrganizationNameFrame = [organizationNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblOrganizationNameFrame.origin.x = xpadding; lblOrganizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15; _lblOrganizationNameF = lblOrganizationNameFrame; if(organizationName!=nil&&organizationName.length>0){ CGRect organizationNameFrame = [organizationName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict]; organizationNameFrame.origin.x = CGRectGetMaxX(_lblOrganizationNameF); organizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15; if(organizationNameFrame.size.width>Screen_Width/2-lblOrganizationNameFrame.size.width){ organizationNameFrame.size.width=Screen_Width/2-lblOrganizationNameFrame.size.width-3; } _organizationNameF = organizationNameFrame; } NSString *staffNameTitle = @"业 务 员:"; CGRect lblStaffNameFrame = [staffNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict]; lblStaffNameFrame.origin.x = Screen_Width/2; lblStaffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15; _lblStaffNameF = lblStaffNameFrame; if(staffName!=nil&&staffName.length>0){ CGRect staffNameFrame = [staffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict]; staffNameFrame.origin.x = CGRectGetMaxX(_lblStaffNameF); staffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15; _staffNameF = staffNameFrame; } _cellHeight = CGRectGetMaxY(_lblOrganizationNameF)+5; } } @end