Commit 9a039119 authored by admin's avatar admin

完成“获取管理人员抽查列表”

parent 54a3efee
......@@ -59,4 +59,7 @@
// 提交公告
#define kAnnounceYetReadURL @"redstar-server/rest/affiche/read/"
// 管理层的抽查列表
#define kManageSportcheckURL @"redstar-server/rest/sportcheck/query"
#endif /* Url_h */
......@@ -331,20 +331,21 @@
_menuView = [[MenuView alloc] init];
_menuView.translatesAutoresizingMaskIntoConstraints = NO;
_menuView.backgroundColor = kInspectSectionBackGroundColor;
UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
[window addSubview:_menuView];
[_menuView.taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[_menuView.screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_menuView];
NSLayoutConstraint *menuTop = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:window attribute:NSLayoutAttributeTop multiplier:1.0 constant:64];
[window addConstraint:menuTop];
NSLayoutConstraint *menuTop = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:menuTop];
NSLayoutConstraint *menuLeft = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:window attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[window addConstraint:menuLeft];
NSLayoutConstraint *menuLeft = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:menuLeft];
NSLayoutConstraint *menuRight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:window attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[window addConstraint:menuRight];
NSLayoutConstraint *menuRight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:menuRight];
NSLayoutConstraint *menuHeight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[window addConstraint:menuHeight];
[self.view addConstraint:menuHeight];
}
return _menuView;
}
......
......@@ -13,6 +13,11 @@
#import "MenuView.h"
#import "OnLineCompleteViewController.h"
#import "HttpClient.h"
#import <MBProgressHUD.h>
#import <MJRefresh.h>
#import "NoDataView.h"
#import "InspectListCell.h"
#define kInspectListTableViewcellIndeterfor @"inspectListTableViewcellIndeterfor"
@interface SpotCheckOnLineViewController ()<UITableViewDelegate, UITableViewDataSource,ScreenTableDelegate, TaxisViewDelegate, InspectTableViewDelegate>
......@@ -27,6 +32,9 @@
@property (nonatomic, assign) NSInteger selectRow;
@property (nonatomic, assign) NSInteger timeSelectNum;
@property (nonatomic, strong) NSMutableArray *allSpotCheckList;
@property (nonatomic, strong) NoDataView *noDataView;
@end
@implementation SpotCheckOnLineViewController
......@@ -46,24 +54,19 @@
[self setupNav];
self.allSpotCheckList = [NSMutableArray array];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self requestSpotCheckList];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.menuView.taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[self.menuView.screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
self.tabBarController.tabBar.hidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.menuView removeFromSuperview];
self.menuView = nil;
}
#pragma mark - Private Mothods
......@@ -97,6 +100,56 @@
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
- (void)requestSpotCheckList
{
HttpClient *http = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kManageSportcheckURL]];
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"user":user_uuid,
@"pageNumber":@(0),
@"pageSize":@(10)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getManageSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"管理层的抽查列表 response= %@", response);
NSLog(@"管理层的抽查列表 error= %@", error);
if (_allSpotCheckList.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
self.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
self.tableView.delegate = self;
self.tableView.dataSource = self;
// 下拉加载更多
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
}];
}
- (void)requestMoreList
{
}
- (void)addSpotCheckTaskClick:(UIButton *)sender
{
OnLineViewController *onlineVC = [[OnLineViewController alloc] init];
......@@ -108,8 +161,6 @@
sender.isDrop = !sender.isDrop;
if (_selctedButton.tag == sender.tag) {
if (sender.isDrop) {
if (sender.tag == 4001) {
[self showRedView];
......@@ -125,7 +176,6 @@
[self closeGreenView];
}
sender.selected = NO;
}
} else {
// 前一次选中的按钮 选中状态置为NO
......@@ -166,7 +216,7 @@
- (void)showRedView
{
if (!_bgView) {
_bgView = [[UIView alloc] initWithFrame:self.view.bounds];
_bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 45, kScreenWidth, kScreenHeight - 45)];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeRedView)];
[_bgView addGestureRecognizer:tapGR];
}
......@@ -183,12 +233,11 @@
_bgView.backgroundColor = [UIColor blackColor];
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, kTaxisViewHeight);
CGRect fromFrame = CGRectMake(0, -kTaxisViewHeight, kScreenWidth, kTaxisViewHeight);
_taxisView.frame = fromFrame;
_taxisView.alpha = 0.0;
_taxisView.frame = toFrame;
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = 0.6;
_taxisView.frame = toFrame;
_taxisView.alpha = 1.0;
}];
}
......@@ -198,10 +247,9 @@
_selctedButton.isDrop = NO;
_selctedButton.selected = NO;
[_selctedButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
CGRect fromFrame = CGRectMake(0, -kTaxisViewHeight, kScreenWidth, kTaxisViewHeight);
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = .0f;
_taxisView.frame = fromFrame;
_taxisView.alpha = 0.0;
} completion:^(BOOL finished) {
[_bgView removeFromSuperview];
[_taxisView removeFromSuperview];
......@@ -212,7 +260,7 @@
- (void)showGreenView
{
if (!_bgView) {
_bgView = [[UIView alloc] initWithFrame:self.view.bounds];
_bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 45, kScreenWidth, kScreenHeight - 45)];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeGreenView)];
[_bgView addGestureRecognizer:tapGR];
}
......@@ -232,12 +280,11 @@
_bgView.backgroundColor = [UIColor blackColor];
CGRect toFrame = CGRectMake(0, 45, kScreenWidth, kScreenViewHeight);
CGRect fromFrame = CGRectMake(0, -kScreenViewHeight, kScreenWidth, kScreenViewHeight);
_screenView.frame = fromFrame;
_screenView.alpha = 0.0;
_screenView.frame = toFrame;
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = 0.6;
_screenView.frame = toFrame;
_screenView.alpha = 1.0;
}];
}
......@@ -247,10 +294,9 @@
_selctedButton.isDrop = NO;
_selctedButton.selected = NO;
[_selctedButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
CGRect fromFrame = CGRectMake(0, -kScreenViewHeight, kScreenWidth, kScreenViewHeight);
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = .0f;
_screenView.frame = fromFrame;
_screenView.alpha = 0.0;
} completion:^(BOOL finished) {
[_bgView removeFromSuperview];
[_screenView removeFromSuperview];
......@@ -300,7 +346,7 @@
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 7;
return _allSpotCheckList.count;
}
// cell显示的内容
......@@ -313,7 +359,7 @@
cell.titleLabel.text = @"9月中旬卫生临时抽查";
cell.startDate.text = @"起始时间:2015-09-21 15:23:21"; // 起
cell.overDate.text = @"截止时间:2015-09-30"; // 截止
cell.address.text = @"巡检商场:上海真北店";
NSString *str = [NSString stringWithFormat:@"巡检进度:进行中"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
......@@ -344,10 +390,8 @@
// cell的点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该功能正在努力开发中!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
// OnLineCompleteViewController *completeVC = [[OnLineCompleteViewController alloc] init];
// [self.navigationController pushViewController:completeVC animated:YES];
OnLineCompleteViewController *completeVC = [[OnLineCompleteViewController alloc] init];
[self.navigationController pushViewController:completeVC animated:YES];
}
......@@ -396,24 +440,45 @@
if (!_menuView) {
_menuView = [[MenuView alloc] init];
_menuView.translatesAutoresizingMaskIntoConstraints = NO;
_menuView.backgroundColor = kInspectSectionBackGroundColor;
UIWindow *window = [[UIApplication sharedApplication].windows lastObject];
[window addSubview:_menuView];
[_menuView.taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[_menuView.screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_menuView];
NSLayoutConstraint *menuTop = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:window attribute:NSLayoutAttributeTop multiplier:1.0 constant:64];
[window addConstraint:menuTop];
NSLayoutConstraint *menuTop = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:menuTop];
NSLayoutConstraint *menuLeft = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:window attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[window addConstraint:menuLeft];
NSLayoutConstraint *menuLeft = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:menuLeft];
NSLayoutConstraint *menuRight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:window attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[window addConstraint:menuRight];
NSLayoutConstraint *menuRight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:menuRight];
NSLayoutConstraint *menuHeight = [NSLayoutConstraint constraintWithItem:_menuView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[window addConstraint:menuHeight];
[self.view addConstraint:menuHeight];
}
return _menuView;
}
- (NoDataView *)noDataView
{
if (!_noDataView) {
_noDataView = [[NoDataView alloc] init];
_noDataView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_noDataView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:45];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _noDataView;
}
@end
......@@ -12,6 +12,8 @@
#import "MenuView.h"
#import "StandardViewController.h"
#import "NoDataView.h"
@interface HandOutViewController ()<ScreenTableDelegate, TaxisViewDelegate, InspectTableViewDelegate>
@property (nonatomic, strong) MenuView *menuView;
......@@ -22,6 +24,9 @@
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, assign) NSInteger selectRow;
@property (nonatomic, assign) NSInteger timeSelectNum;
@property (nonatomic, strong) NoDataView *noDataView;
@end
@implementation HandOutViewController
......@@ -301,4 +306,6 @@
}
return _menuView;
}
@end
......@@ -63,4 +63,8 @@ typedef void (^completionBlock) (id response, NSError *error);
// 提交公告已读状态
- (void)settingAnnounceYetReadWithCompletion:(completionBlock)completion;
// 获取管理层的抽查任务的列表
- (void)getManageSportCheckListWithParameters:(id)parameters completion:(completionBlock)completion;
@end
......@@ -241,4 +241,14 @@
}];
}
// 获取管理层的抽查任务的列表
- (void)getManageSportCheckListWithParameters:(id)parameters completion:(completionBlock)completion
{
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
@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