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
b4c8d8c3
Commit
b4c8d8c3
authored
Sep 02, 2015
by
陈俊俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
行情调研完善
parent
48d5df9b
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
406 additions
and
309 deletions
+406
-309
project.pbxproj
XFFruit.xcodeproj/project.pbxproj
+6
-0
ChooseParentViewController.h
...l/Classes/BaseViewController/ChooseParentViewController.h
+28
-0
ChooseParentViewController.m
...l/Classes/BaseViewController/ChooseParentViewController.m
+138
-0
IBTCommon.h
XFFruit/Utilities/IBTUIKit/IBTCommon.h
+1
-0
IBTCommon.m
XFFruit/Utilities/IBTUIKit/IBTCommon.m
+21
-1
IBTConstants.h
XFFruit/Utilities/IBTUIKit/IBTConstants.h
+5
-3
BusinessViewController.m
XFFruit/ViewControllers/Business/BusinessViewController.m
+1
-2
ChooseProductViewController.h
...trollers/Survey/controllers/ChooseProductViewController.h
+2
-3
ChooseProductViewController.m
...trollers/Survey/controllers/ChooseProductViewController.m
+12
-116
ChosePersonViewController.h
...ontrollers/Survey/controllers/ChosePersonViewController.h
+2
-3
ChosePersonViewController.m
...ontrollers/Survey/controllers/ChosePersonViewController.m
+51
-113
NewSurveyViewController.m
...wControllers/Survey/controllers/NewSurveyViewController.m
+96
-41
SurveyDetailViewController.m
...ntrollers/Survey/controllers/SurveyDetailViewController.m
+24
-9
SurveyViewController.m
...ViewControllers/Survey/controllers/SurveyViewController.m
+19
-18
No files found.
XFFruit.xcodeproj/project.pbxproj
View file @
b4c8d8c3
...
...
@@ -87,6 +87,7 @@
72C8034C1B7B72DB00990363
/* AddWorkSheetViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
72C8034B1B7B72DB00990363
/* AddWorkSheetViewController.m */
;
};
72C8034F1B7B735300990363
/* TopSheetView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
72C8034E1B7B735300990363
/* TopSheetView.m */
;
};
72C803521B7B897B00990363
/* DataManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
72C803511B7B897B00990363
/* DataManager.m */
;
};
72EDD86E1B96E11700964115
/* ChooseParentViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
72EDD86D1B96E11700964115
/* ChooseParentViewController.m */
;
};
72F56CB21B76EC200077F0C9
/* SurveyUser.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
72F56CB11B76EC200077F0C9
/* SurveyUser.m */
;
};
871F9F047CDDAC523E4358DC
/* libPods.a in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
86D33EC280C440156ED1B976
/* libPods.a */
;
};
C10214CD1AD8FE200024637E
/* ICRStoreDetailViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
C10214CC1AD8FE200024637E
/* ICRStoreDetailViewController.m */
;
};
...
...
@@ -522,6 +523,8 @@
72C8034E1B7B735300990363
/* TopSheetView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
TopSheetView.m
;
sourceTree
=
"<group>"
;
};
72C803501B7B897B00990363
/* DataManager.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
DataManager.h
;
sourceTree
=
"<group>"
;
};
72C803511B7B897B00990363
/* DataManager.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
DataManager.m
;
sourceTree
=
"<group>"
;
};
72EDD86C1B96E11700964115
/* ChooseParentViewController.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
ChooseParentViewController.h
;
sourceTree
=
"<group>"
;
};
72EDD86D1B96E11700964115
/* ChooseParentViewController.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
ChooseParentViewController.m
;
sourceTree
=
"<group>"
;
};
72F56CB01B76EC200077F0C9
/* SurveyUser.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
SurveyUser.h
;
sourceTree
=
"<group>"
;
};
72F56CB11B76EC200077F0C9
/* SurveyUser.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
SurveyUser.m
;
sourceTree
=
"<group>"
;
};
7DDFB1D460448C3B45118195
/* Pods.release.xcconfig */
=
{
isa
=
PBXFileReference
;
includeInIndex
=
1
;
lastKnownFileType
=
text.xcconfig
;
name
=
Pods.release.xcconfig
;
path
=
"Pods/Target Support Files/Pods/Pods.release.xcconfig"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1489,6 +1492,8 @@
children
=
(
C142D2C31AC3A16C000109A7
/* ICRBaseViewController.h */
,
C142D2C41AC3A16C000109A7
/* ICRBaseViewController.m */
,
72EDD86C1B96E11700964115
/* ChooseParentViewController.h */
,
72EDD86D1B96E11700964115
/* ChooseParentViewController.m */
,
);
path
=
BaseViewController
;
sourceTree
=
"<group>"
;
...
...
@@ -2373,6 +2378,7 @@
351CFF5E1B90633700F30866
/* GXFNoticeFunctionTableViewCell.m in Sources */
,
FE2FCC881B7492C500BBC6FB
/* ResultDetailViewController.m in Sources */
,
7281A0B41B8974120052B1AC
/* ProductViewController.m in Sources */
,
72EDD86E1B96E11700964115
/* ChooseParentViewController.m in Sources */
,
C159183D1AC062460013B391
/* IBTTableViewCellInfo.m in Sources */
,
C1FE504E1AE024FA00C18080
/* RIButtonItem.m in Sources */
,
C18AEA9A1AD2749200A1DB7B
/* ICRStoreListViewController.m in Sources */
,
...
...
XFFruit/General/Classes/BaseViewController/ChooseParentViewController.h
0 → 100644
View file @
b4c8d8c3
//
// ChooseParentViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/2.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "MaskCell.h"
#import "MJRefresh.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseParentViewController
:
ICRBaseViewController
@property
(
nonatomic
,
assign
)
BOOL
isMoreChose
;
//是否是多选
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
indexArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
UITextField
*
selectTextFiled
;
@property
(
nonatomic
,
assign
)
BOOL
isRefresh
;
-
(
void
)
endRefreshing
;
-
(
void
)
getBaseDataFromLocal
;
-
(
BOOL
)
isHaveIndexPath
:(
NSIndexPath
*
)
indexPath
;
@end
XFFruit/General/Classes/BaseViewController/ChooseParentViewController.m
0 → 100644
View file @
b4c8d8c3
//
// ChooseParentViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/2.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseParentViewController.h"
@interface
ChooseParentViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
@end
@implementation
ChooseParentViewController
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
boxValueChanged
:
)
name
:
UITextFieldTextDidChangeNotification
object
:
nil
];
[
self
initData
];
[
self
bulidLayout
];
[
self
createRefresh
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
self
.
indexArr
=
[
NSMutableArray
array
];
}
#pragma mark - 布局
-
(
void
)
bulidLayout
{
self
.
selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
self
.
selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
self
.
selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
self
.
selectTextFiled
.
delegate
=
self
;
self
.
selectTextFiled
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
self
.
view
addSubview
:
self
.
selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
self
.
selectTextFiled
.
leftView
=
leftView
;
self
.
selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
self
.
selectTextFiled
.
rightView
=
rightView
;
self
.
selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
createRefresh
{
self
.
tableView
.
header
=
[
MJRefreshNormalHeader
headerWithRefreshingBlock
:
^
{
if
(
self
.
isRefresh
)
{
return
;
}
self
.
isRefresh
=
YES
;
[
self
getBaseDataFromLocal
];
}];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"cellID"
;
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
return
cell
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
}
-
(
void
)
keyboardHidden
{
[
self
.
selectTextFiled
resignFirstResponder
];
}
-
(
void
)
deletePerson
{
self
.
selectTextFiled
.
text
=
@""
;
}
#pragma mark - 结束刷新
-
(
void
)
endRefreshing
{
self
.
isRefresh
=
NO
;
[
self
.
tableView
.
header
endRefreshing
];
}
-
(
BOOL
)
isHaveIndexPath
:
(
NSIndexPath
*
)
indexPath
{
for
(
NSIndexPath
*
path
in
self
.
indexArr
)
{
if
(
path
.
row
==
indexPath
.
row
)
{
return
YES
;
}
}
return
NO
;
}
#pragma mark -childFunction
-
(
void
)
getBaseDataFromLocal
{
}
-
(
void
)
sureClick
{
}
-
(
void
)
boxValueChanged
:
(
NSNotification
*
)
fication
{
}
-
(
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
XFFruit/Utilities/IBTUIKit/IBTCommon.h
View file @
b4c8d8c3
...
...
@@ -38,4 +38,5 @@
+
(
NSString
*
)
checkString
:(
NSString
*
)
str
;
+
(
NSMutableAttributedString
*
)
setTextViewFontOfString
:(
NSString
*
)
string
paragraphStyle
:(
NSInteger
)
lineHeight
fontSize
:(
float
)
size
color
:(
UIColor
*
)
color
;
+
(
NSString
*
)
trimmingCharacters
:(
NSString
*
)
str
;
+
(
int
)
compareDate
:(
NSString
*
)
oneDate
withDate
:(
NSString
*
)
twoDate
;
@end
XFFruit/Utilities/IBTUIKit/IBTCommon.m
View file @
b4c8d8c3
...
...
@@ -210,6 +210,26 @@
NSString
*
newStr
=
[
str
stringByTrimmingCharactersInSet
:[
NSCharacterSet
whitespaceCharacterSet
]];
return
newStr
;
}
+
(
int
)
compareDate
:
(
NSString
*
)
oneDate
withDate
:
(
NSString
*
)
twoDate
{
int
ci
;
NSDateFormatter
*
df
=
[[
NSDateFormatter
alloc
]
init
];
[
df
setDateFormat
:
@"yyyy-MM-dd HH:mm:ss"
];
NSDate
*
dt1
=
[[
NSDate
alloc
]
init
];
NSDate
*
dt2
=
[[
NSDate
alloc
]
init
];
dt1
=
[
df
dateFromString
:
oneDate
];
dt2
=
[
df
dateFromString
:
twoDate
];
NSComparisonResult
result
=
[
dt1
compare
:
dt2
];
switch
(
result
)
{
//date02比date01大
case
NSOrderedAscending
:
ci
=
1
;
break
;
//date02比date01小
case
NSOrderedDescending
:
ci
=-
1
;
break
;
//date02=date01
case
NSOrderedSame
:
ci
=
0
;
break
;
default
:
NSLog
(
@"erorr dates %@, %@"
,
dt2
,
dt1
);
break
;
}
return
ci
;
}
@end
XFFruit/Utilities/IBTUIKit/IBTConstants.h
View file @
b4c8d8c3
...
...
@@ -92,7 +92,7 @@
#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define FontSize(num) [UIFont systemFontOfSize:num]
#define AppWindow [[UIApplication sharedApplication].delegate window]
#define GXF_NSUSERFEFTAULTS [NSUserDefaults standardUserDefaults]
#define GXF_NAVIGAYION_COLOR HexColor(@"7ebf74")
#define GXF_SAVE_COLOR HexColor(@"50bd62")
...
...
@@ -110,9 +110,9 @@
#define GXF_SEVENTEENTH_SIZE FontSize(17)
//refreshUpdateDate
#define SurveyUpdateDate @"surveyUpdateDate"
#define SurveyUpdateDate
@"surveyUpdateDate"
#define ChooseProductUpdateDate @"chooseProductUpdateDate"
#define ChoosePersonUpdateDate @"choosePersonUpdateDate"
//行情调研状态
//initial(未提交),submitted(已提交),insurvey(调研中),finished(已完成)
#define SURVEY_STATE_INITIAL @"initial"
...
...
@@ -130,6 +130,8 @@
#define PURCHASE_STATE_FINISHED @"finished"
#define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show]
#endif
XFFruit/ViewControllers/Business/BusinessViewController.m
View file @
b4c8d8c3
...
...
@@ -128,7 +128,7 @@
case
kFunctionNewSurvey
:
//新建行情
{
NewSurveyViewController
*
svc
=
[[
NewSurveyViewController
alloc
]
init
];
svc
.
t
itle
=
[
IBTCommon
localizableString
:
@"AddSurvey"
];
svc
.
navT
itle
=
[
IBTCommon
localizableString
:
@"AddSurvey"
];
[
self
PushViewController
:
svc
animated
:
YES
];
}
break
;
...
...
@@ -136,7 +136,6 @@
{
SurveyViewController
*
svc
=
[[
SurveyViewController
alloc
]
init
];
svc
.
title
=
[
IBTCommon
localizableString
:
@"Survey"
];
svc
.
navigationItem
.
hidesBackButton
=
YES
;
[
self
PushViewController
:
svc
animated
:
YES
];
}
break
;
...
...
XFFruit/ViewControllers/Survey/controllers/ChooseProductViewController.h
View file @
b4c8d8c3
...
...
@@ -6,12 +6,11 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "
ICRBase
ViewController.h"
#import "
ChooseParent
ViewController.h"
#import "Product.h"
typedef
void
(
^
ChoseProduct
)(
Product
*
product
);
@interface
ChooseProductViewController
:
ICRBase
ViewController
@interface
ChooseProductViewController
:
ChooseParent
ViewController
@property
(
nonatomic
,
assign
)
BOOL
isMoreChose
;
//是否是多选
@property
(
nonatomic
,
copy
)
ChoseProduct
choseProduct
;
@end
XFFruit/ViewControllers/Survey/controllers/ChooseProductViewController.m
View file @
b4c8d8c3
...
...
@@ -7,54 +7,21 @@
//
#import "ChooseProductViewController.h"
#import "MaskCell.h"
#import "MJRefresh.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChooseProductViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
@interface
ChooseProductViewController
()
{
UITextField
*
_selectTextFiled
;
NSMutableArray
*
_indexArr
;
NSIndexPath
*
_currentIndexPath
;
BOOL
_isRefresh
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@end
@implementation
ChooseProductViewController
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
boxValueChanged
:
)
name
:
UITextFieldTextDidChangeNotification
object
:
nil
];
self
.
title
=
@"选择商品"
;
[
self
initData
];
[
self
bulidLayout
];
//刷新
[
self
createRefresh
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
_indexArr
=
[
NSMutableArray
array
];
//记录更新时间
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
ChooseProductUpdateDate
;
self
.
title
=
@"选择商品"
;
[
self
fetchProductList
:
@""
];
}
-
(
void
)
createRefresh
{
self
.
tableView
.
header
=
[
MJRefreshNormalHeader
headerWithRefreshingBlock
:
^
{
if
(
_isRefresh
)
{
return
;
}
_isRefresh
=
YES
;
[
self
getBaseDataFromLocal
];
}];
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
ChooseProductUpdateDate
;
}
-
(
void
)
getBaseDataFromLocal
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
...
...
@@ -70,11 +37,6 @@
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
getProductWithPage_number
:
0
page_size
:
100
success
:
succ
failure
:
fail
];
}
#pragma mark - 结束刷新
-
(
void
)
endRefreshing
{
_isRefresh
=
NO
;
[
self
.
tableView
.
header
endRefreshing
];
}
#pragma mark -成功
-
(
void
)
fetchProductList
:
(
NSString
*
)
titleStr
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
...
...
@@ -90,15 +52,15 @@
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
!
fetchedObjects
)
{
[
[
NSUserDefaults
standardUserDefaults
]
setObject
:[
NSDate
date
]
forKey
:
self
.
tableView
.
header
.
lastUpdatedTimeKey
];
[
[
NSUserDefaults
standardUserDefaults
]
synchronize
];
[
self
get
Data
];
if
(
!
[
GXF_NSUSERFEFTAULTS
objectForKey
:
ChooseProductUpdateDate
]
)
{
[
GXF_NSUSERFEFTAULTS
setObject
:[
NSDate
date
]
forKey
:
ChooseProductUpdateDate
];
[
GXF_NSUSERFEFTAULTS
synchronize
];
[
self
get
BaseDataFromLocal
];
}
else
{
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObject
:
self
.
tableView
.
header
.
lastUpdatedTime
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
self
deletePerson
];
[
self
tableViewRefresh
];
}
};
...
...
@@ -108,40 +70,6 @@
fetchResultsBlock
:
fetchResultsBlk
];
}
-
(
void
)
bulidLayout
{
_selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
returnKeyType
=
UIReturnKeyDone
;
_selectTextFiled
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
_selectTextFiled
addTarget
:
self
action
:
@selector
(
boxValueChanged
:
)
forControlEvents
:
UIControlEventValueChanged
];
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
_selectTextFiled
.
leftView
=
leftView
;
_selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
_selectTextFiled
.
rightView
=
rightView
;
_selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
sureClick
{
if
(
self
.
isMoreChose
){
...
...
@@ -156,19 +84,6 @@
}
[
self
PopViewControllerAnimated
:
YES
];
}
-
(
void
)
deletePerson
{
_selectTextFiled
.
text
=
@""
;
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"MaskCell"
;
MaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
...
...
@@ -219,7 +134,7 @@
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
if
(
!
[
self
isHaveIndexPath
:
indexPath
])
{
[
_
indexArr
addObject
:
indexPath
];
[
self
.
indexArr
addObject
:
indexPath
];
}
}
else
{
MaskCell
*
currentCell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
_currentIndexPath
];
...
...
@@ -230,33 +145,14 @@
}
}
-
(
BOOL
)
isHaveIndexPath
:
(
NSIndexPath
*
)
indexPath
{
for
(
NSIndexPath
*
path
in
_indexArr
)
{
if
(
path
.
row
==
indexPath
.
row
)
{
return
YES
;
}
}
return
NO
;
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
}
#pragma mark - 按钮事件
-
(
void
)
boxValueChanged
:
(
NSNotification
*
)
fication
{
NSString
*
tilkeStr
=
[
IBTCommon
trimmingCharacters
:
_
selectTextFiled
.
text
];
NSString
*
tilkeStr
=
[
IBTCommon
trimmingCharacters
:
self
.
selectTextFiled
.
text
];
[
self
fetchProductList
:
tilkeStr
];
[
self
tableViewRefresh
];
}
-
(
void
)
tableViewRefresh
{
[
self
.
tableView
reloadData
];
_currentIndexPath
=
nil
;
}
#pragma mark - hideKeyBoard
-
(
void
)
keyboardHidden
{
[
_selectTextFiled
resignFirstResponder
];
[
self
.
tableView
reloadData
];
}
...
...
XFFruit/ViewControllers/Survey/controllers/ChosePersonViewController.h
View file @
b4c8d8c3
...
...
@@ -6,13 +6,12 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "
ICRBase
ViewController.h"
#import "
ChooseParent
ViewController.h"
typedef
void
(
^
ChosePerson
)(
NSArray
*
user
);
@interface
ChosePersonViewController
:
ICRBase
ViewController
@interface
ChosePersonViewController
:
ChooseParent
ViewController
@property
(
nonatomic
,
assign
)
BOOL
isMoreChose
;
//是否是多选
@property
(
nonatomic
,
copy
)
ChosePerson
chosePerson
;
@end
XFFruit/ViewControllers/Survey/controllers/ChosePersonViewController.m
View file @
b4c8d8c3
...
...
@@ -7,40 +7,31 @@
//
#import "ChosePersonViewController.h"
#import "MaskCell.h"
#import "SurveyUser.h"
#import "User.h"
#define TopMargin 50
#define TableHeight 50
@interface
ChosePersonViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
,
UITextFieldDelegate
>
{
UITextField
*
_selectTextFiled
;
NSIndexPath
*
_currentIndexPath
;
@interface
ChosePersonViewController
(){
NSIndexPath
*
_currentIndexPath
;
}
@property
(
nonatomic
,
strong
)
NSMutableArray
*
dataArr
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
indexArr
;
@end
@implementation
ChosePersonViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
initData
];
[
self
bulidLayout
];
self
.
tableView
.
header
.
lastUpdatedTimeKey
=
ChoosePersonUpdateDate
;
self
.
title
=
@"选择人员"
;
[
self
fetchUserList
:
@""
];
}
-
(
void
)
initData
{
self
.
dataArr
=
[
NSMutableArray
array
];
self
.
indexArr
=
[
NSMutableArray
array
];
[
self
fetchUserList
];
-
(
void
)
getBaseDataFromLocal
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
fetchUserList
];
[
strongSelf
endRefreshing
];
[
strongSelf
fetchUserList
:
@""
];
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
...
...
@@ -50,65 +41,37 @@
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
getUserWithPage_number
:
0
page_size
:
100
success
:
succ
failure
:
fail
];
}
#pragma mark -成功
-
(
void
)
fetchUserList
{
-
(
void
)
fetchUserList
:
(
NSString
*
)
titleStr
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
User
TableName
],
@"uuid"
];
NSString
*
sql
=
@""
;
if
(
titleStr
.
length
>
0
)
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@"
,
[
User
TableName
],
titleStr
,
@"uuid"
];
}
else
{
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ ORDER BY %@"
,
[
User
TableName
],
@"uuid"
];
}
return
[
db
executeQuery
:
sql
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
strongSelf
.
tableView
reloadData
];
if
(
!
[
GXF_NSUSERFEFTAULTS
objectForKey
:
ChoosePersonUpdateDate
])
{
[
GXF_NSUSERFEFTAULTS
setObject
:[
NSDate
date
]
forKey
:
ChoosePersonUpdateDate
];
[
GXF_NSUSERFEFTAULTS
synchronize
];
[
self
getBaseDataFromLocal
];
}
else
{
[
strongSelf
.
dataArr
removeAllObjects
];
[
strongSelf
.
dataArr
addObject
:
self
.
tableView
.
header
.
lastUpdatedTime
];
[
strongSelf
.
dataArr
addObjectsFromArray
:
fetchedObjects
];
[
self
tableViewRefresh
];
}
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
runFetchForClass
:[
User
class
]
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
}
#pragma mark - 插入数据
-
(
void
)
bulidLayout
{
_selectTextFiled
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
20
,
5
,
ScreenSize
.
width
-
40
,
TopMargin
-
10
)];
_selectTextFiled
.
textAlignment
=
NSTextAlignmentLeft
;
_selectTextFiled
.
background
=
[
UIImage
imageNamed
:
@"textFiled"
];
_selectTextFiled
.
delegate
=
self
;
_selectTextFiled
.
font
=
GXF_FIFTEENTEN_SIZE
;
[
self
.
view
addSubview
:
_selectTextFiled
];
UIImageView
*
leftView
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
35
,
40
)];
leftView
.
image
=
[
UIImage
imageNamed
:
@"search"
];
_selectTextFiled
.
leftView
=
leftView
;
_selectTextFiled
.
leftViewMode
=
UITextFieldViewModeAlways
;
UIButton
*
rightView
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
rightView
setImage
:[
UIImage
imageNamed
:
@"delete"
]
forState
:
UIControlStateNormal
];
rightView
.
frame
=
CGRectMake
(
0
,
0
,
35
,
40
);
[
rightView
addTarget
:
self
action
:
@selector
(
deletePerson
)
forControlEvents
:
UIControlEventTouchUpInside
];
_selectTextFiled
.
rightView
=
rightView
;
_selectTextFiled
.
rightViewMode
=
UITextFieldViewModeAlways
;
self
.
tableView
=
[[
UITableView
alloc
]
initWithFrame
:(
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
ScreenSize
.
height
-
64
-
TopMargin
))
style
:(
UITableViewStylePlain
)];
self
.
tableView
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
tableView
.
delegate
=
self
;
self
.
tableView
.
dataSource
=
self
;
[
self
.
view
addSubview
:
self
.
tableView
];
UIBarButtonItem
*
rightItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
rightItem
;
}
-
(
void
)
sureClick
{
if
(
self
.
isMoreChose
)
{
NSMutableArray
*
arr
=
[[
NSMutableArray
alloc
]
init
];
...
...
@@ -138,25 +101,7 @@
[
self
PopViewControllerAnimated
:
YES
];
}
-
(
void
)
deletePerson
{
if
(
self
.
isMoreChose
)
{
[
self
.
indexArr
removeAllObjects
];
}
else
{
_currentIndexPath
=
nil
;
}
_selectTextFiled
.
text
=
@""
;
[
self
.
tableView
reloadData
];
}
#pragma mark - 协议方法
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
1
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
return
self
.
dataArr
.
count
;
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
static
NSString
*
cellID
=
@"MaskCell"
;
MaskCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
cellID
];
...
...
@@ -184,58 +129,51 @@
}
}
if
(
self
.
dataArr
.
count
>
0
)
{
User
*
user
=
self
.
dataArr
[
indexPath
.
row
];
[
cell
setTitleStr
:
user
.
name
];
if
(
indexPath
.
row
==
0
)
{
NSString
*
dateStr
=
[
self
.
dataArr
[
indexPath
.
row
]
httpParameterString
];
cell
.
titleLabel
.
textColor
=
GXF_CONTENT_COLOR
;
[
cell
setTitleStr
:[
NSString
stringWithFormat
:
@"上次更新时间:%@"
,
dateStr
]];
}
else
{
User
*
user
=
self
.
dataArr
[
indexPath
.
row
];
[
cell
setTitleStr
:
user
.
name
];
}
}
return
cell
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
0
)
{
return
;
}
if
(
self
.
isMoreChose
==
YES
)
{
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
if
(
!
[
self
isHaveIndexPath
:
indexPath
])
{
cell
.
Commitbtn
.
hidden
=
NO
;
[
self
.
indexArr
addObject
:
indexPath
];
}
else
{
cell
.
Commitbtn
.
hidden
=
YES
;
[
self
.
indexArr
removeObject
:
indexPath
];
}
NSString
*
personStr
=
@""
;
for
(
NSIndexPath
*
index
in
self
.
indexArr
)
{
User
*
user
=
self
.
dataArr
[
index
.
row
];
if
(
personStr
.
length
==
0
)
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"%@"
,
user
.
name
];
}
else
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"、%@"
,
user
.
name
];
}
}
_selectTextFiled
.
text
=
personStr
;
}
else
{
MaskCell
*
currentCell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
_currentIndexPath
];
currentCell
.
Commitbtn
.
hidden
=
YES
;
MaskCell
*
cell
=
(
MaskCell
*
)[
tableView
cellForRowAtIndexPath
:
indexPath
];
cell
.
Commitbtn
.
hidden
=
NO
;
_currentIndexPath
=
indexPath
;
User
*
user
=
self
.
dataArr
[
indexPath
.
row
];
_selectTextFiled
.
text
=
user
.
name
;
}
}
-
(
BOOL
)
isHaveIndexPath
:
(
NSIndexPath
*
)
indexPath
{
for
(
NSIndexPath
*
path
in
self
.
indexArr
)
{
if
(
path
.
row
==
indexPath
.
row
)
{
return
YES
;
}
}
return
NO
;
#pragma mark - 按钮事件
-
(
void
)
boxValueChanged
:
(
NSNotification
*
)
fication
{
NSString
*
tilkeStr
=
[
IBTCommon
trimmingCharacters
:
self
.
selectTextFiled
.
text
];
[
self
fetchUserList
:
tilkeStr
];
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
TableHeight
;
-
(
void
)
tableViewRefresh
{
_currentIndexPath
=
nil
;
if
(
self
.
indexArr
.
count
>
0
)
{
[
self
.
indexArr
removeAllObjects
];
}
[
self
.
tableView
reloadData
];
}
...
...
XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
View file @
b4c8d8c3
...
...
@@ -20,7 +20,7 @@
#import "Product.h"
#define LeftMargin 15
#define BtnHeight 44
#define TableHeight 46
#define Table
Row
Height 46
#define CornerRadius 5
#define BtnSize 19
#define TotalHeight 432
...
...
@@ -66,8 +66,41 @@ typedef enum : NSUInteger {
[
super
viewDidLoad
];
self
.
title
=
self
.
navTitle
;
[
self
initData
];
[
self
createTableView
];
[
self
createTableView
];
if
(
self
.
survey
)
{
[
self
getDataFromServer
];
}
}
-
(
void
)
getDataFromServer
{
__weak
typeof
(
self
)
weakSelf
=
self
;
void
(
^
succ
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
data
)
{
NSInteger
success
=
[
data
[
@"success"
]
integerValue
];
NSString
*
message
=
data
[
@"message"
]
;
if
(
success
==
1
)
{
NSDictionary
*
dictData
=
data
[
@"data"
];
Survey
*
survey
=
[[
Survey
alloc
]
init
];
[
survey
setValuesForKeysWithDictionary
:
dictData
];
strongSelf
.
survey
=
survey
;
[
strongSelf
preferDataInPersonLabel
];
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
}
};
void
(
^
fail
)(
id
)
=
^
(
id
data
)
{
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
showTips
:
data
];
};
[
IBTLoadingView
showProgressLabel
:
@"正在加载..."
];
[[
ICRHTTPController
sharedController
]
getResultWithSurveyUuid
:
self
.
survey
.
uuid
success
:
succ
failure
:
fail
];
}
-
(
void
)
initData
{
_dataArr
=
[
NSMutableArray
array
];
...
...
@@ -131,11 +164,31 @@ typedef enum : NSUInteger {
-
(
BOOL
)
checkSurvey
{
self
.
titleStr
=
_titleField
.
text
;
self
.
remarkStr
=
_noteTextView
.
text
;
if
(
self
.
titleStr
.
length
==
0
||
self
.
productUuidStr
.
length
==
0
||
self
.
productNameStr
.
length
==
0
||
self
.
productCodeStr
.
length
==
0
||
self
.
users
.
count
<=
0
||
self
.
beginDateStr
.
length
==
0
||
self
.
endDateStr
.
length
==
0
)
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示信息"
message
:
@"信息不完整"
delegate
:
nil
cancelButtonTitle
:
@"确定"
otherButtonTitles
:
nil
,
nil
];
[
alert
show
];
if
(
self
.
titleStr
.
length
==
0
)
{
ShowMessage
(
@"调研标题不能为空"
);
return
NO
;
}
if
(
self
.
productUuidStr
.
length
==
0
||
self
.
productNameStr
.
length
==
0
||
self
.
productCodeStr
.
length
==
0
)
{
ShowMessage
(
@"调研商品不能为空"
);
return
NO
;
}
if
(
self
.
beginDateStr
.
length
==
0
)
{
ShowMessage
(
@"调研开始日期不能为空"
);
return
NO
;
}
if
(
self
.
endDateStr
.
length
==
0
)
{
ShowMessage
(
@"调研结束日期不能为空"
);
return
NO
;
}
if
(
self
.
users
.
count
<=
0
)
{
ShowMessage
(
@"调研人员不能为空"
);
return
NO
;
}
if
([
IBTCommon
compareDate
:
self
.
beginDateStr
withDate
:
self
.
endDateStr
]
<
0
)
{
ShowMessage
(
@"开始日期不能小于结束日期"
);
return
NO
;
}
return
YES
;
}
...
...
@@ -223,7 +276,7 @@ typedef enum : NSUInteger {
-
(
void
)
createViewInCell
:
(
SurveyCell
*
)
cell
indexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
0
)
{
_titleField
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
15
,
TableHeight
)];
_titleField
=
[[
UITextField
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
15
,
Table
Row
Height
)];
_titleField
.
textAlignment
=
NSTextAlignmentRight
;
_titleField
.
textColor
=
GXF_CONTENT_COLOR
;
_titleField
.
placeholder
=
@"输入调研标题"
;
...
...
@@ -231,12 +284,8 @@ typedef enum : NSUInteger {
_titleField
.
returnKeyType
=
UIReturnKeyDone
;
_titleField
.
delegate
=
self
;
[
cell
.
contentView
addSubview
:
_titleField
];
if
(
self
.
survey
)
{
_titleField
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
self
.
titleStr
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
}
}
else
if
(
indexPath
.
row
==
_dataArr
.
count
-
1
){
_noteTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
15
,
TableHeight
)];
_noteTextView
=
[[
HPGrowingTextView
alloc
]
initWithFrame
:
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
15
,
Table
Row
Height
)];
_noteTextView
.
contentInset
=
UIEdgeInsetsMake
(
5
,
5
,
5
,
0
);
_noteTextView
.
minNumberOfLines
=
1
;
_noteTextView
.
maxNumberOfLines
=
4
;
...
...
@@ -246,15 +295,12 @@ typedef enum : NSUInteger {
_noteTextView
.
returnKeyType
=
UIReturnKeyDone
;
_noteTextView
.
placeholder
=
@"输入备注内容"
;
[
cell
.
contentView
addSubview
:
_noteTextView
];
if
(
self
.
survey
)
{
_noteTextView
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
remark
];
self
.
remarkStr
=
[
IBTCommon
checkString
:
self
.
survey
.
remark
];
}
CGRect
lineFrame
=
cell
.
lineLabel
.
frame
;
lineFrame
.
origin
.
y
=
TableHeight
*
2
-
1
;
lineFrame
.
origin
.
y
=
Table
Row
Height
*
2
-
1
;
cell
.
lineLabel
.
frame
=
lineFrame
;
}
else
{
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
15
,
TableHeight
))];
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
initWithFrame
:(
CGRectMake
(
100
+
LeftMargin
,
0
,
ScreenSize
.
width
-
100
-
LeftMargin
*
2
-
15
,
Table
Row
Height
))];
contentLabel
.
textAlignment
=
NSTextAlignmentRight
;
contentLabel
.
textColor
=
GXF_PLACEHOLDER_COLOR
;
contentLabel
.
font
=
GXF_FIFTEENTEN_SIZE
;
...
...
@@ -262,56 +308,59 @@ typedef enum : NSUInteger {
if
(
indexPath
.
row
==
1
)
{
contentLabel
.
text
=
@"选择商品"
;
_productLabel
=
contentLabel
;
[
self
preferDataInProductLabel
];
}
else
if
(
indexPath
.
row
==
2
){
contentLabel
.
text
=
@"选择日期"
;
_startDateLabel
=
contentLabel
;
if
(
self
.
survey
)
{
if
(
self
.
survey
.
beginDate
.
length
>
9
)
{
_startDateLabel
.
text
=
[[
IBTCommon
checkString
:
self
.
survey
.
beginDate
]
substringToIndex
:
10
];
}
_startDateLabel
.
textColor
=
GXF_CONTENT_COLOR
;
self
.
beginDateStr
=
[
IBTCommon
checkString
:
self
.
survey
.
beginDate
];
}
}
else
if
(
indexPath
.
row
==
3
){
contentLabel
.
text
=
@"选择日期"
;
_endDateLabel
=
contentLabel
;
if
(
self
.
survey
)
{
if
(
self
.
survey
.
endDate
.
length
>
9
)
{
_endDateLabel
.
text
=
[[
IBTCommon
checkString
:
self
.
survey
.
endDate
]
substringToIndex
:
10
];
}
_endDateLabel
.
textColor
=
GXF_CONTENT_COLOR
;
self
.
endDateStr
=
[
IBTCommon
checkString
:
self
.
survey
.
endDate
];
}
}
else
if
(
indexPath
.
row
==
4
){
contentLabel
.
text
=
@"选择调研人员"
;
_personLabel
=
contentLabel
;
[
self
preferDataInPersonLabel
];
}
}
}
-
(
void
)
preferDataInPersonLabel
{
if
(
self
.
survey
)
{
_titleField
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
self
.
titleStr
=
[
IBTCommon
checkString
:
self
.
survey
.
title
];
}
if
(
self
.
survey
)
{
if
(
self
.
survey
.
endDate
.
length
>
9
)
{
_endDateLabel
.
text
=
[[
IBTCommon
checkString
:
self
.
survey
.
endDate
]
substringToIndex
:
10
];
}
_endDateLabel
.
textColor
=
GXF_CONTENT_COLOR
;
self
.
endDateStr
=
[
IBTCommon
checkString
:
self
.
survey
.
endDate
];
}
if
(
self
.
survey
)
{
if
(
self
.
survey
.
users
.
count
>
0
)
{
NSString
*
personStr
=
@""
;
for
(
SurveyUser
*
surveyUser
in
self
.
survey
.
users
)
{
for
(
NSDictionary
*
userDict
in
self
.
survey
.
users
)
{
SurveyUser
*
surveyUser
=
[[
SurveyUser
alloc
]
init
];
[
surveyUser
setValuesForKeysWithDictionary
:
userDict
];
if
(
personStr
.
length
==
0
)
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"%@"
,
surveyUser
.
userName
];
}
else
{
}
else
{
personStr
=
[
personStr
stringByAppendingFormat
:
@"、%@"
,
surveyUser
.
userName
];
}
}
_personLabel
.
text
=
personStr
;
_personLabel
.
textColor
=
GXF_CONTENT_COLOR
;
}
if
(
self
.
users
>
0
)
{
[
self
.
users
addObjectsFromArray
:
self
.
survey
.
users
];
}
}
}
-
(
void
)
preferDataInProductLabel
{
if
(
self
.
survey
)
{
if
(
self
.
survey
.
beginDate
.
length
>
9
)
{
_startDateLabel
.
text
=
[[
IBTCommon
checkString
:
self
.
survey
.
beginDate
]
substringToIndex
:
10
];
}
_startDateLabel
.
textColor
=
GXF_CONTENT_COLOR
;
self
.
beginDateStr
=
[
IBTCommon
checkString
:
self
.
survey
.
beginDate
];
}
if
(
self
.
survey
)
{
_productLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@[%@]"
,[
IBTCommon
checkString
:
self
.
survey
.
productName
],[
IBTCommon
checkString
:
self
.
survey
.
productCode
]];
_productLabel
.
textColor
=
GXF_CONTENT_COLOR
;
...
...
@@ -319,13 +368,19 @@ typedef enum : NSUInteger {
self
.
productNameStr
=
[
IBTCommon
checkString
:
self
.
survey
.
productName
];
self
.
productUuidStr
=
[
IBTCommon
checkString
:
self
.
survey
.
productUuid
];
}
if
(
self
.
survey
)
{
_noteTextView
.
text
=
[
IBTCommon
checkString
:
self
.
survey
.
remark
];
self
.
remarkStr
=
[
IBTCommon
checkString
:
self
.
survey
.
remark
];
}
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
5
){
return
TableHeight
*
2
;
return
Table
Row
Height
*
2
;
}
else
{
return
TableHeight
;
return
Table
Row
Height
;
}
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
...
...
XFFruit/ViewControllers/Survey/controllers/SurveyDetailViewController.m
View file @
b4c8d8c3
...
...
@@ -13,9 +13,9 @@
#define BottomHeight 50
#define LeftMargin 20
#define LeftWidth 100
#define LeftHeight
3
0
#define LeftHeight
2
0
#define TopMargin 15
#define ContentMargin 10
typedef
enum
:
NSUInteger
{
DetailTag
=
6000
,
...
...
@@ -37,6 +37,8 @@ typedef enum : NSUInteger {
@property
(
nonatomic
,
strong
)
UILabel
*
endDateLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
userLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
noteLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
lefeNoteLabel
;
@end
@implementation
SurveyDetailViewController
...
...
@@ -149,11 +151,11 @@ typedef enum : NSUInteger {
UIButton
*
endBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
ScreenSize
.
height
-
64
-
BottomHeight
+
5
,
ScreenSize
.
width
-
LeftMargin
*
2
,
40
)
target
:
self
sel
:
@selector
(
btnClick
:
)
tag
:
EndTag
image
:
nil
title
:
@"结束"
titleColor
:
[
UIColor
whiteColor
]
isCorner
:
YES
corner
:
8
bgColor
:
GXF_COMMIT_COLOR
];
[
self
.
view
addSubview
:
endBtn
];
_surveyView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
LeftHeight
*
9
+
LeftMargin
/
2
)];
_surveyView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
TopMargin
,
ScreenSize
.
width
,
LeftHeight
*
9
+
ContentMargin
*
10
)];
_surveyView
.
backgroundColor
=
[
UIColor
whiteColor
];
[
_scrollView
addSubview
:
_surveyView
];
UILabel
*
tagLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
/
2
,
10
,
LeftWidth
*
2
,
LeftHeight
)];
UILabel
*
tagLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
/
2
,
ContentMargin
,
LeftWidth
*
2
,
LeftHeight
)];
tagLabel
.
text
=
@"【调研内容】"
;
tagLabel
.
font
=
GXF_SEVENTEENTH_SIZE
;
tagLabel
.
textColor
=
HexColor
(
@"7ebf74"
);
...
...
@@ -161,13 +163,13 @@ typedef enum : NSUInteger {
NSArray
*
leftArr
=
@[
@"单号:"
,
@"状态:"
,
@"标题:"
,
@"商品:"
,
@"开始日期:"
,
@"截止日期:"
,
@"调研人员:"
,
@"备注:"
];
for
(
NSInteger
i
=
0
;
i
<
leftArr
.
count
;
i
++
)
{
UILabel
*
leftLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
CGRectGetMaxY
(
tagLabel
.
frame
)
+
LeftHeight
*
i
,
LeftWidth
,
LeftHeight
)];
UILabel
*
leftLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
LeftMargin
,
CGRectGetMaxY
(
tagLabel
.
frame
)
+
ContentMargin
+
(
LeftHeight
+
ContentMargin
)
*
i
,
LeftWidth
,
LeftHeight
)];
leftLabel
.
font
=
GXF_SEVENTEENTH_SIZE
;
leftLabel
.
text
=
leftArr
[
i
];
leftLabel
.
textColor
=
GXF_DETAIL_COLOR
;
[
_surveyView
addSubview
:
leftLabel
];
UILabel
*
rightLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
leftLabel
.
frame
),
CGRectGetMaxY
(
tagLabel
.
frame
)
+
LeftHeight
*
i
,
_surveyView
.
frame
.
size
.
width
-
LeftMargin
-
LeftWidth
,
LeftHeight
)];
UILabel
*
rightLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
CGRectGetMaxX
(
leftLabel
.
frame
),
CGRectGetMaxY
(
tagLabel
.
frame
)
+
ContentMargin
+
(
LeftHeight
+
ContentMargin
)
*
i
,
_surveyView
.
frame
.
size
.
width
-
LeftMargin
-
LeftWidth
,
LeftHeight
)];
rightLabel
.
font
=
GXF_SEVENTEENTH_SIZE
;
rightLabel
.
textColor
=
GXF_DETAIL_COLOR
;
if
(
i
==
0
)
{
...
...
@@ -183,10 +185,12 @@ typedef enum : NSUInteger {
}
else
if
(
i
==
5
){
self
.
endDateLabel
=
rightLabel
;
}
else
if
(
i
==
6
){
rightLabel
.
numberOfLines
=
0
;
self
.
userLabel
=
rightLabel
;
}
else
if
(
i
==
7
){
rightLabel
.
numberOfLines
=
0
;
self
.
noteLabel
=
rightLabel
;
self
.
lefeNoteLabel
=
leftLabel
;
}
[
_surveyView
addSubview
:
rightLabel
];
}
...
...
@@ -261,13 +265,24 @@ typedef enum : NSUInteger {
-
(
void
)
setNoteHeight
{
CGFloat
height
=
[
self
.
noteLabel
calculateHeight
];
CGFloat
personHeight
=
[
self
.
userLabel
calculateHeight
];
CGRect
personFrame
=
self
.
userLabel
.
frame
;
personFrame
.
size
.
height
=
personHeight
;
self
.
userLabel
.
frame
=
personFrame
;
CGFloat
noteHeight
=
[
self
.
noteLabel
calculateHeight
];
CGRect
noteFrame
=
self
.
noteLabel
.
frame
;
noteFrame
.
size
.
height
=
height
;
noteFrame
.
size
.
height
=
noteHeight
;
noteFrame
.
origin
.
y
=
CGRectGetMaxY
(
self
.
userLabel
.
frame
)
+
ContentMargin
;
self
.
noteLabel
.
frame
=
noteFrame
;
CGFloat
totalHeight
=
height
+
LeftHeight
*
9
;
CGRect
leftNoteFrame
=
self
.
lefeNoteLabel
.
frame
;
leftNoteFrame
.
origin
.
y
=
CGRectGetMaxY
(
self
.
userLabel
.
frame
)
+
ContentMargin
;
self
.
lefeNoteLabel
.
frame
=
leftNoteFrame
;
CGFloat
totalHeight
=
noteHeight
+
(
LeftHeight
*
7
+
ContentMargin
*
10
)
+
personHeight
;
CGRect
surveyFrame
=
_surveyView
.
frame
;
surveyFrame
.
size
.
height
=
totalHeight
;
_surveyView
.
frame
=
surveyFrame
;
...
...
XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
View file @
b4c8d8c3
...
...
@@ -195,6 +195,9 @@ typedef enum : NSUInteger {
if
(
pageCount
<=
_currentPage
)
{
[
self
.
tableView
.
footer
noticeNoMoreData
];
}
if
(
_currentPage
==
0
&&
self
.
dataArr
.
count
>
0
)
{
[
self
.
tableView
scrollToRowAtIndexPath
:[
NSIndexPath
indexPathForRow
:
0
inSection
:
0
]
atScrollPosition
:
UITableViewScrollPositionTop
animated
:
YES
];
}
}
else
{
[
IBTLoadingView
showTips
:
message
];
}
...
...
@@ -206,7 +209,8 @@ typedef enum : NSUInteger {
-
(
void
)
createTableView
{
_sureBtn
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"确定"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
sureClick
)];
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
_sortBtn
=
[
IBTCustomButtom
creatButtonWithFrame
:
CGRectMake
(
LeftMargin
,
10
,
BtnWidth
,
BtnHeight
)
target
:
self
sel
:
@selector
(
sortClick
:
)
tag
:
SortTag
image
:
@"black_arrow_down_with_text"
title
:
nil
titleColor
:
GXF_DETAIL_COLOR
isCorner
:
NO
corner
:
0
bgColor
:
nil
];
_sortBtn
.
titleLabel
.
font
=
FontSize
(
BtnSize
);
[
self
.
view
addSubview
:
_sortBtn
];
...
...
@@ -247,20 +251,21 @@ typedef enum : NSUInteger {
#pragma mark - 确定
-
(
void
)
sureClick
{
[
_boltView
.
titleFiled
resignFirstResponder
];
[
_boltView
.
billFiled
resignFirstResponder
];
//请求
[
self
getData
];
//还原数据
if
(
_sortView
)
{
[
self
hiddenSortMaskView
:
YES
];
}
if
(
_boltView
)
{
[
self
hiddenBoltMaskView
:
YES
];
if
(
self
.
state
.
length
>
0
||
self
.
billNumberLike
.
length
>
0
||
self
.
titleLike
.
length
>
0
||
self
.
orderDirection
.
length
>
0
)
{
[
_boltView
.
titleFiled
resignFirstResponder
];
[
_boltView
.
billFiled
resignFirstResponder
];
_currentPage
=
0
;
//请求
[
self
getData
];
//还原数据
if
(
_sortView
)
{
[
self
hiddenSortMaskView
:
YES
];
}
if
(
_boltView
)
{
[
self
hiddenBoltMaskView
:
YES
];
}
}
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
#pragma mark -按钮事件
...
...
@@ -275,7 +280,6 @@ typedef enum : NSUInteger {
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_arrow_down_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenSortMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"select_arrow_up_text"
]
forState
:
UIControlStateNormal
];
if
(
_sortView
==
nil
)
{
...
...
@@ -289,7 +293,6 @@ typedef enum : NSUInteger {
_sortView
.
frame
=
sortFrame
;
}];
}
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
currentBtn
=
btn
;
}
}
else
if
(
btn
.
tag
==
BoltTag
){
...
...
@@ -300,7 +303,6 @@ typedef enum : NSUInteger {
[
btn
setImage
:[
UIImage
imageNamed
:
@"black_filter_with_text"
]
forState
:
UIControlStateNormal
];
[
self
hiddenBoltMaskView
:
YES
];
currentBtn
=
nil
;
self
.
navigationItem
.
rightBarButtonItem
=
nil
;
}
else
{
[
btn
setImage
:[
UIImage
imageNamed
:
@"selected-filter_with_text"
]
forState
:
UIControlStateNormal
];
...
...
@@ -316,7 +318,6 @@ typedef enum : NSUInteger {
_boltView
.
frame
=
sortFrame
;
}];
currentBtn
=
btn
;
self
.
navigationItem
.
rightBarButtonItem
=
_sureBtn
;
}
}
...
...
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