UnInstallationInfoTableViewCell.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. //
  2. // UnInstallationInfoCellTableViewCell.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 16/4/15.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:安装未回执单元格类
  9. #import "UnInstallationInfoTableViewCell.h"
  10. #import "DateFormat.h"
  11. #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. #define kTitleFont [UIFont systemFontOfSize:14]
  13. @implementation UnInstallationInfoTableViewCell
  14. #pragma mark - 公共函数
  15. /**
  16. 初始化单元格
  17. @param style <#style description#>
  18. @param reuseIdentifier <#reuseIdentifier description#>
  19. @return <#return value description#>
  20. */
  21. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  22. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  23. if (self) {
  24. self.layer.cornerRadius =CornerRadius;
  25. self.layer.backgroundColor = [UIColor clearColor].CGColor;
  26. self.layer.masksToBounds=YES;
  27. }
  28. return self;
  29. }
  30. /**
  31. 单元格可点击
  32. @param selected <#selected description#>
  33. @param animated <#animated description#>
  34. */
  35. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  36. [super setSelected:selected animated:animated];
  37. }
  38. #pragma mark - 私有函数
  39. /**
  40. 设置安装未回执frame
  41. @param frame <#frame description#>
  42. */
  43. - (void)setUnInstallationInfoFrame:(UnInstallationInfoFrame *)frame{
  44. UILabel *installationNoLabelView = [[UILabel alloc] initWithFrame:[frame lblInstallationNoF]];
  45. installationNoLabelView.backgroundColor = [UIColor clearColor];
  46. installationNoLabelView.textColor = [UIColor blackColor];
  47. installationNoLabelView.text = @"安装单号:";
  48. installationNoLabelView.textAlignment = NSTextAlignmentLeft;
  49. installationNoLabelView.font = kTitleFont;
  50. [self.contentView addSubview: installationNoLabelView];
  51. NSString *installationNoStr = [frame.unInstallationInfoModel installationNo];
  52. if(installationNoStr != nil && installationNoStr.length > 0){
  53. _installationNo = [[UILabel alloc] initWithFrame:[frame installationNoF]];
  54. _installationNo.backgroundColor = [UIColor clearColor];
  55. _installationNo.textColor = [UIColor blackColor];
  56. _installationNo.textAlignment = NSTextAlignmentLeft;
  57. _installationNo.font = kTitleFont;
  58. [self.contentView addSubview: _installationNo];
  59. _installationNo.text = installationNoStr;
  60. }
  61. _btnDialTelephone=[UIButton buttonWithType:UIButtonTypeCustom];
  62. _btnDialTelephone.frame=[frame btnDialTelephoneF];
  63. [self.contentView addSubview:_btnDialTelephone];
  64. [_btnDialTelephone addTarget:self action:@selector(dialTelephone) forControlEvents:UIControlEventTouchUpInside];
  65. UIImageView *telephoneImg = [[UIImageView alloc]init];
  66. telephoneImg.frame=CGRectMake(0,0,32,32);
  67. [telephoneImg setImage:[UIImage imageNamed:@"dial_telephone"]];
  68. telephoneImg.userInteractionEnabled=NO;
  69. [_btnDialTelephone addSubview:telephoneImg];
  70. UIView *separator = [UIView new];
  71. separator.frame = [frame separatorF];
  72. separator.backgroundColor = LineBackgroundColor;
  73. [self.contentView addSubview:separator];
  74. UILabel *arrangementNoLabelView = [[UILabel alloc] initWithFrame:[frame lblArrangementNoF]];
  75. arrangementNoLabelView.backgroundColor = [UIColor clearColor];
  76. arrangementNoLabelView.textColor = [UIColor blackColor];
  77. arrangementNoLabelView.text = @"安排单号:";
  78. arrangementNoLabelView.font = kTextFont;
  79. arrangementNoLabelView.textColor = LabelGrayTextColor;
  80. arrangementNoLabelView.textAlignment = NSTextAlignmentLeft;
  81. [self.contentView addSubview:arrangementNoLabelView];
  82. NSString *arrangementNoStr = [frame.unInstallationInfoModel arrangementNo];
  83. if(arrangementNoStr != nil && arrangementNoStr.length > 0){
  84. _arrangementNo= [[UILabel alloc] initWithFrame:[frame arrangementNoF]];
  85. _arrangementNo.backgroundColor = [UIColor clearColor];
  86. _arrangementNo.textColor = [UIColor blackColor];
  87. _arrangementNo.textAlignment = NSTextAlignmentLeft;
  88. _arrangementNo.font = kTextFont;
  89. [self.contentView addSubview:_arrangementNo];
  90. _arrangementNo.text=arrangementNoStr;
  91. }
  92. UILabel *lblcustomerName = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]];
  93. lblcustomerName.backgroundColor = [UIColor clearColor];
  94. lblcustomerName.textColor = [UIColor blackColor];
  95. lblcustomerName.text = @"客户名称:";
  96. lblcustomerName.textColor = LabelGrayTextColor;
  97. lblcustomerName.textAlignment = NSTextAlignmentLeft;
  98. lblcustomerName.font = kTextFont;
  99. [self.contentView addSubview:lblcustomerName];
  100. NSString *customerNameStr = [frame.unInstallationInfoModel customerName];
  101. if(customerNameStr != nil && customerNameStr.length > 0){
  102. _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]];
  103. _customerName.backgroundColor = [UIColor clearColor];
  104. _customerName.textColor = [UIColor blackColor];
  105. _customerName.textAlignment = NSTextAlignmentLeft;
  106. _customerName.font = kTextFont;
  107. [self.contentView addSubview:_customerName];
  108. _customerName.text = customerNameStr;
  109. }
  110. UILabel *lblCustomerTelephone = [[UILabel alloc] initWithFrame:[frame lblCustomerTelephoneF]];
  111. lblCustomerTelephone.backgroundColor = [UIColor clearColor];
  112. lblCustomerTelephone.textColor = [UIColor blackColor];
  113. lblCustomerTelephone.text = @"客户电话:";
  114. lblCustomerTelephone.textAlignment = NSTextAlignmentLeft;
  115. lblCustomerTelephone.font = kTextFont;
  116. lblCustomerTelephone.textColor = LabelGrayTextColor;
  117. [self.contentView addSubview:lblCustomerTelephone];
  118. NSString *customerTelephone = [frame.unInstallationInfoModel telephone];
  119. _telephoneNumber=customerTelephone;
  120. if(customerTelephone != nil&&customerTelephone.length > 0){
  121. _telephone = [[UILabel alloc] initWithFrame:[frame customerTelephoneF]];
  122. _telephone.backgroundColor = [UIColor clearColor];
  123. _telephone.textColor = [UIColor blackColor];
  124. _telephone.textAlignment = NSTextAlignmentLeft;
  125. _telephone.font = kTextFont;
  126. [self.contentView addSubview:_telephone];
  127. _telephone.text = customerTelephone;
  128. }
  129. UILabel *lblInstallationDate = [[UILabel alloc] initWithFrame:[frame lblInstallationDateF]];
  130. lblInstallationDate.backgroundColor = [UIColor clearColor];
  131. lblInstallationDate.textColor = LabelGrayTextColor;
  132. lblInstallationDate.text = @"安装日期:";
  133. lblInstallationDate.textColor = LabelGrayTextColor;
  134. lblInstallationDate.textAlignment = NSTextAlignmentLeft;
  135. lblInstallationDate.font = kTextFont;
  136. [self.contentView addSubview:lblInstallationDate];
  137. NSString *installationDateStr = [frame.unInstallationInfoModel installationDate];
  138. installationDateStr = [DateFormat dateFormatSplit:installationDateStr];
  139. if(installationDateStr != nil && installationDateStr.length > 0){
  140. _installationDate = [[UILabel alloc] initWithFrame:[frame installationDateF]];
  141. _installationDate.backgroundColor = [UIColor clearColor];
  142. _installationDate.textColor = [UIColor blackColor];
  143. _installationDate.textAlignment = NSTextAlignmentLeft;
  144. _installationDate.font =kTextFont;
  145. [self.contentView addSubview:_installationDate];
  146. _installationDate.text=installationDateStr;
  147. }
  148. UILabel *lblCustomerAddress = [[UILabel alloc] initWithFrame:[frame lblCustomerAddressF]];
  149. lblCustomerAddress.backgroundColor = [UIColor clearColor];
  150. lblCustomerAddress.textColor = [UIColor blackColor];
  151. lblCustomerAddress.text = @"客户地址:";
  152. lblCustomerAddress.font = kTextFont;
  153. lblCustomerAddress.textColor = LabelGrayTextColor;
  154. lblCustomerAddress.textAlignment = NSTextAlignmentLeft;
  155. [self.contentView addSubview: lblCustomerAddress];
  156. NSString *customerAddress = [frame.unInstallationInfoModel customerAddress];
  157. if(customerAddress != nil&&customerAddress.length > 0){
  158. _customerAddress = [[UILabel alloc] initWithFrame:[frame customerAddressF]];
  159. _customerAddress.backgroundColor = [UIColor clearColor];
  160. _customerAddress.textColor = [UIColor blackColor];
  161. _customerAddress.textAlignment = NSTextAlignmentLeft;
  162. _customerAddress.numberOfLines=0;
  163. _customerAddress.font =kTextFont;
  164. [self.contentView addSubview:_customerAddress];
  165. _customerAddress.text=customerAddress;
  166. }
  167. NSString *organizationName=[frame.unInstallationInfoModel organizationName];
  168. NSString *staffName=[frame.unInstallationInfoModel staffName];
  169. UILabel *lblTitleOrganization= [[UILabel alloc] initWithFrame:[frame lblOrganizationNameF]];
  170. lblTitleOrganization.backgroundColor = [UIColor clearColor];
  171. lblTitleOrganization.textColor = LabelGrayTextColor;
  172. lblTitleOrganization.text = @"业务部门:";
  173. lblTitleOrganization.font =kTextFont;
  174. lblTitleOrganization.textAlignment = NSTextAlignmentLeft;
  175. [self.contentView addSubview: lblTitleOrganization];
  176. if((organizationName!=nil&&organizationName.length>0)){
  177. _lblDepartment = [[UILabel alloc] initWithFrame:[frame organizationNameF]];
  178. _lblDepartment.backgroundColor = [UIColor clearColor];
  179. _lblDepartment.textColor = [UIColor blackColor];
  180. _lblDepartment.textAlignment = NSTextAlignmentLeft;
  181. _lblDepartment.numberOfLines=0;
  182. _lblDepartment.font =kTextFont;
  183. [self.contentView addSubview:_lblDepartment];
  184. _lblDepartment.text=organizationName;
  185. }
  186. UILabel *lblTitleStaff= [[UILabel alloc] initWithFrame:[frame lblStaffNameF]];
  187. lblTitleStaff.backgroundColor = [UIColor clearColor];
  188. lblTitleStaff.textColor = LabelGrayTextColor;
  189. lblTitleStaff.text = @"业 务 员:";
  190. lblTitleStaff.font =kTextFont;
  191. lblTitleStaff.textAlignment = NSTextAlignmentLeft;
  192. [self.contentView addSubview: lblTitleStaff];
  193. if(staffName!=nil&&staffName.length>0){
  194. _lblStaff = [[UILabel alloc] initWithFrame:[frame staffNameF]];
  195. _lblStaff.backgroundColor = [UIColor clearColor];
  196. _lblStaff.textColor = [UIColor blackColor];
  197. _lblStaff.textAlignment = NSTextAlignmentLeft;
  198. _lblStaff.numberOfLines=0;
  199. _lblStaff.font =kTextFont;
  200. [self.contentView addSubview:_lblStaff];
  201. _lblStaff.text=staffName;
  202. }
  203. }
  204. -(void)dialTelephone{
  205. if(_telephoneNumber!=nil&&_telephoneNumber.length>0)
  206. if([self.telephoneDelegate respondsToSelector:@selector(dialTelephone:)])
  207. {
  208. [self.telephoneDelegate dialTelephone:_telephoneNumber];
  209. }
  210. }
  211. @end