//
//  CompanyListTableViewCell.swift
//  MobilePortal
//
//  Created by xiejiangbo on 2019/3/28.
//  Copyright © 2019 yin chen. All rights reserved.
//

import UIKit

class CompanyListTableViewCell: BaseTableViewCell {
 
    var infoModel = CompanyListTableViewCellModel()
    var block:passParameterBlock!
    lazy var valueLable: UILabel = {
        let valueLable = UILabel.init()
        valueLable.font = UIFont.systemFont(ofSize: 15*WHIDTH_RATIO())
        valueLable.textAlignment = .left
        valueLable.textColor = titleColor
        valueLable.numberOfLines = 0
        return valueLable
    }()
    override func awakeFromNib() {
        super.awakeFromNib()
        self.separatorInset=UIEdgeInsetsMake(0, 10, 0, 0)
        self.addSubview(valueLable)
    }
    override func configurateTheCell(_ xinfo: BaseCellModel) {
        self.infoModel = xinfo as! CompanyListTableViewCellModel
        valueLable.frame = CGRect(x:10, y: 0, width:self.width-15 , height:self.height )
        self.valueLable.text = self.infoModel.titleValue
        self.valueLable.textColor = titleColor
        self.block = self.infoModel.block
        if infoModel.titleValue == AccountInfo.sharedInstance().selecCompanyName && infoModel.selecCompanyUserid == AccountInfo.sharedInstance().sysUserId{
            valueLable.textColor = statusBarColor
//            self.block(self.infoModel as AnyObject)
            return
        }
        if infoModel.titleValue == AccountInfo.sharedInstance().selecDepartmentName{
            valueLable.textColor = statusBarColor
        }
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        if selected == true {
            self.block(self.infoModel as AnyObject)
        }
    }
}
class CompanyListTableViewCellModel: BaseCellModel {
    var titleValue:String?
    var block:passParameterBlock!
    var isShowSelec = true
    var companyname:String?
    var companyid:String?
    var selecCompanyUserid:String?
    
}
