Commit a24df6e0 authored by n22's avatar n22

Merge branch 'DEV_20150805_001' of http://121.42.32.57/root/xffruit into DEV_20150805_001

Conflicts:
	XFFruit/Macro/ICRNotificationMacro.h
	XFFruit/XFFruit-Prefix.pch
parents d9568f12 b94eefca
......@@ -6,5 +6,5 @@ pod 'SSKeychain', '~> 1.2.3'
pod 'FMDB', '~> 2.5'
pod 'Base64nl', '~> 1.2'
pod 'Reveal-iOS-SDK', '~> 1.5.1'
pod 'BaiduMapAPI', '~> 2.8.0'
pod 'BaiduMapAPI', '~> 2.7.0'
pod 'MJRefresh', '~> 2.2.0'
......@@ -20,14 +20,7 @@ PODS:
- AFNetworking/UIKit (2.5.4):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- BaiduMapAPI (2.8.0):
- BaiduMapAPI/All (= 2.8.0)
- BaiduMapAPI/All (2.8.0):
- BaiduMapAPI/Core
- BaiduMapAPI/Extend
- BaiduMapAPI/Core (2.8.0)
- BaiduMapAPI/Extend (2.8.0):
- BaiduMapAPI/Core
- BaiduMapAPI (2.7.0)
- Base64nl (1.2)
- FMDB (2.5):
- FMDB/standard (= 2.5)
......@@ -44,7 +37,7 @@ PODS:
DEPENDENCIES:
- AFNetworking (~> 2.5.4)
- BaiduMapAPI (~> 2.8.0)
- BaiduMapAPI (~> 2.7.0)
- Base64nl (~> 1.2)
- FMDB (~> 2.5)
- MBProgressHUD (~> 0.9.1)
......@@ -55,7 +48,7 @@ DEPENDENCIES:
SPEC CHECKSUMS:
AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e
BaiduMapAPI: e066aa1e85f9fee77a1bc071afb67552852bb0fb
BaiduMapAPI: d6433624b0b4dd156f2d842f394a5011b02a6401
Base64nl: a497bdcd1c01ea793d36b399016195a8713c0e95
FMDB: 96e8f1bcc1329e269330f99770ad4285d9003e52
MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad
......@@ -64,4 +57,4 @@ SPEC CHECKSUMS:
SDWebImage: 71b7cdc1d1721d6a82ed62889030225f2c249e29
SSKeychain: 3f42991739c6c60a9cf1bbd4dff6c0d3694bcf3d
COCOAPODS: 0.38.2
COCOAPODS: 0.37.1
This diff is collapsed.
//
// GXFFunctionDB.h
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTObject.h"
#import "GXFFunction.h"
#import "GXFDisplayFunction.h"
@interface GXFFunctionDB : IBTObject
+ (GXFFunctionDB *)sharedInstance;
- (void)createTables;
//- (BOOL)functionTableCreate;
- (BOOL)displayFunctionTableCreate;
- (BOOL)insertFunction: (GXFFunction *)function ;
- (GXFFunction *)functionSelectWithId: (NSInteger)Id;
- (BOOL)updateFunctionHasPermissionWithId: (GXFFunction *)function;
- (BOOL)updateFunctionIsSelectedWithId: (GXFFunction *)function;
- (NSArray *)originFunctions;
//返回全部有权限的function
- (NSArray *)functionsHasPermission;
//既有权限又被选择的
- (NSArray *)functionsHasPermissionAndIsSelected;
#pragma displayFunction
- (BOOL)insertDisplayFunction: (GXFDisplayFunction *)displayFunction;
- (BOOL)updateDisplayFunctionIsSelectedWithId: (GXFDisplayFunction *)displayFunction;
-(NSArray *)displayFunctionsHasPermission;
//默认配置显示功能 初始配置为
- (NSArray *)defaultdisplayFunctions;
- (NSArray *)originDisplayFunctions;
- (NSArray *)isSelectedDisplayFunctions;
@end
This diff is collapsed.
//
// GXFFunctionDBHelper.h
// XFFruit
//
// Created by freecui on 15/8/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTObject.h"
@interface GXFFunctionDBHelper : IBTObject
+ (instancetype)sharedInstance;
- (void)insertAllOriginFunctions;
- (BOOL)successInsertOriginFunctions;
- (void)insertAllOriginDisplayFunctions;
- (BOOL)sucessInsertOriginDisplayFunctions;
@end
//
// GXFFunctionDBHelper.m
// XFFruit
//
// Created by freecui on 15/8/28.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFFunctionDBHelper.h"
#import "GXFFunctionDB.h"
@interface GXFFunctionDBHelper ()
//@property (nonatomic, strong)GXFFunctionDB *functionDb;
@end
@implementation GXFFunctionDBHelper
+ (instancetype)sharedInstance{
static GXFFunctionDBHelper *dbHelper = nil;
static dispatch_once_t once;
dispatch_once(&once, ^{
dbHelper = [[GXFFunctionDBHelper alloc]init];
});
return dbHelper;
}
////开启一次就可以了
//- (void)openDb {
// self.functionDb = [GXFFunctionDB sharedInstance];
// [_functionDb functionTableCreate];
// [_functionDb displayFunctionTableCreate];
//}
- (void)insertAllOriginFunctions{
NSArray *functionsArr = [NSArray arrayWithArray:[self p_readJsonFile]];
for (int count = 0; count < functionsArr.count; count ++) {
GXFFunction *function = (GXFFunction *)functionsArr[count];
[[GXFFunctionDB sharedInstance] insertFunction:function];
}
}
//从读出的json文件返回GXFFunction数组
- (NSArray *)p_readJsonFile {
NSMutableArray *muArr = [NSMutableArray array];
//添加公告
GXFFunction *function = [[GXFFunction alloc]init];
function.Id = 000000;
function.name = @"announcement";
function.caption = @"公告";
function.hasPermission = YES;
function.isSelected = NO;
[muArr addObject:function];
NSString *path = [[NSBundle mainBundle] pathForResource:@"PermissionJson" ofType:nil];
NSData *jsonData = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedIfSafe error:nil];
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData options: NSJSONReadingMutableContainers error:nil];
NSArray *childrenArr = dict[@"children"];
for (int i = 0; i < childrenArr.count; i ++) {
NSArray *permissionsArr = [childrenArr[i] objectForKey:@"permissions"];
for (int j = 0; j < permissionsArr.count; j++) {
NSMutableDictionary *muDict = [NSMutableDictionary dictionaryWithObjects:@[@(0),@(0)] forKeys:@[@"hasPermission",@"isSelected"]];
[muDict addEntriesFromDictionary:permissionsArr[j]];
GXFFunction *function = [[GXFFunction alloc]initWithDictionary:muDict];
[muArr addObject:function];
}
}
return muArr;
}
- (void)insertAllOriginDisplayFunctions{
NSArray *arr = [self p_createAllDisplayFunctions];
for (int count = 0; count < arr.count; count ++) {
GXFDisplayFunction *displayFunction = (GXFDisplayFunction *)arr[count];
[[GXFFunctionDB sharedInstance] insertDisplayFunction:displayFunction];
}
}
- (NSArray *)p_createAllDisplayFunctions{
NSArray *functionsId = @[@(000000),
@(500101),@(500102),@(500103),
@(500201),
@(500301),@(500302),@(500303),//"采购通知",
@(500401),@(500402),@(500403),@(500406),//"采购单"
@(500501),@(500502),@(500503),//"发运单"
@(500601),@(500602),@(500603),//"转运单"
@(500701),@(500702),@(500703),];//加工单
NSArray *functionsName = @[@"公告",
@"新建行情调研",@"查看行情调研", @"查看行情调研",
@"填写行情反馈",
@"新建采购通知",@"查看采购通知", @"查看采购通知",
@"新建采购单",@"查看采购单", @"查看采购单", @"审核采购单【供应商】",
@"新建发运单",@"查看发运单", @"查看发运单",
@"新增加工单",@"查看加工单", @"查看加工单",
@"新建转运单", @"查看转运单", @"查看转运单"];
NSArray *functionsImageName = @[@"notice",
@"create_surver",@"watch_surver", @"watch_surver",
@"create_surver_result",
@"create_needs",@"watch_needs", @"watch_needs",
@"create_purchase",@"watch_purchase", @"watch_purchase", @"review_purchase",
@"create_transport",@"watch_transort", @"watch_transort",
@"create_process",@"watch_process", @"watch_process",
@"新建转运单", @"查看转运单", @"查看转运单"];
//NSArray *functionsSmallImgName = @[];
NSArray *functionItemTag = @[@(0),
@(1),@(2),@(2),
@(3),
@(4),@(5),@(5),//"采购通知",
@(6),@(7),@(7),@(8),//"采购单"
@(9),@(10),@(10),//"发运单"
@(11),@(12),@(12),//"转运单"
@(13),@(14),@(14),];//加工单
if ((functionsId.count != functionsName.count) ||(functionsId.count != functionsImageName.count)||(functionsName.count != functionsImageName.count)) {
NSLog(@"展现功能界面:插入的数据不是一一对应的");
return nil;
}
NSMutableArray *muarr = [NSMutableArray array];
for (int count = 0; count < functionsId.count; count ++) {
GXFDisplayFunction *displayFunction = [[GXFDisplayFunction alloc]init];
displayFunction.functionId = [functionsId[count] integerValue];
displayFunction.functionName = functionsName[count];
displayFunction.functionImgName = functionsImageName[count];
//displayFunction.functionSmallImgName = fu
displayFunction.functionItemTag = [functionItemTag[count] integerValue];
[muarr addObject:displayFunction];
}
return muarr;
}
- (BOOL)successInsertOriginFunctions{
return [[GXFFunctionDB sharedInstance] originFunctions].count > 0 ? YES : NO;
}
- (BOOL)sucessInsertOriginDisplayFunctions {
return [[GXFFunctionDB sharedInstance] originDisplayFunctions].count > 0 ? YES : NO;
}
@end
......@@ -408,6 +408,7 @@ acceptTypeJson:(BOOL)bAcceptJson
userUtil.orgName = dictResult[ @"enterprise_name" ];
userUtil.orgId = dictResult[ @"enterprise_uuid" ];
userUtil.authenticode = dictResult[@"authenticode"];
userUtil.permissions = dictResult[@"permissions"];
[userUtil saveArchive];
if (succ) {
succ( dictResult );
......
......@@ -71,6 +71,7 @@
[baseView addSubview:fControl];
}
}
baseView.height = MODULE_VIEW_HEIGHT * baseView.m_rows;
return baseView;
}
......
......@@ -11,28 +11,32 @@
//@protocol ICRFuctionItemControlDelegate;
typedef NS_ENUM (NSUInteger, ICRFunctionID) {
kFunctionAnnouncement = 0,
kFunctionTaskManagement,
kFunctionPatrolPlan,
kFunctionMyShop,
kFunctionNavigation,
kFunctionComeShopReg,
kFunctionLeaveShopReg,
kFunctionCreatTask,
kFunctionHandleTask,
kFunctionNotice = 0, //公告
kFunctionNewSurvey, //新建行情调研
kFunctionSeeSurvey, //查看行情调研
kFunctionFeeBackSurvey, //填写行情反馈
kFunctionNewPurchaseNotice, //新建采购通知
kFunctionSeePurchaseNotice, //查看采购通知
kFunctionNewPurchase, // 新建采购单
kFunctionSeePurchase, // 查看采购单
kFunctionExaminePurchase, // 审核采购单【供应商】
kFunctionNewShipment, // 新建发运单
kFunctionSeeShipment, // 查看发运单
kFunctionNewProcessing, // 新增加工单
kFunctionSeeProcessing, // 查看加工单
kFunctionNotice,
kFunctionNewSurvey,
kFunctionSeeSurvey,
kFunctionFeeBackSurvey,
kFunctionNewPurchaseNotice,
kFunctionSeePurchaseNotice,
kFunctionNewPurchase,
kFunctionSeePurchase,
kFunctionExaminePurchas,
kFunctionNewShipment,
kFunctionSeeShipment,
kFunctionNewProcessing,
kFunctionAnnouncement ,
kFunctionTaskManagement,
kFunctionPatrolPlan,
kFunctionMyShop,
kFunctionNavigation,
kFunctionComeShopReg,
kFunctionLeaveShopReg,
kFunctionCreatTask,
kFunctionHandleTask
};
@interface ICRFunctionItemControl : UIControl
......
......@@ -11,4 +11,6 @@
#define SetProductTotalPrice @"setProductTotalPrice"
#define KNOTIFICATION_changeIsSelectedFunctions @"KNOTIFICATION_changeIsSelectedFunctions"
#endif
{
"id" : "50",
"name": "前台",
"type" : "mobileModule",
"children": [
{
"id" : "5001",
"name": "行情调研",
"type" : "mobileModule",
"permissions": [
{
"id" : "500101",
"name": "create",
"caption": "新建权"
},
{
"id" : "500102",
"name": "viewall",
"caption": "全部查看权"
},
{
"id" : "500103",
"name": "viewself",
"caption": "本人查看权"
}
]
},
{
"id" : "5002",
"name": "行情反馈",
"type" : "mobileModule",
"permissions": [
{
"id" : "500201",
"name": "create",
"caption": "新建权"
},
{
"id" : "500202",
"name": "viewall",
"caption": "全部查看权"
},
{
"id" : "500203",
"name": "viewself",
"caption": "本人查看权"
}
]
},
{
"id" : "5003",
"name": "采购通知",
"type" : "mobileModule",
"permissions": [
{
"id" : "500301",
"name": "create",
"caption": "新建权"
},
{
"id" : "500302",
"name": "viewall",
"caption": "全部查看权"
},
{
"id" : "500303",
"name": "viewself",
"caption": "本人查看权"
},
{
"id" : "500304",
"name": "accepttask",
"caption": "接受任务权"
},
{
"id" : "500305",
"name": "createpurchasebill",
"caption": "新建采购单权"
},
{
"id" : "500306",
"name": "finish",
"caption": "结束权"
}
]
},
{
"id" : "5004",
"name": "采购单",
"type" : "mobileModule",
"permissions": [
{
"id" : "500401",
"name": "create",
"caption": "新建权"
},
{
"id" : "500402",
"name": "viewall",
"caption": "全部查看权"
},
{
"id" : "500403",
"name": "viewself",
"caption": "本人查看权"
},
{
"id" : "500404",
"name": "viewvendor",
"caption": "供应商查看权"
},
{
"id" : "500405",
"name": "managerapprove",
"caption": "经理审批权"
},
{
"id" : "500406",
"name": "vendorapprove",
"caption": "供应商审批权"
},
{
"id" : "500407",
"name": "finish",
"caption": "结束权"
},
{
"id" : "500408",
"name": "abort",
"caption": "作废权"
}
]
},
{
"id" : "5005",
"name": "发运单",
"type" : "mobileModule",
"permissions": [
{
"id" : "500501",
"name": "create",
"caption": "新建权"
},
{
"id" : "500502",
"name": "viewall",
"caption": "全部查看权"
},
{
"id" : "500503",
"name": "viewself",
"caption": "本人查看权"
},
{
"id" : "500404",
"name": "finish",
"caption": "结束权"
},
{
"id" : "500505",
"name": "abort",
"caption": "作废权"
}
]
},
{
"id" : "5006",
"name": "转运单",
"type" : "mobileModule",
"permissions": [
{
"id" : "500601",
"name": "create",
"caption": "新建权"
},
{
"id" : "500602",
"name": "viewall",
"caption": "全部查看权"
},
{
"id" : "500603",
"name": "viewself",
"caption": "本人查看权"
},
{
"id" : "500604",
"name": "finish",
"caption": "结束权"
},
{
"id" : "500605",
"name": "abort",
"caption": "作废权"
}
]
},
{
"id" : "5007",
"name": "加工单",
"type" : "mobileModule",
"permissions": [
{
"id" : "500701",
"name": "create",
"caption": "新建权"
},
{
"id" : "500702",
"name": "viewall",
"caption": "全部查看权"
},
{
"id" : "500703",
"name": "viewself",
"caption": "本人查看权"
},
{
"id" : "500704",
"name": "finish",
"caption": "结束权"
},
{
"id" : "500705",
"name": "abort",
"caption": "作废权"
}
]
}
]
}
......@@ -13,21 +13,28 @@
// Login Data
@property (copy, nonatomic) NSString *userName;
@property (copy, nonatomic) NSString *password;
@property (copy, nonatomic) NSString *registerCode;
@property (copy, nonatomic) NSString *registerCode; //企业认证码
@property (copy, nonatomic) NSString *token;
@property (copy, nonatomic) NSNumber *bAutoLogin;
@property (copy, nonatomic) NSString *authenticode;
@property (copy, nonatomic) NSString *authenticode;//企业认证码
@property (assign,nonatomic)BOOL needFresh;
// User Data
@property (copy, nonatomic) NSString *displayName;
@property (copy, nonatomic) NSString *userCode;
@property (copy, nonatomic) NSString *orgCode;
@property (copy, nonatomic) NSString *orgName;
@property (copy, nonatomic) NSString *userId;
@property (copy, nonatomic) NSString *orgId;
@property (copy, nonatomic) NSString *currentStoreID;
@property (copy, nonatomic) NSString *uniqueID;
@property (copy, nonatomic) NSString *userId; // 唯一标识
@property (copy, nonatomic) NSString *displayName; //用户名称
@property (copy, nonatomic) NSString *userCode; // 用户代码
@property (copy, nonatomic) NSString *orgCode; // 企业代码
@property (copy, nonatomic) NSString *orgName; // 企业名称
@property (copy, nonatomic) NSString *orgId; // 唯一标识
@property (strong, nonatomic) NSArray *permissions; //权限列表
@property (copy, nonatomic) NSString *currentStoreID; //
@property (copy, nonatomic) NSString *uniqueID; //
+ (instancetype)sharedInstance;
......
......@@ -78,7 +78,7 @@
//新建采购单
@(kFunctionSeePurchase),
//查看采购单
@(kFunctionExaminePurchas),
@(kFunctionExaminePurchase),
//审核采购单
@(kFunctionNewShipment),
//新建发运单
......@@ -172,28 +172,28 @@
break;
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;
// 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;
default:
return;
......
//
// GXFFunctionsViewController.h
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTUIViewController.h"
@interface GXFFunctionsViewController : IBTUIViewController
@end
//
// GXFFunctionsViewController.m
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFFunctionsViewController.h"
#import "GXFDisplayFunction.h"
#import "GXFFunction.h"
#import "GXFFunctionDBHelper.h"
#import "GXFFunctionDB.h"
@interface GXFFunctionsViewController ()<UITableViewDataSource,UITableViewDelegate>
//@property (nonatomic, strong) NSArray *
@property (nonatomic, strong) UITableView *f_tableView;
@property (nonatomic, strong) NSArray *firstSectionArr;
@property (nonatomic, strong) NSArray *secondSectionArr;
@end
@implementation GXFFunctionsViewController
static NSString *cellID = @"cell";
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self initData];
[self setupSubViews];
}
- (void)initData {
NSUserDefaults *f_default = [NSUserDefaults standardUserDefaults];
BOOL noDefault = [[f_default objectForKey:@"noDefault"] integerValue] > 0 ? YES : NO;
if (!noDefault) {
self.secondSectionArr = [[GXFFunctionDB sharedInstance]defaultdisplayFunctions];
} else {
self.secondSectionArr = [[GXFFunctionDB sharedInstance]originDisplayFunctions];
}
NSDictionary *dictOne = @{@"Id":@(1),@"functionName":@"新建行情反馈",@"imgName":@"RefreshBtn",@"isSelected":@(0)};
NSDictionary *dictTwo = @{@"Id":@(2),@"functionName":@"查询行情反馈",@"imgName":@"RefreshBtn",@"isSelected":@(1)};
GXFDisplayFunction *dFuntionOne = [[GXFDisplayFunction alloc]initWithDictionary:dictOne];
GXFDisplayFunction *dFuntionTwo =[[GXFDisplayFunction alloc]initWithDictionary:dictTwo];
self.firstSectionArr = @[dFuntionOne,dFuntionTwo];
//@[dFuntionOne,dFuntionTwo];
}
- (void)setupSubViews {
[self setupRightBarBtn];
[self setupTableView];
}
- (void)setupRightBarBtn {
UIBarButtonItem *rightBarBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(selectedFunctions)];
self.navigationItem.rightBarButtonItem = rightBarBtn;
}
- (void)setupTableView {
self.f_tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
self.f_tableView.dataSource = self;
self.f_tableView.delegate = self;
//[self.f_tableView dequeueReusableCellWithIdentifier ]
[self.view addSubview:_f_tableView];
[_f_tableView reloadData];
}
#pragma BarButton Action
- (void)selectedFunctions {
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_changeIsSelectedFunctions object:nil];
//配置功能 不是默认配置
NSUserDefaults *f_default = [NSUserDefaults standardUserDefaults];
BOOL noDefault = [[f_default objectForKey:@"noDefault"] integerValue] > 0 ? YES : NO;
if (!noDefault) {
[f_default setObject:@(1) forKey:@"noDefault"];
}
[self PopViewControllerAnimated:YES];
}
#pragma UITablewViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return _firstSectionArr.count;
} else {
return _secondSectionArr.count;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//TableViewCell重用机制避免重复显示问题 它的子视图全部删除
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (!cell) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
} else {
while ([cell.contentView.subviews lastObject] != nil) {
[(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
}
}
[self p_contentToTableViewCell:cell ForRowAtIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *sectionTitle = [NSString string];
switch (indexPath.section) {
case 0:
{
sectionTitle = @"提示选择";
}
break;
case 1:
{
sectionTitle = @"功能选择";
}
break;
}
return sectionTitle;
}
#pragma UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.section) {
case 0:
{
}
break;
case 1:
{
GXFDisplayFunction *displayFunction = (GXFDisplayFunction *)_secondSectionArr[indexPath.row];
UITableViewCell *cell = [_f_tableView cellForRowAtIndexPath:indexPath];
if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
displayFunction.isSelected = YES;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
displayFunction.isSelected = NO;
}
[[GXFFunctionDB sharedInstance] updateDisplayFunctionIsSelectedWithId:displayFunction];
}
break;
}
}
#pragma 给cell的内容赋值
- (void)p_contentToTableViewCell: (UITableViewCell *)cell ForRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.section) {
case 0:
{
GXFDisplayFunction *dFunction = (GXFDisplayFunction *)_firstSectionArr[indexPath.row];
cell.imageView.image = [UIImage imageNamed:@"RefreshBtn"];//dFunction.functionImgName];
cell.textLabel.text = dFunction.functionName;
}
break;
case 1:
{
GXFDisplayFunction *dFunction = (GXFDisplayFunction *)_secondSectionArr[indexPath.row];
cell.imageView.image = [UIImage imageNamed:@"RefreshBtn"];//dFunction.functionImgName];
cell.textLabel.text = dFunction.functionName;
if (dFunction.isSelected) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
break;
default:
break;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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.
}
*/
@end
//
// ICRHomeViewController.m
// XFFruit
//
// Created by Xummer on 3/24/15.
// Copyright (c) 2015 Xummer. All rights reserved.
//
#define M_HEAD_IMG_VIEW_HEIGHT (190)
#define M_HEAD_VIEW_TITLE_LABEL_HEIGHT (30)
#define M_HEAD_IMG_HEIGHT_WIDTH_PROPORTION 190.0f/320.0f
#import "ICRHomeViewController.h"
#import "ICRTaskListViewController.h"
#import "ICRPatrolPlanViewController.h"
#import "ICRStoreListViewController.h"
#import "ICRStoreDetailViewController.h"
#import "ICRAnnouncementViewController.h"
#import "ICRFunctionBaseView.h"
#import "ICRFunctionEntity.h"
#import "ICRFunctionBaseView.h"
#import "NewSurveyViewController.h"
#import "SurveyViewController.h"
#import "AddWorkSheetViewController.h"
#import "NewPurchaseViewController.h"
@interface ICRHomeViewController ()
<
ICRFunctionBaseViewDelegate,
ICRStoreListViewDelegate
>
@property (strong, nonatomic) UIImageView *m_headImageView;
@property (strong, nonatomic) UILabel *m_headViewTextLabel;
@end
@implementation ICRHomeViewController
#pragma mark - Life Cycle
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setupSubviews];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Private Method
- (void)setupSubviews {
self.m_headImageView = [[UIImageView alloc] initWithFrame:(CGRect){
.origin.x = 0,
.origin.y = 0,
.size.width = self.view.width,
.size.height = self.view.width * M_HEAD_IMG_HEIGHT_WIDTH_PROPORTION
}];
_m_headImageView.image = [UIImage imageNamed:@"HomeDisplayImage"];
self.m_headViewTextLabel = [[UILabel alloc] initWithFrame:(CGRect){
.origin.x = 0,
.origin.y = CGRectGetHeight(self.m_headImageView.frame) - M_HEAD_VIEW_TITLE_LABEL_HEIGHT,
.size.width = CGRectGetWidth(self.m_headImageView.frame),
.size.height = M_HEAD_VIEW_TITLE_LABEL_HEIGHT
}];
_m_headViewTextLabel.backgroundColor = [UIColor colorWithRed:0.310f green:0.345f blue:0.392f alpha:0.5f];
_m_headViewTextLabel.textColor = [UIColor whiteColor];
_m_headViewTextLabel.font = [UIFont systemFontOfSize:13];
_m_headViewTextLabel.textAlignment = NSTextAlignmentCenter;
// _m_headViewTextLabel.text = @"我是文字我是文字我是文字我是文字";
[_m_headImageView addSubview:_m_headViewTextLabel];
[self.view addSubview:_m_headImageView];
NSMutableArray *arrFunctionEntities = [NSMutableArray array];
NSArray *functionImageNames = @[ @"AnnouncementIcon",@"TaskManageIcon",@"PatrolPlanIcon",@"MyStoreIcon",@"MyStoreIcon",@"MyStoreIcon"];
NSArray *fuctionNames = @[ [IBTCommon localizableString:@"Announcement"],
[IBTCommon localizableString:@"TaskManage"],
[IBTCommon localizableString:@"PatrolPlan"],
[IBTCommon localizableString:@"MyStore"],
[IBTCommon localizableString:@"Survey"],[IBTCommon localizableString:@"AddSurvey"]];
NSArray *functionTags = @[ @(kFunctionAnnouncement),
@(kFunctionTaskManagement),
@(kFunctionPatrolPlan),
@(kFunctionMyShop),
@(kFunctionNavigation),
@(kFunctionComeShopReg)];
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 = CGRectGetMaxY(_m_headImageView.frame),
.size.width = CGRectGetWidth(self.view.frame),
.size.height = CGRectGetHeight(self.view.frame) - CGRectGetHeight(_m_headImageView.frame)
};
baseView.backgroundColor = [UIColor clearColor];
baseView.m_delegate = self;
[self.view addSubview:baseView];
}
#pragma mark - ICRFunctionBaseViewDelegate
- (void)ICRFunctionBaseView:(ICRFunctionItemControl *)imageView {
/*
kFunctionAnnouncement = 0,
kFunctionTaskManagement,
kFunctionPatrolPlan,
kFunctionMyShop,
*/
switch (imageView.tag) {
case kFunctionAnnouncement:
{
ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
[self PushViewController:aVC animated:YES];
}
break;
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];
NewPurchaseViewController *sVC = [[NewPurchaseViewController alloc] init];
[self PushViewController:sVC animated:YES];
}
break;
case kFunctionNavigation:
{
SurveyViewController *svc = [[SurveyViewController alloc] init];
svc.title = [IBTCommon localizableString:@"Survey"];
[self PushViewController:svc animated:YES];
}
break;
case kFunctionComeShopReg:
{
NewSurveyViewController *svc = [[NewSurveyViewController alloc] init];
svc.title = [IBTCommon localizableString:@"AddSurvey"];
[self PushViewController:svc animated:YES];
}
break;
default:
break;
}
}
#pragma mark - ICRStoreListViewDelegate
- (void)storeListViewCtrl:(ICRStoreListViewController *)vCtrl didSelectedStore:(ICRStore *)store {
ICRStoreDetailViewController *dVC = [[ICRStoreDetailViewController alloc] initWithStoreData:store];
[vCtrl PushViewController:dVC animated:YES];
}
@end
//
// GXFDisplayActions.h
// XFFruit
// 显示有已有权限功能的信息
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTObject.h"
@interface GXFDisplayFunction : IBTObject
@property (nonatomic, assign) NSInteger Id; //
@property (nonatomic, assign) NSInteger functionId;
@property (nonatomic, copy) NSString *functionName; //
@property (nonatomic, copy) NSString *functionImgName; //
@property (nonatomic, copy) NSString *functionSmallImgName;
@property (nonatomic, assign) BOOL isSelected; //选中
@property (nonatomic, assign) NSInteger functionItemTag;
+ (instancetype)initClassWithDictionary: (NSDictionary *)dict;
- (instancetype)initWithDictionary: (NSDictionary *)dict;
@end
//
// GXFDisplayActions.m
// XFFruit
// 显示有已有权限功能的信息
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFDisplayFunction.h"
@implementation GXFDisplayFunction
+ (instancetype)initClassWithDictionary:(NSDictionary *)dict {
return [self initClassWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict {
self = [super init];
if (!self) {
return nil;
} else {
self.Id = [dict[@"id"] integerValue];
self.functionName = dict[@"functionName"];
self.functionImgName = dict[@"imgName"];
self.isSelected = [dict[@"isSelected"] integerValue];
// [self setValuesForKeysWithDictionary:dict];
}
return self;
}
@end
//
// GXFActions.h
// XFFruit
// 后台返回的json权限文件的内容:选择权限和是否选择
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTObject.h"
@interface GXFFunction : IBTObject
@property (nonatomic, assign) NSInteger Id;
@property (nonatomic, copy) NSString *name; //权限
@property (nonatomic, copy) NSString *caption; //权限的名称
@property (nonatomic, assign) BOOL hasPermission;
@property (nonatomic, assign) BOOL isSelected;
//@property (nonatomic, assign) BOOL isPublic; 是否公共部分功能
+ (instancetype)initClassWithDictionary: (NSDictionary *)dict;
- (instancetype)initWithDictionary: (NSDictionary *)dict;
@end
//
// GXFActions.m
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFFunction.h"
@implementation GXFFunction
+ (instancetype)initClassWithDictionary:(NSDictionary *)dict {
return [self initClassWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict {
self = [super init];
if (!self) {
return nil;
} else {
self.Id = [dict[@"id"] integerValue];
self.name = dict[@"name"];
self.caption = dict[@"caption"];
self.hasPermission = [dict[@"hasPermission"] integerValue];
self.isSelected = [dict[@"isSelected"] integerValue];
// [self setValuesForKeysWithDictionary:dict];
return self;
}
}
@end
//
// GXFNoticeCollectionViewCell.h
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#define ICRFUNCTION_IMG_TOP_PADDING (25)
#define ICRFUNCTION_IMG_WIDTH (65)
#define ICRFUNCTION_LABEL_HEIGHT (15)
#define ICRFUNCTION_INNER_GAP (7)
#define RIGHT_LINE_WIDTH (0.5)
@interface GXFFunctionCollectionViewCell : UICollectionViewCell
@property (nonatomic, strong, readonly) UIImageView *functionImage;
@property (nonatomic, strong, readonly) UILabel *functionNameLabel;
@end
//
// GXFNoticeCollectionViewCell.m
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFFunctionCollectionViewCell.h"
@implementation GXFFunctionCollectionViewCell
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (!self) {
return nil;
}
_functionImage = [[UIImageView alloc]initWithFrame:CGRectMake((CGRectGetWidth(self.frame) - ICRFUNCTION_IMG_WIDTH)/2, ICRFUNCTION_IMG_TOP_PADDING, ICRFUNCTION_IMG_WIDTH, ICRFUNCTION_IMG_WIDTH)];
_functionImage.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:_functionImage];
_functionNameLabel = [[UILabel alloc] init];
CGSize labelSize = CGSizeMake(CGRectGetWidth(self.frame), ICRFUNCTION_LABEL_HEIGHT);
labelSize = [_functionNameLabel sizeThatFits:labelSize];
_functionNameLabel.frame = (CGRect){
.origin.x = (CGRectGetWidth(self.frame) - labelSize.width)/2,
.origin.y = CGRectGetMaxY(_functionImage.frame) + ICRFUNCTION_INNER_GAP,
.size.width = labelSize.width,
.size.height = ICRFUNCTION_LABEL_HEIGHT
};
_functionNameLabel.textColor = [UIColor colorWithRed:0.596f green:0.596f blue:0.596f alpha:1.00f];
_functionNameLabel.textAlignment = NSTextAlignmentCenter;
_functionNameLabel.font = [UIFont systemFontOfSize:13];
[self.contentView addSubview:_functionNameLabel];
self.backgroundColor = [UIColor whiteColor];
return self;
}
@end
//
// GXFNoticeFunctionTableViewCell.h
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GXFNoticeFunctionTableViewCell : UITableViewCell
@property (nonatomic, strong, readonly) UIImageView *functionImg;
@property (nonatomic, strong, readonly) UILabel *noticeLabel;
@property (nonatomic, strong, readonly) UILabel *unReadLabel;
@end
//
// GXFNoticeFunctionTableViewCell.m
// XFFruit
//
// Created by freecui on 15/8/27.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFNoticeFunctionTableViewCell.h"
@implementation GXFNoticeFunctionTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
_functionImg = [[UIImageView alloc]initWithFrame:CGRectMake(20.f, 10.f, 45.f, 45.f)];
_functionImg.image = [UIImage imageNamed:@""];
[self.contentView addSubview:_functionImg];
_unReadLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.width - 60.f,(self.height - 20.0f)/2.0 , 25.0f, 20.0f)];
_unReadLabel.backgroundColor = [UIColor redColor];
_unReadLabel.textColor = [UIColor whiteColor];
_unReadLabel.font = [UIFont systemFontOfSize:13];
_unReadLabel.layer.cornerRadius =10;
_unReadLabel.layer.masksToBounds = YES;
[self.contentView addSubview:_unReadLabel];
_noticeLabel = [[UILabel alloc] initWithFrame:CGRectMake(_functionImg.right ,_functionImg.x,self.width - _functionImg.right - 40,self.height)];
_noticeLabel.font = [UIFont systemFontOfSize:13.0f];
[_noticeLabel setTextAlignment:NSTextAlignmentRight];
_noticeLabel.textColor = [UIColor blackColor];
[self.contentView addSubview:_noticeLabel];
}
return self;
}
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -9,6 +9,9 @@
#import "ICRLoginViewController.h"
#import "ICRLoginContentView.h"
#import "GXFFunctionDB.h"
#import "GXFFunctionDBHelper.h"
#define LOGIN_CONTAINER_LEFT_MARGIN (20)
#define LOGIN_CONTAINER_HEIGHT (450)
......@@ -134,8 +137,38 @@
ICRAppViewControllerManager *mgr =
[ICRAppViewControllerManager getAppViewControllerManager];
[mgr openMainFrame];
#pragma 可以开新线程 ,待优化
//当登陆成功时就建立功能数据表
[[GXFFunctionDB sharedInstance]createTables];
//完成对初始化数据书库的操作
if (![[GXFFunctionDBHelper sharedInstance] successInsertOriginFunctions]) {
[[GXFFunctionDBHelper sharedInstance] insertAllOriginFunctions];
}
if (![[GXFFunctionDBHelper sharedInstance] sucessInsertOriginDisplayFunctions]) {
[[GXFFunctionDBHelper sharedInstance] insertAllOriginDisplayFunctions];
}
//更改功能权限
for (int count = 0; count < userUtil.permissions.count; count ++) {
GXFFunction *function = [[GXFFunctionDB sharedInstance]functionSelectWithId:[userUtil.permissions[count] integerValue]];
if (function.Id) {
function.hasPermission = 1;
[[GXFFunctionDB sharedInstance] updateFunctionHasPermissionWithId:function];
}
}
if (![[GXFFunctionDB sharedInstance]defaultdisplayFunctions]) {
[[GXFFunctionDB sharedInstance]defaultdisplayFunctions];
}
};
void(^fail)(id) = ^(id data) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment