InstallReceiptedListFrame.m 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //
  2. // InstallReceiptedListFrame.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2017/7/13.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. // 功能描述:安装已回执frame
  8. #import "InstallReceiptedListFrame.h"
  9. #import "DateFormat.h"
  10. #import "NSString+Tools.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation InstallReceiptedListFrame
  14. #pragma mark - 私有函数
  15. /**
  16. 设置安装已回执frame
  17. @param installationInfoModel <#installationInfoModel description#>
  18. */
  19. - (void)setInstallationListFrame:(InstallReceiptListModel *)installationInfoModel{
  20. _installationReceiptListModel = installationInfoModel;
  21. NSDictionary *installationDict = @{NSFontAttributeName:kTitleFont};
  22. CGFloat xpadding = 10;
  23. NSString *receiptNoTitle = @"回执单号:";
  24. CGRect lblReceiptNoFrame = [receiptNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  25. lblReceiptNoFrame.origin.x = xpadding;
  26. lblReceiptNoFrame.origin.y = 15;
  27. _lblReceiptNoF = lblReceiptNoFrame;
  28. NSString *receiptNoStr = [_installationReceiptListModel receiptNo];
  29. if(receiptNoStr != nil && receiptNoStr.length > 0){
  30. CGRect receiptNoFrame = [receiptNoStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict];
  31. receiptNoFrame.origin.y = 15;
  32. receiptNoFrame.origin.x = CGRectGetMaxX(_lblReceiptNoF);
  33. _receiptNoF = receiptNoFrame;
  34. }
  35. _btnCancelReceiptF=CGRectMake(Screen_Width-70, 15,60,17);
  36. _separatorF = CGRectMake(0,CGRectGetMaxY(_lblReceiptNoF) + 15, Screen_Width, 1);
  37. NSString *arrangementNoTitle = @"安排单号:";
  38. CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  39. lblArrangementNoFrame.origin.x = xpadding;
  40. lblArrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF)+15;
  41. _lblArrangementNoF = lblArrangementNoFrame;
  42. NSString *arrangementNoStr = [_installationReceiptListModel arrangementNo];
  43. if(arrangementNoStr != nil&&arrangementNoStr.length > 0){
  44. CGRect arrangementNoFrame = [arrangementNoStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict];
  45. arrangementNoFrame.origin.x = CGRectGetMaxX(_lblArrangementNoF) ;
  46. arrangementNoFrame.origin.y = CGRectGetMaxY(_separatorF) + 15;
  47. _arrangementNoF = arrangementNoFrame;
  48. }
  49. NSString *installationNoTitle = @"安装单号:";
  50. CGRect lblInstallationNoFrame = [installationNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  51. lblInstallationNoFrame.origin.x = xpadding;
  52. lblInstallationNoFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) +15;
  53. _lblInstallationNoF = lblInstallationNoFrame;
  54. NSString *installationNoStr = [_installationReceiptListModel installationNo];
  55. if(installationNoStr != nil && installationNoStr.length > 0){
  56. CGRect installationNoFrame = [installationNoStr textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict];
  57. installationNoFrame.origin.x = CGRectGetMaxX(_lblInstallationNoF);
  58. installationNoFrame.origin.y = CGRectGetMaxY(_lblArrangementNoF) + 15;
  59. _installationNoF = installationNoFrame;
  60. }
  61. NSString *customerNameTitle = @"客户名称:";
  62. CGRect lblCustomerNameFrame = [customerNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  63. lblCustomerNameFrame.origin.x = xpadding;
  64. lblCustomerNameFrame.origin.y = CGRectGetMaxY(_lblInstallationNoF) + 15;
  65. _lblCustomerNameF=lblCustomerNameFrame;
  66. NSString *customerName = [_installationReceiptListModel customerName];
  67. if(customerName != nil &&customerName.length > 0){
  68. CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerNameF) - 5, MAXFLOAT) attributes:installationDict];
  69. customerNameFrame.origin.x = CGRectGetMaxX(_lblCustomerNameF);
  70. customerNameFrame.origin.y = CGRectGetMaxY( _lblInstallationNoF) + 15;
  71. _customerNameF = customerNameFrame;
  72. }
  73. NSString *customerAddressTitle = @"客户地址:";
  74. CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  75. lblCustomerAddressFrame.origin.x = xpadding;
  76. lblCustomerAddressFrame.origin.y = CGRectGetMaxY(_lblCustomerNameF) + 15;
  77. _lblCustomerAddressF=lblCustomerAddressFrame;
  78. NSString *customerAddress = [_installationReceiptListModel customerAddress];
  79. if(customerAddress != nil &&customerAddress.length > 0){
  80. CGRect customerAddressFrame=CGRectMake( CGRectGetMaxX(_lblCustomerAddressF), CGRectGetMaxY(_lblCustomerNameF)+15, Screen_Width- CGRectGetMaxX(_lblCustomerAddressF)-5, 16.7);
  81. _customerAddressF = customerAddressFrame;
  82. }
  83. NSString *customerTelephoneTitle = @"客户电话:";
  84. CGRect lblCustomerTelephoneFrame = [customerTelephoneTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  85. lblCustomerTelephoneFrame.origin.x = xpadding;
  86. lblCustomerTelephoneFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  87. _lblCustomerTelephoneF = lblCustomerTelephoneFrame;
  88. NSString *customerTelephone = [_installationReceiptListModel customerTelephone];
  89. if(customerTelephone != nil && customerTelephone.length > 0){
  90. CGRect customerTelephoneFrame=CGRectMake( CGRectGetMaxX(_lblCustomerTelephoneF)+2, CGRectGetMaxY(_lblCustomerAddressF)+15, Screen_Width- CGRectGetMaxX(_lblCustomerTelephoneF)-2-5, 16.7);
  91. _customerTelephoneF = customerTelephoneFrame;
  92. }
  93. NSString *receiptDateTitle = @"回执日期:";
  94. CGRect lblReceiptDateFrame = [receiptDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  95. lblReceiptDateFrame.origin.x = xpadding;
  96. lblReceiptDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
  97. _lblReceiptDateF = lblReceiptDateFrame;
  98. NSString *receiptDate = [_installationReceiptListModel receiptDate];
  99. receiptDate = [DateFormat dateFormatSplit:receiptDate];
  100. if(receiptDate != nil && receiptDate.length > 0){
  101. CGRect receiptDateFrame = [receiptDate textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:installationDict];
  102. receiptDateFrame.origin.x = CGRectGetMaxX(_lblReceiptDateF) ;
  103. receiptDateFrame.origin.y = CGRectGetMaxY(_lblCustomerTelephoneF) + 15;
  104. _receiptDateF = receiptDateFrame;
  105. }
  106. NSString *receiptStatusTitle = @"回执状态:";
  107. CGRect lblReceiptStatusFrame = [receiptStatusTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:installationDict];
  108. lblReceiptStatusFrame.origin.x=Screen_Width /2;
  109. lblReceiptStatusFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  110. _lblReceiptStatusF= lblReceiptStatusFrame;
  111. NSString *receiptType = [_installationReceiptListModel receiptType];
  112. if ([receiptType isEqualToString:@"1"]) {
  113. receiptType = @"完成";
  114. }
  115. if ([receiptType isEqualToString:@"3"]) {
  116. receiptType = @"推迟安装";
  117. }
  118. if(receiptType != nil&&receiptType.length>0){
  119. CGRect receiptStatusFrame = [receiptType textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblReceiptStatusF)-5, MAXFLOAT) attributes:installationDict];
  120. receiptStatusFrame.origin.x =CGRectGetMaxX(_lblReceiptStatusF);
  121. receiptStatusFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  122. _receiptStatusF= receiptStatusFrame;
  123. }
  124. _cellHeight=CGRectGetMaxY(_lblReceiptDateF)+5;
  125. }
  126. @end