| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- //
- // RequirementNoReceiptSearchCell.m
- // IBOSSHSH
- //
- // Created by ssl on 2018/1/12.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "DispatchNoReceiptSearchCell.h"
- #import "DateFormat.h"
- #import "UIColor+hexColor.h"
- #import "SideSlipConfig.h"
- @implementation DispatchNoReceiptSearchCell
- static DispatchNoReceiptSearchCell* searchCell;
- #pragma 公有函数
- /**
- 加载xib
- */
- - (void)awakeFromNib {
- [super awakeFromNib];
- }
- #pragma 委托函数
- /**
- 单元格高度
- @return <#return value description#>
- */
- - (CGFloat)cellHeight {
- return 532.0f;
- }
- /**
- 加载tableviewcell
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
- DispatchNoReceiptSearchCell *cell = [[NSBundle mainBundle] loadNibNamed:@"DispatchNoReceiptSearchCell" owner:nil options:nil][0];
- cell.txtDispatchArrangementNo.delegate=cell;
- cell.txtTelephone.delegate=cell;
- cell.txtDispatchCustomerName.delegate=cell;
- searchCell = cell;
- [cell configureKeyboard];
- return cell;
- }
- /**
- 文本框编辑
-
- @param textField <#textField description#>
- */
- - (void)textFieldDidEndEditing:(UITextField *)textField {
- _dispatchSearchModel.customerName= [_txtDispatchCustomerName.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- _dispatchSearchModel.customerTelephone = [_txtTelephone.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- _dispatchSearchModel.arrangementNo=[_txtDispatchArrangementNo.text stringByReplacingOccurrencesOfString:@" " withString:@""];
-
- [_multDict setValue:_dispatchSearchModel forKey:SEARCH_RANGE_MODEL];
- _dispatchSlideModel.customDict = _multDict;
- }
- /**
- 初始化cell数据
-
- @param model <#model description#>
- @param indexPath <#indexPath description#>
- */
- - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model
- indexPath:(NSIndexPath *)indexPath {
- _dispatchSlideModel = *model;
- _dispatchSearchModel = [DispatchNoReceiptSearchModel new];
- [_multDict setValue:_dispatchSearchModel forKey:SEARCH_RANGE_MODEL];
- _dispatchSlideModel.customDict = _multDict;
- _multDict = [NSMutableDictionary dictionaryWithDictionary:_dispatchSlideModel.customDict];
-
- }
- /**
- 重置按钮 事件
- */
- - (void)resetData {
-
- [_txtDispatchArrangementNo setText:@""];
- [_txtTelephone setText:@""];
- [_btnDispatchStartDate setTitle:@"请选择回执开始日期" forState:UIControlStateNormal];
- [_btnDispatchEndDate setTitle:@"请选择回执结束日期" forState:UIControlStateNormal];
- [_txtDispatchCustomerName setText:@""];
- _dispatchSearchModel.customerTelephone= @"";
- _dispatchSearchModel.startDate =@"";
- _dispatchSearchModel.endDate=@"";
- _dispatchSearchModel.customerName=@"";
- _dispatchSearchModel.arrangementNo=@"";
- [_multDict setValue:_dispatchSearchModel forKey:SEARCH_RANGE_MODEL];
- _dispatchSlideModel.customDict = _multDict;
- }
- /**
- 返回tableviewcell标识
-
- @return <#return value description#>
- */
- + (NSString *)cellReuseIdentifier {
- return @"SearchTableViewCell";
- }
- /**
- 校验文本
-
- @param textField <#textField description#>
- @param range <#range description#>
- @param string <#string description#>
- @return <#return value description#>
- */
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
-
- return YES;
- }
- /**
- 触摸事件
-
- @param touches <#touches description#>
- @param event <#event description#>
- */
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
- [self hideKey];
- [_txtDispatchCustomerName resignFirstResponder];
- [_txtTelephone resignFirstResponder];
- [_txtDispatchArrangementNo resignFirstResponder];
-
- }
- #pragma 私有函数
- /**
- 开始日期点击监听器
- @param sender <#sender description#>
- */
- - (IBAction)startDateAction:(id)sender {
- _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_brDatePicker configureSelectionBlock:^(NSString *date){
- _dispatchStartDate=date;
-
- } andCompletionBlock:^(void){
- [_dispatchSearchModel setStartDate:_dispatchStartDate];
- [_multDict setValue:_dispatchSearchModel forKey:SEARCH_RANGE_MODEL];
-
- _dispatchSlideModel.customDict =_multDict;
- [_btnDispatchStartDate setTitle:_dispatchStartDate forState:UIControlStateNormal];
- } andCancelBlock:^(void){
- _dispatchStartDate=_btnDispatchStartDate.titleLabel.text;
-
- }];
- [_brDatePicker show];
- }
- /**
- 结束日期点击监听器
- @param sender <#sender description#>
- */
- - (IBAction)endDateAction:(id)sender {
- _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_brDatePicker configureSelectionBlock:^(NSString *date){
- _dispatchEndDate=date;
-
- } andCompletionBlock:^(void){
- [_dispatchSearchModel setEndDate:_dispatchEndDate];
- [_multDict setValue:_dispatchSearchModel forKey:SEARCH_RANGE_MODEL];
- _dispatchSlideModel.customDict = _multDict;
- [_btnDispatchEndDate setTitle:_dispatchEndDate forState:UIControlStateNormal];
- } andCancelBlock:^(void){
- _dispatchEndDate=_btnDispatchEndDate.titleLabel.text;
-
- }];
- [_brDatePicker show];
- }
- /**
- 键盘配置
- */
- - (void)configureKeyboard {
- UIView *keyBoardAccessoryView = [self createKeyBoardAccessoryView];
- _txtDispatchCustomerName.inputAccessoryView = keyBoardAccessoryView;
- _txtTelephone.inputAccessoryView=keyBoardAccessoryView;
- _txtDispatchCustomerName.inputAccessoryView=keyBoardAccessoryView;
- }
- /**
- 文本编辑时候 弹出取消完成按钮
- @return <#return value description#>
- */
- - (UIView *)createKeyBoardAccessoryView {
- UIView *keyBoardAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, ACCESSORY_VIEW_HEIGHT)];
- [keyBoardAccessoryView setBackgroundColor:[UIColor hexColor:@"e1e1e1"]];
- UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(ACCESSORY_BUTTON_LEADING_TRAILING, 0, ACCESSORY_BUTTON_WIDTH, ACCESSORY_VIEW_HEIGHT)];
- [backButton setTitle:@"取消" forState:UIControlStateNormal];
- [backButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
- [backButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [backButton addTarget:self action:@selector(accessoryButtonBack) forControlEvents:UIControlEventTouchUpInside];
- UIButton *doneButton = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width - ACCESSORY_BUTTON_LEADING_TRAILING - ACCESSORY_BUTTON_WIDTH, 0, ACCESSORY_BUTTON_WIDTH, ACCESSORY_VIEW_HEIGHT)];
- [doneButton setTitle:@"完成" forState:UIControlStateNormal];
- [doneButton setTitleColor:[UIColor hexColor:FILTER_RED_STRING] forState:UIControlStateNormal];
- [doneButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [doneButton addTarget:self action:@selector(accessoryButtonDone) forControlEvents:UIControlEventTouchUpInside];
- [keyBoardAccessoryView addSubview:backButton];
- [keyBoardAccessoryView addSubview:doneButton];
- return keyBoardAccessoryView;
- }
- /**
- 取消文本
- */
- - (void)accessoryButtonBack {
- [self hideKey];}
- /**
- 确定文本
- */
- - (void)accessoryButtonDone {
- [_txtDispatchCustomerName resignFirstResponder];
- [_txtTelephone resignFirstResponder];
- [_txtDispatchArrangementNo resignFirstResponder];
- [self hideKey];
- }
- /**
- * 隐藏键盘
- */
- - (void)hideKey
- {
- [self.contentView endEditing:YES];
- }
- @end
|