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

表报图表

parent 67c310c3
......@@ -12,19 +12,32 @@
#import "RPassgerView.h"
#import "FinishTimeView.h"
#import "QueryOrder.h"
#define WebUrl @"cruiser-web/chart/salesdatachart.thor"
@interface ReportDetailViewController ()<CustomSegViewDelegate,FinishTimeViewDelegate,UIWebViewDelegate>
@property (nonatomic,strong)CustomSegView *segView;
@property (nonatomic,strong)RSaleView *rsaleView;
@property (nonatomic,strong)UIWebView *rwebView;
@property (nonatomic,strong)UIActivityIndicatorView *ractivityView;
@property (nonatomic,strong)RPassgerView *rpassgerView;
@property (nonatomic,strong)UIWebView *rpassgerWebView;
@property (nonatomic,strong)UIActivityIndicatorView *passActivityView;
@property (nonatomic,strong)RPassgerView *rpriceView;
@property (nonatomic,strong)UIWebView *rpriceWebView;
@property (nonatomic,strong)UIActivityIndicatorView *priceActivityView;
@property (nonatomic,strong)RPassgerView *rgrossView;
@property (nonatomic,strong)UIWebView *rgrossWebView;
@property (nonatomic,strong)UIActivityIndicatorView *grossActivityView;
@property (nonatomic,strong)FinishTimeView *startTimeView;
......@@ -59,13 +72,15 @@
self.segView.delegate = self;
[self.view addSubview:self.segView];
self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, self.segView.bottom, ScreenSize.width, ScreenSize.height - 64 - self.segView.bottom)];
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.pagingEnabled = YES;
[self.view addSubview:self.scrollView];
//销售
rect = CGRectMake(0, 0, ScreenSize.width, 145);
self.rsaleView = [[RSaleView alloc]initWithFrame:rect];
......@@ -74,51 +89,102 @@
[self.scrollView addSubview:self.rsaleView];
rect = CGRectMake(0, self.rsaleView.bottom, ScreenSize.width*2, self.scrollView.height - self.rsaleView.bottom - 64);
rect = CGRectMake(0, self.rsaleView.bottom, ScreenSize.width, self.scrollView.height - self.rsaleView.bottom - 64);
CLog(@"-------%f",self.scrollView.height);
UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0,self.rsaleView.bottom, ScreenSize.width*2, self.scrollView.height)];
UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0,self.rsaleView.bottom, ScreenSize.width, self.scrollView.height-self.rsaleView.bottom)];
webView.delegate = self;
webView.scalesPageToFit = YES;
webView.backgroundColor = [UIColor clearColor];
[self.scrollView addSubview:webView];
self.rwebView = webView;
UIActivityIndicatorView *indicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake((ScreenSize.width-80)/2, (webView.height-80)/2, 80, 80)];
indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
[webView addSubview:indicatorView];
self.ractivityView = indicatorView;
for (int i = 1; i< 4 ; i++) {
RPassgerView *prassView = [[RPassgerView alloc]initWithFrame:CGRectMake(i*ScreenSize.width, 0, ScreenSize.width*2, 145) withPage:i];
RPassgerView *prassView = [[RPassgerView alloc]initWithFrame:CGRectMake(i*ScreenSize.width, 0, ScreenSize.width, 145) withPage:i];
prassView.bgImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"salebg_%d",(i+1)]];
prassView.cenImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"sale_%d",(i+1)]];
UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(i*ScreenSize.width, prassView.bottom, ScreenSize.width*2, self.scrollView.height)];
UIWebView *web = [[UIWebView alloc]initWithFrame:CGRectMake(i*ScreenSize.width, prassView.bottom, ScreenSize.width, self.scrollView.height-prassView.bottom)];
web.scalesPageToFit = YES;
web.delegate = self;
web.backgroundColor = [UIColor clearColor];
[self.scrollView addSubview:prassView];
[self.scrollView addSubview:web];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake((ScreenSize.width-80)/2, (web.height-80)/2, 80, 80)];
indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
[web addSubview:indicator];
if (i == 1) {
self.rpassgerView = prassView;
self.rpassgerWebView = web;
self.passActivityView = indicator;
}else if (i == 2) {
self.rpriceView = prassView;
self.rpriceWebView = web;
self.priceActivityView = indicator;
}else if (i == 3) {
self.rgrossView = prassView;
self.rgrossWebView = web;
self.grossActivityView = indicator;
}
}
self.scrollView.contentSize = CGSizeMake(ScreenSize.width*4, ScreenSize.height - 64 - self.segView.bottom);
//加载webView
[self loadWebViewFromServer];
}
#pragma mark- 请求webView
- (void)loadWebViewFromServer{
#warning 测试
[self.rpassgerWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://218.244.151.129:7580/cruiser-web/chart/surveychart.thor?enterprise=1111&surveyUuid=2222"]]];
[self.rpriceWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://218.244.151.129:7580/cruiser-web/chart/surveychart.thor?enterprise=1111&surveyUuid=2222"]]];
[self.rgrossWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://218.244.151.129:7580/cruiser-web/chart/surveychart.thor?enterprise=1111&surveyUuid=2222"]]];
[self.rwebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://218.244.151.129:7580/cruiser-web/chart/surveychart.thor?enterprise=1111&surveyUuid=2222"]]];
// NSString *url = http://218.244.151.129:7580/cruiser-web/chart/surveychart.thor?enterprise=1111&surveyUuid=2222
NSString *url = [NSString stringWithFormat:@"%@/%@?enterprise=%@&dateScopeType=%@&dateScope=%@&orgUuid=%@",HTTP_REST_API_BASE_URL,WebUrl,[ICRUserUtil sharedInstance].orgId,self.dayType,self.scopeType,self.compass.orgUuid];
CLog(@"==========%@",url);
[self.rpassgerWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
[self.rpriceWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
[self.rgrossWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
[self.rwebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
if (webView == self.rwebView) {
[self.ractivityView startAnimating];
}else if (webView == self.rpassgerWebView) {
[self.passActivityView startAnimating];
}else if (webView == self.rpriceWebView) {
[self.priceActivityView startAnimating];
}else if (webView == self.rgrossWebView) {
[self.grossActivityView startAnimating];
}
return YES;
}
- (void)webViewDidFinishLoad:(UIWebView *)webView { //webview 自适应高度
if (webView == self.rwebView || webView == self.rpassgerWebView || webView == self.rpriceWebView || webView == self.rgrossWebView) {
webView.scrollView.contentSize = CGSizeMake(ScreenSize.width*3, self.scrollView.height+100);
if (webView == self.rwebView) {
[self.ractivityView stopAnimating];
}else if (webView == self.rpassgerWebView) {
[self.passActivityView stopAnimating];
}else if (webView == self.rpriceWebView) {
[self.priceActivityView stopAnimating];
}else if (webView == self.rgrossWebView) {
[self.grossActivityView stopAnimating];
}
}
- (void)getDataFromServer{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
......@@ -195,6 +261,9 @@
CLog(@"-------%@",self.scopeType);
self.dayType = dayType;
[self getDataFromServer];
//加载webView
[self loadWebViewFromServer];
}
- (void)customSegTwoClick:(NSString *)title{
//选择历史查看
......@@ -263,6 +332,9 @@
self.scopeType = time;
[self getDataFromServer];
//加载webView
[self loadWebViewFromServer];
}
#pragma mark - 取消
- (void)clearDatePickView{
......
......@@ -104,8 +104,15 @@
void(^succ)(id) = ^(id data) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
//赋值
[strongSelf prepareDataInScrollView:data];
[strongSelf getBottomData:nil];
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
[strongSelf prepareDataInScrollView:data];
[strongSelf getBottomData:nil];
}else{
[IBTLoadingView hideHUDWithText:message];
[IBTLoadingView showTips:data];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
......
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