//
//  SetCompanyDepartmentTableViewCell.swift
//  MobilePortal
//
//  Created by xiejiangbo on 2019/4/1.
//  Copyright © 2019 yin chen. All rights reserved.
//

import UIKit

class SetCompanyDepartmentTableViewCell: BaseTableViewCell {

    var xinfo = SetCompanyDepartmentTableViewCellModel()
    
    lazy var tagesLabel: UILabel = {
        let tagesLabel = UILabel.init()
        tagesLabel.font = UIFont.systemFont(ofSize: 16*WHIDTH_RATIO())
        tagesLabel.textAlignment = .left
        tagesLabel.textColor = blackTitleColor
        return tagesLabel
    }()
    lazy var companyNameLabel: UILabel = {
        let companyNameLabel = UILabel.init()
        companyNameLabel.font = UIFont.systemFont(ofSize: 16*WHIDTH_RATIO())
        companyNameLabel.textAlignment = .left
        companyNameLabel.textColor = titleColor
        //        companyNameLabel.backgroundColor = UIColor.red
        companyNameLabel.numberOfLines = 0
        return companyNameLabel
    }()
    lazy var departmentNameLabel: UILabel = {
        let departmentNameLabel = UILabel.init()
        departmentNameLabel.font = UIFont.systemFont(ofSize: 16*WHIDTH_RATIO())
        departmentNameLabel.textAlignment = .left
        departmentNameLabel.textColor = titleColor
        //        departmentNameLabel.backgroundColor = UIColor.red
        departmentNameLabel.numberOfLines = 0
        return departmentNameLabel
    }()
    override func awakeFromNib() {
        super.awakeFromNib()
        self .addSubview(tagesLabel)
        self .addSubview(companyNameLabel)
        self .addSubview(departmentNameLabel)
    }
    override func configurateTheCell(_ info: BaseCellModel) {
        xinfo = info as! SetCompanyDepartmentTableViewCellModel
        tagesLabel.frame = CGRect(x:10, y: 5, width:SCREEN_WHIDTH()-20 , height:17 )
        companyNameLabel.frame = CGRect(x:10, y: tagesLabel.originY+tagesLabel.height+2, width:(SCREEN_WHIDTH()-25)/2 , height:getTextHeigh(textStr: xinfo.companyName!, font: UIFont.systemFont(ofSize: 17*WHIDTH_RATIO()), width: (SCREEN_WHIDTH()-25)/2) )
        let departmentNameLabelH = getTextHeigh(textStr: xinfo.departmentName!, font: UIFont.systemFont(ofSize: 17*WHIDTH_RATIO()), width: (SCREEN_WHIDTH()-25)/2)
        departmentNameLabel.frame = CGRect(x:SCREEN_WHIDTH()/2, y: tagesLabel.originY+tagesLabel.height+2, width:(SCREEN_WHIDTH()-25)/2 , height:departmentNameLabelH )
        tagesLabel.text = xinfo.tages!
        companyNameLabel.text = xinfo.companyName
        departmentNameLabel.text = xinfo.departmentName
    }
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        if selected {
            self.xinfo.block()
        }
    }

}
class SetCompanyDepartmentTableViewCellModel: BaseCellModel {
    var block:selectBlock!
    var tages:String?
    var companyName:String?
    var departmentName:String?
    var partyOpcode:String?
    var selecCompanyUserid:String?
    
}
