Commit f27c3520 authored by 陈俊俊's avatar 陈俊俊

行情反馈接口

parent 9f7df76f
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
7217E9EC1B72364300FE5C1D /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D61B72364300FE5C1D /* HPTextViewInternal.m */; }; 7217E9EC1B72364300FE5C1D /* HPTextViewInternal.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D61B72364300FE5C1D /* HPTextViewInternal.m */; };
7217E9EE1B72364300FE5C1D /* MaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D91B72364300FE5C1D /* MaskCell.m */; }; 7217E9EE1B72364300FE5C1D /* MaskCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9D91B72364300FE5C1D /* MaskCell.m */; };
7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9DA1B72364300FE5C1D /* maskEnable.png */; }; 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 */; }; 7217E9F11B72364300FE5C1D /* SortMaskView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DD1B72364300FE5C1D /* SortMaskView.m */; };
7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DF1B72364300FE5C1D /* StartTimeView.m */; }; 7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9DF1B72364300FE5C1D /* StartTimeView.m */; };
7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E11B72364300FE5C1D /* SurveyCell.m */; }; 7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E11B72364300FE5C1D /* SurveyCell.m */; };
...@@ -436,7 +435,6 @@ ...@@ -436,7 +435,6 @@
7217E9D81B72364300FE5C1D /* MaskCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaskCell.h; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 7217E9DE1B72364300FE5C1D /* StartTimeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StartTimeView.h; sourceTree = "<group>"; };
...@@ -868,7 +866,6 @@ ...@@ -868,7 +866,6 @@
7217E9D81B72364300FE5C1D /* MaskCell.h */, 7217E9D81B72364300FE5C1D /* MaskCell.h */,
7217E9D91B72364300FE5C1D /* MaskCell.m */, 7217E9D91B72364300FE5C1D /* MaskCell.m */,
7217E9DA1B72364300FE5C1D /* maskEnable.png */, 7217E9DA1B72364300FE5C1D /* maskEnable.png */,
7217E9DB1B72364300FE5C1D /* sort.png */,
7217E9F51B724A7600FE5C1D /* mask.png */, 7217E9F51B724A7600FE5C1D /* mask.png */,
7217E9DC1B72364300FE5C1D /* SortMaskView.h */, 7217E9DC1B72364300FE5C1D /* SortMaskView.h */,
7217E9DD1B72364300FE5C1D /* SortMaskView.m */, 7217E9DD1B72364300FE5C1D /* SortMaskView.m */,
...@@ -1877,7 +1874,6 @@ ...@@ -1877,7 +1874,6 @@
C1E0930A1AC8FC94003B7126 /* Localizable.strings in Resources */, C1E0930A1AC8FC94003B7126 /* Localizable.strings in Resources */,
C123A9191B25CBAD003C0C36 /* selected_star@2x.png in Resources */, C123A9191B25CBAD003C0C36 /* selected_star@2x.png in Resources */,
7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */, 7217E9EF1B72364300FE5C1D /* maskEnable.png in Resources */,
7217E9F01B72364300FE5C1D /* sort.png in Resources */,
7217E9F61B724A7600FE5C1D /* mask.png in Resources */, 7217E9F61B724A7600FE5C1D /* mask.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -2330,7 +2326,7 @@ ...@@ -2330,7 +2326,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 7.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
...@@ -2368,7 +2364,7 @@ ...@@ -2368,7 +2364,7 @@
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0; IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
...@@ -2392,7 +2388,7 @@ ...@@ -2392,7 +2388,7 @@
"$(PROJECT_DIR)", "$(PROJECT_DIR)",
); );
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Debug; name = Debug;
...@@ -2413,7 +2409,7 @@ ...@@ -2413,7 +2409,7 @@
"$(PROJECT_DIR)", "$(PROJECT_DIR)",
); );
PRODUCT_NAME = XFFruit; PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "251ce065-a08f-44fd-bd52-f79372f4e47e"; PROVISIONING_PROFILE = "a12432a9-50b3-4cef-bae7-dcb35f965ce4";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
name = Release; name = Release;
...@@ -2436,7 +2432,7 @@ ...@@ -2436,7 +2432,7 @@
INFOPLIST_FILE = XFFruitTests/Info.plist; INFOPLIST_FILE = XFFruitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = XFFruitTests; 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"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
...@@ -2456,7 +2452,7 @@ ...@@ -2456,7 +2452,7 @@
INFOPLIST_FILE = XFFruitTests/Info.plist; INFOPLIST_FILE = XFFruitTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = XFFruitTests; 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"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XFFruit.app/XFFruit";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
}; };
......
...@@ -202,8 +202,22 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -202,8 +202,22 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
page_size:(NSUInteger)page_size page_size:(NSUInteger)page_size
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; 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 @end
......
...@@ -71,7 +71,11 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -71,7 +71,11 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_QuerySurvey, XFFHttp_QuerySurvey,
XFFHttp_GetSurvey, XFFHttp_GetSurvey,
XFFHttp_GetProduct, XFFHttp_GetProduct,
XFFHttp_GetUser XFFHttp_GetUser,
XFFHttp_SurveyFinish,
//行情反馈图片
XFFHttp_ResultChart,
XFFHttp_GetResults
}; };
static NSString * const ICRHTTPInterface[] = { static NSString * const ICRHTTPInterface[] = {
...@@ -123,8 +127,11 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -123,8 +127,11 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_QuerySurvey] = @"survey/query_survey", [XFFHttp_QuerySurvey] = @"survey/query_survey",
[XFFHttp_GetSurvey] = @"survey/get_survey", [XFFHttp_GetSurvey] = @"survey/get_survey",
[XFFHttp_GetProduct] = @"mdata/product/download", [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[] = { static NSString * const ICRAttachmentTypeValue[] = {
...@@ -1338,27 +1345,8 @@ acceptTypeJson:YES ...@@ -1338,27 +1345,8 @@ acceptTypeJson:YES
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) { void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject); CLog(@"%@", responseObject);
if (IsDictObject(responseObject)) { if (succ) {
void (^complete)(void) = ^(void){ succ( responseObject );
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 );
}
} }
}; };
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) { void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
...@@ -1507,6 +1495,112 @@ acceptTypeJson:YES ...@@ -1507,6 +1495,112 @@ acceptTypeJson:YES
failure:failure]; 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 @end
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
// yyyy-MM-dd HH:mm:ss // yyyy-MM-dd HH:mm:ss
- (NSString *)httpParameterString; - (NSString *)httpParameterString;
- (NSString *)coverStringFromString;
// yymmddhhmmssSSS // yymmddhhmmssSSS
- (NSString *)mobileIDDateString; - (NSString *)mobileIDDateString;
......
...@@ -292,7 +292,9 @@ ...@@ -292,7 +292,9 @@
- (NSString *)httpParameterString { - (NSString *)httpParameterString {
return [self stringWithFormatter:@"%Y-%m-%d %H:%M:%S"]; return [self stringWithFormatter:@"%Y-%m-%d %H:%M:%S"];
} }
- (NSString *)coverStringFromString {
return [self stringWithFormatter:@"%Y.%m.%d"];
}
- (NSString *)mobileIDDateString { - (NSString *)mobileIDDateString {
return [self stringWithFormatter:@"%y%m%d%H%M%S000"]; 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 @@ ...@@ -27,6 +27,7 @@
//new HTTP //new HTTP
#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:7580/cruiser-server/rest" #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" //#define HTTP_REST_API_BASE_URL @"http://218.244.151.129:8281/XFFruit-server/rest"
......
...@@ -177,10 +177,11 @@ ...@@ -177,10 +177,11 @@
} }
+ (NSString *)stringFromDate:(NSDate*)aDate{ + (NSString *)stringFromDate:(NSDate*)aDate{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy.MM.dd"]; [formatter setDateFormat:@"yyyy-MM-dd"];
NSString *dateString = [formatter stringFromDate:aDate]; NSString *dateString = [formatter stringFromDate:aDate];
return dateString; return dateString;
} }
+ (NSString*)dictionaryToJson:(id)dic + (NSString*)dictionaryToJson:(id)dic
{ {
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
@property (copy, nonatomic) NSString *currentStoreID; @property (copy, nonatomic) NSString *currentStoreID;
@property (copy, nonatomic) NSString *uniqueID; @property (copy, nonatomic) NSString *uniqueID;
+ (instancetype)sharedInstance; + (instancetype)sharedInstance;
- (BOOL)saveArchive; - (BOOL)saveArchive;
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
@protocol BoltMaskViewDelegate <NSObject> @protocol BoltMaskViewDelegate <NSObject>
- (void)getBoltValueSelectRow:(NSString *)state; - (void)getBoltValueSelectRow:(NSString *)state;
- (void)getTitleLike:(NSString *)titleLike;
- (void)getBillNumber:(NSString *)billNumber;
@end @end
...@@ -18,4 +20,6 @@ ...@@ -18,4 +20,6 @@
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <BoltMaskViewDelegate>delegate; @property (nonatomic,weak)id <BoltMaskViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill;
@end @end
...@@ -8,33 +8,70 @@ ...@@ -8,33 +8,70 @@
#import "BoltMaskView.h" #import "BoltMaskView.h"
#import "MaskCell.h" #import "MaskCell.h"
#define TableHeight 35 #define TableHeight 45
#define LeftMargin 80 #define LeftMargin 80
#define TotalHeight 176 #define TotalHeight 224
#define LeftHeight 44 #define LeftHeight 44
@interface BoltMaskView () @interface BoltMaskView ()<UITextFieldDelegate>
{ {
UIView *_leftView; UIView *_leftView;
UIButton *_currentBtn; UIButton *_currentBtn;
NSIndexPath *_currentIndexPath; 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 @end
@implementation BoltMaskView @implementation BoltMaskView
- (instancetype)initWithFrame:(CGRect)frame{ - (instancetype)initWithFrame:(CGRect)frame state:(NSString *)state title:(NSString *)title bill:(NSString *)bill{
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
self.title = title;
self.billNumber = bill;
self.state = state;
[self createView]; [self createView];
[self createRightView];
[self preferData];
} }
return self; 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 - 创建视图 #pragma mark - 创建视图
- (void)createView - (void)createView
{ {
_leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height)]; _leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, LeftMargin,self.frame.size.height)];
[self addSubview:_leftView]; [self addSubview:_leftView];
NSArray *arr = @[@"按状态",@"条件一",@"条件二",@"条件三"]; NSArray *arr = @[@"按状态",@"条件一",@"条件二"];
for (NSInteger i = 0; i<arr.count; i++) { for (NSInteger i = 0; i<arr.count; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight); button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
...@@ -50,19 +87,84 @@ ...@@ -50,19 +87,84 @@
[button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(leftBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_leftView addSubview:button]; [_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 = [[UITableView alloc]initWithFrame:CGRectMake(LeftMargin, 0, ScreenSize.width - LeftMargin, self.frame.size.height) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor]; self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
[self addSubview:self.tableView]; [self addSubview:self.tableView];
} }
- (void)leftBtnClick:(UIButton *)btn{ - (void)leftBtnClick:(UIButton *)btn{
_currentBtn.enabled = YES; _currentBtn.enabled = YES;
btn.enabled = NO; btn.enabled = NO;
_currentBtn = btn; _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 - 协议 #pragma mark - 协议
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
...@@ -102,11 +204,43 @@ ...@@ -102,11 +204,43 @@
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath; _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{ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight; 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 @end
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#import "MaskCell.h" #import "MaskCell.h"
#define TitleSize 14 #define TitleSize 14
#define LeftMargin 20 #define LeftMargin 20
#define TableHeight 35 #define TableHeight 45
#define BtnSize 14 #define BtnSize 14
@implementation MaskCell @implementation MaskCell
......
...@@ -13,7 +13,10 @@ ...@@ -13,7 +13,10 @@
@end @end
@interface SortMaskView : UIView<UITableViewDataSource,UITableViewDelegate> @interface SortMaskView : UIView<UITableViewDataSource,UITableViewDelegate>
- (instancetype)initWithFrame:(CGRect)frame withOrderDirection:(NSString *)orderDirection;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,weak)id <SortMaskViewDelegate>delegate; @property (nonatomic,weak)id <SortMaskViewDelegate>delegate;
@end @end
...@@ -8,23 +8,30 @@ ...@@ -8,23 +8,30 @@
#import "SortMaskView.h" #import "SortMaskView.h"
#import "MaskCell.h" #import "MaskCell.h"
#define TableHeight 35 #define TableHeight 45
@interface SortMaskView () @interface SortMaskView ()
{ {
NSIndexPath *_currentIndexPath; NSIndexPath *_currentIndexPath;
NSString *_orderDirection;
} }
@end @end
@implementation SortMaskView @implementation SortMaskView
- (instancetype)initWithFrame:(CGRect)frame{ - (instancetype)initWithFrame:(CGRect)frame withOrderDirection:(NSString *)orderDirection{
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
self.tableView = [[UITableView alloc]initWithFrame:self.bounds style:(UITableViewStylePlain)]; self.tableView = [[UITableView alloc]initWithFrame:self.bounds style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor redColor];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
[self addSubview:self.tableView]; [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; return self;
} }
...@@ -64,8 +71,11 @@ ...@@ -64,8 +71,11 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath]; MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO; cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath; _currentIndexPath = indexPath;
if (indexPath.row == 0) {
[self.delegate getSortValueSelectRow:@"s"]; [self.delegate getSortValueSelectRow:@"asc"];
}else{
[self.delegate getSortValueSelectRow:@"desc"];
}
} }
......
...@@ -39,9 +39,10 @@ ...@@ -39,9 +39,10 @@
_timePicker.backgroundColor = [UIColor whiteColor]; _timePicker.backgroundColor = [UIColor whiteColor];
_timePicker.datePickerMode = UIDatePickerModeDate; _timePicker.datePickerMode = UIDatePickerModeDate;
_timePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"]; _timePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"];
// 设置最小时间段,防止用户的出现已过去的时间 // // 设置最小时间段,防止用户的出现已过去的时间
_timePicker.minimumDate = [NSDate date]; // _timePicker.minimumDate = [NSDate date];
[_bgView addSubview:_timePicker]; [_bgView addSubview:_timePicker];
} }
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
{ {
self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20); self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
self.stateBtn.titleLabel.font = FontSize(ContentSize); // self.stateBtn.titleLabel.font = FontSize(ContentSize);
[self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; // [self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.stateBtn.enabled = NO; self.stateBtn.enabled = NO;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))]; self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
...@@ -72,29 +72,30 @@ ...@@ -72,29 +72,30 @@
- (void)setSurvey:(Survey *)survey{ - (void)setSurvey:(Survey *)survey{
self.titleLabel.text = survey.title; self.titleLabel.text = survey.title;
self.billnumberLabel.text = survey.billNumber; self.billnumberLabel.text = [NSString stringWithFormat:@"单号:%@",survey.billNumber];
self.productnameLabel.text = survey.productName; self.productnameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",survey.productName,survey.productCode];
self.begindateLabel.text = survey.beginDate; self.begindateLabel.text = [NSString stringWithFormat:@"开始时间:%@",[survey.beginDate substringToIndex:10]];
self.enddateLabel.text = survey.endDate; self.enddateLabel.text = [NSString stringWithFormat:@"结束时间:%@",[survey.endDate substringToIndex:10]];
NSString *stateStr = @""; // NSString *stateStr = @"";
if ([survey.state isEqualToString:@"initial"]) { if ([survey.state isEqualToString:@"initial"]) {
[self.stateBtn setBackgroundColor:[UIColor redColor]]; // [self.stateBtn setBackgroundColor:[UIColor redColor]];
stateStr = @"未提交"; // stateStr = @"未提交";
[self.stateBtn setImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"submitted"]) { }else if ([survey.state isEqualToString:@"submitted"]) {
[self.stateBtn setBackgroundColor:[UIColor greenColor]]; // [self.stateBtn setBackgroundColor:[UIColor greenColor]];
// stateStr = @"已提交";
stateStr = @"已提交"; [self.stateBtn setImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"insurvey"]) { }else if ([survey.state isEqualToString:@"insurvey"]) {
[self.stateBtn setBackgroundColor:[UIColor grayColor]]; // [self.stateBtn setBackgroundColor:[UIColor grayColor]];
// stateStr = @"调研中";
stateStr = @"调研中"; [self.stateBtn setImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"finished"]) { }else if ([survey.state isEqualToString:@"finished"]) {
[self.stateBtn setBackgroundColor:[UIColor blackColor]]; // [self.stateBtn setBackgroundColor:[UIColor blackColor]];
// stateStr = @"已完成";
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 { - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
self.imageBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.imageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.imageBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftWidth, TableHeight - TopMargin*2); 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 = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.imageBtn.frame) + TopMargin, TopMargin, ScreenSize.width - TopMargin*2 - LeftWidth, TitleHeight * 2))];
self.userNameLabel.textColor = HexColor(TitleColor); self.userNameLabel.numberOfLines = 0;
self.userNameLabel.font = FontSize(TitleSize); 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 = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.userNameLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
self.placeLabel.textColor = HexColor(ContentColor); self.placeLabel.textColor = HexColor(ContentColor);
...@@ -68,11 +69,11 @@ ...@@ -68,11 +69,11 @@
- (void)setSurveyResult:(SurveyResult *)surveyResult{ - (void)setSurveyResult:(SurveyResult *)surveyResult{
[self.imageBtn setBackgroundImage:[UIImage imageNamed:@"no_image_default"] forState:UIControlStateNormal]; [self.imageBtn setBackgroundImage:[UIImage imageNamed:@"no_image_default"] forState:UIControlStateNormal];
self.userNameLabel.text = surveyResult.unit; self.userNameLabel.text = [NSString stringWithFormat:@"反馈人:%@[%@]",surveyResult.userName,surveyResult.feedbackTime];
self.placeLabel.text = surveyResult.place; self.placeLabel.text = [NSString stringWithFormat:@"产地:%@",surveyResult.place];
self.priceLabel.text = surveyResult.price; self.priceLabel.text = [NSString stringWithFormat:@"价格:%@",surveyResult.price];
self.capacityLabel.text = surveyResult.capacity; self.capacityLabel.text = [NSString stringWithFormat:@"市场容量:%@",surveyResult.capacity];
self.qualityLabel.text = surveyResult.quality; self.qualityLabel.text = [NSString stringWithFormat:@"质量情况:%@",surveyResult.quality];
} }
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
#import "Survey.h"
@interface NewSurveyViewController : ICRBaseViewController @interface NewSurveyViewController : ICRBaseViewController
@property (nonatomic,strong)Survey *survey;
@end @end
...@@ -45,13 +45,13 @@ typedef enum : NSUInteger { ...@@ -45,13 +45,13 @@ typedef enum : NSUInteger {
BOOL _isClickStart; BOOL _isClickStart;
StartTimeView *_startTimeView; StartTimeView *_startTimeView;
} }
@property (nonatomic,strong)NSString *surveyTitle; @property (nonatomic,strong)NSString *titleStr;
@property (nonatomic,strong)NSString *productCode; @property (nonatomic,strong)NSString *productCodeStr;
@property (nonatomic,strong)NSString *productUuid; @property (nonatomic,strong)NSString *productNameStr;
@property (nonatomic,strong)NSString *productName; @property (nonatomic,strong)NSString *productUuidStr;
@property (nonatomic,strong)NSString *beginDate; @property (nonatomic,strong)NSString *beginDateStr;
@property (nonatomic,strong)NSString *endDate; @property (nonatomic,strong)NSString *endDateStr;
@property (nonatomic,strong)NSString *remark; @property (nonatomic,strong)NSString *remarkStr;
@property (nonatomic,strong)NSMutableArray *users; @property (nonatomic,strong)NSMutableArray *users;
@end @end
...@@ -60,8 +60,9 @@ typedef enum : NSUInteger { ...@@ -60,8 +60,9 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"新建行情调研";
[self initData]; [self initData];
[self createTableView]; [self createTableView];
} }
- (void)initData{ - (void)initData{
_dataArr = [NSMutableArray array]; _dataArr = [NSMutableArray array];
...@@ -119,9 +120,9 @@ typedef enum : NSUInteger { ...@@ -119,9 +120,9 @@ typedef enum : NSUInteger {
} }
} }
- (BOOL)checkSurvey{ - (BOOL)checkSurvey{
self.surveyTitle = _titleField.text; self.titleStr = _titleField.text;
self.remark = _noteTextView.text; self.remarkStr = _noteTextView.text;
if (self.surveyTitle.length == 0 || self.productUuid.length == 0 || self.productName.length == 0 || self.users.count <=0 || self.beginDate.length == 0 || self.endDate.length == 0) { 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]; UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示信息" message:@"信息不完整" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show]; [alert show];
return NO; return NO;
...@@ -142,6 +143,7 @@ typedef enum : NSUInteger { ...@@ -142,6 +143,7 @@ typedef enum : NSUInteger {
if (success == 1) { if (success == 1) {
//成功 //成功
[IBTLoadingView showTips:@"操作成功"]; [IBTLoadingView showTips:@"操作成功"];
[self clearAllInformation];
}else{ }else{
[IBTLoadingView showTips:message]; [IBTLoadingView showTips:message];
...@@ -152,20 +154,55 @@ typedef enum : NSUInteger { ...@@ -152,20 +154,55 @@ typedef enum : NSUInteger {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
}; };
NSDictionary *dict = @{@"billnumber":@"", id uuidObject = [NSNull null];
@"title":self.surveyTitle, if(self.survey.uuid.length > 0){
uuidObject = self.survey.uuid;
}
id billNumberObject = [NSNull null];
if (self.survey.billNumber > 0) {
billNumberObject = self.survey.billNumber;
}
NSDictionary *dict = @{@"uuid":uuidObject,
@"billnumber":billNumberObject,
@"title":[IBTCommon checkString:self.titleStr],
@"state":state, @"state":state,
@"productUuid":self.productUuid, @"productUuid":[IBTCommon checkString:self.productUuidStr],
@"productCode":self.productCode, @"productCode":[IBTCommon checkString:self.productCodeStr],
@"productName":self.productName, @"productName":[IBTCommon checkString:self.productNameStr],
@"beginDate":self.beginDate, @"beginDate":[IBTCommon checkString:self.beginDateStr],
@"endDate":self.endDate, @"endDate":[IBTCommon checkString:self.endDateStr],
@"remark":self.remark, @"remark":[IBTCommon checkString:self.remarkStr],
@"users":self.users}; @"users":self.users};
[IBTLoadingView showProgressLabel:msg]; [IBTLoadingView showProgressLabel:msg];
[[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail]; [[ICRHTTPController sharedController] saveSurveyWithAuthenticode:dict success:succ failure:fail];
} }
- (void)clearAllInformation{
_titleField.text = @"";
_productLabel.text = @"请输入商品";
_productLabel.textColor = HexColor(@"bbbbbb");
_startDateLabel.text = @"选择日期";
_startDateLabel.textColor = HexColor(@"bbbbbb");
_endDateLabel.text = @"选择日期";
_endDateLabel.textColor = HexColor(@"bbbbbb");
_personLabel.text = @"选择调研人员";
_personLabel.textColor = HexColor(@"bbbbbb");
_noteTextView.text = @"输入备注";
_noteTextView.textColor = HexColor(@"bbbbbb");
//清空数据
self.titleStr = @"";
self.productCodeStr = @"";
self.productNameStr = @"";
self.productUuidStr = @"";
self.beginDateStr = @"";
self.endDateStr = @"";
[self.users removeAllObjects];
self.remarkStr = @"";
}
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
...@@ -200,7 +237,10 @@ typedef enum : NSUInteger { ...@@ -200,7 +237,10 @@ typedef enum : NSUInteger {
_titleField.returnKeyType = UIReturnKeyDone; _titleField.returnKeyType = UIReturnKeyDone;
_titleField.delegate = self; _titleField.delegate = self;
[cell.contentView addSubview:_titleField]; [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){ }else if (indexPath.row == _dataArr.count -1){
_noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)]; _noteTextView = [[HPGrowingTextView alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
_noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0); _noteTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
...@@ -212,7 +252,10 @@ typedef enum : NSUInteger { ...@@ -212,7 +252,10 @@ typedef enum : NSUInteger {
_noteTextView.returnKeyType = UIReturnKeyDone; _noteTextView.returnKeyType = UIReturnKeyDone;
_noteTextView.placeholder = @"输入备注内容"; _noteTextView.placeholder = @"输入备注内容";
[cell.contentView addSubview:_noteTextView]; [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; CGRect lineFrame = cell.lineLabel.frame;
lineFrame.origin.y = TableHeight*2-1; lineFrame.origin.y = TableHeight*2-1;
cell.lineLabel.frame = lineFrame; cell.lineLabel.frame = lineFrame;
...@@ -225,22 +268,65 @@ typedef enum : NSUInteger { ...@@ -225,22 +268,65 @@ typedef enum : NSUInteger {
if (indexPath.row == 1) { if (indexPath.row == 1) {
contentLabel.text = @"选择商品"; contentLabel.text = @"选择商品";
_productLabel = contentLabel; _productLabel = contentLabel;
[self preferDataInProductLabel];
}else if(indexPath.row == 2){ }else if(indexPath.row == 2){
contentLabel.text = @"选择日期"; contentLabel.text = @"选择日期";
_startDateLabel = contentLabel; _startDateLabel = contentLabel;
if (self.survey) {
if (self.survey.beginDate.length > 9) {
_startDateLabel.text = [[IBTCommon checkString:self.survey.beginDate]substringToIndex:10];
}
_startDateLabel.textColor = HexColor(@"444444");
self.beginDateStr =[IBTCommon checkString:self.survey.beginDate];
}
}else if(indexPath.row == 3){ }else if(indexPath.row == 3){
contentLabel.text = @"选择日期"; contentLabel.text = @"选择日期";
_endDateLabel = contentLabel; _endDateLabel = contentLabel;
if (self.survey) {
if (self.survey.endDate.length > 9) {
_endDateLabel.text = [[IBTCommon checkString:self.survey.endDate]substringToIndex:10];
}
_endDateLabel.textColor = HexColor(@"444444");
self.endDateStr = [IBTCommon checkString:self.survey.endDate];
}
}else if(indexPath.row == 4){ }else if(indexPath.row == 4){
contentLabel.text = @"选择调研人员"; contentLabel.text = @"选择调研人员";
_personLabel = contentLabel; _personLabel = contentLabel;
[self preferDataInPersonLabel];
}
}
}
- (void)preferDataInPersonLabel{
if (self.survey) {
if (self.survey.users.count > 0) {
NSString *personStr = @"";
for (SurveyUser * surveyUser in self.survey.users) {
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",surveyUser.userName];
}else {
personStr = [personStr stringByAppendingFormat:@"、%@",surveyUser.userName];
}
}
_personLabel.text = personStr;
_personLabel.textColor = HexColor(@"444444");
}
if (self.users > 0) {
[self.users addObjectsFromArray:self.survey.users];
} }
} }
} }
- (void)preferDataInProductLabel{
if (self.survey) {
_productLabel.text = [IBTCommon checkString:self.survey.productName];
_productLabel.textColor = HexColor(@"444444");
self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
self.productNameStr = [IBTCommon checkString:self.survey.productName];
self.productUuidStr = [IBTCommon checkString:self.survey.productUuid];
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 5){ if (indexPath.row == 5){
return TableHeight*2; return TableHeight*2;
...@@ -265,7 +351,11 @@ typedef enum : NSUInteger { ...@@ -265,7 +351,11 @@ typedef enum : NSUInteger {
[self.users removeAllObjects]; [self.users removeAllObjects];
} }
for (SurveyUser *user in users) { for (SurveyUser *user in users) {
textStr = [textStr stringByAppendingFormat:@"%@、",user.userName]; if (textStr.length == 0) {
textStr = [textStr stringByAppendingFormat:@"%@",user.userName];
}else {
textStr = [textStr stringByAppendingFormat:@"、%@",user.userName];
}
[self.users addObject:[user dictForCommit]]; [self.users addObject:[user dictForCommit]];
} }
_personLabel.text = textStr; _personLabel.text = textStr;
...@@ -278,9 +368,9 @@ typedef enum : NSUInteger { ...@@ -278,9 +368,9 @@ typedef enum : NSUInteger {
cvc.choseProduct = ^(Product *product){ cvc.choseProduct = ^(Product *product){
_productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code]; _productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_productLabel.textColor = HexColor(@"444444"); _productLabel.textColor = HexColor(@"444444");
self.productName = product.name; self.productNameStr = product.name;
self.productUuid = product.uuid; self.productUuidStr = product.uuid;
self.productCode = product.code; self.productCodeStr = product.code;
}; };
cvc.isMoreChose = NO; cvc.isMoreChose = NO;
[self PushViewController:cvc animated:YES]; [self PushViewController:cvc animated:YES];
...@@ -308,16 +398,14 @@ typedef enum : NSUInteger { ...@@ -308,16 +398,14 @@ typedef enum : NSUInteger {
[self clearDatePickView]; [self clearDatePickView];
} }
- (void)okTimeView:(NSDate *)time{ - (void)okTimeView:(NSDate *)time{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateFormat = @"yyyy年MM月dd日";
if (_isClickStart) { if (_isClickStart) {
_startDateLabel.textColor = HexColor(@"444444"); _startDateLabel.textColor = HexColor(@"444444");
_startDateLabel.text = [df stringFromDate:time]; _startDateLabel.text = [IBTCommon stringFromDate:time];
self.beginDate = [time httpParameterString]; self.beginDateStr = [time httpParameterString];
}else{ }else{
_endDateLabel.textColor = HexColor(@"444444"); _endDateLabel.textColor = HexColor(@"444444");
_endDateLabel.text = [df stringFromDate:time]; _endDateLabel.text = [IBTCommon stringFromDate:time];
self.endDate = [time httpParameterString]; self.endDateStr = [time httpParameterString];
} }
// 关闭选择器 // 关闭选择器
[self clearDatePickView]; [self clearDatePickView];
...@@ -334,6 +422,11 @@ typedef enum : NSUInteger { ...@@ -334,6 +422,11 @@ typedef enum : NSUInteger {
}]; }];
} }
#pragma mark delegate #pragma mark delegate
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{ - (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
[_noteTextView resignFirstResponder]; [_noteTextView resignFirstResponder];
......
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
#import "ICRBaseViewController.h" #import "ICRBaseViewController.h"
@interface ResultDetailViewController : ICRBaseViewController @interface ResultDetailViewController : ICRBaseViewController
@property (nonatomic,strong)NSString *surveyUuid;
@end @end
...@@ -24,13 +24,28 @@ ...@@ -24,13 +24,28 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"行情反馈列表";
[self initData]; [self initData];
[self createTableView]; [self createTableView];
} }
- (void)initData{ - (void)initData{
_dataArr = [NSMutableArray array]; _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++) { for (NSInteger i = 0; i < 4; i++) {
SurveyResult *survey = [[SurveyResult alloc]init]; SurveyResult *survey = [[SurveyResult alloc]init];
survey.unit = @"南汇8424西瓜调研情况"; survey.unit = @"南汇8424西瓜调研情况";
...@@ -38,6 +53,8 @@ ...@@ -38,6 +53,8 @@
survey.price = @"南汇842[100213]"; survey.price = @"南汇842[100213]";
survey.capacity = @"22222222222"; survey.capacity = @"22222222222";
survey.quality = @"费卡接口"; survey.quality = @"费卡接口";
survey.userName = @"张三";
survey.feedbackTime = @"2015-04-05 12:04:06";
[_dataArr addObject:survey]; [_dataArr addObject:survey];
} }
} }
......
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
#import "SurveyDetailViewController.h" #import "SurveyDetailViewController.h"
#import "ResultDetailViewController.h" #import "ResultDetailViewController.h"
#import "SurveyUser.h" #import "SurveyUser.h"
#import "UIImageView+WebCache.h"
#define BottomHeight 50 #define BottomHeight 50
#define LeftMargin 20 #define LeftMargin 20
#define LeftWidth 100 #define LeftWidth 100
#define LeftHeight 30 #define LeftHeight 30
#define TopMargin 15
typedef enum : NSUInteger { typedef enum : NSUInteger {
...@@ -26,6 +27,7 @@ typedef enum : NSUInteger { ...@@ -26,6 +27,7 @@ typedef enum : NSUInteger {
UIScrollView *_scrollView; UIScrollView *_scrollView;
UIView *_surveyView; UIView *_surveyView;
UIView *_bottomView; UIView *_bottomView;
UIImageView *_chartImageView;
} }
@property (nonatomic,strong)UILabel *billNumberLabel; @property (nonatomic,strong)UILabel *billNumberLabel;
@property (nonatomic,strong)UILabel *stateLabel; @property (nonatomic,strong)UILabel *stateLabel;
...@@ -41,21 +43,28 @@ typedef enum : NSUInteger { ...@@ -41,21 +43,28 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"行情调研详情";
[self bulifLayout]; [self bulifLayout];
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
if (data) { if (data) {
NSDictionary *dictData = data[@"data"]; NSInteger success = [data[@"success"] integerValue];
Survey *survey = [[Survey alloc]init]; NSString *message = data[@"message"] ;
[survey setValuesForKeysWithDictionary:dictData]; if (success == 1) {
self.survey = survey; NSDictionary *dictData = data[@"data"];
[strongSelf fetchtSurveyDetail]; Survey *survey = [[Survey alloc]init];
[survey setValuesForKeysWithDictionary:dictData];
self.survey = survey;
[strongSelf fetchtSurveyDetail];
}else{
[IBTLoadingView showTips:message];
}
}else{ }else{
[strongSelf fetchtSurveyDetail]; [strongSelf fetchtSurveyDetail];
} }
[self createResultChart];
}; };
void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
...@@ -65,6 +74,29 @@ typedef enum : NSUInteger { ...@@ -65,6 +74,29 @@ typedef enum : NSUInteger {
[[ICRHTTPController sharedController] getResultWithSurveyUuid:self.surveyUuid success:succ failure:fail]; [[ICRHTTPController sharedController] getResultWithSurveyUuid:self.surveyUuid success:succ failure:fail];
} }
- (void)createResultChart {
void(^succ)(id) = ^(id data) {
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
NSString *dataStr = data[@"data"];
NSString *urlStr = [NSString stringWithFormat:@"%@/DisplayChart?filename=%@",Server_Url,dataStr];
[_chartImageView sd_setImageWithURL:[NSURL URLWithString:urlStr]];
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[[ICRHTTPController sharedController] resultChartWithResultUuid:self.surveyUuid width:[NSNumber numberWithFloat:CGRectGetWidth(_chartImageView.frame)] height:[NSNumber numberWithFloat:CGRectGetHeight(_chartImageView.frame)] success:succ failure:fail];
}
- (void)fetchtSurveyDetail{ - (void)fetchtSurveyDetail{
self.billNumberLabel.text = [IBTCommon checkString:self.survey.billNumber]; self.billNumberLabel.text = [IBTCommon checkString:self.survey.billNumber];
if ([self.survey.state isEqualToString:@"initial"]) { if ([self.survey.state isEqualToString:@"initial"]) {
...@@ -84,7 +116,11 @@ typedef enum : NSUInteger { ...@@ -84,7 +116,11 @@ typedef enum : NSUInteger {
for (NSDictionary *userDict in self.survey.users) { for (NSDictionary *userDict in self.survey.users) {
SurveyUser *surveyUser = [[SurveyUser alloc]init]; SurveyUser *surveyUser = [[SurveyUser alloc]init];
[surveyUser setValuesForKeysWithDictionary:userDict]; [surveyUser setValuesForKeysWithDictionary:userDict];
user = [user stringByAppendingFormat:@"%@、",surveyUser.userName]; if (user.length == 0) {
user = [user stringByAppendingFormat:@"%@",surveyUser.userName];
}else{
user = [user stringByAppendingFormat:@"、%@",surveyUser.userName];
}
} }
self.titleLabel.text = [IBTCommon checkString:self.survey.title]; self.titleLabel.text = [IBTCommon checkString:self.survey.title];
self.productLabel.text = [IBTCommon checkString:self.survey.productName]; self.productLabel.text = [IBTCommon checkString:self.survey.productName];
...@@ -99,19 +135,17 @@ typedef enum : NSUInteger { ...@@ -99,19 +135,17 @@ typedef enum : NSUInteger {
#pragma mark - 视图初始化 #pragma mark - 视图初始化
- (void)bulifLayout{ - (void)bulifLayout{
self.view.backgroundColor = HexColor(@"f8f8f8");
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)]; _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)];
_scrollView.showsHorizontalScrollIndicator = NO; _scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO; _scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = HexColor(@"f8f8f8");
[self.view addSubview:_scrollView]; [self.view addSubview:_scrollView];
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:HexColor(@"f69100")]; 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:HexColor(@"f69100")];
[self.view addSubview:endBtn]; [self.view addSubview:endBtn];
_surveyView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*9+LeftMargin/2)];
_surveyView= [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, LeftHeight*9+LeftMargin/2)];
_surveyView.backgroundColor = [UIColor whiteColor]; _surveyView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_surveyView]; [_scrollView addSubview:_surveyView];
...@@ -122,16 +156,6 @@ typedef enum : NSUInteger { ...@@ -122,16 +156,6 @@ typedef enum : NSUInteger {
[_surveyView addSubview:tagLabel]; [_surveyView addSubview:tagLabel];
NSArray *leftArr = @[@"单号:",@"状态:",@"标题:",@"商品:",@"开始日期:",@"截止日期:",@"调研人员:",@"备注:"]; NSArray *leftArr = @[@"单号:",@"状态:",@"标题:",@"商品:",@"开始日期:",@"截止日期:",@"调研人员:",@"备注:"];
// NSMutableArray *contentArr = [[NSMutableArray alloc]init];
// [contentArr addObject:[IBTCommon checkString:self.survey.billNumber]];
// [contentArr addObject:[IBTCommon checkString:self.survey.state]];
// [contentArr addObject:[IBTCommon checkString:self.survey.title]];
// [contentArr addObject:[IBTCommon checkString:self.survey.productName]];
// [contentArr addObject:[IBTCommon checkString:self.survey.beginDate]];
// [contentArr addObject:[IBTCommon checkString:self.survey.endDate]];
// [contentArr addObject:[IBTCommon checkString:self.survey.productCode]];
// [contentArr addObject:[IBTCommon checkString:self.survey.remark]];
for (NSInteger i = 0 ; i < leftArr.count; i++) { 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) + LeftHeight *i, LeftWidth, LeftHeight)];
leftLabel.font = FontSize(17); leftLabel.font = FontSize(17);
...@@ -144,19 +168,6 @@ typedef enum : NSUInteger { ...@@ -144,19 +168,6 @@ typedef enum : NSUInteger {
if (i == 0) { if (i == 0) {
self.billNumberLabel = rightLabel; self.billNumberLabel = rightLabel;
}else if (i == 1) { }else if (i == 1) {
// if ([contentArr[i] isEqualToString:@"initial"]) {
// rightLabel.textColor = [UIColor redColor];
// rightLabel.text = @"未提交";
// }else if ([contentArr[i] isEqualToString:@"submitted"]) {
// rightLabel.textColor = [UIColor greenColor];
// rightLabel.text = @"已提交";
// }else if ([contentArr[i] isEqualToString:@"insurvey"]) {
// rightLabel.textColor = [UIColor grayColor];
// rightLabel.text = @"调研中";
// }else if ([contentArr[i] isEqualToString:@"finished"]) {
// rightLabel.textColor = [UIColor blackColor];
// rightLabel.text = @"已完成";
// }
self.stateLabel = rightLabel; self.stateLabel = rightLabel;
}else if(i == 2){ }else if(i == 2){
self.titleLabel = rightLabel; self.titleLabel = rightLabel;
...@@ -176,7 +187,7 @@ typedef enum : NSUInteger { ...@@ -176,7 +187,7 @@ typedef enum : NSUInteger {
} }
_bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_surveyView.frame), ScreenSize.width, 200)]; _bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_surveyView.frame) + TopMargin, ScreenSize.width, 200)];
_bottomView.backgroundColor = [UIColor whiteColor]; _bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView]; [_scrollView addSubview:_bottomView];
...@@ -184,35 +195,60 @@ typedef enum : NSUInteger { ...@@ -184,35 +195,60 @@ typedef enum : NSUInteger {
UILabel *resultLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)]; UILabel *resultLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)];
resultLabel.text = @"【行情反馈】"; resultLabel.text = @"【行情反馈】";
resultLabel.font = FontSize(17); resultLabel.font = FontSize(17);
resultLabel.textColor = [UIColor blueColor]; resultLabel.textColor = [UIColor blueColor];
[_bottomView addSubview:resultLabel]; [_bottomView addSubview:resultLabel];
_chartImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(resultLabel.frame) + 10, CGRectGetWidth(_bottomView.frame) - 20, CGRectGetHeight(_bottomView.frame) - LeftHeight - 20)];
[_bottomView addSubview:_chartImageView];
UIButton *btn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bottomView.frame) - 100, 10, 100, LeftHeight) target:self sel:@selector(btnClick:) tag:DetailTag image:nil title:@">>查看详情" titleColor:[UIColor blueColor] isCorner:NO corner:0 bgColor:nil]; UIButton *btn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bottomView.frame) - 100, 10, 100, LeftHeight) target:self sel:@selector(btnClick:) tag:DetailTag image:nil title:@">>查看详情" titleColor:[UIColor blueColor] isCorner:NO corner:0 bgColor:nil];
[_bottomView addSubview:btn]; [_bottomView addSubview:btn];
}
if ([self.survey.state isEqualToString:@"finished"]) {
endBtn.hidden = YES;
CGRect scrollViewFrame = _scrollView.frame;
scrollViewFrame.size.height = ScreenSize.height - 64;
_scrollView.frame = scrollViewFrame;
}
- (void)createSurvey{
} }
- (void)btnClick:(UIButton *)btn{ - (void)btnClick:(UIButton *)btn{
if (btn.tag == DetailTag) { if (btn.tag == DetailTag) {
ResultDetailViewController *rvc = [ResultDetailViewController new]; ResultDetailViewController *rvc = [ResultDetailViewController new];
rvc.surveyUuid = self.surveyUuid;
[self PushViewController:rvc animated:YES]; [self PushViewController:rvc animated:YES];
}else if (btn.tag == EndTag){ }else if (btn.tag == EndTag){
[self finishSurveyRequest];
} }
} }
#pragma mark - 结束行情调研
- (void)finishSurveyRequest{
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@"返回异常"];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] surveyFinishWithUuid:self.surveyUuid success:succ failure:fail];
}
- (void)setNoteHeight - (void)setNoteHeight
{ {
CGFloat height = [self.noteLabel calculateHeight]; CGFloat height = [self.noteLabel calculateHeight];
...@@ -228,10 +264,10 @@ typedef enum : NSUInteger { ...@@ -228,10 +264,10 @@ typedef enum : NSUInteger {
CGRect bottomFrame = _bottomView.frame; CGRect bottomFrame = _bottomView.frame;
bottomFrame.origin.y = CGRectGetMaxY(_surveyView.frame); bottomFrame.origin.y = CGRectGetMaxY(_surveyView.frame) + TopMargin;
_bottomView.frame = bottomFrame; _bottomView.frame = bottomFrame;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame)); _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#import "SortMaskView.h" #import "SortMaskView.h"
#import "BoltMaskView.h" #import "BoltMaskView.h"
#import "SurveyDetailViewController.h" #import "SurveyDetailViewController.h"
#import "NewSurveyViewController.h"
#define TopMargin 44 #define TopMargin 44
#define TableHeight 120 #define TableHeight 120
...@@ -38,6 +38,12 @@ typedef enum : NSUInteger { ...@@ -38,6 +38,12 @@ typedef enum : NSUInteger {
} }
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView; @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 @end
...@@ -46,19 +52,20 @@ typedef enum : NSUInteger { ...@@ -46,19 +52,20 @@ typedef enum : NSUInteger {
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"行情调研"; self.title = @"行情调研";
self.view.backgroundColor = XXFBgColor;
[self initData]; [self initData];
[self createTableView]; [self createTableView];
[self getData];
} }
- (void)initData{ - (void)initData{
self.dataArr = [NSMutableArray array]; self.dataArr = [NSMutableArray array];
}
[self fetchtSurveyList]; - (void)getData{
__weak typeof(self)weakSelf = self; __weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchtSurveyList]; [strongSelf fetchtSurveyList:data];
}; };
void(^fail)(id) = ^(id data) { void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
...@@ -66,32 +73,58 @@ typedef enum : NSUInteger { ...@@ -66,32 +73,58 @@ typedef enum : NSUInteger {
}; };
[IBTLoadingView showProgressLabel:@"正在加载..."]; [IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; 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 = @{ NSDictionary *dict = @{
@"billNumberLike":billObject,
@"state":stateObject,
@"titleLike":titleObject,
@"orderField":[NSNull null],
@"orderDirection":orderObject,
@"userUuid":userUtil.userId, @"userUuid":userUtil.userId,
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(20)}; @"pageSize":@(20)};
[[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail]; [[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail];
} }
#pragma mark -成功 #pragma mark -成功
- (void)fetchtSurveyList{ - (void)fetchtSurveyList:(id)data{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) { if (data) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Survey TableName], @"uuid"]; NSInteger success = [data[@"success"] integerValue];
return [db executeQuery:sql]; NSString *message = data[@"message"] ;
}; if (success == 1) {
if (self.dataArr.count > 0) {
__weak typeof(self)weakSelf = self; [self.dataArr removeAllObjects];
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) { }
__strong __typeof(weakSelf)strongSelf = weakSelf; NSArray *recodesArr = data[ @"data" ][ @"records" ];
[strongSelf.dataArr removeAllObjects]; for (NSDictionary *surveyDict in recodesArr) {
[strongSelf.dataArr addObjectsFromArray:fetchedObjects]; Survey *survey = [[Survey alloc]init];
[strongSelf.tableView reloadData]; [survey setValuesForKeysWithDictionary:surveyDict];
}; [self.dataArr addObject:survey];
}
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController]; [self.tableView reloadData];
[dbCtrl runFetchForClass:[Survey class] }else{
fetchBlock:fetchBlk [IBTLoadingView showTips:message];
fetchResultsBlock:fetchResultsBlk]; }
}else{
[IBTLoadingView showTips:@" 无记录 "];
} }
}
- (void)createTableView - (void)createTableView
{ {
...@@ -106,7 +139,6 @@ typedef enum : NSUInteger { ...@@ -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 = [[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.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
...@@ -119,12 +151,28 @@ typedef enum : NSUInteger { ...@@ -119,12 +151,28 @@ typedef enum : NSUInteger {
#pragma mark - 确定 #pragma mark - 确定
- (void)sureClick{ - (void)sureClick{
//请求
[self getData];
//还原数据
if (_sortView) { if (_sortView) {
[self hiddenSortMaskView:YES]; [self hiddenSortMaskView:YES];
} }
if (_boltView) { if (_boltView) {
[self hiddenBoltMaskView:YES]; [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; self.navigationItem.rightBarButtonItem = nil;
} }
...@@ -144,8 +192,8 @@ typedef enum : NSUInteger { ...@@ -144,8 +192,8 @@ typedef enum : NSUInteger {
}else{ }else{
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) { if (_sortView == nil) {
_sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 105)]; _sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 105) withOrderDirection:self.orderDirection];
_sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序",@"默认排序",@"默认排序" ,nil]; _sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"按时间顺序",@"按时间逆序",nil];
_sortView.delegate = self; _sortView.delegate = self;
[_maskView addSubview:_sortView]; [_maskView addSubview:_sortView];
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25 animations:^{
...@@ -170,10 +218,10 @@ typedef enum : NSUInteger { ...@@ -170,10 +218,10 @@ typedef enum : NSUInteger {
}else{ }else{
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
if (_boltView == nil) { 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.backgroundColor = HexColor(@"f8f8f8");
_boltView.delegate = self; _boltView.delegate = self;
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序1",@"默认排序1",@"默认排序1" ,nil]; _boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"不限",@"未提交",@"已提交" ,@"调研中",nil];
[_maskView addSubview:_boltView]; [_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _boltView.frame; CGRect sortFrame = _boltView.frame;
...@@ -189,6 +237,7 @@ typedef enum : NSUInteger { ...@@ -189,6 +237,7 @@ typedef enum : NSUInteger {
} }
- (void)hiddenSortMaskView:(BOOL)isHide{ - (void)hiddenSortMaskView:(BOOL)isHide{
currentBtn = nil;
[_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal]; [_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
if (isHide == NO) { if (isHide == NO) {
[_sortView removeFromSuperview]; [_sortView removeFromSuperview];
...@@ -207,6 +256,7 @@ typedef enum : NSUInteger { ...@@ -207,6 +256,7 @@ typedef enum : NSUInteger {
} }
} }
- (void)hiddenBoltMaskView:(BOOL)isHide{ - (void)hiddenBoltMaskView:(BOOL)isHide{
currentBtn = nil;
[_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal]; [_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
if (isHide == NO) { if (isHide == NO) {
[_boltView removeFromSuperview]; [_boltView removeFromSuperview];
...@@ -226,11 +276,21 @@ typedef enum : NSUInteger { ...@@ -226,11 +276,21 @@ typedef enum : NSUInteger {
} }
#pragma mark - sortDelegate #pragma mark - sortDelegate
- (void)getSortValueSelectRow:(NSString *)state{ - (void)getSortValueSelectRow:(NSString *)state{
self.orderDirection = state;
NSLog(@"%@",state); NSLog(@"%@",state);
} }
- (void)getBoltValueSelectRow:(NSString *)state{ - (void)getBoltValueSelectRow:(NSString *)state{
self.state = state;
NSLog(@"%@",state); NSLog(@"%@",state);
} }
- (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike;
NSLog(@"%@",titleLike);
}
- (void)getBillNumber:(NSString *)billNumber{
self.billNumberLike = billNumber;
NSLog(@"%@",billNumber);
}
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
...@@ -256,13 +316,22 @@ typedef enum : NSUInteger { ...@@ -256,13 +316,22 @@ typedef enum : NSUInteger {
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
SurveyDetailViewController *svc = [SurveyDetailViewController new]; Survey *survey = nil;
if (self.dataArr.count > 0) { 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.survey = survey;
svc.surveyUuid = survey.uuid; svc.surveyUuid = survey.uuid;
[self PushViewController:svc animated:YES];
} }
[self PushViewController:svc animated:YES];
} }
...@@ -274,6 +343,10 @@ typedef enum : NSUInteger { ...@@ -274,6 +343,10 @@ typedef enum : NSUInteger {
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
@property (nonatomic,strong)NSString *place;//产地 @property (nonatomic,strong)NSString *place;//产地
@property (nonatomic,strong)NSString *capacity;//市场容量 @property (nonatomic,strong)NSString *capacity;//市场容量
@property (nonatomic,strong)NSString *quality;//质量情况 @property (nonatomic,strong)NSString *quality;//质量情况
@property (nonatomic,strong)NSDate *feedbackTime;//反馈时间 @property (nonatomic,strong)NSString *feedbackTime;//反馈时间
@property (nonatomic,strong)NSArray *attachmnets;//附件列表 @property (nonatomic,strong)NSArray *attachmnets;//附件列表
@end @end
...@@ -12,5 +12,9 @@ ...@@ -12,5 +12,9 @@
@property (nonatomic,strong)NSString *userUuid;//用户UUid @property (nonatomic,strong)NSString *userUuid;//用户UUid
@property (nonatomic,strong)NSString *userCode;//用户编码 @property (nonatomic,strong)NSString *userCode;//用户编码
@property (nonatomic,strong)NSString *userName;//用户名称 @property (nonatomic,strong)NSString *userName;//用户名称
@property (nonatomic,strong)NSString *uuid; @property (nonatomic,strong)NSString *uuid;//唯一标识
@end @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