BusinessViewController.m 8.96 KB
Newer Older
mei's avatar
mei committed
1 2 3 4 5 6 7 8 9 10
//
//  BusinessViewController.m
//  XFFruit
//
//  Created by mac on 15/8/13.
//  Copyright (c) 2015年 Xummer. All rights reserved.
//

#import "BusinessViewController.h"

朱朝吉's avatar
朱朝吉 committed
11 12 13 14 15 16 17 18 19 20
#import "ICRTaskListViewController.h"
#import "ICRPatrolPlanViewController.h"
#import "ICRStoreListViewController.h"
#import "ICRStoreDetailViewController.h"
#import "ICRAnnouncementViewController.h"

#import "NewSurveyViewController.h"
#import "SurveyViewController.h"
#import "AddWorkSheetViewController.h"

mei's avatar
mei committed
21 22 23 24
#import "ICRFunctionBaseView.h"
#import "ICRFunctionEntity.h"
#import "ICRFunctionBaseView.h"

朱朝吉's avatar
朱朝吉 committed
25 26 27
#import "NewPurchaseNoticeViewController.h"
#import "SeePurchaseNoticeViewController.h"

陈俊俊's avatar
陈俊俊 committed
28 29 30 31

#import "NewPurchaseViewController.h"
#import "PurchaseViewController.h"

mei's avatar
mei committed
32
@interface BusinessViewController ()<ICRFunctionBaseViewDelegate>
mei's avatar
mei committed
33 34 35 36 37 38 39

@end

@implementation BusinessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
mei's avatar
mei committed
40 41
//    [self initView];
    [self setupSubviews];
mei's avatar
mei committed
42 43 44 45 46 47
    // Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
mei's avatar
mei committed
48 49 50 51 52 53 54 55 56 57 58
-(void)setupSubviews
{
    NSMutableArray *arrFunctionEntities = [NSMutableArray array];
    
    NSArray *functionImageNames = @[ @"AnnouncementIcon",@"create_surver",@"watch_surver",@"create_surver_result",@"create_needs",@"watch_needs",@"create_purchase",@"watch_purchase",@"review_purchase",@"create_transport",@"watch_transort",@"create_process"];
    NSArray *fuctionNames = @[ [IBTCommon localizableString:@"Announcement"],
                               [IBTCommon localizableString:@"AddSurvey"],
                               [IBTCommon localizableString:@"Survey"],
                               [IBTCommon localizableString:@"Survey1"],
                               [IBTCommon localizableString:@"Survey2"],
                               [IBTCommon localizableString:@"Survey3"],
n22's avatar
n22 committed
59 60
                               [IBTCommon localizableString:@"AddPurchase"],
                               [IBTCommon localizableString:@"Purchase"],
mei's avatar
mei committed
61 62 63 64
                               [IBTCommon localizableString:@"Survey6"],
                               [IBTCommon localizableString:@"Survey7"],
                               [IBTCommon localizableString:@"Survey8"],[IBTCommon localizableString:@"Survey9"],
                               ];
朱朝吉's avatar
朱朝吉 committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    NSArray *functionTags = @[ @(kFunctionNotice),
                               //公告
                               @(kFunctionNewSurvey),
                               //新建行情调研
                               @(kFunctionSeeSurvey),
                               //查看行情调研
                               @(kFunctionFeeBackSurvey),
                               //填写行情反馈
                               @(kFunctionNewPurchaseNotice),
                               //新建采购通知
                               @(kFunctionSeePurchaseNotice),
                               //查看采购通知
                               @(kFunctionNewPurchase),
                               //新建采购单
                               @(kFunctionSeePurchase),
                               //查看采购单
freecui's avatar
freecui committed
81
                               @(kFunctionExaminePurchase),
朱朝吉's avatar
朱朝吉 committed
82 83 84 85 86 87 88
                               //审核采购单
                               @(kFunctionNewShipment),
                               //新建发运单
                               @(kFunctionSeeShipment),
                               //查看发运单
                               @(kFunctionNewProcessing)];
                               //新建加工单
mei's avatar
mei committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    
    int i = 0;
    for (NSString *functionName in fuctionNames) {
        ICRFunctionEntity *funtionEntity = [[ICRFunctionEntity alloc] init];
        funtionEntity.functionName = functionName;
        funtionEntity.iconName = [functionImageNames objectAtIndex:i];
        funtionEntity.functionItemTag = [[functionTags objectAtIndex:i] integerValue];
        [arrFunctionEntities addObject:funtionEntity];
        i ++;
    }
    
    ICRFunctionBaseView *baseView = [ICRFunctionBaseView initWithFunctionData:arrFunctionEntities];
    
    baseView.frame = (CGRect){
        .origin.x = 0,
        .origin.y =0,
        .size.width = CGRectGetWidth(self.view.frame),
        .size.height = CGRectGetHeight(self.view.frame),};
    baseView.backgroundColor = [UIColor clearColor];
    baseView.m_delegate = self;
    [self.view addSubview:baseView];
mei's avatar
mei committed
110

mei's avatar
mei committed
111
}
朱朝吉's avatar
朱朝吉 committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138

#pragma mark - ICRFunctionBaseViewDelegate
- (void)ICRFunctionBaseView:(ICRFunctionItemControl *)imageView {
    /*
     kFunctionAnnouncement = 0,
     kFunctionTaskManagement,
     kFunctionPatrolPlan,
     kFunctionMyShop,
     */
    switch (imageView.tag) {
        case kFunctionNotice://公告
        {
            ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
            [self PushViewController:aVC animated:YES];
        }
            break;
        case kFunctionNewSurvey://新建行情
        {
            NewSurveyViewController *svc = [[NewSurveyViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"AddSurvey"];
            [self PushViewController:svc animated:YES];
        }
            break;
        case kFunctionSeeSurvey://查看行情
        {
            SurveyViewController *svc = [[SurveyViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"Survey"];
n22's avatar
n22 committed
139
            svc.navigationItem.hidesBackButton = YES;
朱朝吉's avatar
朱朝吉 committed
140 141 142 143 144
            [self PushViewController:svc animated:YES];
        }
            break;
        case kFunctionNewPurchaseNotice://新建采购通知单
        {
朱朝吉's avatar
朱朝吉 committed
145 146
            NewPurchaseNoticeViewController *svc = [[NewPurchaseNoticeViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"Survey2"];
朱朝吉's avatar
朱朝吉 committed
147 148 149 150 151
            [self PushViewController:svc animated:YES];
        }
            break;
        case kFunctionSeePurchaseNotice://查看采购通知单
        {
朱朝吉's avatar
朱朝吉 committed
152 153 154
            SeePurchaseNoticeViewController *svc =
            [[SeePurchaseNoticeViewController alloc] init];
            svc.title = [IBTCommon localizableString:@"Survey3"];
朱朝吉's avatar
朱朝吉 committed
155 156 157 158
            [self PushViewController:svc animated:YES];
        }
            break;
       
陈俊俊's avatar
陈俊俊 committed
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
            case kFunctionNewPurchase://新建采购单
        {
            NewPurchaseViewController *nvc = [[NewPurchaseViewController alloc]init];
            nvc.title = @"新建采购单";
            [self PushViewController:nvc animated:YES];

        }
            break;
        case kFunctionSeePurchase:{
            PurchaseViewController *pvc = [[PurchaseViewController alloc]init];
            pvc.title = @"采购单";
            [self PushViewController:pvc animated:YES];
        }
            break;
            
            
freecui's avatar
freecui committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
//        case kFunctionTaskManagement://任务管理
//        {
//            ICRTaskListViewController *tVC = [[ICRTaskListViewController alloc] init];
//            [self PushViewController:tVC animated:YES];
//        }
//            break;
//        case kFunctionPatrolPlan://巡店计划
//        {
//            ICRPatrolPlanViewController *pVC = [[ICRPatrolPlanViewController alloc] initWithStore:nil isHomeShow:YES];
//            [self PushViewController:pVC animated:YES];
//        }
//            break;
//        case kFunctionMyShop://我的店铺
//        {
//            //            ICRStoreListViewController *sVC = [[ICRStoreListViewController alloc] initWithBHaveToChooseOne:NO];
//            //            sVC.title = [IBTCommon localizableString:@"MyStore"];
//            //            sVC.m_delegate = self;
//            //            [self PushViewController:sVC animated:YES];
//            AddWorkSheetViewController *sVC = [[AddWorkSheetViewController alloc] init];
//            [self PushViewController:sVC animated:YES];
//        }
//            break;
朱朝吉's avatar
朱朝吉 committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212

        default:
            return;
            break;
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
mei's avatar
mei committed
213 214 215 216 217 218
-(void)initView
{
    NSArray *butArray=[[NSArray alloc]initWithObjects:@"公告", @"新建行情调研",@"查看行情调研",@"填写行情反馈",@"新建采购通知",@"查看采购通知",@"新建采购单",@"查看采购单",@"审核采购单",@"新建发运单",@"查看发运单",@"新建加工单",nil];
    for (int i=0; i<butArray.count; i++) {
        UIButton *but=[UIButton buttonWithType:UIButtonTypeCustom];
        but.frame=CGRectMake(15+i%3*(90+10),10+(i/3)*(100+10) , 90, 90) ;
朱朝吉's avatar
朱朝吉 committed
219
        //        but.titleLabel.text=[NSString stringWithFormat:@"%@",[butArray objectAtIndex:i]];
mei's avatar
mei committed
220 221 222 223 224 225 226 227
        NSString *str=[butArray objectAtIndex:i];
        [but setTitle:str forState:UIControlStateNormal];
        but.backgroundColor=[UIColor redColor];
        [self .view addSubview:but];
        
    }
    
}
mei's avatar
mei committed
228 229

@end