| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- //
- // SingleProfitAnalyzeListSearchCell.m
- // IBOSS
- //
- // Created by 关宏厚 on 2019/4/11.
- // Copyright © 2019 elongtian. All rights reserved.
- //
- #import "SingleProfitAnalyzeListSearchCell.h"
- #import "CustomerAchievementTextVC.h"
- @implementation SingleProfitAnalyzeListSearchCell
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- }
- /**
- 单元格高度
- @return <#return value description#>
- */
- - (CGFloat)cellHeight {
- return 364.0f;
- }
- - (IBAction)clickSalesOrderAction:(id)sender {
- [self selectOrder:_btnSalesOrder];
- }
- - (IBAction)clickSalesSlipAction:(id)sender {
- [self selectOrder:_btnSalesSlip];
- }
- /**
- 初始化布局
- */
- - (void)initUI {
- self.btnSalesOrder.layer.borderWidth = 0.5;
- self.btnSalesOrder.layer.cornerRadius = 5;
- self.btnSalesOrder.tag = 6;
- self.btnSalesOrder.layer.borderColor = [NavBarUnEnbleItemColor CGColor];
- [ self.btnSalesOrder setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
-
- self.btnSalesSlip.layer.borderWidth = 0.5;
- self.btnSalesSlip.layer.cornerRadius = 5;
- self.btnSalesSlip.tag = 7;
- self.btnSalesSlip.layer.borderColor = [NavBarUnEnbleItemColor CGColor];
- [self.btnSalesSlip setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
- [self selectOrder:_btnSalesSlip];
- [self updateModel];
-
- }
- /**
- 更新model
- */
- - (void)updateModel{
- SingleProfitAnalyseSearchModel *model = [[SingleProfitAnalyseSearchModel alloc] init];
- model.organizationCode =_organizationCode;
- model.startDate = _sAccountStartDate;
- model.endDate = _sAccountEndDate;
- model.businessType = [NSString stringWithFormat:@"%ld",(long)_selectLable.tag];
-
- NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
- [mutDict setValue:model forKey:SINGLE_PROFIT_ANALYSE_SEARCH_MODEL];
- _regionModel.customDict = [mutDict copy];
- }
- /**
- 加载tableviewcell
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
- SingleProfitAnalyzeListSearchCell *cell = [[NSBundle mainBundle] loadNibNamed:@"SingleProfitAnalyzeListSearchCell" owner:nil options:nil][0];
- return cell;
- }
- /**
- 切换排序
-
- @param lab <#lab description#>
- */
- - (void)selectOrder: (UIButton *) lab {
- if(_selectLable == lab){
- return;
- }else{
- _selectLable.layer.borderColor = [NavBarUnEnbleItemColor CGColor];
- [_selectLable setTitleColor:NavBarUnEnbleItemColor forState:UIControlStateNormal];
-
- _selectLable = lab;
- _selectLable.layer.borderColor = [[UIColor redColor] CGColor];
- [_selectLable setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
- [self updateModel];
- }
- }
- /**
- 更新model
- 关宏厚2017-7-6
- @param model <#model description#>
- @param indexPath <#indexPath description#>
- */
- - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model indexPath:(NSIndexPath *)indexPath{
- self.regionModel = *model;
- [self initUI];
- NSString *startDateStr = [DateFormat getDateBefore:31];
- NSString *endDateStr = [DateFormat getCurrentDate];
- [_btnStartDate setTitle:startDateStr forState:UIControlStateNormal];
- _sAccountStartDate= _btnStartDate.titleLabel.text;
- [_btnEndDate setTitle:endDateStr forState:UIControlStateNormal];
- _sAccountEndDate =_btnEndDate.titleLabel.text;
- [self updateModel];
- }
- /**
- Identifier
- @return <#return value description#>
- */
- + (NSString *)cellReuseIdentifier {
-
- return @"SingleProfitAnalyzeListSearchCell";
- }
- /**
- 业务部门
-
- @param Amodel <#Amodel description#>
- @param cr <#cr description#>
- */
- - (void)achiementData:(AchiementDepartmentInfoModel *)Amodel CustomerReport:(CustomerReport)cr{
- //返回值
- if(cr == ReportAchiementDepartmt){
- _organizationCode=Amodel.organizationCode;
- [self.btnDepartment setTitle:Amodel.organizationName forState:UIControlStateNormal];
- }
-
- [self updateModel];
- }
- - (IBAction)clickDepartmentAction:(id)sender {
- CustomerAchievementTextVC *tc = [[CustomerAchievementTextVC alloc ]init];
- tc.cDelegate = self;
- tc.flag = YES;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag=ReportAchiementDepartmt;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- - (IBAction)clickStartDateAction:(id)sender {
- __weak typeof(self) weakself=self;
- _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_dealDatePicker configureSelectionBlock:^(NSString *date){
- self->_tempAccountStartDate=date;
- } andCompletionBlock:^(void){
- weakself.sAccountStartDate = self->_tempAccountStartDate;
- [weakself.btnStartDate setTitle: weakself.sAccountStartDate forState:UIControlStateNormal];
- [self updateModel];
- } andCancelBlock:^(void){
-
- }];
- [_dealDatePicker show];
- }
- - (IBAction)clickEndDateAction:(id)sender {
- __weak typeof(self) weakself=self;
- _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_dealDatePicker configureSelectionBlock:^(NSString *date){
- self->_tempAccountEndDate=date;
- } andCompletionBlock:^(void){
- weakself.sAccountEndDate = self->_tempAccountEndDate;
- [weakself.btnEndDate setTitle:weakself.sAccountEndDate forState:UIControlStateNormal];
- [self updateModel];
- }
- andCancelBlock:^(void){
-
- }];
- [_dealDatePicker show];
- }
- /**
- 重置按钮 事件
- */
- - (void)resetData {
-
- [_btnDepartment setTitle:@"请选择业务部门" forState:UIControlStateNormal];
- _organizationCode = @"";
- [_btnStartDate setTitle:@"请选择开始日期" forState:UIControlStateNormal];
- _sAccountStartDate = @"";
- [_btnEndDate setTitle:@"请选择结束日期" forState:UIControlStateNormal];
- _sAccountEndDate= @"";
-
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- }
- @end
|