Browse Source

1.修改RedAnt Mobile Result使之与Apex Mobile Rsult相适应。

Pen Li 8 năm trước cách đây
mục cha
commit
3f7c1cf821

+ 33 - 6
RedAnt Mobile/RedAnt Mobile.xcodeproj/project.pbxproj

@@ -22,6 +22,11 @@
 		42973AD71FBA8F4A00A3C164 /* CommonEditorRangeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42973AD51FBA8F4A00A3C164 /* CommonEditorRangeCell.m */; };
 		42973AD81FBAB9C300A3C164 /* EnumSelectAndSort.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71FF60261FA7233500C5523A /* EnumSelectAndSort.storyboard */; };
 		42973ADC1FBABB7F00A3C164 /* EnumSelectAndSortCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42973ADB1FBABB7E00A3C164 /* EnumSelectAndSortCell.m */; };
+		42A7EA6D20609DEE002EF939 /* RAResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A7EA6C20609DEE002EF939 /* RAResultViewController.m */; };
+		42A7EA7220609F70002EF939 /* Result.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42A7EA6E20609F6F002EF939 /* Result.xib */; };
+		42A7EA7320609F70002EF939 /* MyQLPreviewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A7EA7020609F6F002EF939 /* MyQLPreviewController.m */; };
+		42A7EA7420609F70002EF939 /* ResultCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42A7EA7120609F70002EF939 /* ResultCell.xib */; };
+		42A7EA772060AF56002EF939 /* ResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A7EA762060AF56002EF939 /* ResultCell.m */; };
 		42D64C921FD0FAA4003F49F9 /* CommonEditorBannerItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D64C8D1FD0FAA3003F49F9 /* CommonEditorBannerItemCell.m */; };
 		42D64C931FD0FAA4003F49F9 /* CommonEditorBannerCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D64C8F1FD0FAA3003F49F9 /* CommonEditorBannerCell.m */; };
 		42D64C941FD0FAA4003F49F9 /* Phone_Banner_Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42D64C901FD0FAA3003F49F9 /* Phone_Banner_Cell.xib */; };
@@ -192,12 +197,20 @@
 		4221EFAF1FA853660026E1EC /* UIScrollView+JLRefresh.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+JLRefresh.m"; sourceTree = "<group>"; };
 		4221EFB01FA853660026E1EC /* UIView+JLExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+JLExtension.h"; sourceTree = "<group>"; };
 		4221EFB11FA853660026E1EC /* UIView+JLExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+JLExtension.m"; sourceTree = "<group>"; };
-		4221EFB71FA879470026E1EC /* Result.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Result.storyboard; sourceTree = "<group>"; };
+		4221EFB71FA879470026E1EC /* Result.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Result.storyboard; path = ../../common/customUI/Result.storyboard; sourceTree = "<group>"; };
 		42973AD31FBA8F4900A3C164 /* CommonEditorRangeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommonEditorRangeCell.h; path = "../../RedAnt ERP Mobile/common/CommonEditor/CommonEditorRangeCell.h"; sourceTree = "<group>"; };
 		42973AD41FBA8F4900A3C164 /* Phone_Range_Cell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Phone_Range_Cell.xib; path = "../../RedAnt ERP Mobile/common/CommonEditor/Phone_Range_Cell.xib"; sourceTree = "<group>"; };
 		42973AD51FBA8F4A00A3C164 /* CommonEditorRangeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommonEditorRangeCell.m; path = "../../RedAnt ERP Mobile/common/CommonEditor/CommonEditorRangeCell.m"; sourceTree = "<group>"; };
 		42973ADA1FBABB7E00A3C164 /* EnumSelectAndSortCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnumSelectAndSortCell.h; path = "../../RedAnt ERP Mobile/common/CommonEditor/EnumSelectAndSort/EnumSelectAndSortCell.h"; sourceTree = "<group>"; };
 		42973ADB1FBABB7E00A3C164 /* EnumSelectAndSortCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EnumSelectAndSortCell.m; path = "../../RedAnt ERP Mobile/common/CommonEditor/EnumSelectAndSort/EnumSelectAndSortCell.m"; sourceTree = "<group>"; };
+		42A7EA6B20609DEE002EF939 /* RAResultViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAResultViewController.h; sourceTree = "<group>"; };
+		42A7EA6C20609DEE002EF939 /* RAResultViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RAResultViewController.m; sourceTree = "<group>"; };
+		42A7EA6E20609F6F002EF939 /* Result.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = Result.xib; path = ../../common/customUI/Result.xib; sourceTree = "<group>"; };
+		42A7EA6F20609F6F002EF939 /* MyQLPreviewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MyQLPreviewController.h; path = ../../common/customUI/MyQLPreviewController.h; sourceTree = "<group>"; };
+		42A7EA7020609F6F002EF939 /* MyQLPreviewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MyQLPreviewController.m; path = ../../common/customUI/MyQLPreviewController.m; sourceTree = "<group>"; };
+		42A7EA7120609F70002EF939 /* ResultCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ResultCell.xib; path = ../../common/customUI/ResultCell.xib; sourceTree = "<group>"; };
+		42A7EA752060AF56002EF939 /* ResultCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ResultCell.h; path = ../../common/customUI/ResultCell.h; sourceTree = "<group>"; };
+		42A7EA762060AF56002EF939 /* ResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ResultCell.m; path = ../../common/customUI/ResultCell.m; sourceTree = "<group>"; };
 		42D64C8C1FD0FAA3003F49F9 /* CommonEditorBannerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommonEditorBannerCell.h; path = "../../RedAnt ERP Mobile/common/CommonEditor/CommonEditorBannerCell.h"; sourceTree = "<group>"; };
 		42D64C8D1FD0FAA3003F49F9 /* CommonEditorBannerItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CommonEditorBannerItemCell.m; path = "../../RedAnt ERP Mobile/common/CommonEditor/CommonEditorBannerItemCell.m"; sourceTree = "<group>"; };
 		42D64C8E1FD0FAA3003F49F9 /* CommonEditorBannerItemCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommonEditorBannerItemCell.h; path = "../../RedAnt ERP Mobile/common/CommonEditor/CommonEditorBannerItemCell.h"; sourceTree = "<group>"; };
@@ -329,10 +342,10 @@
 		71F3A9AC1F5F8E22001036C8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		71F3A9AF1F5F8E22001036C8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		71F3A9B11F5F8E22001036C8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
-		71F3A9B71F5F8E73001036C8 /* ResultViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultViewController.h; sourceTree = "<group>"; };
-		71F3A9B81F5F8E73001036C8 /* ResultViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultViewController.m; sourceTree = "<group>"; };
-		71F3A9BB1F5F8EAE001036C8 /* FullyShowViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FullyShowViewController.h; sourceTree = "<group>"; };
-		71F3A9BC1F5F8EAE001036C8 /* FullyShowViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FullyShowViewController.m; sourceTree = "<group>"; };
+		71F3A9B71F5F8E73001036C8 /* ResultViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ResultViewController.h; path = ../../common/customUI/ResultViewController.h; sourceTree = "<group>"; };
+		71F3A9B81F5F8E73001036C8 /* ResultViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ResultViewController.m; path = ../../common/customUI/ResultViewController.m; sourceTree = "<group>"; };
+		71F3A9BB1F5F8EAE001036C8 /* FullyShowViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FullyShowViewController.h; path = ../../common/customUI/FullyShowViewController.h; sourceTree = "<group>"; };
+		71F3A9BC1F5F8EAE001036C8 /* FullyShowViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FullyShowViewController.m; path = ../../common/customUI/FullyShowViewController.m; sourceTree = "<group>"; };
 		71F3A9C01F5FA11F001036C8 /* login.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = login.json; sourceTree = "<group>"; };
 		71F3A9C31F5FA11F001036C8 /* LoginSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginSwitchCell.h; sourceTree = "<group>"; };
 		71F3A9C41F5FA11F001036C8 /* LoginSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginSwitchCell.m; sourceTree = "<group>"; };
@@ -497,7 +510,8 @@
 				4221EFB01FA853660026E1EC /* UIView+JLExtension.h */,
 				4221EFB11FA853660026E1EC /* UIView+JLExtension.m */,
 			);
-			path = Refresh;
+			name = Refresh;
+			path = ../../common/customUI/Refresh;
 			sourceTree = "<group>";
 		};
 		4221EFA61FA853660026E1EC /* Footer */ = {
@@ -961,12 +975,20 @@
 		71F3A9BA1F5F8E89001036C8 /* result */ = {
 			isa = PBXGroup;
 			children = (
+				42A7EA752060AF56002EF939 /* ResultCell.h */,
+				42A7EA762060AF56002EF939 /* ResultCell.m */,
+				42A7EA6F20609F6F002EF939 /* MyQLPreviewController.h */,
+				42A7EA7020609F6F002EF939 /* MyQLPreviewController.m */,
+				42A7EA6E20609F6F002EF939 /* Result.xib */,
+				42A7EA7120609F70002EF939 /* ResultCell.xib */,
 				71F3A9B71F5F8E73001036C8 /* ResultViewController.h */,
 				71F3A9B81F5F8E73001036C8 /* ResultViewController.m */,
 				71CB70B01FA1BA5E009FDCB7 /* data.json */,
 				71F3A9BB1F5F8EAE001036C8 /* FullyShowViewController.h */,
 				71F3A9BC1F5F8EAE001036C8 /* FullyShowViewController.m */,
 				4221EFB71FA879470026E1EC /* Result.storyboard */,
+				42A7EA6B20609DEE002EF939 /* RAResultViewController.h */,
+				42A7EA6C20609DEE002EF939 /* RAResultViewController.m */,
 			);
 			name = result;
 			sourceTree = "<group>";
@@ -1242,7 +1264,9 @@
 			files = (
 				42D64C9D1FD0FAEF003F49F9 /* Assets.bundle in Resources */,
 				7102C1461FCD51FF0062A67A /* RAImage.storyboard in Resources */,
+				42A7EA7220609F70002EF939 /* Result.xib in Resources */,
 				42973AD81FBAB9C300A3C164 /* EnumSelectAndSort.storyboard in Resources */,
+				42A7EA7420609F70002EF939 /* ResultCell.xib in Resources */,
 				42DBCB131FBEC0E1005574E0 /* Phone_Web_Cell.xib in Resources */,
 				7197D4041FB438B60063EFBB /* demo_row.pdf in Resources */,
 				71FF60371FA96F4F00C5523A /* download_query.xls in Resources */,
@@ -1298,6 +1322,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				42A7EA6D20609DEE002EF939 /* RAResultViewController.m in Sources */,
 				7167803B1FCC098600FE2784 /* ManufacturerListController.m in Sources */,
 				4221EFB61FA859B80026E1EC /* JLRefreshFooter.m in Sources */,
 				4221EFB21FA8599A0026E1EC /* JLRefreshHeader.m in Sources */,
@@ -1393,6 +1418,8 @@
 				71F3AA5C1F624A88001036C8 /* SignatureViewController.m in Sources */,
 				7167804C1FCC0B0000FE2784 /* MenuViewController.m in Sources */,
 				71F3A9F91F5FA688001036C8 /* Reachability.m in Sources */,
+				42A7EA772060AF56002EF939 /* ResultCell.m in Sources */,
+				42A7EA7320609F70002EF939 /* MyQLPreviewController.m in Sources */,
 				42D8CD5C1FC662E7005BEA15 /* CommonEditorTableContainerView.m in Sources */,
 				71F3AA461F612369001036C8 /* SRMonthPicker.m in Sources */,
 				71F3AA421F612369001036C8 /* DatePickerViewController.m in Sources */,

+ 23 - 0
RedAnt Mobile/RedAnt Mobile/Assets.xcassets/ic_menu.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "ic_menu.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_menu@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "ic_menu@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RedAnt Mobile/RedAnt Mobile/Assets.xcassets/ic_menu.imageset/ic_menu.png


BIN
RedAnt Mobile/RedAnt Mobile/Assets.xcassets/ic_menu.imageset/ic_menu@2x.png


BIN
RedAnt Mobile/RedAnt Mobile/Assets.xcassets/ic_menu.imageset/ic_menu@3x.png


+ 12 - 5
RedAnt Mobile/RedAnt Mobile/RAModeListViewController.m

@@ -19,6 +19,8 @@
 #import "PopModeViewController.h"
 #import "RootViewController.h"
 #import "SearchSettingViewController.h"
+#import "RAResultViewController.h"
+
 @interface RAModeListViewController () <UITableViewDelegate,UITableViewDataSource>
 
 @property (weak, nonatomic) IBOutlet UITableView *modeTableView;
@@ -165,11 +167,16 @@
 //    preQueryVC.query_id = [model.query_id integerValue];
 //    preQueryVC.title = model.name;
     
-    ResultViewController *preQueryVC = [[UIStoryboard storyboardWithName:@"Result" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
-    [preQueryVC setQueryParams: @{
-                                  @"query_id" : modeinfo[@"query_id"],
-                                  @"title":modeinfo[@"name"]
-                                  }];
+//    ResultViewController *preQueryVC = [[UIStoryboard storyboardWithName:@"Result" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
+//    [preQueryVC setQueryParams: @{
+//                                  @"query_id" : modeinfo[@"query_id"],
+//                                  @"title":modeinfo[@"name"]
+//                                  }];
+    
+    RAResultViewController *preQueryVC = [RAResultViewController buildInstanceWithParams:@{
+                                                                                           @"query_id" : modeinfo[@"query_id"],
+                                                                                           @"title":modeinfo[@"name"]
+                                                                                           }.mutableCopy];
     
     [self.navigationController pushViewController:preQueryVC animated:YES];
 }

+ 13 - 0
RedAnt Mobile/RedAnt Mobile/RAResultViewController.h

@@ -0,0 +1,13 @@
+//
+//  RAResultViewController.h
+//  RedAnt Mobile
+//
+//  Created by Jack on 2018/3/20.
+//  Copyright © 2018年 Ray. All rights reserved.
+//
+
+#import "ResultViewController.h"
+
+@interface RAResultViewController : ResultViewController
+
+@end

+ 477 - 0
RedAnt Mobile/RedAnt Mobile/RAResultViewController.m

@@ -0,0 +1,477 @@
+//
+//  RAResultViewController.m
+//  RedAnt Mobile
+//
+//  Created by Jack on 2018/3/20.
+//  Copyright © 2018年 Ray. All rights reserved.
+//
+
+#import "RAResultViewController.h"
+#import "RANetwork.h"
+#import "RAUtils.h"
+#import "KVViewController.h"
+#import "OrderDetailViewController.h"
+#import "config.h"
+
+@interface RAResultViewController ()
+
+@end
+
+@implementation RAResultViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+#pragma mark - Override
+
+/**
+ * 0: init load
+ * 1: refresh
+ * 2: load more
+ */
+- (void)loadContentWithOption:(int)option Complete:(void (^)(int result,int count))finish {
+
+    if (self.params) {
+
+        NSMutableDictionary *dic = self.params.mutableCopy;
+        switch (option) {
+            case 0:
+            case 1: {
+                self.offset = 0;
+                self.content_layout =nil;
+                self.content_action = nil;
+                self.content_menu = nil;
+                self.content_data = nil;
+            }
+            break;
+            case 2: {
+                self.offset = [self resultItemCount];
+            }
+            break;
+        }
+
+        if (self.loadingIndicator.hidden) {
+            self.loadingIndicator.hidden = NO;
+        }
+        
+        if (![self.loadingIndicator isAnimating]) {
+            [self.loadingIndicator startAnimating];
+        }
+        
+//        dic[@"criteria"] = self.params;
+
+        [dic setObject:@(self.offset) forKey:@"offset"];
+        [dic setObject:@(delta) forKey:@"limit"];
+//        dic[@"criteria"] = [NSArray arrayWithObjects:@"aaa",@"bbb", nil];
+
+        __weak typeof(self) weakSelf = self;
+        dispatch_async(dispatch_get_global_queue(0, 0), ^{
+            NSDictionary *contentDic = [RANetwork query:dic];
+            NSInteger result = [[contentDic objectForKey:@"result"] integerValue];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                if (weakSelf) {
+                    __strong typeof(weakSelf) strongSelf = weakSelf;
+                    
+                    [strongSelf.loadingIndicator stopAnimating];
+                    
+                    if (result == RESULT_TRUE) {
+                        strongSelf.content_layout = [contentDic objectForKey:@"layout"];
+                        strongSelf.content_action = [contentDic objectForKey:@"row_action"];
+                        strongSelf.content_menu = [[contentDic objectForKey:@"menu"] mutableCopy];
+                        [strongSelf setupNavigationBar];
+
+//                            UILabel * headerview=(UILabel *)self.tableview.tableHeaderView;
+//                            headerview.text = contentDic[@"table_title"];
+//                            [self resize_tableHeader];
+                        
+                        NSString *title = contentDic[@"table_title"];
+                        self.titleLabel.text = title;
+
+                        if(strongSelf.content_data==nil)
+                            strongSelf.content_data = [NSMutableDictionary new];
+                        NSMutableDictionary* newdata = [[contentDic objectForKey:@"data"] mutableCopy];
+                        for(int dc = 0;dc<[newdata[@"count"] intValue];dc++)
+                        {
+                            NSMutableDictionary * newdata_item = newdata[[NSString stringWithFormat:@"item_%d",dc]];
+
+                            strongSelf.content_data[[NSString stringWithFormat:@"item_%d",[strongSelf.content_data[@"count"] intValue] ]] = newdata_item;
+                            strongSelf.content_data[@"count"] = @([strongSelf.content_data[@"count"] intValue]+1);
+                        }
+
+//                        strongSelf.content_data = [contentDic objectForKey:@"data"];
+                        [strongSelf updateTableFrame];
+                        [strongSelf.tableview reloadData];
+                    } else {
+                        [RAUtils message_alert:[contentDic objectForKey:@"err_msg"] title:@"Warning" controller:strongSelf];
+                    }
+
+                    if (finish) {
+                        finish((int)result,(int)[self resultItemCount]);
+                    }
+
+                }
+
+            });
+        });
+    }
+}
+
+- (void)presses3DTouchForIndexPath:(NSIndexPath *)indexPath {
+    [self handleRowAction:indexPath];
+}
+
+-(void)cellDoubleTapAction:(UIGestureRecognizer*)gestureRecognizer {
+    NSLog(@"cell double tap");
+    UITableViewCell* cell = (UITableViewCell*)[gestureRecognizer view];
+    NSIndexPath* indexPath=[self.tableview indexPathForCell:cell];
+    //strongSelf.content_action
+    
+    [self handleRowAction:indexPath];
+}
+
+- (void)MenuClick:(UIBarButtonItem *)sender {
+    
+    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+    //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"];
+        //        NSMutableDictionary* add_params = json[@"params"];
+        UIAlertAction *actioni = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
+            // DebugLog(@"Cancel");
+            if([actiontype isEqualToString:@"download"])
+            {
+                [weakSelf Export:url];
+            }
+            else if([actiontype isEqualToString:@"save"])
+            {
+                [weakSelf save];
+            }
+        }];
+        [alertControl addAction:actioni];
+    }
+    
+    UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+        // DebugLog(@"Cancel");
+        
+    }];
+    [alertControl addAction:actionCancel];
+    
+    
+    
+    
+    
+    [self presentViewController:alertControl animated:NO completion:nil];
+}
+
+#pragma mark - Action
+
+- (void)handleRowAction:(NSIndexPath *)indexPath {
+    
+    if (indexPath == nil) {
+        return;
+    }
+    
+    if(self.content_action!=nil)
+    {
+        
+        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;
+                
+                
+                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;
+            }
+        }
+        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"];
+                        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];
+            
+            
+            
+            
+            
+            [self presentViewController:alertControl animated:NO completion:nil];
+            
+        }
+        
+    }
+}
+
+- (void)save {
+    
+}
+
+
+-(void)Export:(NSString*) url {
+    
+    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), ^{
+        
+        //        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;
+        
+        if (path) {
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
+            });
+        }
+        
+    });
+}
+- (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), ^{
+        
+        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];
+            });
+        }
+        
+    });
+    
+}
+
+@end

+ 5 - 3
RedAnt Mobile/RedAnt Mobile/SearchViewController.m

@@ -9,7 +9,7 @@
 #import "SearchViewController.h"
 #import "RANetwork.h"
 #import "RAUtils.h"
-#import "ResultViewController.h"
+#import "RAResultViewController.h"
 #import "RAConvertor.h"
 
 @interface SearchViewController ()
@@ -83,8 +83,10 @@
     result_params[@"criteria"] = [RAConvertor dict2string:criteria];//criteria;
     result_params[@"query_id"]=self.params[@"query_id"];
     result_params[@"title"]=self.params[@"title"];
-    ResultViewController *preQueryVC = [[UIStoryboard storyboardWithName:@"Result" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
-    [preQueryVC setQueryParams: result_params];
+//    ResultViewController *preQueryVC = [[UIStoryboard storyboardWithName:@"Result" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
+//    [preQueryVC setQueryParams: result_params];
+    
+    RAResultViewController *preQueryVC = [RAResultViewController buildInstanceWithParams:result_params];
     
     [self.navigationController pushViewController:preQueryVC animated:YES];
     

+ 1 - 1
RedAnt Mobile/RedAnt Mobile/config.h

@@ -27,7 +27,7 @@
 #define PDF_DEBUG false
 
 
-//#define FAKE_DATA
+#define FAKE_DATA
 
 #define PROJ_RAMOBILE
 

+ 3 - 2
RedAnt Mobile/RedAnt Mobile/predef_query.json

@@ -1,5 +1,6 @@
 {
     "result": 2,
+    "table_title":"Resutl Title",
     "menu": [
              {
              "title": "Export 1",
@@ -20,8 +21,8 @@
                    {
                    "title": "demo title",
                    "module0": "quick_look",
-                   "module1": "kv_detail",
-                   "module": "order_detail",
+                   "module": "kv_detail",
+                   "module1": "order_detail",
                    "url": "http://1.1.1.1",
                    "params": {
                    "order#": 0