| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- //
- // RepairUnReceiptFrame.m
- // IBOSS
- //
- // Created by guan hong hou on 16/4/15.
- // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
- //
- //功能描述: 维修未回执单元格frame类
- #import "RepairUnReceiptFrame.h"
- #import "NSString+Tools.h"
- #import "DateFormat.h"
- #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
- #define kTitleFont [UIFont systemFontOfSize:14]
- @implementation RepairUnReceiptFrame
- #pragma 私有函数
- /**
- 设置维修未回执frame
- @param unRepairModel <#unRepairModel description#>
- */
- - (void)setUnRepairFrame:(RepairUnReceiptModel *)unRepairModel{
- _unRepairModel=unRepairModel;
- NSDictionary *unRepairDict = @{NSFontAttributeName:kTitleFont};
- CGFloat xpadding = 10;
-
- NSString *repairNoTitle = @"维修单号:";
- CGRect lblRepairNoFrame = [repairNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
- lblRepairNoFrame.origin.x=xpadding;
- lblRepairNoFrame.origin.y=15;
- _lblRepairNoF= lblRepairNoFrame;
- NSString *repairNo = [_unRepairModel repairNo];
- if(repairNo != nil&&repairNo.length>0){
- CGRect repairNoFrame = CGRectMake(CGRectGetMaxX(_lblRepairNoF), 15, SCREENWIDTH - 20 - CGRectGetMaxX(_lblRepairNoF), 16);
- _repairNoF= repairNoFrame;
- }
-
- _separatorF=CGRectMake(0,CGRectGetMaxY(_lblRepairNoF)+15, Screen_Width, 1);
- NSString *arrangementNoTitle = @"安排单号:";
- CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
- lblArrangementNoFrame.origin.x=xpadding;
- lblArrangementNoFrame.origin.y=CGRectGetMaxY(_separatorF)+15;
- _lblArrangementNoF=lblArrangementNoFrame;
-
- NSString *arrangementNo = [_unRepairModel arrangementNo];
- if(arrangementNo != nil&&arrangementNo.length>0){
- CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict];
- arrangementNoFrame.origin.x =CGRectGetMaxX(_lblArrangementNoF);
- arrangementNoFrame.origin.y =CGRectGetMaxY(_separatorF)+15;
- _arrangementNoF=arrangementNoFrame;
- }
-
- NSString *customerNameTitle = @"客户名称:";
- CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
- lblCustomerNameFrame.origin.x=xpadding;
- lblCustomerNameFrame.origin.y=CGRectGetMaxY(_lblArrangementNoF)+15;
- _lblCustomerNameF=lblCustomerNameFrame;
- NSString *customerName = [_unRepairModel customerName];
- if(customerName != nil &&customerName.length>0){
- CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerNameF)-5, MAXFLOAT) attributes:unRepairDict];
- customerNameFrame.origin.x =CGRectGetMaxX(_lblCustomerNameF);
- customerNameFrame.origin.y =CGRectGetMaxY(_lblArrangementNoF)+15;
- _customerNameF= customerNameFrame;
- }
-
- NSString *customerTelephoneTitle = @"客户电话:";
- CGRect lblCustomerTelephoneFrame = [customerTelephoneTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
- lblCustomerTelephoneFrame.origin.x= xpadding;
- lblCustomerTelephoneFrame.origin.y=CGRectGetMaxY(_lblCustomerNameF)+15;
- _lblCustomerTelephoneF= lblCustomerTelephoneFrame;
- NSString *customerTelephone = [unRepairModel telephone];
- if(customerTelephone != nil&&customerTelephone.length>0){
- CGRect customerTelephoneFrame = [customerTelephone textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict];
- customerTelephoneFrame.origin.x =CGRectGetMaxX(_lblCustomerTelephoneF);
- customerTelephoneFrame.origin.y =CGRectGetMaxY(_lblCustomerNameF)+15;
- _customerTelephoneF= customerTelephoneFrame;
- }
-
-
- NSString *repairDateTitle = @"维修日期:";
- CGRect lblRepairDateFrame = [repairDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
- lblRepairDateFrame.origin.x=xpadding;
- lblRepairDateFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15;
- _lblRepairDateF=lblRepairDateFrame;
-
- NSString *repairDate = [unRepairModel repairDate];
- if(repairDate != nil&& repairDate.length>0){
- NSString *repairTime = [DateFormat dateFormatSplit:repairDate];
- CGRect repairDateFrame = [repairTime textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict];
- repairDateFrame.origin.x =CGRectGetMaxX(_lblRepairDateF);
- repairDateFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15;
- _repairDateF=repairDateFrame;
- }
-
- NSString *customerAddressTitle = @"客户地址:";
- CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
- lblCustomerAddressFrame.origin.x=xpadding;
- lblCustomerAddressFrame.origin.y=CGRectGetMaxY(_lblRepairDateF)+15;
- _lblCustomerAddressF= lblCustomerAddressFrame;
- NSString *customerAddress = [unRepairModel customerAddress];
- if(customerAddress != nil && customerAddress.length>0){
- CGRect customerAddressFrame = [customerAddress textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerAddressF)-15, MAXFLOAT) attributes:unRepairDict];
- customerAddressFrame.origin.x =CGRectGetMaxX(_lblCustomerAddressF);
- customerAddressFrame.origin.y =CGRectGetMaxY(_lblRepairDateF)+15;
- _customerAddressF= customerAddressFrame;
-
-
- }
-
- NSString *staffName =[unRepairModel staffName];
- NSString *organizationName = [unRepairModel organizationName];
-
- if((organizationName==nil||[organizationName isEqualToString:@""])&&(staffName==nil||[staffName isEqualToString:@""])){
- NSString *questionDesc = [unRepairModel questionDesc];
-
- _cellHeight = CGRectGetMaxY(_lblCustomerAddressF)+5;
-
- }
- else{
- NSString *organizationNameTitle = @"业务部门:";
- CGRect lblOrganizationNameFrame = [organizationNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
- 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:unRepairDict];
- 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:unRepairDict];
- 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:unRepairDict ];
- staffNameFrame.origin.x = CGRectGetMaxX(_lblStaffNameF);
- staffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
- _staffNameF = staffNameFrame;
-
- }
-
-
- _cellHeight = CGRectGetMaxY(_lblStaffNameF)+5;
-
-
-
- }
-
-
-
-
- }
- @end
|