| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- //
- // OrderSalesApproveSearchCell.m
- // IBOSS
- //
- // Created by 关宏厚 on 2019/4/12.
- // Copyright © 2019 elongtian. All rights reserved.
- //
- #import "OrderSalesApproveSearchCell.h"
- #import "StatusInfo.h"
- @implementation OrderSalesApproveSearchCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- }
- /**
- 单元格高度
- @return <#return value description#>
- */
- - (CGFloat)cellHeight {
- return 955.0f;
- }
- /**
- 加载tableviewcell
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
- OrderSalesApproveSearchCell *cell = [[NSBundle mainBundle] loadNibNamed:@"OrderSalesApproveSearchCell" owner:nil options:nil][0];
- cell.txtInvoiceNo.delegate = cell;
- cell.txtCustomerCode.delegate=cell;
- cell.txtCustomerName.delegate=cell;
- cell.txtCustomerAddress.delegate=cell;
- [cell configureKeyboard];
- return cell;
- }
- /**
- 键盘配置
- */
- - (void)configureKeyboard {
- UIView *keyBoardAccessoryView = [self createKeyBoardAccessoryView];
- _txtInvoiceNo.inputAccessoryView = keyBoardAccessoryView;
- _txtApprover.inputAccessoryView=keyBoardAccessoryView;
- _txtCustomerCode.inputAccessoryView = keyBoardAccessoryView;
- _txtCustomerName.inputAccessoryView = keyBoardAccessoryView;
- _txtCustomerAddress.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 {
- [_txtInvoiceNo resignFirstResponder];
- [_txtApprover resignFirstResponder];
- [_txtCustomerCode resignFirstResponder];
- [_txtCustomerName resignFirstResponder];
- [_txtCustomerAddress resignFirstResponder];
- [self hideKey];
- }
- /**
- * 隐藏键盘
- */
- - (void)hideKey
- {
- [self.contentView endEditing:YES];
- }
- - (IBAction)clickStaffAction:(id)sender {
- CustomerAchievementTextVC *tc = [[CustomerAchievementTextVC alloc ]init];
- tc.cDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag=ReportAchiementmn;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
-
- }
- /**
- 更新model
- 关宏厚2017-7-6
- @param model <#model description#>
- @param indexPath <#indexPath description#>
- */
- - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model indexPath:(NSIndexPath *)indexPath{
- self.regionModel = *model;
- NSString *startDateStr = [DateFormat getDateBefore:31];
- NSString *endDateStr = [DateFormat getCurrentDate];
- [_btnStartDate setTitle:startDateStr forState:UIControlStateNormal];
- _sStartDate= _btnStartDate.titleLabel.text;
- [_btnEndDate setTitle:endDateStr forState:UIControlStateNormal];
- _sEndDate =_btnEndDate.titleLabel.text;
- [self updateModel];
- }
- /**
- Identifier
- @return <#return value description#>
- */
- + (NSString *)cellReuseIdentifier {
-
- return @"OrderSalesApproveSearchCell";
- }
- - (IBAction)clickInvoiceTypeAction:(id)sender
- {
- [self initStatus];
- _flag=@"invoiceType";
- StatusInfoTextVC *tc = [[StatusInfoTextVC alloc] init];
- tc.sdelegate=self;
- tc.isPresentViewFlag=YES;
- [tc.arrFilter addObjectsFromArray: _invoiceTypeList];
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- /**
- 重置按钮 事件
- */
- - (void)resetData {
- _txtInvoiceNo.text=@"";
- _txtApprover.text=@"";
- _txtCustomerCode.text=@"";
- _txtCustomerName.text=@"";
- _txtCustomerAddress.text=@"";
- [_btnInvoiceType setTitle:@"请选择业务类型" forState:UIControlStateNormal];
- _invoiceType=@"0";
- [_btnApproveResult setTitle:@"请选择审批结果" forState:UIControlStateNormal];
- _approveResult=@"2";
- [_btnDepartment setTitle:@"请选择业务部门" forState:UIControlStateNormal];
- _organizationCode = @"";
- [_btnStartDate setTitle:@"请选择开始日期" forState:UIControlStateNormal];
- _sStartDate = @"";
- [_btnEndDate setTitle:@"请选择结束日期" forState:UIControlStateNormal];
- _sEndDate= @"";
-
- [_btnStaff setTitle:@"请选择业务员" forState:UIControlStateNormal];
- _staffId=@"";
- }
- /**
- 回调状态
-
- @param s <#s description#>
- */
- - (void)showStatusValue:(StatusInfo *)s{
- if([_flag isEqualToString:@"invoiceType"]){
- _invoiceType=s.statusId;
- [_btnInvoiceType setTitle:s.name forState:UIControlStateNormal];
- [self updateModel];
- }
- else if([_flag isEqualToString:@"approveResult"])
- {
- _approveResult=s.statusId;
- [_btnApproveResult setTitle:s.name forState:UIControlStateNormal];
- [self updateModel];
- }
-
- }
- /**
- 业务部门
-
- @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];
- }
-
- // 业务员
- if(cr == ReportAchiementmn){
- _staffId = Amodel.staffId;
- [self.btnStaff setTitle:Amodel.staffName forState:UIControlStateNormal];
- }
-
- [self updateModel];
- }
- - (IBAction)clickApproveResultAction:(id)sender {
- _flag=@"approveResult";
- [self initApproveList];
- StatusInfoTextVC *tc = [[StatusInfoTextVC alloc] init];
- tc.sdelegate=self;
- tc.isPresentViewFlag=YES;
- [tc.arrFilter addObjectsFromArray: _approveResultList];
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
-
-
- }
- - (IBAction)clickApproveStartDateAction:(id)sender {
-
- __weak typeof(self) weakself=self;
- _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_dealDatePicker configureSelectionBlock:^(NSString *date){
- self->_tempStartDate=date;
- } andCompletionBlock:^(void){
- weakself.sStartDate = self->_tempStartDate;
- [weakself.btnStartDate setTitle: weakself.sStartDate forState:UIControlStateNormal];
- [self updateModel];
- } andCancelBlock:^(void){
-
- }];
- [_dealDatePicker show];
-
- }
- - (IBAction)clickApproveEndDateAction:(id)sender {
- __weak typeof(self) weakself=self;
- _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_dealDatePicker configureSelectionBlock:^(NSString *date){
- self->_tempEndDate=date;
- } andCompletionBlock:^(void){
- weakself.sEndDate = self->_tempEndDate;
- [weakself.btnEndDate setTitle:weakself.sEndDate forState:UIControlStateNormal];
- [self updateModel];
- }
- andCancelBlock:^(void){
-
- }];
- [_dealDatePicker show];
-
- }
- - (IBAction)clickDepartmentAction:(id)sender {
- CustomerAchievementTextVC *tc = [[CustomerAchievementTextVC alloc ]init];
- tc.cDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.flag = YES;
- tc.showDialogViewTag=ReportAchiementDepartmt;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- /**
- 触摸事件
-
- @param touches <#touches description#>
- @param event <#event description#>
- */
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
- [self hideKey];
- [_txtInvoiceNo resignFirstResponder];
- [_txtApprover resignFirstResponder];
- [_txtCustomerCode resignFirstResponder];
- [_txtCustomerName resignFirstResponder];
- [_txtCustomerAddress resignFirstResponder];
-
- }
- /**
- 长度
-
- @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 textField <#textField description#>
- */
- - (void)textFieldDidEndEditing:(UITextField *)textField {
- [self updateModel];
- }
- /**
- 更新model
- */
- - (void)updateModel{
- OrderSalesApproveSearchModel *model = [[OrderSalesApproveSearchModel alloc] init];
- model.invoiceNo =[_txtInvoiceNo.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- model.reviewerName=[_txtApprover.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- model.customerCode=[_txtCustomerCode.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- model.customerName=[_txtCustomerName.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- model.customerAddress=[_txtCustomerAddress.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- model.startDate = _sStartDate;
- model.endDate = _sEndDate;
- model.invoiceType=_invoiceType;
- model.organizationCode=_organizationCode;
- model.approveResult=_approveResult;
- model.staffId=_staffId;
-
- NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
- [mutDict setValue:model forKey:Order_SALES_APPROVE_SEARCH_MODEL];
- _regionModel.customDict = [mutDict copy];
- }
- /**
- 单据类型数据源
- */
- - (void)initStatus{
- _invoiceTypeList = [[NSMutableArray alloc]init];
-
- StatusInfo* s = [[StatusInfo alloc]init];
- s.statusId = @"0";
- s.name = @"全部";
- [_invoiceTypeList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"1";
- s.name = @"销售订单";
- [_invoiceTypeList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"2";
- s.name = @"订单存定金";
- [_invoiceTypeList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"3";
- s.name = @"订单取定金";
- [_invoiceTypeList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"5";
- s.name = @"销售单";
- [_invoiceTypeList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"6";
- s.name = @"订单申请";
- [_invoiceTypeList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"7";
- s.name = @"订单占库";
- [_invoiceTypeList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"8";
- s.name = @"退货登记";
- [_invoiceTypeList addObject:s];
-
- }
- -(void)initApproveList
- {
- _approveResultList=[[NSMutableArray alloc]init];
- StatusInfo* s = [[StatusInfo alloc]init];
- s.statusId = @"2";
- s.name = @"全部";
- [_approveResultList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"0";
- s.name = @"审批未通过";
- [_approveResultList addObject:s];
-
- s = [[StatusInfo alloc]init];
- s.statusId = @"1";
- s.name = @"审批通过";
- [_approveResultList addObject:s];
-
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- }
- @end
|