Commit aae2413b authored by 朱朝吉's avatar 朱朝吉

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

parents 38d3a8b1 f27c3520
......@@ -62,7 +62,6 @@
7217E9EC1B72364300FE5C1D /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D61B72364300FE5C1D /* HPTextViewInternal.m */; };
7217E9EE1B72364300FE5C1D /* MaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D91B72364300FE5C1D /* MaskCell.m */; };
7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9DA1B72364300FE5C1D /* maskEnable.png */; };
7217E9F01B72364300FE5C1D /* sort.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9DB1B72364300FE5C1D /* sort.png */; };
7217E9F11B72364300FE5C1D /* SortMaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DD1B72364300FE5C1D /* SortMaskView.m */; };
7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DF1B72364300FE5C1D /* StartTimeView.m */; };
7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E11B72364300FE5C1D /* SurveyCell.m */; };
......@@ -442,7 +441,6 @@
7217E9D81B72364300FE5C1D /* MaskCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaskCell.h; sourceTree = "<group>"; };
7217E9D91B72364300FE5C1D /* MaskCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MaskCell.m; sourceTree = "<group>"; };
7217E9DA1B72364300FE5C1D /* maskEnable.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = maskEnable.png; sourceTree = "<group>"; };
7217E9DB1B72364300FE5C1D /* sort.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = sort.png; sourceTree = "<group>"; };
7217E9DC1B72364300FE5C1D /* SortMaskView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SortMaskView.h; sourceTree = "<group>"; };
7217E9DD1B72364300FE5C1D /* SortMaskView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SortMaskView.m; sourceTree = "<group>"; };
7217E9DE1B72364300FE5C1D /* StartTimeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StartTimeView.h; sourceTree = "<group>"; };
......@@ -885,7 +883,6 @@
7217E9D81B72364300FE5C1D /* MaskCell.h */,
7217E9D91B72364300FE5C1D /* MaskCell.m */,
7217E9DA1B72364300FE5C1D /* maskEnable.png */,
7217E9DB1B72364300FE5C1D /* sort.png */,
7217E9F51B724A7600FE5C1D /* mask.png */,
7217E9DC1B72364300FE5C1D /* SortMaskView.h */,
7217E9DD1B72364300FE5C1D /* SortMaskView.m */,
......@@ -1895,7 +1892,6 @@
C1E0930A1AC8FC94003B7126 /* Localizable.strings in Resources */,
C123A9191B25CBAD003C0C36 /* selected_star@2x.png in Resources */,
7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */,
7217E9F01B72364300FE5C1D /* sort.png in Resources */,
7217E9F61B724A7600FE5C1D /* mask.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -2350,7 +2346,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e";
PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
......@@ -2388,7 +2384,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e";
PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
......@@ -2412,7 +2408,7 @@
"$(PROJECT_DIR)",
);
PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e";
PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
};
name = Debug;
......@@ -2433,7 +2429,7 @@
"$(PROJECT_DIR)",
);
PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e";
PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
};
name = Release;
......@@ -2456,7 +2452,7 @@
INFOPLIST_FILE = XFFruitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = XFFruitTests;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e";
PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
};
......@@ -2476,7 +2472,7 @@
INFOPLIST_FILE = XFFruitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = XFFruitTests;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e";
PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
};
......
......@@ -202,8 +202,22 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
page_size:(NSUInteger)page_size
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//生成行情反馈图片
- (void)resultChartWithResultUuid:(NSString *)uuid
width:(NSNumber *)width
height:(NSNumber *)height
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//结束行情反馈(写)
- (void)surveyFinishWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//获取行情调研单反馈列表
- (void)getResultsWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end
......
......@@ -71,7 +71,11 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_QuerySurvey,
XFFHttp_GetSurvey,
XFFHttp_GetProduct,
XFFHttp_GetUser
XFFHttp_GetUser,
XFFHttp_SurveyFinish,
//行情反馈图片
XFFHttp_ResultChart,
XFFHttp_GetResults
};
static NSString * const ICRHTTPInterface[] = {
......@@ -123,8 +127,11 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_QuerySurvey] = @"survey/query_survey",
[XFFHttp_GetSurvey] = @"survey/get_survey",
[XFFHttp_GetProduct] = @"mdata/product/download",
[XFFHttp_GetUser] = @"user/download"
[XFFHttp_GetUser] = @"user/download",
[XFFHttp_SurveyFinish] = @"survey/finish",
//行情反馈生成图片
[XFFHttp_ResultChart] = @"survey/resultchart",
[XFFHttp_GetResults] = @"survey/get_results"
};
static NSString * const ICRAttachmentTypeValue[] = {
......@@ -1338,27 +1345,8 @@ acceptTypeJson:YES
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (IsDictObject(responseObject)) {
void (^complete)(void) = ^(void){
if (succ) {
[IBTCommon runOnMainThreadWithoutDeadlocking:^{
succ( responseObject );
}];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
objectClass:NSClassFromString( @"Survey" )
deleteLocal:YES
handleData:NULL
complete:complete
fail:fail];
}
else {
if (fail) {
fail( nil );
}
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
......@@ -1507,6 +1495,112 @@ acceptTypeJson:YES
failure:failure];
}
- (void)resultChartWithResultUuid:(NSString *)uuid
width:(NSNumber *)width
height:(NSNumber *)height
success:(void (^)(id))succ
failure:(void (^)(id))fail{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (IsDictObject(responseObject)) {
if (succ) {
[IBTCommon runOnMainThreadWithoutDeadlocking:^{
succ( responseObject );
}];
}
}
else {
if (fail) {
fail( nil );
}
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_ResultChart] stringByAppendingFormat:@"/%@?width=%@&height=%@",uuid,width,height];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//结束行情反馈(写)
- (void)surveyFinishWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!uuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_SurveyFinish] stringByAppendingFormat:@"/%@?time=%@&operId=%@&operName=%@",uuid,currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//获取行情调研单反馈列表
- (void)getResultsWithUuid:(NSString *)uuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!uuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetResults] stringByAppendingFormat:@"/%@",uuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end
......@@ -51,7 +51,7 @@
// yyyy-MM-dd HH:mm:ss
- (NSString *)httpParameterString;
- (NSString *)coverStringFromString;
// yymmddhhmmssSSS
- (NSString *)mobileIDDateString;
......
......@@ -292,7 +292,9 @@
- (NSString *)httpParameterString {
return [self stringWithFormatter:@"%Y-%m-%d %H:%M:%S"];
}
- (NSString *)coverStringFromString {
return [self stringWithFormatter:@"%Y.%m.%d"];
}
- (NSString *)mobileIDDateString {
return [self stringWithFormatter:@"%y%m%d%H%M%S000"];
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "finish.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "finish@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "initial.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "initial@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "insurvey.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "insurvey@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -27,6 +27,7 @@
//new HTTP
#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:7580/cruiser-server/rest"
#define Server_Url @"http://218.244.151.129:7580/cruiser-server"
//#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:8281/XFFruit-server/rest"
......
......@@ -177,10 +177,11 @@
}
+ (NSString *)stringFromDate:(NSDate*)aDate{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy.MM.dd"];
[formatter setDateFormat:@"yyyy-MM-dd"];
NSString *dateString = [formatter stringFromDate:aDate];
return dateString;
}
+ (NSString*)dictionaryToJson:(id)dic
{
......
......@@ -28,7 +28,6 @@
@property (copy, nonatomic) NSString *currentStoreID;
@property (copy, nonatomic) NSString *uniqueID;
+ (instancetype)sharedInstance;
- (BOOL)saveArchive;
......
......@@ -10,6 +10,8 @@
@protocol BoltMaskViewDelegate <NSObject>
- (void)getBoltValueSelectRow:(NSString *)state;
- (void)getTitleLike:(NSString *)titleLike;
- (void)getBillNumber:(NSString *)billNumber;
@end
......@@ -18,4 +20,6 @@
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <BoltMaskViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill;
@end
......@@ -8,33 +8,70 @@
#import "BoltMaskView.h"
#import "MaskCell.h"
#define TableHeight 35
#define TableHeight 45
#define LeftMargin 80
#define TotalHeight 176
#define TotalHeight 224
#define LeftHeight 44
@interface BoltMaskView ()
@interface BoltMaskView ()<UITextFieldDelegate>
{
UIView *_leftView;
UIButton *_currentBtn;
NSIndexPath *_currentIndexPath;
UIView *_titleView;
UIView *_billNumberView;
UITextField * _titleFiled;
UITextField *_billFiled;
NSString *_state;
NSString *_billNumber;
NSString *_title;
}
@property (nonatomic,strong)NSString *state;
@property (nonatomic,strong)NSString *title;
@property (nonatomic,strong)NSString *billNumber;
@end
@implementation BoltMaskView
- (instancetype)initWithFrame:(CGRect)frame{
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill{
self = [super initWithFrame:frame];
if (self) {
self.title = title;
self.billNumber = bill;
self.state = state;
[self createView];
[self createRightView];
[self preferData];
}
return self;
}
- (void)preferData{
//initial(未提交),submitted(已提交),insurvey(调研中)
if ([self.state isEqualToString:@"none"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([self.state isEqualToString:@"initial"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else if ([self.state isEqualToString:@"submitted"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
}else if ([self.state isEqualToString:@"insurvey"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:3 inSection:0];
}
_titleView.hidden = YES;
if(self.title.length > 0){
_titleFiled.text = self.title;
}
_billNumberView.hidden = YES;
if (self.billNumber.length > 0) {
_billFiled.text = self.billNumber;
}
}
#pragma mark - 创建视图
- (void)createView
{
_leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height)];
[self addSubview:_leftView];
NSArray *arr = @[@"按状态",@"条件一",@"条件二",@"条件三"];
NSArray *arr = @[@"按状态",@"条件一",@"条件二"];
for (NSInteger i = 0; i<arr.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
......@@ -50,19 +87,84 @@
[button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_leftView addSubview:button];
}
}
- (void)createRightView{
_titleView = [[UIView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height)];
_titleView.backgroundColor = [UIColor whiteColor];
[self addSubview:_titleView];
UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
titleLabel.font = FontSize(15);
titleLabel.text = @"标题类似于:";
[_titleView addSubview:titleLabel];
_titleFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
_titleFiled.textAlignment = NSTextAlignmentLeft;
_titleFiled.textColor = HexColor(@"444444");
_titleFiled.placeholder = @"输入标题";
_titleFiled.borderStyle = UITextBorderStyleRoundedRect;
_titleFiled.font = FontSize(15);
_titleFiled.returnKeyType = UIReturnKeyDone;
_titleFiled.delegate = self;
[_titleView addSubview:_titleFiled];
_billNumberView = [[UIView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height)];
_billNumberView.backgroundColor = [UIColor whiteColor];
[self addSubview:_billNumberView];
UILabel *billLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
billLabel.font = FontSize(15);
billLabel.text = @"单号:";
[_billNumberView addSubview:billLabel];
_billFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(billLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
_billFiled.textAlignment = NSTextAlignmentLeft;
_billFiled.textColor = HexColor(@"444444");
_billFiled.placeholder = @"输入单号";
_billFiled.borderStyle = UITextBorderStyleRoundedRect;
_billFiled.font = FontSize(15);
_billFiled.returnKeyType = UIReturnKeyDone;
_billFiled.delegate = self;
[_billNumberView addSubview:_billFiled];
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self addSubview:self.tableView];
}
- (void)leftBtnClick:(UIButton *)btn{
_currentBtn.enabled = YES;
btn.enabled = NO;
_currentBtn = btn;
[self keyBoardHidden];
switch (btn.tag) {
case 1001://状态
{
self.tableView.hidden = NO;
_titleView.hidden = YES;
_billNumberView.hidden = YES;
}
break;
case 1002://条件二
{
self.tableView.hidden = YES;
_titleView.hidden = YES;
_billNumberView.hidden = NO;
}
break;
case 1003://条件三
{
self.tableView.hidden = YES;
_titleView.hidden = NO;
_billNumberView.hidden = YES;
}
break;
default:
break;
}
}
#pragma mark - 协议
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
......@@ -102,11 +204,43 @@
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
[self.delegate getBoltValueSelectRow:@"tt"];
//initial(未提交),submitted(已提交),insurvey(调研中)
NSString *stateStr = @"";
if (indexPath.row == 0) {
stateStr = @"none";
}else if(indexPath.row == 1){
stateStr = @"initial";
}else if(indexPath.row == 2){
stateStr = @"submitted";
}else if(indexPath.row == 3){
stateStr = @"insurvey";
}
[self.delegate getBoltValueSelectRow:stateStr];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[self keyBoardHidden];
return YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self keyBoardHidden];
}
- (void)keyBoardHidden{
[_titleFiled resignFirstResponder];
[_billFiled resignFirstResponder];
}
- (void)textFieldDidEndEditing:(UITextField *)textField{
if (textField == _titleFiled) {
[self.delegate getTitleLike:_titleFiled.text];
}else if(textField == _billFiled){
[self.delegate getBillNumber:_billFiled.text];
}
}
@end
......@@ -9,7 +9,7 @@
#import "MaskCell.h"
#define TitleSize 14
#define LeftMargin 20
#define TableHeight 35
#define TableHeight 45
#define BtnSize 14
@implementation MaskCell
......
......@@ -13,7 +13,10 @@
@end
@interface SortMaskView : UIView<UITableViewDataSource,UITableViewDelegate>
- (instancetype)initWithFrame:(CGRect)frame withOrderDirection:(NSString *)orderDirection;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <SortMaskViewDelegate>delegate;
@end
......@@ -8,23 +8,30 @@
#import "SortMaskView.h"
#import "MaskCell.h"
#define TableHeight 35
#define TableHeight 45
@interface SortMaskView ()
{
NSIndexPath *_currentIndexPath;
NSString *_orderDirection;
}
@end
@implementation SortMaskView
- (instancetype)initWithFrame:(CGRect)frame{
- (instancetype)initWithFrame:(CGRect)frame withOrderDirection:(NSString *)orderDirection{
self = [super initWithFrame:frame];
if (self) {
self.tableView = [[UITableView alloc]initWithFrame:self.bounds style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor redColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self addSubview:self.tableView];
if (orderDirection.length >0) {
if ([orderDirection isEqualToString:@"asc"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else{
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}
}
}
return self;
}
......@@ -64,8 +71,11 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
[self.delegate getSortValueSelectRow:@"s"];
if (indexPath.row == 0) {
[self.delegate getSortValueSelectRow:@"asc"];
}else{
[self.delegate getSortValueSelectRow:@"desc"];
}
}
......
......@@ -39,9 +39,10 @@
_timePicker.backgroundColor = [UIColor whiteColor];
_timePicker.datePickerMode = UIDatePickerModeDate;
_timePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"];
// 设置最小时间段,防止用户的出现已过去的时间
_timePicker.minimumDate = [NSDate date];
// // 设置最小时间段,防止用户的出现已过去的时间
// _timePicker.minimumDate = [NSDate date];
[_bgView addSubview:_timePicker];
}
......
......@@ -31,8 +31,8 @@
{
self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
self.stateBtn.titleLabel.font = FontSize(ContentSize);
[self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// self.stateBtn.titleLabel.font = FontSize(ContentSize);
// [self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.stateBtn.enabled = NO;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
......@@ -72,29 +72,30 @@
- (void)setSurvey:(Survey *)survey{
self.titleLabel.text = survey.title;
self.billnumberLabel.text = survey.billNumber;
self.productnameLabel.text = survey.productName;
self.begindateLabel.text = survey.beginDate;
self.enddateLabel.text = survey.endDate;
NSString *stateStr = @"";
self.billnumberLabel.text = [NSString stringWithFormat:@"单号:%@",survey.billNumber];
self.productnameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",survey.productName,survey.productCode];
self.begindateLabel.text = [NSString stringWithFormat:@"开始时间:%@",[survey.beginDate substringToIndex:10]];
self.enddateLabel.text = [NSString stringWithFormat:@"结束时间:%@",[survey.endDate substringToIndex:10]];
// NSString *stateStr = @"";
if ([survey.state isEqualToString:@"initial"]) {
[self.stateBtn setBackgroundColor:[UIColor redColor]];
stateStr = @"未提交";
// [self.stateBtn setBackgroundColor:[UIColor redColor]];
// stateStr = @"未提交";
[self.stateBtn setImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"submitted"]) {
[self.stateBtn setBackgroundColor:[UIColor greenColor]];
stateStr = @"已提交";
// [self.stateBtn setBackgroundColor:[UIColor greenColor]];
// stateStr = @"已提交";
[self.stateBtn setImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"insurvey"]) {
[self.stateBtn setBackgroundColor:[UIColor grayColor]];
stateStr = @"调研中";
// [self.stateBtn setBackgroundColor:[UIColor grayColor]];
// stateStr = @"调研中";
[self.stateBtn setImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"finished"]) {
[self.stateBtn setBackgroundColor:[UIColor blackColor]];
stateStr = @"已完成";
// [self.stateBtn setBackgroundColor:[UIColor blackColor]];
// stateStr = @"已完成";
[self.stateBtn setImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}
[self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
// [self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
......@@ -32,9 +32,10 @@
self.imageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.imageBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftWidth, TableHeight - TopMargin*2);
self.userNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.imageBtn.frame) + TopMargin, TopMargin, ScreenSize.width - TopMargin*2 - LeftWidth, TitleHeight))];
self.userNameLabel.textColor = HexColor(TitleColor);
self.userNameLabel.font = FontSize(TitleSize);
self.userNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.imageBtn.frame) + TopMargin, TopMargin, ScreenSize.width - TopMargin*2 - LeftWidth, TitleHeight * 2))];
self.userNameLabel.numberOfLines = 0;
self.userNameLabel.textColor = HexColor(ContentColor);
self.userNameLabel.font = FontSize(ContentSize);
self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.userNameLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
self.placeLabel.textColor = HexColor(ContentColor);
......@@ -68,11 +69,11 @@
- (void)setSurveyResult:(SurveyResult *)surveyResult{
[self.imageBtn setBackgroundImage:[UIImage imageNamed:@"no_image_default"] forState:UIControlStateNormal];
self.userNameLabel.text = surveyResult.unit;
self.placeLabel.text = surveyResult.place;
self.priceLabel.text = surveyResult.price;
self.capacityLabel.text = surveyResult.capacity;
self.qualityLabel.text = surveyResult.quality;
self.userNameLabel.text = [NSString stringWithFormat:@"反馈人:%@[%@]",surveyResult.userName,surveyResult.feedbackTime];
self.placeLabel.text = [NSString stringWithFormat:@"产地:%@",surveyResult.place];
self.priceLabel.text = [NSString stringWithFormat:@"价格:%@",surveyResult.price];
self.capacityLabel.text = [NSString stringWithFormat:@"市场容量:%@",surveyResult.capacity];
self.qualityLabel.text = [NSString stringWithFormat:@"质量情况:%@",surveyResult.quality];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
......@@ -8,6 +8,9 @@
#import "ICRBaseViewController.h"
#import "Survey.h"
@interface NewSurveyViewController : ICRBaseViewController
@property (nonatomic,strong)Survey *survey;
@end
......@@ -9,5 +9,5 @@
#import "ICRBaseViewController.h"
@interface ResultDetailViewController : ICRBaseViewController
@property (nonatomic,strong)NSString *surveyUuid;
@end
......@@ -24,13 +24,28 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"行情反馈列表";
[self initData];
[self createTableView];
}
- (void)initData{
_dataArr = [NSMutableArray array];
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
NSLog(@"%@",data);
// [strongSelf fetchtSurveyList:data];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getResultsWithUuid:self.surveyUuid success:succ failure:fail];
for (NSInteger i = 0; i < 4; i++) {
SurveyResult *survey = [[SurveyResult alloc]init];
survey.unit = @"南汇8424西瓜调研情况";
......@@ -38,6 +53,8 @@
survey.price = @"南汇842[100213]";
survey.capacity = @"22222222222";
survey.quality = @"费卡接口";
survey.userName = @"张三";
survey.feedbackTime = @"2015-04-05 12:04:06";
[_dataArr addObject:survey];
}
}
......
......@@ -12,7 +12,7 @@
#import "SortMaskView.h"
#import "BoltMaskView.h"
#import "SurveyDetailViewController.h"
#import "NewSurveyViewController.h"
#define TopMargin 44
#define TableHeight 120
......@@ -38,6 +38,12 @@ typedef enum : NSUInteger {
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSString *billNumberLike;
@property (nonatomic,strong)NSString *state;//未提交=initial已提交=submitted调研中=insurvey已完成=finished
@property (nonatomic,strong)NSString *titleLike;
@property (nonatomic,strong)NSString *orderField;
@property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序)
@end
......@@ -46,19 +52,20 @@ typedef enum : NSUInteger {
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"行情调研";
self.view.backgroundColor = XXFBgColor;
[self initData];
[self createTableView];
[self createTableView];
[self getData];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
[self fetchtSurveyList];
}
- (void)getData{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchtSurveyList];
[strongSelf fetchtSurveyList:data];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
......@@ -66,32 +73,58 @@ typedef enum : NSUInteger {
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
id billObject = [NSNull null];
if (self.billNumberLike.length > 0) {
billObject = self.billNumberLike;
}
id stateObject = [NSNull null];
if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
stateObject = self.state;
}
id titleObject = [NSNull null];
if (self.titleLike.length > 0) {
billObject = self.titleLike;
}
id orderObject = [NSNull null];
if (self.orderDirection.length > 0) {
orderObject = self.orderDirection;
}
NSDictionary *dict = @{
@"billNumberLike":billObject,
@"state":stateObject,
@"titleLike":titleObject,
@"orderField":[NSNull null],
@"orderDirection":orderObject,
@"userUuid":userUtil.userId,
@"pageNumber":@(0),
@"pageSize":@(20)};
[[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail];
}
#pragma mark -成功
- (void)fetchtSurveyList{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Survey 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];
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[Survey class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
- (void)fetchtSurveyList:(id)data{
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
if (self.dataArr.count > 0) {
[self.dataArr removeAllObjects];
}
NSArray *recodesArr = data[ @"data" ][ @"records" ];
for (NSDictionary *surveyDict in recodesArr) {
Survey *survey = [[Survey alloc]init];
[survey setValuesForKeysWithDictionary:surveyDict];
[self.dataArr addObject:survey];
}
[self.tableView reloadData];
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@" 无记录 "];
}
}
- (void)createTableView
{
......@@ -106,7 +139,6 @@ typedef enum : NSUInteger {
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];
......@@ -119,12 +151,28 @@ typedef enum : NSUInteger {
#pragma mark - 确定
- (void)sureClick{
//请求
[self getData];
//还原数据
if (_sortView) {
[self hiddenSortMaskView:YES];
}
if (_boltView) {
[self hiddenBoltMaskView:YES];
}
//清空所有条件
if (self.orderDirection.length > 0) {
self.orderDirection = @"";
}
if (self.billNumberLike.length > 0) {
self.billNumberLike = @"";
}
if (self.titleLike.length > 0) {
self.titleLike = @"";
}
if (self.state.length > 0) {
self.state = @"";
}
self.navigationItem.rightBarButtonItem = nil;
}
......@@ -144,8 +192,8 @@ typedef enum : NSUInteger {
}else{
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) {
_sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 105)];
_sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序",@"默认排序",@"默认排序" ,nil];
_sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 105) withOrderDirection:self.orderDirection];
_sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"按时间顺序",@"按时间逆序",nil];
_sortView.delegate = self;
[_maskView addSubview:_sortView];
[UIView animateWithDuration:0.25 animations:^{
......@@ -170,10 +218,10 @@ typedef enum : NSUInteger {
}else{
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
if (_boltView == nil) {
_boltView = [[BoltMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 176)];
_boltView = [[BoltMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 224) state:self.state title:self.titleLike bill:self.billNumberLike];
_boltView.backgroundColor = HexColor(@"f8f8f8");
_boltView.delegate = self;
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序1",@"默认排序1",@"默认排序1" ,nil];
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"不限",@"未提交",@"已提交" ,@"调研中",nil];
[_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _boltView.frame;
......@@ -189,6 +237,7 @@ typedef enum : NSUInteger {
}
- (void)hiddenSortMaskView:(BOOL)isHide{
currentBtn = nil;
[_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
if (isHide == NO) {
[_sortView removeFromSuperview];
......@@ -207,6 +256,7 @@ typedef enum : NSUInteger {
}
}
- (void)hiddenBoltMaskView:(BOOL)isHide{
currentBtn = nil;
[_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
if (isHide == NO) {
[_boltView removeFromSuperview];
......@@ -226,11 +276,21 @@ typedef enum : NSUInteger {
}
#pragma mark - sortDelegate
- (void)getSortValueSelectRow:(NSString *)state{
self.orderDirection = state;
NSLog(@"%@",state);
}
- (void)getBoltValueSelectRow:(NSString *)state{
self.state = state;
NSLog(@"%@",state);
}
- (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike;
NSLog(@"%@",titleLike);
}
- (void)getBillNumber:(NSString *)billNumber{
self.billNumberLike = billNumber;
NSLog(@"%@",billNumber);
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
......@@ -256,13 +316,22 @@ typedef enum : NSUInteger {
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SurveyDetailViewController *svc = [SurveyDetailViewController new];
Survey *survey = nil;
if (self.dataArr.count > 0) {
Survey *survey = self.dataArr[indexPath.row];
survey = self.dataArr[indexPath.row];
}
if ([survey.state isEqualToString:@"initial"]) {
NewSurveyViewController *nvc = [[NewSurveyViewController alloc]init];
nvc.survey = survey;
[self PushViewController:nvc animated:YES];
}else if([survey.state isEqualToString:@"submitted"] || [survey.state isEqualToString:@"insurvey"]|| [survey.state isEqualToString:@"finished"]){
SurveyDetailViewController *svc = [SurveyDetailViewController new];
svc.survey = survey;
svc.surveyUuid = survey.uuid;
[self PushViewController:svc animated:YES];
}
[self PushViewController:svc animated:YES];
}
......@@ -274,6 +343,10 @@ typedef enum : NSUInteger {
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
......
......@@ -18,7 +18,7 @@
@property (nonatomic,strong)NSString *place;//产地
@property (nonatomic,strong)NSString *capacity;//市场容量
@property (nonatomic,strong)NSString *quality;//质量情况
@property (nonatomic,strong)NSDate *feedbackTime;//反馈时间
@property (nonatomic,strong)NSString *feedbackTime;//反馈时间
@property (nonatomic,strong)NSArray *attachmnets;//附件列表
@end
......@@ -12,5 +12,9 @@
@property (nonatomic,strong)NSString *userUuid;//用户UUid
@property (nonatomic,strong)NSString *userCode;//用户编码
@property (nonatomic,strong)NSString *userName;//用户名称
@property (nonatomic,strong)NSString *uuid;
@property (nonatomic,strong)NSString *uuid;//唯一标识
@end
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