|
@@ -10,9 +10,15 @@
|
|
|
#import "const.h"
|
|
#import "const.h"
|
|
|
#import "RANetwork.h"
|
|
#import "RANetwork.h"
|
|
|
#import "RAUtils.h"
|
|
#import "RAUtils.h"
|
|
|
|
|
+#import "DetailTabBarController.h"
|
|
|
|
|
+
|
|
|
|
|
+#pragma clang diagnostic push
|
|
|
|
|
+#pragma clang diagnostic ignored"-Wdeprecated-declarations"
|
|
|
|
|
|
|
|
@interface AMResultViewController ()
|
|
@interface AMResultViewController ()
|
|
|
|
|
|
|
|
|
|
+@property (nonatomic,assign) BOOL dirty;
|
|
|
|
|
+
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation AMResultViewController
|
|
@implementation AMResultViewController
|
|
@@ -55,14 +61,67 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
- (void)viewDidLoad {
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableArray* header_name =[[NSMutableArray alloc]init];
|
|
|
|
|
+ NSMutableArray* header_aname =[[NSMutableArray alloc]init];
|
|
|
|
|
+ [self getHeader:header_name header_aname:header_aname];
|
|
|
|
|
+ NSString* fields =@"";
|
|
|
|
|
+ for(int i=0;i<header_name.count;i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ fields=[fields stringByAppendingFormat:@"%@,",header_name[i]];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ fields=[fields substringToIndex: fields.length-1];
|
|
|
|
|
+
|
|
|
|
|
+ [self.params setValue:fields forKey:@"columns"];
|
|
|
|
|
+
|
|
|
|
|
+ // 参数设置放在Super前
|
|
|
|
|
+
|
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
// Do any additional setup after loading the view.
|
|
|
|
|
|
|
|
|
|
+// NSString* title=@"";
|
|
|
|
|
+// NSString *module_name = [self.params objectForKey:@"module_name"];
|
|
|
|
|
+// if([module_name isEqualToString:@"Ocean Booking"])
|
|
|
|
|
+// title = @"Booking Result";
|
|
|
|
|
+// else if([module_name isEqualToString:@"Ocean B/L info."])
|
|
|
|
|
+// title = @"B/L info. Result";
|
|
|
|
|
+// else if([module_name isEqualToString:@"Container detail"])
|
|
|
|
|
+// title = @"Container Result";
|
|
|
|
|
+// else if([module_name isEqualToString:@"Download Document"])
|
|
|
|
|
+// title = @"Document Result";
|
|
|
|
|
+// self.title = title;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
[self resetContraint];
|
|
[self resetContraint];
|
|
|
[self configureTableView];
|
|
[self configureTableView];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (void)viewWillAppear:(BOOL)animated {
|
|
|
|
|
+ [super viewWillAppear:animated];
|
|
|
|
|
+
|
|
|
|
|
+ if(self.dirty ==true)
|
|
|
|
|
+ {
|
|
|
|
|
+ NSMutableArray* header_name =[[NSMutableArray alloc]init];
|
|
|
|
|
+ NSMutableArray* header_aname =[[NSMutableArray alloc]init];
|
|
|
|
|
+ [self getHeader:header_name header_aname:header_aname];
|
|
|
|
|
+
|
|
|
|
|
+ NSString* fields =@"";
|
|
|
|
|
+ for(int i=0;i<header_name.count;i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ fields=[fields stringByAppendingFormat:@"%@,",header_name[i]];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ fields=[fields substringToIndex: fields.length-1];
|
|
|
|
|
+
|
|
|
|
|
+ [self.params setValue:fields forKey:@"columns"];
|
|
|
|
|
+ [self loadContent];
|
|
|
|
|
+
|
|
|
|
|
+ self.dirty = false;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
- (void)didReceiveMemoryWarning {
|
|
- (void)didReceiveMemoryWarning {
|
|
|
[super didReceiveMemoryWarning];
|
|
[super didReceiveMemoryWarning];
|
|
|
// Dispose of any resources that can be recreated.
|
|
// Dispose of any resources that can be recreated.
|
|
@@ -98,12 +157,13 @@
|
|
|
__weak typeof(self) weakSelf = self;
|
|
__weak typeof(self) weakSelf = self;
|
|
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
|
|
|
|
|
- NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_search.json" ofType:nil];
|
|
|
|
|
- NSData *data = [[NSData alloc] initWithContentsOfFile:path];
|
|
|
|
|
- NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
|
|
|
|
|
-
|
|
|
|
|
- NSDictionary *contentDic = json;
|
|
|
|
|
|
|
+// NSString *path = [[NSBundle mainBundle] pathForResource:@"fake_search.json" ofType:nil];
|
|
|
|
|
+// NSData *data = [[NSData alloc] initWithContentsOfFile:path];
|
|
|
|
|
+// NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
|
|
|
|
|
+//
|
|
|
|
|
+// NSDictionary *contentDic = json;
|
|
|
|
|
|
|
|
|
|
+ NSDictionary *contentDic = [RANetwork search:[self.params mutableCopy]];
|
|
|
|
|
|
|
|
NSInteger result = [[contentDic objectForKey:@"result"] integerValue];
|
|
NSInteger result = [[contentDic objectForKey:@"result"] integerValue];
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -148,258 +208,258 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+- (void)showDetailForIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
+
|
|
|
|
|
+ NSArray *actions = [self getActions];
|
|
|
|
|
+ if (actions.count < 1) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ NSArray* arr_col=self.content_layout[@"header"][@"col"];
|
|
|
|
|
+
|
|
|
|
|
+ NSArray* item =self.content_data[[NSString stringWithFormat:@"item_%ld",indexPath.row]];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *detail_id = item[arr_col.count];
|
|
|
|
|
+ NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithDictionary:self.params copyItems:true];
|
|
|
|
|
+ [params setValue:detail_id forKey:@"id"];
|
|
|
|
|
+ NSString *module_name = [self.params objectForKey:@"module_name"];
|
|
|
|
|
+ DetailTabBarController *detailViewController=[[DetailTabBarController alloc] init:module_name actions:actions params:params];
|
|
|
|
|
+
|
|
|
|
|
+ if (detailViewController) {
|
|
|
|
|
+ [self.navigationController pushViewController:detailViewController animated:YES];
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
-(void)cellDoubleTapAction:(UIGestureRecognizer*)gestureRecognizer
|
|
-(void)cellDoubleTapAction:(UIGestureRecognizer*)gestureRecognizer
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- NSAssert(true, ([NSString stringWithFormat:@"%s cellDoubleTapAction not impl",object_getClassName([self class])]));
|
|
|
|
|
|
|
+ UITableViewCell *cell = (UITableViewCell *)[gestureRecognizer view];
|
|
|
|
|
+ NSIndexPath *indexPath = [self.tableview indexPathForCell:cell];
|
|
|
|
|
+ [self showDetailForIndexPath:indexPath];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)presses3DTouchForIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
+ [self showDetailForIndexPath:indexPath];
|
|
|
}
|
|
}
|
|
|
-//{
|
|
|
|
|
-// NSLog(@"cell double tap");
|
|
|
|
|
-// UITableViewCell* cell = (UITableViewCell*)[gestureRecognizer view];
|
|
|
|
|
-// NSIndexPath* indexPath=[self.tableview indexPathForCell:cell];
|
|
|
|
|
-// //strongSelf.content_action
|
|
|
|
|
-// if(self.content_action!=nil)
|
|
|
|
|
|
|
+
|
|
|
|
|
+/*
|
|
|
|
|
+#pragma mark - Navigation
|
|
|
|
|
+
|
|
|
|
|
+// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
|
|
|
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
|
|
|
+ // Get the new view controller using [segue destinationViewController].
|
|
|
|
|
+ // Pass the selected object to the new view controller.
|
|
|
|
|
+}
|
|
|
|
|
+*/
|
|
|
|
|
+
|
|
|
|
|
+-(void)Export:(NSString*) url
|
|
|
|
|
+{
|
|
|
|
|
+// if(self.download_query )
|
|
|
// {
|
|
// {
|
|
|
|
|
+// self.documentPath = self.download_query;
|
|
|
|
|
+// [self.navigationController pushViewController:self.quickLook animated:NO];
|
|
|
|
|
+// return;
|
|
|
|
|
+// }
|
|
|
//
|
|
//
|
|
|
-// if(self.content_action.count==1)
|
|
|
|
|
-// {
|
|
|
|
|
-// NSDictionary* action =self.content_action.firstObject;
|
|
|
|
|
-// NSString * module = action[@"module"];
|
|
|
|
|
-// if([module isEqualToString:@"quick_look"])
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// // +(NSString*)download_file : (NSMutableDictionary*) params url:(NSString*) url
|
|
|
|
|
-// NSMutableDictionary *params = action[@"params"];
|
|
|
|
|
-// NSString* URL =action[@"url"];
|
|
|
|
|
-// __weak typeof(self) weakSelf = self;
|
|
|
|
|
-// dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// NSString *path = [RANetwork download_file:params url:URL];
|
|
|
|
|
-// weakSelf.documentPath = path;
|
|
|
|
|
-//
|
|
|
|
|
-// if (path) {
|
|
|
|
|
-// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
-// [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
-// else if([module isEqualToString:@"kv_detail"])
|
|
|
|
|
-// {
|
|
|
|
|
-// NSMutableDictionary *params = [NSMutableDictionary new];
|
|
|
|
|
-// params[@"query_id"] = self.params[@"query_id"];
|
|
|
|
|
-//
|
|
|
|
|
-// NSMutableDictionary *criteria =[NSMutableDictionary new];
|
|
|
|
|
-// for(NSString* key in [action[@"params"] allKeys] )
|
|
|
|
|
-// {
|
|
|
|
|
-// NSArray* item =self.content_data[[NSString stringWithFormat:@"item_%ld",indexPath.row]];
|
|
|
|
|
-// int idx =[action[@"params"][key] intValue];
|
|
|
|
|
-// criteria[key]=item[ idx];
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// params[@"criteria"]=[RAConvertor dict2string:criteria] ;
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// UIAlertView * waitalert = [RAUtils waiting_alert:@"Loading..." title:@"Please wait"];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// __weak typeof(self) weakself = self;
|
|
|
|
|
-// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// NSDictionary* json =[RANetwork kv_detail:params];
|
|
|
|
|
-//
|
|
|
|
|
-// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
-// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// if([[json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
-// {
|
|
|
|
|
-// KVViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"KVViewController"];
|
|
|
|
|
-// vc.content = [json mutableCopy];
|
|
|
|
|
-// [weakself.navigationController pushViewController:vc animated:NO];
|
|
|
|
|
-//
|
|
|
|
|
-// // weakself.content_data_download = [weakself CopyDirty:weakself.content_data_download to:[editor_json mutableCopy]];//[editor_json mutableCopy];
|
|
|
|
|
-// //
|
|
|
|
|
-// // weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed: weakself.changed_data];
|
|
|
|
|
-// //
|
|
|
|
|
-// //
|
|
|
|
|
-// // [weakself download_success];
|
|
|
|
|
-// // [weakself.editorTable reloadData];
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-// [RAUtils message_alert:json[@"msg"] title:nil controller:weakself] ;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// });
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
-// else if([module isEqualToString:@"order_detail"])
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// OrderDetailViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderDetailViewController"];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// vc.url_type = URL_REMOTE;
|
|
|
|
|
-// vc.request_url=URL_ORDER_DETAIL;
|
|
|
|
|
|
|
+// __weak typeof(self) weakSelf = self;
|
|
|
|
|
+// dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
//
|
|
//
|
|
|
|
|
+//// NSMutableDictionary *params = self.params.mutableCopy;
|
|
|
|
|
+//// if(add_params!=nil)
|
|
|
|
|
+//// [params addEntriesFromDictionary:add_params];
|
|
|
|
|
+// NSString *path = [RANetwork download_query:url];
|
|
|
|
|
+// weakSelf.download_query = path;
|
|
|
|
|
+// weakSelf.documentPath = path;
|
|
|
//
|
|
//
|
|
|
-// vc.params = [NSMutableDictionary dictionary];
|
|
|
|
|
-// // NSString *path = [[NSBundle mainBundle] pathForResource:@"search_ui.json" ofType:nil];
|
|
|
|
|
-// // NSData *data = [NSData dataWithContentsOfFile:path];
|
|
|
|
|
-// // vc.content_data_download = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil] mutableCopy];
|
|
|
|
|
-// [self.navigationController pushViewController:vc animated:NO];
|
|
|
|
|
-// return;
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+// if (path) {
|
|
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
+// [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
|
|
+// });
|
|
|
// }
|
|
// }
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"" message:nil preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
-// //block代码块取代了delegate
|
|
|
|
|
-//
|
|
|
|
|
-// __weak typeof(self) weakSelf = self;
|
|
|
|
|
-// for(int i=0;i<self.content_action.count;i++)
|
|
|
|
|
-// {
|
|
|
|
|
-// NSMutableDictionary* json = self.content_action[i];
|
|
|
|
|
-// NSString* title =json[@"title"];
|
|
|
|
|
-// NSString* module = json[@"module"];
|
|
|
|
|
-// NSMutableDictionary* add_params = json[@"params"];
|
|
|
|
|
-// UIAlertAction *actioni = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// if([module isEqualToString:@"quick_look"])
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// // +(NSString*)download_file : (NSMutableDictionary*) params url:(NSString*) url
|
|
|
|
|
-// NSMutableDictionary *params = json[@"params"];
|
|
|
|
|
-// NSString* URL =json[@"url"];
|
|
|
|
|
-// __weak typeof(self) weakSelf = self;
|
|
|
|
|
-// dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// NSString *path = [RANetwork download_file:params url:URL];
|
|
|
|
|
-// weakSelf.documentPath = path;
|
|
|
|
|
-//
|
|
|
|
|
-// if (path) {
|
|
|
|
|
-// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
-// [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
-// else if([module isEqualToString:@"kv_detail"])
|
|
|
|
|
-// {
|
|
|
|
|
-// NSMutableDictionary *params = json[@"params"];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// UIAlertView * waitalert = [RAUtils waiting_alert:@"Loading..." title:@"Please wait"];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// __weak typeof(self) weakself = self;
|
|
|
|
|
-// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// NSDictionary* json =[RANetwork kv_detail:params];
|
|
|
|
|
-//
|
|
|
|
|
-// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
-// [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// if([[json valueForKey:@"result"] intValue]==2)
|
|
|
|
|
-// {
|
|
|
|
|
-// KVViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"KVViewController"];
|
|
|
|
|
-// vc.content = [json mutableCopy];
|
|
|
|
|
-// [weakself.navigationController pushViewController:vc animated:NO];
|
|
|
|
|
-//
|
|
|
|
|
-// // weakself.content_data_download = [weakself CopyDirty:weakself.content_data_download to:[editor_json mutableCopy]];//[editor_json mutableCopy];
|
|
|
|
|
-// //
|
|
|
|
|
-// // weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed: weakself.changed_data];
|
|
|
|
|
-// //
|
|
|
|
|
-// //
|
|
|
|
|
-// // [weakself download_success];
|
|
|
|
|
-// // [weakself.editorTable reloadData];
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-// [RAUtils message_alert:json[@"msg"] title:nil controller:weakself] ;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// });
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
-// else if([module isEqualToString:@"order_detail"])
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// OrderDetailViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderDetailViewController"];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// vc.url_type = URL_REMOTE;
|
|
|
|
|
-// vc.request_url=URL_ORDER_DETAIL;
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// vc.params = [NSMutableDictionary dictionary];
|
|
|
|
|
-// // NSString *path = [[NSBundle mainBundle] pathForResource:@"search_ui.json" ofType:nil];
|
|
|
|
|
-// // NSData *data = [NSData dataWithContentsOfFile:path];
|
|
|
|
|
-// // vc.content_data_download = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil] mutableCopy];
|
|
|
|
|
-// [self.navigationController pushViewController:vc animated:NO];
|
|
|
|
|
-// return;
|
|
|
|
|
-// }
|
|
|
|
|
-// // DebugLog(@"Cancel");
|
|
|
|
|
-//// if([actiontype isEqualToString:@"download"])
|
|
|
|
|
-//// {
|
|
|
|
|
-//// [weakSelf Export:add_params];
|
|
|
|
|
-//// }
|
|
|
|
|
-//// else if([actiontype isEqualToString:@"save"])
|
|
|
|
|
-//// {
|
|
|
|
|
-//// }
|
|
|
|
|
-// }];
|
|
|
|
|
-// [alertControl addAction:actioni];
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
|
|
|
|
-// // DebugLog(@"Cancel");
|
|
|
|
|
-//
|
|
|
|
|
-// }];
|
|
|
|
|
-// [alertControl addAction:actionCancel];
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
//
|
|
//
|
|
|
|
|
+// });
|
|
|
|
|
+}
|
|
|
|
|
+- (void)downloadItemClick:(UIBarButtonItem *)sender {
|
|
|
|
|
+
|
|
|
|
|
+// if(self.download_query )
|
|
|
|
|
+// {
|
|
|
|
|
+// self.documentPath = self.download_query;
|
|
|
|
|
+// [self.navigationController pushViewController:self.quickLook animated:NO];
|
|
|
|
|
+// return;
|
|
|
|
|
+// }
|
|
|
//
|
|
//
|
|
|
|
|
+// __weak typeof(self) weakSelf = self;
|
|
|
|
|
+// dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
//
|
|
//
|
|
|
-// [self presentViewController:alertControl animated:NO completion:nil];
|
|
|
|
|
|
|
+// NSMutableDictionary *params = self.params.mutableCopy;
|
|
|
|
|
+// NSString *path = [RANetwork download_query:params];
|
|
|
|
|
+// weakSelf.download_query = path;
|
|
|
|
|
+// weakSelf.documentPath = path;
|
|
|
//
|
|
//
|
|
|
|
|
+// if (path) {
|
|
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
+// [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
|
|
+// });
|
|
|
// }
|
|
// }
|
|
|
//
|
|
//
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-//}
|
|
|
|
|
-/*
|
|
|
|
|
-#pragma mark - Navigation
|
|
|
|
|
|
|
+// });
|
|
|
|
|
|
|
|
-// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
|
|
|
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
|
|
|
- // Get the new view controller using [segue destinationViewController].
|
|
|
|
|
- // Pass the selected object to the new view controller.
|
|
|
|
|
}
|
|
}
|
|
|
-*/
|
|
|
|
|
|
|
+
|
|
|
|
|
+- (void)save {
|
|
|
|
|
+ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"alert_title_create_tag", nil) message:NSLocalizedString(@"alert_msg_savehint", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"cancel", nil) otherButtonTitles:NSLocalizedString(@"save", nil),nil];
|
|
|
|
|
+ alert.alertViewStyle = UIAlertViewStylePlainTextInput;
|
|
|
|
|
+ [alert show];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)fieldSetting {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *module_name = [self.params objectForKey:@"module_name"];
|
|
|
|
|
+ CustomizeFieldViewController *ViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CustomizeFieldViewController"];
|
|
|
|
|
+ ViewController.function_name = module_name;
|
|
|
|
|
+ ViewController.behavior =BEHAVIOR_RESULT;
|
|
|
|
|
+ self.dirty=true;
|
|
|
|
|
+
|
|
|
|
|
+ [self.navigationController pushViewController:ViewController animated:YES];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)MenuClick:(UIBarButtonItem *)sender {
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Menu" message:nil preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
+ //block代码块取代了delegate
|
|
|
|
|
+
|
|
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
|
|
+ for(int i=0;i<self.content_menu.count;i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ NSMutableDictionary* json = self.content_menu[i];
|
|
|
|
|
+ NSString* title =json[@"title"];
|
|
|
|
|
+ NSString* actiontype = json[@"action"];
|
|
|
|
|
+ NSString* url = json[@"url"];
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertAction *actioni = [UIAlertAction actionWithTitle:NSLocalizedString([title lowercaseString], nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
|
|
|
|
+
|
|
|
|
|
+ if([actiontype isEqualToString:@"download"])
|
|
|
|
|
+ {
|
|
|
|
|
+ [weakSelf Export:url];
|
|
|
|
|
+ }
|
|
|
|
|
+ else if([actiontype isEqualToString:@"save"])
|
|
|
|
|
+ {
|
|
|
|
|
+ [weakSelf save];
|
|
|
|
|
+ }
|
|
|
|
|
+ else if([actiontype isEqualToString:@"field_setting"])
|
|
|
|
|
+ {
|
|
|
|
|
+ [weakSelf fieldSetting];
|
|
|
|
|
+ }
|
|
|
|
|
+ }];
|
|
|
|
|
+ [alertControl addAction:actioni];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
|
|
|
|
+ // DebugLog(@"Cancel");
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+ [alertControl addAction:actionCancel];
|
|
|
|
|
+
|
|
|
|
|
+ [self presentViewController:alertControl animated:NO completion:nil];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#pragma mark - GridResult
|
|
|
|
|
+
|
|
|
|
|
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
|
|
|
|
+{
|
|
|
|
|
+
|
|
|
|
|
+ if(buttonIndex!=alertView.cancelButtonIndex)
|
|
|
|
|
+ {
|
|
|
|
|
+ UITextField * txt=[alertView textFieldAtIndex:0];
|
|
|
|
|
+ NSString* name = txt.text;
|
|
|
|
|
+ NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self.params
|
|
|
|
|
+ options:0
|
|
|
|
|
+ error:nil];
|
|
|
|
|
+ NSString* param = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+ NSString* user = appDelegate.user;
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3 *db =[ApexMobileDB get_db];
|
|
|
|
|
+ NSString *module_name = [self.params objectForKey:@"module_name"];
|
|
|
|
|
+
|
|
|
|
|
+ [ApexMobileDB execSql: [NSString stringWithFormat: @"insert into history(params,name,module_name,user) values('%@','%@','%@','%@')",param,name,module_name,user] db:db];
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3_close(db);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (NSArray*)getActions
|
|
|
|
|
+{
|
|
|
|
|
+ DebugLog(@"getActions");
|
|
|
|
|
+
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+ NSString *module_name = [self.params objectForKey:@"module_name"];
|
|
|
|
|
+
|
|
|
|
|
+ NSMutableArray* actions = [[NSMutableArray alloc]init];
|
|
|
|
|
+ sqlite3 *db =[ApexMobileDB get_db];
|
|
|
|
|
+ NSString *quary = [NSString stringWithFormat:@"select name from actions_info where function_name='%@' and user='%@'order by priority",module_name, appDelegate.user];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3_stmt *stmt;
|
|
|
|
|
+
|
|
|
|
|
+ if (sqlite3_prepare_v2(db, [quary UTF8String], -1, &stmt, nil) == SQLITE_OK) {
|
|
|
|
|
+ DebugLog(@"sql:%@",quary);
|
|
|
|
|
+ DebugLog(@"=======================show tabs===================");
|
|
|
|
|
+ while (sqlite3_step(stmt)==SQLITE_ROW)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *name = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(stmt, 0)];
|
|
|
|
|
+ [actions addObject:name];
|
|
|
|
|
+ DebugLog(@"action name: %@",name);
|
|
|
|
|
+ }
|
|
|
|
|
+ DebugLog(@"=======================show tabs===================");
|
|
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
|
|
+ }
|
|
|
|
|
+ //用完了一定记得关闭,释放内存
|
|
|
|
|
+ sqlite3_close(db);
|
|
|
|
|
+ return actions;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)getHeader: (NSMutableArray*)header_name header_aname:(NSMutableArray*)header_aname
|
|
|
|
|
+{
|
|
|
|
|
+ // NSMutableDictionary* header = [[NSMutableDictionary alloc] init];
|
|
|
|
|
+ // [header setValue:@"aaa" forKey:@"bbb"];
|
|
|
|
|
+ DebugLog(@"initHeader");
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
|
|
+ NSString *module_name = [self.params objectForKey:@"module_name"];
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3 *db =[ApexMobileDB get_db];
|
|
|
|
|
+ NSString *quary = [NSString stringWithFormat:@"select aname,name from fields_info where function_name='%@' and user='%@' and behavior=%d and show=1 order by priority,aname",module_name, appDelegate.user,BEHAVIOR_RESULT];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ sqlite3_stmt *stmt;
|
|
|
|
|
+
|
|
|
|
|
+ if (sqlite3_prepare_v2(db, [quary UTF8String], -1, &stmt, nil) == SQLITE_OK) {
|
|
|
|
|
+ DebugLog(@"sql:%@",quary);
|
|
|
|
|
+ DebugLog(@"=======================show fields===================");
|
|
|
|
|
+ while (sqlite3_step(stmt)==SQLITE_ROW)
|
|
|
|
|
+ {
|
|
|
|
|
+ NSString *aname = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(stmt, 0)];
|
|
|
|
|
+ NSString *name = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(stmt, 1)];
|
|
|
|
|
+ // [header setValue:aname forKey:name];
|
|
|
|
|
+ [header_name addObject:name];
|
|
|
|
|
+ [header_aname addObject:aname];
|
|
|
|
|
+ DebugLog(@"%@",aname);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ DebugLog(@"=======================show fields===================");
|
|
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
|
|
+ }
|
|
|
|
|
+ //用完了一定记得关闭,释放内存
|
|
|
|
|
+ sqlite3_close(db);
|
|
|
|
|
+ // return header;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
@end
|
|
@end
|
|
|
|
|
+
|
|
|
|
|
+#pragma clang diagnostic pop
|