RepairUnReceiptFrame.m 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. //
  2. // RepairUnReceiptFrame.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 16/4/15.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. //功能描述: 维修未回执单元格frame类
  9. #import "RepairUnReceiptFrame.h"
  10. #import "NSString+Tools.h"
  11. #import "DateFormat.h"
  12. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  13. #define kTitleFont [UIFont systemFontOfSize:14]
  14. @implementation RepairUnReceiptFrame
  15. #pragma 私有函数
  16. /**
  17. 设置维修未回执frame
  18. @param unRepairModel <#unRepairModel description#>
  19. */
  20. - (void)setUnRepairFrame:(RepairUnReceiptModel *)unRepairModel{
  21. _unRepairModel=unRepairModel;
  22. NSDictionary *unRepairDict = @{NSFontAttributeName:kTitleFont};
  23. CGFloat xpadding = 10;
  24. NSString *repairNoTitle = @"维修单号:";
  25. CGRect lblRepairNoFrame = [repairNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
  26. lblRepairNoFrame.origin.x=xpadding;
  27. lblRepairNoFrame.origin.y=15;
  28. _lblRepairNoF= lblRepairNoFrame;
  29. NSString *repairNo = [_unRepairModel repairNo];
  30. if(repairNo != nil&&repairNo.length>0){
  31. CGRect repairNoFrame = CGRectMake(CGRectGetMaxX(_lblRepairNoF), 15, SCREENWIDTH - 20 - CGRectGetMaxX(_lblRepairNoF), 16);
  32. _repairNoF= repairNoFrame;
  33. }
  34. _separatorF=CGRectMake(0,CGRectGetMaxY(_lblRepairNoF)+15, Screen_Width, 1);
  35. NSString *arrangementNoTitle = @"安排单号:";
  36. CGRect lblArrangementNoFrame = [arrangementNoTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
  37. lblArrangementNoFrame.origin.x=xpadding;
  38. lblArrangementNoFrame.origin.y=CGRectGetMaxY(_separatorF)+15;
  39. _lblArrangementNoF=lblArrangementNoFrame;
  40. NSString *arrangementNo = [_unRepairModel arrangementNo];
  41. if(arrangementNo != nil&&arrangementNo.length>0){
  42. CGRect arrangementNoFrame = [arrangementNo textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict];
  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:unRepairDict];
  49. lblCustomerNameFrame.origin.x=xpadding;
  50. lblCustomerNameFrame.origin.y=CGRectGetMaxY(_lblArrangementNoF)+15;
  51. _lblCustomerNameF=lblCustomerNameFrame;
  52. NSString *customerName = [_unRepairModel customerName];
  53. if(customerName != nil &&customerName.length>0){
  54. CGRect customerNameFrame = [customerName textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerNameF)-5, MAXFLOAT) attributes:unRepairDict];
  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:unRepairDict];
  61. lblCustomerTelephoneFrame.origin.x= xpadding;
  62. lblCustomerTelephoneFrame.origin.y=CGRectGetMaxY(_lblCustomerNameF)+15;
  63. _lblCustomerTelephoneF= lblCustomerTelephoneFrame;
  64. NSString *customerTelephone = [unRepairModel telephone];
  65. if(customerTelephone != nil&&customerTelephone.length>0){
  66. CGRect customerTelephoneFrame = [customerTelephone textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict];
  67. customerTelephoneFrame.origin.x =CGRectGetMaxX(_lblCustomerTelephoneF);
  68. customerTelephoneFrame.origin.y =CGRectGetMaxY(_lblCustomerNameF)+15;
  69. _customerTelephoneF= customerTelephoneFrame;
  70. }
  71. NSString *repairDateTitle = @"维修日期:";
  72. CGRect lblRepairDateFrame = [repairDateTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
  73. lblRepairDateFrame.origin.x=xpadding;
  74. lblRepairDateFrame.origin.y=CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  75. _lblRepairDateF=lblRepairDateFrame;
  76. NSString *repairDate = [unRepairModel repairDate];
  77. if(repairDate != nil&& repairDate.length>0){
  78. NSString *repairTime = [DateFormat dateFormatSplit:repairDate];
  79. CGRect repairDateFrame = [repairTime textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict];
  80. repairDateFrame.origin.x =CGRectGetMaxX(_lblRepairDateF);
  81. repairDateFrame.origin.y =CGRectGetMaxY(_lblCustomerTelephoneF)+15;
  82. _repairDateF=repairDateFrame;
  83. }
  84. NSString *customerAddressTitle = @"客户地址:";
  85. CGRect lblCustomerAddressFrame = [customerAddressTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
  86. lblCustomerAddressFrame.origin.x=xpadding;
  87. lblCustomerAddressFrame.origin.y=CGRectGetMaxY(_lblRepairDateF)+15;
  88. _lblCustomerAddressF= lblCustomerAddressFrame;
  89. NSString *customerAddress = [unRepairModel customerAddress];
  90. if(customerAddress != nil && customerAddress.length>0){
  91. CGRect customerAddressFrame = [customerAddress textRectWithSize:CGSizeMake(Screen_Width-CGRectGetMaxX(_lblCustomerAddressF)-15, MAXFLOAT) attributes:unRepairDict];
  92. customerAddressFrame.origin.x =CGRectGetMaxX(_lblCustomerAddressF);
  93. customerAddressFrame.origin.y =CGRectGetMaxY(_lblRepairDateF)+15;
  94. _customerAddressF= customerAddressFrame;
  95. }
  96. NSString *staffName =[unRepairModel staffName];
  97. NSString *organizationName = [unRepairModel organizationName];
  98. if((organizationName==nil||[organizationName isEqualToString:@""])&&(staffName==nil||[staffName isEqualToString:@""])){
  99. NSString *questionDesc = [unRepairModel questionDesc];
  100. _cellHeight = CGRectGetMaxY(_lblCustomerAddressF)+5;
  101. }
  102. else{
  103. NSString *organizationNameTitle = @"业务部门:";
  104. CGRect lblOrganizationNameFrame = [organizationNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
  105. lblOrganizationNameFrame.origin.x = xpadding;
  106. lblOrganizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  107. _lblOrganizationNameF = lblOrganizationNameFrame;
  108. if(organizationName!=nil&&organizationName.length>0){
  109. CGRect organizationNameFrame = [organizationName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict];
  110. organizationNameFrame.origin.x = CGRectGetMaxX(_lblOrganizationNameF);
  111. organizationNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  112. if(organizationNameFrame.size.width>Screen_Width/2-lblOrganizationNameFrame.size.width){
  113. organizationNameFrame.size.width=Screen_Width/2-lblOrganizationNameFrame.size.width-3;
  114. }
  115. _organizationNameF = organizationNameFrame;
  116. }
  117. NSString *staffNameTitle = @"业 务 员:";
  118. CGRect lblStaffNameFrame = [staffNameTitle textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:unRepairDict];
  119. lblStaffNameFrame.origin.x = Screen_Width/2;
  120. lblStaffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  121. _lblStaffNameF = lblStaffNameFrame;
  122. if(staffName!=nil&&staffName.length>0){
  123. CGRect staffNameFrame = [staffName textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:unRepairDict ];
  124. staffNameFrame.origin.x = CGRectGetMaxX(_lblStaffNameF);
  125. staffNameFrame.origin.y = CGRectGetMaxY(_lblCustomerAddressF) + 15;
  126. _staffNameF = staffNameFrame;
  127. }
  128. _cellHeight = CGRectGetMaxY(_lblStaffNameF)+5;
  129. }
  130. }
  131. @end