Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
X
xffruit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
xffruit
Commits
b9a36cf9
Commit
b9a36cf9
authored
9 years ago
by
freecui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改首页界面
parent
c2a61d9c
master
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
262 additions
and
114 deletions
+262
-114
GXFFunctionDB.h
XFFruit/Controllers/DataBaseController/GXFFunctionDB.h
+8
-0
GXFFunctionDB.m
XFFruit/Controllers/DataBaseController/GXFFunctionDB.m
+97
-9
GXFFunctionDBHelper.h
XFFruit/Controllers/DataBaseController/GXFFunctionDBHelper.h
+3
-0
GXFFunctionDBHelper.m
XFFruit/Controllers/DataBaseController/GXFFunctionDBHelper.m
+23
-3
ICRFunctionBaseView.m
XFFruit/General/Views/FunctionView/ICRFunctionBaseView.m
+1
-0
ICRNotificationMacro.h
XFFruit/Macro/ICRNotificationMacro.h
+1
-1
GXFFunctionsViewController.m
...Controllers/Home/Controllers/GXFFunctionsViewController.m
+68
-32
ICRHomeViewController.m
.../ViewControllers/Home/Controllers/ICRHomeViewController.m
+42
-66
ICRLoginViewController.m
XFFruit/ViewControllers/Login/ICRLoginViewController.m
+18
-2
XFFruit-Prefix.pch
XFFruit/XFFruit-Prefix.pch
+1
-1
No files found.
XFFruit/Controllers/DataBaseController/GXFFunctionDB.h
View file @
b9a36cf9
...
...
@@ -19,8 +19,10 @@
//- (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
;
//既有权限又被选择的
...
...
@@ -30,4 +32,10 @@
#pragma displayFunction
-
(
BOOL
)
insertDisplayFunction
:
(
GXFDisplayFunction
*
)
displayFunction
;
-
(
BOOL
)
updateDisplayFunctionIsSelectedWithId
:
(
GXFDisplayFunction
*
)
displayFunction
;
-
(
NSArray
*
)
displayFunctionsHasPermission
;
//默认配置显示功能 初始配置为
-
(
NSArray
*
)
defaultdisplayFunctions
;
-
(
NSArray
*
)
originDisplayFunctions
;
-
(
NSArray
*
)
isSelectedDisplayFunctions
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/Controllers/DataBaseController/GXFFunctionDB.m
View file @
b9a36cf9
...
...
@@ -94,10 +94,27 @@
// [db close];
return
work
;
}
//查找一条数据
-
(
GXFFunction
*
)
functionSelectWithId
:
(
NSInteger
)
Id
{
GXFFunction
*
function
=
[[
GXFFunction
alloc
]
init
];
FMResultSet
*
rs
=
[
_dataBase
executeQuery
:
@"SELECT * FROM function WHERE Id = ? "
,
@
(
Id
)];
while
([
rs
next
])
{
function
.
Id
=
[
rs
intForColumnIndex
:
0
];
function
.
name
=
[
rs
stringForColumnIndex
:
1
];
function
.
caption
=
[
rs
stringForColumnIndex
:
2
];
function
.
hasPermission
=
[
rs
intForColumnIndex
:
3
];
function
.
isSelected
=
[
rs
intForColumnIndex
:
4
];
break
;
}
return
function
;
}
//更新权限
-
(
BOOL
)
updateFunctionHasPermissionWithId
:
(
GXFFunction
*
)
function
{
BOOL
work
=
[
_dataBase
executeUpdate
:
@"UPDATE function SET hasPermission = ? where Id = ?"
,
function
.
hasPermission
,
function
.
Id
];
//GXFFunction *function = [self functionSelectWithId:Id];
BOOL
work
=
[
_dataBase
executeUpdate
:
@"UPDATE function SET hasPermission = ? where Id = ?"
,
@
(
function
.
hasPermission
),
@
(
function
.
Id
)
];
return
work
;
}
//更新是否选中
...
...
@@ -105,6 +122,18 @@
BOOL
work
=
[
_dataBase
executeUpdate
:
@"UPDATE function SET isSelected = ? where Id = ?"
,
function
.
isSelected
,
function
.
Id
];
return
work
;
}
//返回全部原始数据的function
-
(
NSArray
*
)
originFunctions
{
NSMutableArray
*
muArr
=
[
NSMutableArray
array
];
FMResultSet
*
rs
=
[
_dataBase
executeQuery
:
@"SELECT * FROM function"
];
while
([
rs
next
])
{
GXFFunction
*
function
=
[[
GXFFunction
alloc
]
init
];
function
.
Id
=
[
rs
intForColumn
:
@"Id"
];
[
muArr
addObject
:
function
];
}
return
muArr
;
}
//返回全部有权限的function
-
(
NSArray
*
)
functionsHasPermission
{
NSMutableArray
*
muArr
=
[
NSMutableArray
array
];
...
...
@@ -151,6 +180,19 @@
}
#pragma displayFunction
-
(
BOOL
)
insertDisplayFunction
:
(
GXFDisplayFunction
*
)
displayFunction
{
...
...
@@ -171,7 +213,11 @@
}
return
displayFunction
;
}
//更新是否选中
-
(
BOOL
)
updateDisplayFunctionIsSelectedWithId
:
(
GXFDisplayFunction
*
)
displayFunction
{
BOOL
work
=
[
_dataBase
executeUpdate
:
@"UPDATE displayFunction SET isSelected = ? where functionId = ?"
,
@
(
displayFunction
.
isSelected
),
@
(
displayFunction
.
functionId
)];
return
work
;
}
#pragma 有权限的displayfunctions
//待改正,最好的办法是两张表关联起来查找但是我还没做到
-
(
NSArray
*
)
displayFunctionsHasPermission
{
...
...
@@ -180,19 +226,61 @@
NSArray
*
hasPermission
=
[
self
p_functionsIdPermission
];
for
(
int
count
=
0
;
count
<
hasPermission
.
count
;
count
++
)
{
FMResultSet
*
rs
=
[
_dataBase
executeQuery
:
@"SELECT * FROM displayFunction WHERE functionId = ?"
,
[
hasPermission
[
count
]
integerValue
]
];
FMResultSet
*
rs
=
[
_dataBase
executeQuery
:
@"SELECT * FROM displayFunction WHERE functionId = ?"
,
hasPermission
[
count
]
];
while
([
rs
next
])
{
GXFDisplayFunction
*
displayFunction
=
[[
GXFDisplayFunction
alloc
]
init
];
displayFunction
.
functionId
=
[
rs
intForColumn
:
@"functionId"
];
displayFunction
.
functionName
=
[
rs
stringForColumn
:
@"functionName"
];
displayFunction
.
functionImgName
=
[
rs
stringForColumn
:
@"functionImgName"
];
displayFunction
.
functionSmallImgName
=
[
rs
stringForColumn
:
@"functionSmallImgName"
];
GXFDisplayFunction
*
displayFunction
=
[
self
p_resultSetDisplayFunction
:
rs
];
[
muArr
addObject
:
displayFunction
];
}
}
return
muArr
;
}
//默认配置显示功能 初始配置为
-
(
NSArray
*
)
defaultdisplayFunctions
{
NSMutableArray
*
arr
=
[
NSMutableArray
arrayWithArray
:[
self
displayFunctionsHasPermission
]];
for
(
int
count
=
0
;
count
<
arr
.
count
;
count
++
)
{
if
((
count
%
2
)
||
(
count
==
0
))
{
GXFDisplayFunction
*
displayFunction
=
(
GXFDisplayFunction
*
)
arr
[
count
];
displayFunction
.
isSelected
=
YES
;
[
self
updateDisplayFunctionIsSelectedWithId
:
displayFunction
];
[
arr
replaceObjectAtIndex
:
count
withObject
:
displayFunction
];
}
}
return
arr
;
}
//返回全部原始数据的function
-
(
NSArray
*
)
originDisplayFunctions
{
NSMutableArray
*
muArr
=
[
NSMutableArray
array
];
FMResultSet
*
rs
=
[
_dataBase
executeQuery
:
@"SELECT * FROM displayFunction"
];
while
([
rs
next
])
{
GXFDisplayFunction
*
displayFunction
=
[
self
p_resultSetDisplayFunction
:
rs
];
[
muArr
addObject
:
displayFunction
];
}
return
muArr
;
}
-
(
GXFDisplayFunction
*
)
p_resultSetDisplayFunction
:
(
FMResultSet
*
)
rs
{
GXFDisplayFunction
*
displayFunction
=
[[
GXFDisplayFunction
alloc
]
init
];
displayFunction
.
functionId
=
[
rs
intForColumn
:
@"functionId"
];
displayFunction
.
functionName
=
[
rs
stringForColumn
:
@"functionName"
];
displayFunction
.
functionImgName
=
[
rs
stringForColumn
:
@"functionImgName"
];
displayFunction
.
functionSmallImgName
=
[
rs
stringForColumn
:
@"functionSmallImgName"
];
displayFunction
.
isSelected
=
[
rs
intForColumn
:
@"isSelected"
];
return
displayFunction
;
}
//返回被选中的
-
(
NSArray
*
)
isSelectedDisplayFunctions
{
NSMutableArray
*
muArr
=
[
NSMutableArray
array
];
FMResultSet
*
rs
=
[
_dataBase
executeQuery
:
@"SELECT * FROM displayFunction WHERE isSelected = ?"
,
@
(
1
)];
while
([
rs
next
])
{
GXFDisplayFunction
*
displayFunction
=
[
self
p_resultSetDisplayFunction
:
rs
];
[
muArr
addObject
:
displayFunction
];
}
return
muArr
;
}
@end
This diff is collapsed.
Click to expand it.
XFFruit/Controllers/DataBaseController/GXFFunctionDBHelper.h
View file @
b9a36cf9
...
...
@@ -12,5 +12,8 @@
+
(
instancetype
)
sharedInstance
;
-
(
void
)
insertAllOriginFunctions
;
-
(
BOOL
)
successInsertOriginFunctions
;
-
(
void
)
insertAllOriginDisplayFunctions
;
-
(
BOOL
)
sucessInsertOriginDisplayFunctions
;
@end
This diff is collapsed.
Click to expand it.
XFFruit/Controllers/DataBaseController/GXFFunctionDBHelper.m
View file @
b9a36cf9
...
...
@@ -33,6 +33,8 @@
//}
-
(
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
];
...
...
@@ -44,6 +46,14 @@
-
(
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
];
...
...
@@ -75,21 +85,24 @@
}
-
(
NSArray
*
)
p_createAllDisplayFunctions
{
NSArray
*
functionsId
=
@[
@
(
500101
),
@
(
500102
),
@
(
500103
),
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
*
functionsName
=
@[
@"公告"
,
@"新建行情调研"
,
@"查看行情调研"
,
@"查看行情调研"
,
@"填写行情反馈"
,
@"新建采购通知"
,
@"查看采购通知"
,
@"查看采购通知"
,
@"新建采购单"
,
@"查看采购单"
,
@"查看采购单"
,
@"审核采购单【供应商】"
,
@"新建发运单"
,
@"查看发运单"
,
@"查看发运单"
,
@"新增加工单"
,
@"查看加工单"
,
@"查看加工单"
,
@"新建转运单"
,
@"查看转运单"
,
@"查看转运单"
];
NSArray
*
functionsImageName
=
@[
@"create_surver"
,
@"watch_surver"
,
@"watch_surver"
,
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"
,
...
...
@@ -116,4 +129,11 @@
return
muarr
;
}
-
(
BOOL
)
successInsertOriginFunctions
{
return
[[
GXFFunctionDB
sharedInstance
]
originFunctions
].
count
>
0
?
YES
:
NO
;
}
-
(
BOOL
)
sucessInsertOriginDisplayFunctions
{
return
[[
GXFFunctionDB
sharedInstance
]
originDisplayFunctions
].
count
>
0
?
YES
:
NO
;
}
@end
This diff is collapsed.
Click to expand it.
XFFruit/General/Views/FunctionView/ICRFunctionBaseView.m
View file @
b9a36cf9
...
...
@@ -71,6 +71,7 @@
[
baseView
addSubview
:
fControl
];
}
}
baseView
.
height
=
MODULE_VIEW_HEIGHT
*
baseView
.
m_rows
;
return
baseView
;
}
...
...
This diff is collapsed.
Click to expand it.
XFFruit/Macro/ICRNotificationMacro.h
View file @
b9a36cf9
...
...
@@ -9,5 +9,5 @@
#ifndef XFFruit_ICRNotificationMacro_h
#define XFFruit_ICRNotificationMacro_h
#define KNOTIFICATION_changeIsSelectedFunctions @"KNOTIFICATION_changeIsSelectedFunctions"
#endif
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Home/Controllers/GXFFunctionsViewController.m
View file @
b9a36cf9
...
...
@@ -6,9 +6,12 @@
// 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 *
...
...
@@ -28,14 +31,19 @@ static NSString *cellID = @"cell";
[
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
];
GXFDisplayFunction
*
dFuntionTwo
=
[[
GXFDisplayFunction
alloc
]
initWithDictionary
:
dictTwo
];
self
.
firstSectionArr
=
@[
dFuntionOne
,
dFuntionTwo
];
self
.
secondSectionArr
=
@[
dFuntionOne
,
dFuntionTwo
];
//self.firstSection =
//@[dFuntionOne,dFuntionTwo];
}
-
(
void
)
setupSubViews
{
[
self
setupRightBarBtn
];
...
...
@@ -51,14 +59,25 @@ static NSString *cellID = @"cell";
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
];
}
...
...
@@ -76,25 +95,17 @@ static NSString *cellID = @"cell";
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
//TableViewCell重用机制避免重复显示问题 它的子视图全部删除
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
if
(
!
cell
)
{
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
cellID
];
}
switch
(
indexPath
.
section
)
{
case
0
:
{
[
self
p_contentToTableViewCell
:
cell
andArray
:
_firstSectionArr
];
}
break
;
case
1
:
{
[
self
p_contentToTableViewCell
:
cell
andArray
:
_secondSectionArr
];
}
else
{
while
([
cell
.
contentView
.
subviews
lastObject
]
!=
nil
)
{
[(
UIView
*
)[
cell
.
contentView
.
subviews
lastObject
]
removeFromSuperview
];
}
break
;
default
:
break
;
}
[
self
p_contentToTableViewCell
:
cell
ForRowAtIndexPath
:
indexPath
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
...
...
@@ -119,16 +130,7 @@ static NSString *cellID = @"cell";
}
#pragma UITableViewDelegate
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
UITableViewCell
*
cell
=
[
_f_tableView
cellForRowAtIndexPath
:
indexPath
];
if
(
cell
.
accessoryType
==
UITableViewCellAccessoryNone
)
{
cell
.
accessoryType
=
UITableViewCellAccessoryCheckmark
;
// if (indexPath.section == 0) {
// _firstSectionArr
// }
}
else
{
cell
.
accessoryType
=
UITableViewCellAccessoryNone
;
}
switch
(
indexPath
.
section
)
{
switch
(
indexPath
.
section
)
{
case
0
:
{
...
...
@@ -136,6 +138,18 @@ static NSString *cellID = @"cell";
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
;
...
...
@@ -144,12 +158,34 @@ static NSString *cellID = @"cell";
}
#pragma 给cell的内容赋值
-
(
void
)
p_contentToTableViewCell
:
(
UITableViewCell
*
)
cell
andArray
:
(
NSArray
*
)
array
{
for
(
int
count
=
0
;
count
<
array
.
count
;
count
++
)
{
GXFDisplayFunction
*
dFunction
=
(
GXFDisplayFunction
*
)
array
[
count
];
cell
.
imageView
.
image
=
[
UIImage
imageNamed
:
dFunction
.
functionImgName
];
cell
.
textLabel
.
text
=
dFunction
.
functionName
;
-
(
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
];
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Home/Controllers/ICRHomeViewController.m
View file @
b9a36cf9
...
...
@@ -36,6 +36,8 @@
#import "GXFFunctionCollectionViewCell.h"
#import "GXFFunctionDB.h"
#define ICRFUNCTION_IMG_TOP_PADDING (25)
#define ICRFUNCTION_IMG_WIDTH (65)
#define ICRFUNCTION_LABEL_HEIGHT (15)
...
...
@@ -46,7 +48,7 @@
@property
(
nonatomic
,
strong
)
UITableView
*
f_tableView
;
@property
(
nonatomic
,
strong
)
NSArray
*
firstSectionArr
;
@property
(
nonatomic
,
strong
)
NSArray
*
secondSectionArr
;
@property
(
nonatomic
,
strong
)
NS
Mutable
Array
*
secondSectionArr
;
@property
(
nonatomic
,
strong
)
ICRFunctionBaseView
*
f_functionBaseView
;
@property
(
nonatomic
,
strong
)
UICollectionView
*
f_collectionView
;
...
...
@@ -66,27 +68,32 @@ static NSString *collectionCellID = @"collectionCell";
[
self
initData
];
[
self
setupSubviews
];
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
}
-
(
void
)
setupSubviews
{
[
self
setupRightBarBtn
];
[
self
setupTableView
];
[
self
setupColletionView
];
//
[self setupColletionView];
[
self
setupFunctionBaseView
];
}
-
(
void
)
initData
{
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
];
self
.
secondSectionArr
=
@[
dFuntionOne
,
dFuntionTwo
];
self
.
secondSectionArr
=
[
NSMutableArray
array
];
//self.firstSection =
}
[
self
.
secondSectionArr
addObjectsFromArray
:[[
GXFFunctionDB
sharedInstance
]
isSelectedDisplayFunctions
]];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
changeSecondSectionArr
)
name
:
KNOTIFICATION_changeIsSelectedFunctions
object
:
nil
];
}
-
(
void
)
setupRightBarBtn
{
UIBarButtonItem
*
rightBarBtn
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"自定义功能"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
defineFunctions
)];
...
...
@@ -94,10 +101,15 @@ static NSString *collectionCellID = @"collectionCell";
}
-
(
void
)
setupTableView
{
self
.
f_tableView
=
[[
UITableView
alloc
]
initWithFrame
:
self
.
view
.
frame
style
:
UITableViewStyleGrouped
];
self
.
f_tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRect
){
.
origin
.
x
=
0
,
.
origin
.
y
=
0
,
.
size
.
width
=
self
.
view
.
width
,
.
size
.
height
=
self
.
view
.
height
-
80
}
style
:
UITableViewStyleGrouped
];
self
.
f_tableView
.
dataSource
=
self
;
self
.
f_tableView
.
delegate
=
self
;
//[self.f_tableView dequeueReusableCellWithIdentifier ]
[
self
.
view
addSubview
:
_f_tableView
];
}
...
...
@@ -116,54 +128,11 @@ static NSString *collectionCellID = @"collectionCell";
-
(
void
)
setupFunctionBaseView
{
NSMutableArray
*
funtionEntitlesArr
=
[
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
*
functionNames
=
@[
[
IBTCommon
localizableString
:
@"Announcement"
],
[
IBTCommon
localizableString
:
@"AddSurvey"
],
[
IBTCommon
localizableString
:
@"Survey"
],
[
IBTCommon
localizableString
:
@"Survey1"
],
[
IBTCommon
localizableString
:
@"Survey2"
],
[
IBTCommon
localizableString
:
@"Survey3"
],
[
IBTCommon
localizableString
:
@"Survey4"
],
[
IBTCommon
localizableString
:
@"Survey5"
],
[
IBTCommon
localizableString
:
@"Survey6"
],
[
IBTCommon
localizableString
:
@"Survey7"
],
[
IBTCommon
localizableString
:
@"Survey8"
],[
IBTCommon
localizableString
:
@"Survey9"
],
];
NSArray
*
functionTags
=
@[
@
(
kFunctionNotice
),
//公告
@
(
kFunctionNewSurvey
),
//新建行情调研
@
(
kFunctionSeeSurvey
),
//查看行情调研
@
(
kFunctionFeeBackSurvey
),
//填写行情反馈
@
(
kFunctionNewPurchaseNotice
),
//新建采购通知
@
(
kFunctionSeePurchaseNotice
),
//查看采购通知
@
(
kFunctionNewPurchase
),
//新建采购单
@
(
kFunctionSeePurchase
),
//查看采购单
@
(
kFunctionExaminePurchas
),
//审核采购单
@
(
kFunctionNewShipment
),
//新建发运单
@
(
kFunctionSeeShipment
),
//查看发运单
@
(
kFunctionNewProcessing
)];
//新建加工单
int
i
=
0
;
for
(
NSString
*
functionName
in
functionNames
)
{
for
(
GXFDisplayFunction
*
displayFunction
in
_secondSectionArr
)
{
ICRFunctionEntity
*
functionEntity
=
[[
ICRFunctionEntity
alloc
]
init
];
functionEntity
.
functionName
=
functionName
;
functionEntity
.
iconName
=
functionImageNames
[
i
];
// functionEntity.functionItemTag = []
functionEntity
.
functionName
=
displayFunction
.
functionName
;
functionEntity
.
iconName
=
displayFunction
.
functionImgName
;
[
funtionEntitlesArr
addObject
:
functionEntity
];
i
++
;
}
self
.
f_functionBaseView
=
[
ICRFunctionBaseView
initWithFunctionData
:
funtionEntitlesArr
];
...
...
@@ -171,17 +140,29 @@ static NSString *collectionCellID = @"collectionCell";
.
origin
.
x
=
0
,
.
origin
.
y
=
0
,
.
size
.
width
=
CGRectGetWidth
(
self
.
view
.
frame
),
.
size
.
height
=
CGRectGetHeight
(
self
.
view
.
frame
),};
.
size
.
height
=
_f_functionBaseView
.
height
};
//
CGRectGetHeight(self.view.frame),};
_f_functionBaseView
.
backgroundColor
=
[
UIColor
clearColor
];
_f_functionBaseView
.
m_delegate
=
self
;
}
#pragma BarButton Action
#pragma Notification
-
(
void
)
changeSecondSectionArr
{
if
(
_secondSectionArr
.
count
)
{
[
_secondSectionArr
removeAllObjects
];
[
self
.
secondSectionArr
addObjectsFromArray
:[[
GXFFunctionDB
sharedInstance
]
isSelectedDisplayFunctions
]];
}
if
(
_f_functionBaseView
)
{
[
_f_functionBaseView
removeFromSuperview
];
_f_functionBaseView
=
nil
;
[
self
setupFunctionBaseView
];
}
[
_f_tableView
reloadData
];
}
#pragma rightBarButton Action
-
(
void
)
defineFunctions
{
GXFFunctionsViewController
*
functionsVc
=
[[
GXFFunctionsViewController
alloc
]
init
];
[
self
PushViewController
:
functionsVc
animated
:
YES
];
}
#pragma UITablewViewDataSource
...
...
@@ -198,7 +179,7 @@ static NSString *collectionCellID = @"collectionCell";
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
1
)
{
return
900
;
return
_f_functionBaseView
.
height
;
}
else
{
return
44
;
}
...
...
@@ -213,16 +194,11 @@ static NSString *collectionCellID = @"collectionCell";
cell
.
textLabel
.
text
=
@"查看行情反馈-进行中"
;
}
else
{
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
@"secondCell"
];
//self.f_collectionView.size =
// [cell.contentView addSubview:_f_collectionView];
[
cell
.
contentView
addSubview
:
_f_functionBaseView
];
NSLog
(
@"%@"
,
NSStringFromCGRect
(
cell
.
frame
));
}
}
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
return
cell
;
}
...
...
This diff is collapsed.
Click to expand it.
XFFruit/ViewControllers/Login/ICRLoginViewController.m
View file @
b9a36cf9
...
...
@@ -145,8 +145,24 @@
[[
GXFFunctionDB
sharedInstance
]
createTables
];
//完成对初始化数据书库的操作
[[
GXFFunctionDBHelper
sharedInstance
]
insertAllOriginFunctions
];
[[
GXFFunctionDBHelper
sharedInstance
]
insertAllOriginDisplayFunctions
];
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
];
}
}
};
...
...
This diff is collapsed.
Click to expand it.
XFFruit/XFFruit-Prefix.pch
View file @
b9a36cf9
...
...
@@ -14,5 +14,5 @@
#import "IBTConstants.h"
#import "ICRAppMacro.h"
#import "ICRNotificationMacro.h"
#endif
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment