UnInstallationInfoFrame.m 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. //
  2. // UnInstallationInfoFrame.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 16/4/15.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. // 功能描述:安装未回执frame
  8. #import "UnInstallationInfoFrame.h"
  9. #import "NSString+Tools.h"
  10. #import "DateFormat.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation UnInstallationInfoFrame
  14. #pragma mark - 私有函数
  15. /**
  16. 设置安装未回执frame
  17. @param unInstallationInfoModel <#unInstallationInfoModel description#>
  18. */
  19. - (void)setUnInstallationListFrame:(UnInstallationInfoModel *)unInstallationInfoModel{
  20. _unInstallationInfoModel=unInstallationInfoModel;
  21. NSDictionary *unInstallationDict = @{NSFontAttributeName:kTitleFont};
  22. CGFloat xpadding =10;
  23. NSString *installationNoTitle = @"安装单号:";
  24. CGRect lblInstallationNoFrame = [installationNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  25. lblInstallationNoFrame.origin.x=xpadding;
  26. lblInstallationNoFrame.origin.y=15;
  27. _lblInstallationNoF=lblInstallationNoFrame;
  28. NSString *installationNo = [_unInstallationInfoModel installationNo];
  29. if(installationNo != nil&&installationNo.length > 0){
  30. CGRect installationNoFrame = CGRectMake(CGRectGetMaxX(_lblInstallationNoF), 15, SCREENWIDTH - 20 - CGRectGetMaxX(_lblInstallationNoF), 16);
  31. _installationNoF=installationNoFrame;
  32. }
  33. _btnDialTelephoneF=CGRectMake(Screen_Width-56,8,32,32);
  34. _separatorF=CGRectMake(0,CGRectGetMaxY(_lblInstallationNoF)+15, Screen_Width, 1);
  35. NSString *arrangementNoTitle = @"安排单号:";
  36. CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  37. lblArrangementNoFrame.origin.x=xpadding;
  38. lblArrangementNoFrame.origin.y=CGRectGetMaxY(_separatorF)+15;
  39. _lblArrangementNoF= lblArrangementNoFrame;
  40. NSString *arrangementNo = [_unInstallationInfoModel arrangementNo];
  41. if(arrangementNo != nil&&arrangementNo.length>0){
  42. CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict];
  43. arrangementNoFrame.origin.x =CGRectGetMaxX(_lblArrangementNoF);
  44. arrangementNoFrame.origin.y =CGRectGetMaxY(_separatorF)+15;
  45. _arrangementNoF= arrangementNoFrame;
  46. }
  47. NSString *customerNameTitle = @"客户名称:";
  48. CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  49. lblCustomerNameFrame.origin.x=xpadding;
  50. lblCustomerNameFrame.origin.y=CGRectGetMaxY(_lblArrangementNoF)+15;
  51. _lblCustomerNameF=lblCustomerNameFrame;
  52. NSString *customerName = [_unInstallationInfoModel customerName];
  53. if(customerName != nil &&customerName.length>0){
  54. CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerNameF)-5, MAXFLOAT) attributes:unInstallationDict];
  55. customerNameFrame.origin.x =CGRectGetMaxX(_lblCustomerNameF);
  56. customerNameFrame.origin.y =CGRectGetMaxY(_lblArrangementNoF)+15;
  57. _customerNameF= customerNameFrame;
  58. }
  59. NSString *customerTelephoneTitle = @"客户电话:";
  60. CGRect lblCustomerTelephoneFrame = [customerTelephoneTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  61. lblCustomerTelephoneFrame.origin.x= xpadding;
  62. lblCustomerTelephoneFrame.origin.y=CGRectGetMaxY(_lblCustomerNameF)+15;
  63. _lblCustomerTelephoneF= lblCustomerTelephoneFrame;
  64. NSString *customerTelephone = [unInstallationInfoModel telephone];
  65. if(customerTelephone != nil&&customerTelephone.length>0){
  66. CGRect customerTelephoneFrame = [customerTelephone textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict];
  67. customerTelephoneFrame.origin.x =CGRectGetMaxX(_lblCustomerTelephoneF);
  68. customerTelephoneFrame.origin.y =CGRectGetMaxY(_lblCustomerNameF)+15;
  69. _customerTelephoneF= customerTelephoneFrame;
  70. }
  71. NSString *installationDateTitle = @"安装日期:";
  72. CGRect lblInstallationDateFrame = [installationDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  73. lblInstallationDateFrame.origin.x=xpadding;
  74. lblInstallationDateFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  75. _lblInstallationDateF= lblInstallationDateFrame;
  76. NSString *installationDate = [unInstallationInfoModel installationDate];
  77. installationDate= [DateFormat dateFormatSplit:installationDate];
  78. if(installationDate != nil&&installationDate.length>0){
  79. CGRect installationDateFrame = [installationDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict];
  80. installationDateFrame.origin.x =CGRectGetMaxX(_lblInstallationDateF);
  81. installationDateFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  82. _installationDateF= installationDateFrame;
  83. }
  84. NSString *customerAddressTitle = @"客户地址:";
  85. CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  86. lblCustomerAddressFrame.origin.x=xpadding;
  87. lblCustomerAddressFrame.origin.y=CGRectGetMaxY(_lblInstallationDateF)+15;
  88. _lblCustomerAddressF= lblCustomerAddressFrame;
  89. NSString *customerAddress = [unInstallationInfoModel customerAddress];
  90. if(customerAddress != nil&&customerAddress.length>0){
  91. CGRect customerAddressFrame = [customerAddress textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerAddressF)-15, MAXFLOAT) attributes:unInstallationDict];
  92. customerAddressFrame.origin.x =CGRectGetMaxX(_lblCustomerAddressF);
  93. customerAddressFrame.origin.y =CGRectGetMaxY(_lblInstallationDateF)+15;
  94. _customerAddressF= customerAddressFrame;
  95. }
  96. NSString *staffName =[unInstallationInfoModel staffName];
  97. NSString *organizationName = [unInstallationInfoModel organizationName];
  98. if((organizationName==nil||[organizationName isEqualToString:@""])&&(staffName==nil||[staffName isEqualToString:@""])){
  99. _cellHeight = CGRectGetMaxY(_lblCustomerAddressF)+5;
  100. }
  101. else{
  102. NSString *organizationNameTitle = @"业务部门:";
  103. CGRect lblOrganizationNameFrame = [organizationNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  104. lblOrganizationNameFrame.origin.x = xpadding;
  105. lblOrganizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  106. _lblOrganizationNameF = lblOrganizationNameFrame;
  107. if(organizationName!=nil&&organizationName.length>0){
  108. CGRect organizationNameFrame = [organizationName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict];
  109. organizationNameFrame.origin.x = CGRectGetMaxX(_lblOrganizationNameF);
  110. organizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  111. if(organizationNameFrame.size.width>Screen_Width/2-lblOrganizationNameFrame.size.width){
  112. organizationNameFrame.size.width=Screen_Width/2-lblOrganizationNameFrame.size.width-3;
  113. }
  114. _organizationNameF = organizationNameFrame;
  115. }
  116. NSString *staffNameTitle = @"业 务 员:";
  117. CGRect lblStaffNameFrame = [staffNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unInstallationDict];
  118. lblStaffNameFrame.origin.x = Screen_Width/2;
  119. lblStaffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  120. _lblStaffNameF = lblStaffNameFrame;
  121. if(staffName!=nil&&staffName.length>0){
  122. CGRect staffNameFrame = [staffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unInstallationDict];
  123. staffNameFrame.origin.x = CGRectGetMaxX(_lblStaffNameF);
  124. staffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  125. _staffNameF = staffNameFrame;
  126. }
  127. _cellHeight = CGRectGetMaxY(_lblOrganizationNameF)+5;
  128. }
  129. }
  130. @end