// // UnInstallationInfoCellTableViewCell.m // IBOSS // // Created by guan hong hou on 16/4/15. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved. // // 功能描述:安装未回执单元格类 #import "UnInstallationInfoTableViewCell.h" #import "DateFormat.h" #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize] #define kTitleFont [UIFont systemFontOfSize:14] @implementation UnInstallationInfoTableViewCell #pragma mark - 公共函数 /** 初始化单元格 @param style <#style description#> @param reuseIdentifier <#reuseIdentifier description#> @return <#return value description#> */ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.layer.cornerRadius =CornerRadius; self.layer.backgroundColor = [UIColor clearColor].CGColor; self.layer.masksToBounds=YES; } return self; } /** 单元格可点击 @param selected <#selected description#> @param animated <#animated description#> */ - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } #pragma mark - 私有函数 /** 设置安装未回执frame @param frame <#frame description#> */ - (void)setUnInstallationInfoFrame:(UnInstallationInfoFrame *)frame{ UILabel *installationNoLabelView = [[UILabel alloc] initWithFrame:[frame lblInstallationNoF]]; installationNoLabelView.backgroundColor = [UIColor clearColor]; installationNoLabelView.textColor = [UIColor blackColor]; installationNoLabelView.text = @"安装单号:"; installationNoLabelView.textAlignment = NSTextAlignmentLeft; installationNoLabelView.font = kTitleFont; [self.contentView addSubview: installationNoLabelView]; NSString *installationNoStr = [frame.unInstallationInfoModel installationNo]; if(installationNoStr != nil && installationNoStr.length > 0){ _installationNo = [[UILabel alloc] initWithFrame:[frame installationNoF]]; _installationNo.backgroundColor = [UIColor clearColor]; _installationNo.textColor = [UIColor blackColor]; _installationNo.textAlignment = NSTextAlignmentLeft; _installationNo.font = kTitleFont; [self.contentView addSubview: _installationNo]; _installationNo.text = installationNoStr; } _btnDialTelephone=[UIButton buttonWithType:UIButtonTypeCustom]; _btnDialTelephone.frame=[frame btnDialTelephoneF]; [self.contentView addSubview:_btnDialTelephone]; [_btnDialTelephone addTarget:self action:@selector(dialTelephone) forControlEvents:UIControlEventTouchUpInside]; UIImageView *telephoneImg = [[UIImageView alloc]init]; telephoneImg.frame=CGRectMake(0,0,32,32); [telephoneImg setImage:[UIImage imageNamed:@"dial_telephone"]]; telephoneImg.userInteractionEnabled=NO; [_btnDialTelephone addSubview:telephoneImg]; UIView *separator = [UIView new]; separator.frame = [frame separatorF]; separator.backgroundColor = LineBackgroundColor; [self.contentView addSubview:separator]; UILabel *arrangementNoLabelView = [[UILabel alloc] initWithFrame:[frame lblArrangementNoF]]; arrangementNoLabelView.backgroundColor = [UIColor clearColor]; arrangementNoLabelView.textColor = [UIColor blackColor]; arrangementNoLabelView.text = @"安排单号:"; arrangementNoLabelView.font = kTextFont; arrangementNoLabelView.textColor = LabelGrayTextColor; arrangementNoLabelView.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview:arrangementNoLabelView]; NSString *arrangementNoStr = [frame.unInstallationInfoModel arrangementNo]; if(arrangementNoStr != nil && arrangementNoStr.length > 0){ _arrangementNo= [[UILabel alloc] initWithFrame:[frame arrangementNoF]]; _arrangementNo.backgroundColor = [UIColor clearColor]; _arrangementNo.textColor = [UIColor blackColor]; _arrangementNo.textAlignment = NSTextAlignmentLeft; _arrangementNo.font = kTextFont; [self.contentView addSubview:_arrangementNo]; _arrangementNo.text=arrangementNoStr; } UILabel *lblcustomerName = [[UILabel alloc] initWithFrame:[frame lblCustomerNameF]]; lblcustomerName.backgroundColor = [UIColor clearColor]; lblcustomerName.textColor = [UIColor blackColor]; lblcustomerName.text = @"客户名称:"; lblcustomerName.textColor = LabelGrayTextColor; lblcustomerName.textAlignment = NSTextAlignmentLeft; lblcustomerName.font = kTextFont; [self.contentView addSubview:lblcustomerName]; NSString *customerNameStr = [frame.unInstallationInfoModel customerName]; if(customerNameStr != nil && customerNameStr.length > 0){ _customerName = [[UILabel alloc] initWithFrame:[frame customerNameF]]; _customerName.backgroundColor = [UIColor clearColor]; _customerName.textColor = [UIColor blackColor]; _customerName.textAlignment = NSTextAlignmentLeft; _customerName.font = kTextFont; [self.contentView addSubview:_customerName]; _customerName.text = customerNameStr; } UILabel *lblCustomerTelephone = [[UILabel alloc] initWithFrame:[frame lblCustomerTelephoneF]]; lblCustomerTelephone.backgroundColor = [UIColor clearColor]; lblCustomerTelephone.textColor = [UIColor blackColor]; lblCustomerTelephone.text = @"客户电话:"; lblCustomerTelephone.textAlignment = NSTextAlignmentLeft; lblCustomerTelephone.font = kTextFont; lblCustomerTelephone.textColor = LabelGrayTextColor; [self.contentView addSubview:lblCustomerTelephone]; NSString *customerTelephone = [frame.unInstallationInfoModel telephone]; _telephoneNumber=customerTelephone; if(customerTelephone != nil&&customerTelephone.length > 0){ _telephone = [[UILabel alloc] initWithFrame:[frame customerTelephoneF]]; _telephone.backgroundColor = [UIColor clearColor]; _telephone.textColor = [UIColor blackColor]; _telephone.textAlignment = NSTextAlignmentLeft; _telephone.font = kTextFont; [self.contentView addSubview:_telephone]; _telephone.text = customerTelephone; } UILabel *lblInstallationDate = [[UILabel alloc] initWithFrame:[frame lblInstallationDateF]]; lblInstallationDate.backgroundColor = [UIColor clearColor]; lblInstallationDate.textColor = LabelGrayTextColor; lblInstallationDate.text = @"安装日期:"; lblInstallationDate.textColor = LabelGrayTextColor; lblInstallationDate.textAlignment = NSTextAlignmentLeft; lblInstallationDate.font = kTextFont; [self.contentView addSubview:lblInstallationDate]; NSString *installationDateStr = [frame.unInstallationInfoModel installationDate]; installationDateStr = [DateFormat dateFormatSplit:installationDateStr]; if(installationDateStr != nil && installationDateStr.length > 0){ _installationDate = [[UILabel alloc] initWithFrame:[frame installationDateF]]; _installationDate.backgroundColor = [UIColor clearColor]; _installationDate.textColor = [UIColor blackColor]; _installationDate.textAlignment = NSTextAlignmentLeft; _installationDate.font =kTextFont; [self.contentView addSubview:_installationDate]; _installationDate.text=installationDateStr; } UILabel *lblCustomerAddress = [[UILabel alloc] initWithFrame:[frame lblCustomerAddressF]]; lblCustomerAddress.backgroundColor = [UIColor clearColor]; lblCustomerAddress.textColor = [UIColor blackColor]; lblCustomerAddress.text = @"客户地址:"; lblCustomerAddress.font = kTextFont; lblCustomerAddress.textColor = LabelGrayTextColor; lblCustomerAddress.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview: lblCustomerAddress]; NSString *customerAddress = [frame.unInstallationInfoModel customerAddress]; if(customerAddress != nil&&customerAddress.length > 0){ _customerAddress = [[UILabel alloc] initWithFrame:[frame customerAddressF]]; _customerAddress.backgroundColor = [UIColor clearColor]; _customerAddress.textColor = [UIColor blackColor]; _customerAddress.textAlignment = NSTextAlignmentLeft; _customerAddress.numberOfLines=0; _customerAddress.font =kTextFont; [self.contentView addSubview:_customerAddress]; _customerAddress.text=customerAddress; } NSString *organizationName=[frame.unInstallationInfoModel organizationName]; NSString *staffName=[frame.unInstallationInfoModel staffName]; UILabel *lblTitleOrganization= [[UILabel alloc] initWithFrame:[frame lblOrganizationNameF]]; lblTitleOrganization.backgroundColor = [UIColor clearColor]; lblTitleOrganization.textColor = LabelGrayTextColor; lblTitleOrganization.text = @"业务部门:"; lblTitleOrganization.font =kTextFont; lblTitleOrganization.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview: lblTitleOrganization]; if((organizationName!=nil&&organizationName.length>0)){ _lblDepartment = [[UILabel alloc] initWithFrame:[frame organizationNameF]]; _lblDepartment.backgroundColor = [UIColor clearColor]; _lblDepartment.textColor = [UIColor blackColor]; _lblDepartment.textAlignment = NSTextAlignmentLeft; _lblDepartment.numberOfLines=0; _lblDepartment.font =kTextFont; [self.contentView addSubview:_lblDepartment]; _lblDepartment.text=organizationName; } UILabel *lblTitleStaff= [[UILabel alloc] initWithFrame:[frame lblStaffNameF]]; lblTitleStaff.backgroundColor = [UIColor clearColor]; lblTitleStaff.textColor = LabelGrayTextColor; lblTitleStaff.text = @"业 务 员:"; lblTitleStaff.font =kTextFont; lblTitleStaff.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview: lblTitleStaff]; if(staffName!=nil&&staffName.length>0){ _lblStaff = [[UILabel alloc] initWithFrame:[frame staffNameF]]; _lblStaff.backgroundColor = [UIColor clearColor]; _lblStaff.textColor = [UIColor blackColor]; _lblStaff.textAlignment = NSTextAlignmentLeft; _lblStaff.numberOfLines=0; _lblStaff.font =kTextFont; [self.contentView addSubview:_lblStaff]; _lblStaff.text=staffName; } } -(void)dialTelephone{ if(_telephoneNumber!=nil&&_telephoneNumber.length>0) if([self.telephoneDelegate respondsToSelector:@selector(dialTelephone:)]) { [self.telephoneDelegate dialTelephone:_telephoneNumber]; } } @end