Commit 42ce6cb5 authored by freecui's avatar freecui

找到加工单界面but

parent 5bfa7b5f
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
35A1C3551B8EFBBF004AC9F7 /* PermissionJson in Resources */ = {isa = PBXBuildFile; fileRef = 35A1C3541B8EFBBF004AC9F7 /* PermissionJson */; }; 35A1C3551B8EFBBF004AC9F7 /* PermissionJson in Resources */ = {isa = PBXBuildFile; fileRef = 35A1C3541B8EFBBF004AC9F7 /* PermissionJson */; };
35A1C3581B8F09D2004AC9F7 /* GXFFunctionDB.m in Sources */ = {isa = PBXBuildFile; fileRef = 35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */; }; 35A1C3581B8F09D2004AC9F7 /* GXFFunctionDB.m in Sources */ = {isa = PBXBuildFile; fileRef = 35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */; };
35B448DF1B9B0A73001209E2 /* ProductBillCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B448DE1B9B0A73001209E2 /* ProductBillCell.m */; }; 35B448DF1B9B0A73001209E2 /* ProductBillCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B448DE1B9B0A73001209E2 /* ProductBillCell.m */; };
35B462D91B9C3D7D00AE2C3E /* GXFProcessMaterialItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B462D81B9C3D7D00AE2C3E /* GXFProcessMaterialItemView.m */; };
35B462DC1B9C3D9600AE2C3E /* GXFProcessProductItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B462DB1B9C3D9600AE2C3E /* GXFProcessProductItemView.m */; };
35B9B40E1B8FFB59009851CC /* GXFFunctionDBHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B9B40D1B8FFB59009851CC /* GXFFunctionDBHelper.m */; }; 35B9B40E1B8FFB59009851CC /* GXFFunctionDBHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 35B9B40D1B8FFB59009851CC /* GXFFunctionDBHelper.m */; };
35C3C0AC1AE956040035AC8A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35C3C0AB1AE956040035AC8A /* Security.framework */; }; 35C3C0AC1AE956040035AC8A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35C3C0AB1AE956040035AC8A /* Security.framework */; };
35C3C0AE1AE9560E0035AC8A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35C3C0AD1AE9560E0035AC8A /* CoreGraphics.framework */; }; 35C3C0AE1AE9560E0035AC8A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35C3C0AD1AE9560E0035AC8A /* CoreGraphics.framework */; };
...@@ -491,6 +493,10 @@ ...@@ -491,6 +493,10 @@
35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFFunctionDB.m; sourceTree = "<group>"; }; 35A1C3571B8F09D2004AC9F7 /* GXFFunctionDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFFunctionDB.m; sourceTree = "<group>"; };
35B448DD1B9B0A73001209E2 /* ProductBillCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductBillCell.h; sourceTree = "<group>"; }; 35B448DD1B9B0A73001209E2 /* ProductBillCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductBillCell.h; sourceTree = "<group>"; };
35B448DE1B9B0A73001209E2 /* ProductBillCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductBillCell.m; sourceTree = "<group>"; }; 35B448DE1B9B0A73001209E2 /* ProductBillCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductBillCell.m; sourceTree = "<group>"; };
35B462D71B9C3D7D00AE2C3E /* GXFProcessMaterialItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFProcessMaterialItemView.h; sourceTree = "<group>"; };
35B462D81B9C3D7D00AE2C3E /* GXFProcessMaterialItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFProcessMaterialItemView.m; sourceTree = "<group>"; };
35B462DA1B9C3D9600AE2C3E /* GXFProcessProductItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFProcessProductItemView.h; sourceTree = "<group>"; };
35B462DB1B9C3D9600AE2C3E /* GXFProcessProductItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFProcessProductItemView.m; sourceTree = "<group>"; };
35B9B40C1B8FFB59009851CC /* GXFFunctionDBHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFFunctionDBHelper.h; sourceTree = "<group>"; }; 35B9B40C1B8FFB59009851CC /* GXFFunctionDBHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GXFFunctionDBHelper.h; sourceTree = "<group>"; };
35B9B40D1B8FFB59009851CC /* GXFFunctionDBHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFFunctionDBHelper.m; sourceTree = "<group>"; }; 35B9B40D1B8FFB59009851CC /* GXFFunctionDBHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GXFFunctionDBHelper.m; sourceTree = "<group>"; };
35C3C0AB1AE956040035AC8A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 35C3C0AB1AE956040035AC8A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
...@@ -1060,6 +1066,10 @@ ...@@ -1060,6 +1066,10 @@
358432ED1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m */, 358432ED1B993BAF007E73ED /* GXFProcessMaterialTableViewCell.m */,
358432EF1B993BD8007E73ED /* GXFProcessProductTableViewCell.h */, 358432EF1B993BD8007E73ED /* GXFProcessProductTableViewCell.h */,
358432F01B993BD8007E73ED /* GXFProcessProductTableViewCell.m */, 358432F01B993BD8007E73ED /* GXFProcessProductTableViewCell.m */,
35B462D71B9C3D7D00AE2C3E /* GXFProcessMaterialItemView.h */,
35B462D81B9C3D7D00AE2C3E /* GXFProcessMaterialItemView.m */,
35B462DA1B9C3D9600AE2C3E /* GXFProcessProductItemView.h */,
35B462DB1B9C3D9600AE2C3E /* GXFProcessProductItemView.m */,
); );
path = Views; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2463,6 +2473,7 @@ ...@@ -2463,6 +2473,7 @@
30D749551ACE421A00C63BA1 /* IBTUITextField.m in Sources */, 30D749551ACE421A00C63BA1 /* IBTUITextField.m in Sources */,
7217E9EA1B72364300FE5C1D /* BoltMaskView.m in Sources */, 7217E9EA1B72364300FE5C1D /* BoltMaskView.m in Sources */,
C11A346B1B2451D500079129 /* NALLabelsMatrix.m in Sources */, C11A346B1B2451D500079129 /* NALLabelsMatrix.m in Sources */,
35B462D91B9C3D7D00AE2C3E /* GXFProcessMaterialItemView.m in Sources */,
C17DE85A1AD81D1600581AA6 /* NSMutableArray+SafeInsert.m in Sources */, C17DE85A1AD81D1600581AA6 /* NSMutableArray+SafeInsert.m in Sources */,
35C3C0B91AE9567B0035AC8A /* ICRNavigationViewController.mm in Sources */, 35C3C0B91AE9567B0035AC8A /* ICRNavigationViewController.mm in Sources */,
35321F6A1B97EF3600E5C670 /* GXFPopNewProductViewController.m in Sources */, 35321F6A1B97EF3600E5C670 /* GXFPopNewProductViewController.m in Sources */,
...@@ -2534,6 +2545,7 @@ ...@@ -2534,6 +2545,7 @@
C1E1085D1ADA577500620375 /* ICRTaskDetailContentView.m in Sources */, C1E1085D1ADA577500620375 /* ICRTaskDetailContentView.m in Sources */,
C14BE30E1ADB86DB0049F1AA /* NSData+EncodeAdditions.m in Sources */, C14BE30E1ADB86DB0049F1AA /* NSData+EncodeAdditions.m in Sources */,
FEA2F3031B8453C700D64735 /* GoodsViewController.m in Sources */, FEA2F3031B8453C700D64735 /* GoodsViewController.m in Sources */,
35B462DC1B9C3D9600AE2C3E /* GXFProcessProductItemView.m in Sources */,
FE0C9B091B7C543D00335B39 /* User.m in Sources */, FE0C9B091B7C543D00335B39 /* User.m in Sources */,
C1E093041AC8E8E0003B7126 /* ICRCheckBox.m in Sources */, C1E093041AC8E8E0003B7126 /* ICRCheckBox.m in Sources */,
C1864A561B0B0D9D00D11C4E /* ICRPostTask.m in Sources */, C1864A561B0B0D9D00D11C4E /* ICRPostTask.m in Sources */,
......
...@@ -1722,7 +1722,7 @@ acceptTypeJson:YES ...@@ -1722,7 +1722,7 @@ acceptTypeJson:YES
} }
}; };
#pragma 请求参数的下载时间应该有要求???? #pragma 请求参数的下载时间应该有要求???? 加工工厂,用[NSDate date]可以获取到数据,但是供应商获取不到 ??
NSString *dateStr = @"2015-05-04";//[[NSDate date] httpParameterString];//urlAction NSString *dateStr = @"2015-05-04";//[[NSDate date] httpParameterString];//urlAction
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:urlAction] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)]; NSString *urlStr = [[[self class] UrlForPluginHTTPAction:urlAction] stringByAppendingFormat:@"?startDate=%@&pageNumber=%@&pageSize=%@", dateStr,@(page_number),@(page_size)];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
......
...@@ -77,6 +77,11 @@ typedef NS_ENUM(NSInteger, cellRow) { ...@@ -77,6 +77,11 @@ typedef NS_ENUM(NSInteger, cellRow) {
self.title = @"添加加工单"; self.title = @"添加加工单";
[self initData]; [self initData];
[self initSubViews]; [self initSubViews];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addNewMaterail:) name:KNOTIFICATION_saveMaterial object:nil];
//货物明细
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addNewProduct:) name:KNOTIFICATION_saveProduct object:nil];
} }
//刷新数据 //刷新数据
...@@ -86,7 +91,7 @@ typedef NS_ENUM(NSInteger, cellRow) { ...@@ -86,7 +91,7 @@ typedef NS_ENUM(NSInteger, cellRow) {
} }
- (void)addNewMaterail: (NSNotification *)aNotification { - (void)addNewMaterail: (NSNotification *)aNotification {
GXFProcessMaterial *material = aNotification.object; GXFProcessMaterial *material = aNotification.object;
if (_d_materialMuArr) { if (_d_materialMuArr ) {
[_d_materialMuArr addObject:material]; [_d_materialMuArr addObject:material];
[self p_refreshData]; [self p_refreshData];
} }
...@@ -113,12 +118,9 @@ typedef NS_ENUM(NSInteger, cellRow) { ...@@ -113,12 +118,9 @@ typedef NS_ENUM(NSInteger, cellRow) {
} }
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addNewMaterail:) name:KNOTIFICATION_saveMaterial object:nil];
//货物明细 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editProduct:) name:KNOTIFICATION_editProduct object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addNewProduct:) name:KNOTIFICATION_saveProduct object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteProduct:) name:KNOTIFICATION_deleteProduct object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editProduct:) name:KNOTIFICATION_editProduct object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteProduct:) name:KNOTIFICATION_deleteProduct object:nil];
// //
// //保存 // //保存
// void(^succ)(id) = ^(id data) { // void(^succ)(id) = ^(id data) {
...@@ -388,7 +390,7 @@ typedef NS_ENUM(NSInteger, cellRow) { ...@@ -388,7 +390,7 @@ typedef NS_ENUM(NSInteger, cellRow) {
}else { }else {
static NSString *cellID = @"ProductCell"; static NSString *cellID = @"ProductCell";
// if(_d_isProduct)
GXFProcessMaterialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; GXFProcessMaterialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
...@@ -404,6 +406,8 @@ typedef NS_ENUM(NSInteger, cellRow) { ...@@ -404,6 +406,8 @@ typedef NS_ENUM(NSInteger, cellRow) {
if (self.isHiddenEdit) { if (self.isHiddenEdit) {
cell.editBtn.hidden = YES; cell.editBtn.hidden = YES;
} }
} else {
} }
if ([self isHaveIndexPath:indexPath]) { if ([self isHaveIndexPath:indexPath]) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"]; cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
...@@ -587,6 +591,7 @@ typedef NS_ENUM(NSInteger, cellRow) { ...@@ -587,6 +591,7 @@ typedef NS_ENUM(NSInteger, cellRow) {
//保存 //保存
void(^succ)(id) = ^(id data) { void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
CLog(@"%@",data[@"message"]);
// if (data) { // if (data) {
// NSInteger success = [data[@"success"] integerValue]; // NSInteger success = [data[@"success"] integerValue];
// NSString *message = data[@"message"]; // NSString *message = data[@"message"];
...@@ -637,13 +642,13 @@ typedef NS_ENUM(NSInteger, cellRow) { ...@@ -637,13 +642,13 @@ typedef NS_ENUM(NSInteger, cellRow) {
} }
NSDictionary *dict = @{@"uuid":@"", NSDictionary *dict = @{//@"uuid":@"",
@"version":@(0), @"version":@(0),
@"billnumber":@"", @"billnumber":@"",
@"title":@"title",//[IBTCommon checkString:self.titleStr], @"title":@"title",//[IBTCommon checkString:self.titleStr],
@"vendor_uuid": @"000",//_d_processBill.vendor_uuid, @"vendor_uuid": _d_processBill.vendor_uuid,
@"vendor_code": @"111",//_d_processBill.vendor_code, @"vendor_code": _d_processBill.vendor_code,
@"vendor_name": @"ff",//_d_processBill.vendor_name, @"vendor_name": _d_processBill.vendor_name,
@"warehouse_uuid":_d_processBill.warehouse_uuid, @"warehouse_uuid":_d_processBill.warehouse_uuid,
@"warehouse_code":_d_processBill.warehouse_code, @"warehouse_code":_d_processBill.warehouse_code,
@"warehouse_name":_d_processBill.warehouse_name, @"warehouse_name":_d_processBill.warehouse_name,
......
...@@ -7,8 +7,47 @@ ...@@ -7,8 +7,47 @@
// //
#import "GXFSeeProcessViewController.h" #import "GXFSeeProcessViewController.h"
#import "SurveyListCell.h"
#import "Survey.h"
#import "SortMaskView.h"
#import "BoltMaskView.h"
#import "SurveyDetailViewController.h"
#import "NewSurveyViewController.h"
#import "QueryOrder.h"
#import "MJRefresh.h"
#define TopMargin 44
#define TableHeight 120
#define LeftMargin 20
#define BtnWidth 60
#define BtnHeight 24
#define BtnSize 16
typedef enum : NSUInteger {
SortTag = 3000,
BoltTag
} BtnTag;
@interface GXFSeeProcessViewController ()<UITableViewDataSource,UITableViewDelegate,BoltMaskViewDelegate,SortMaskViewDelegate>
{
UIView *_maskView;
UIButton *currentBtn;
SortMaskView *_sortView;
BoltMaskView *_boltView;
UIBarButtonItem *_sureBtn;
UIButton *_sortBtn;
UIButton *_boltBtn;
BOOL _isRefresh;
BOOL _isLoadMore;
NSInteger _currentPage;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@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 *orderDirection;//asc(升序),desc(降序)
@interface GXFSeeProcessViewController ()
@end @end
...@@ -17,7 +56,14 @@ ...@@ -17,7 +56,14 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.title = @"加工单列表";
self.view.backgroundColor = XXFBgColor;
[self createBackBtn];
[self initData];
[self createTableView];
[self getData];
//刷新
[self createRefresh];
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
...@@ -45,6 +91,396 @@ ...@@ -45,6 +91,396 @@
@"pageSize":@(20)}; @"pageSize":@(20)};
[[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail]; [[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail];
} }
- (void)initData{
self.dataArr = [NSMutableArray array];
}
- (void)createRefresh{
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
if (_isRefresh) {
return ;
}
_isRefresh = YES;
_currentPage = 0;
[self getData];
}];
self.tableView.header.lastUpdatedTimeKey = SurveyUpdateDate;
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (_isLoadMore) {
return ;
}
_isLoadMore = YES;
_currentPage ++;
[self getData];
} ];
}
#pragma mark - 结束刷新
- (void)endRefreshing{
_isLoadMore = NO;
_isRefresh = NO;
[self.tableView.header endRefreshing];
[self.tableView.footer endRefreshing];
}
//- (void)viewWillAppear:(BOOL)animated{
// [super viewWillAppear:animated];
// if ([ICRUserUtil sharedInstance].needFresh && self.tableView != nil) {
// [self.tableView.header beginRefreshing];
// }
//}
- (void)getData{
[ICRUserUtil sharedInstance].needFresh = NO;
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchtSurveyList:data];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSMutableArray *orderArr =[NSMutableArray array];
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"lastModified";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
id billObject = [NSNull null];
if (self.billNumberLike.length > 0) {
billObject = self.billNumberLike;
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"billNumber";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
}
id stateObject = [NSNull null];
if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
stateObject = self.state;
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"state";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
}
id titleObject = [NSNull null];
if (self.titleLike.length > 0) {
titleObject = self.titleLike;
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrder *order = [QueryOrder new];
order.field = @"title";
order.direction = self.orderDirection;
[orderArr addObject:[order dictForCommit]];
}
}
if (orderArr.count == 0) {
QueryOrder *order = [QueryOrder new];
order.field = @"billNumber";
order.direction = @"desc";
[orderArr addObject:[order dictForCommit]];
}
NSDictionary *dict = @{
@"billNumberLike":billObject,
@"state":stateObject,
@"titleLike":titleObject,
@"queryOrders":orderArr,
@"userUuid":userUtil.userId,
@"pageNumber":@(_currentPage),
@"pageSize":@(20)};
[[ICRHTTPController sharedController] querySurveyWithBillData:dict success:succ failure:fail];
}
#pragma mark -成功
- (void)fetchtSurveyList:(id)data{
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
if (success == 1) {
if (_currentPage == 0) {
if (self.dataArr.count > 0) {
[self.dataArr removeAllObjects];
}
}
NSArray *recodesArr = data[ @"data" ][ @"records" ];
for (NSDictionary *surveyDict in recodesArr) {
Survey *survey = [[Survey alloc]init];
[survey setValuesForKeysWithDictionary:surveyDict];
[self.dataArr addObject:survey];
}
NSDictionary *pageDict = data[ @"data" ][ @"paging" ];
NSInteger pageCount = [pageDict[@"pageCount"] integerValue];
[self.tableView reloadData];
[self endRefreshing];
if (pageCount <= _currentPage) {
[self.tableView.footer noticeNoMoreData];
}
if (_currentPage == 0 && self.dataArr.count > 0) {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}else{
[IBTLoadingView showTips:message];
}
}else{
[IBTLoadingView showTips:@" 无记录 "];
}
}
- (void)createTableView
{
_sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = _sureBtn;
_sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil];
_sortBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_sortBtn];
_boltBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(ScreenSize.width-BtnWidth - LeftMargin,10,BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:BoltTag image:@"black_filter_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil];
_boltBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_boltBtn];
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
_maskView = [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, ScreenSize.height - 64- TopMargin)];
_maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
_maskView.hidden = YES;
[self.view addSubview:_maskView];
}
//检测排序的颜色
- (void)checkSortBtnColor{
if (self.orderDirection.length > 0) {
[_sortBtn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
}else{
[_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
}
}
- (void)checkBoltBtnColor{
if (self.state.length > 0 || self.billNumberLike.length > 0 || self.titleLike.length > 0) {
[_boltBtn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
}else{
[_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
}
}
#pragma mark - 确定
- (void)sureClick{
if (self.state.length > 0 || self.billNumberLike.length > 0 || self.titleLike.length > 0 ||self.orderDirection.length > 0) {
[_boltView.titleFiled resignFirstResponder];
[_boltView.billFiled resignFirstResponder];
_currentPage = 0;
//请求
[self getData];
//还原数据
if (_sortView) {
[self hiddenSortMaskView:YES];
}
if (_boltView) {
[self hiddenBoltMaskView:YES];
}
}
}
#pragma mark -按钮事件
- (void)sortClick:(UIButton *)btn{
_maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
_maskView.hidden = NO;
if (btn.tag == SortTag) {
if(_boltView){
[self hiddenBoltMaskView:NO];
}
if (currentBtn == btn) {
[btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
[self hiddenSortMaskView:YES];
currentBtn = nil;
}else{
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) {
_sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 150) withOrderDirection:self.orderDirection];
_sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"按时间顺序",@"按时间逆序",@"默认排序",nil];
_sortView.delegate = self;
[_maskView addSubview:_sortView];
[UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _sortView.frame;
sortFrame.origin.y = 0;
_sortView.frame = sortFrame;
}];
}
currentBtn = btn;
}
}else if(btn.tag == BoltTag){
if (_sortView) {
[self hiddenSortMaskView:NO];
}
if (currentBtn == btn) {
[btn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
[self hiddenBoltMaskView:YES];
currentBtn = nil;
}else{
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
if (_boltView == nil) {
_boltView = [[BoltMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 274) state:self.state title:self.titleLike bill:self.billNumberLike];
_boltView.backgroundColor = XXFBgColor;
_boltView.delegate = self;
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"不限",@"未提交",@"已提交" ,@"调研中",nil];
[_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _boltView.frame;
sortFrame.origin.y = 0;
_boltView.frame = sortFrame;
}];
currentBtn = btn;
}
}
}
}
- (void)hiddenSortMaskView:(BOOL)isHide{
currentBtn = nil;
[self checkSortBtnColor];
if (isHide == NO) {
[_sortView removeFromSuperview];
_sortView = nil;
}else{
[UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _sortView.frame;
sortFrame.origin.y = -105;
_sortView.frame = sortFrame;
_maskView.backgroundColor = RGBA(0, 0, 0, 0);
}completion:^(BOOL finished) {
[_sortView removeFromSuperview];
_sortView = nil;
_maskView.hidden = YES;
}];
}
}
- (void)hiddenBoltMaskView:(BOOL)isHide{
currentBtn = nil;
[self checkBoltBtnColor];
if (isHide == NO) {
[_boltView removeFromSuperview];
_boltView = nil;
}else{
[UIView animateWithDuration:0.25 animations:^{
CGRect sortFrame = _boltView.frame;
sortFrame.origin.y = -105;
_boltView.frame = sortFrame;
_maskView.backgroundColor = RGBA(0, 0, 0, 0);
}completion:^(BOOL finished) {
[_boltView removeFromSuperview];
_boltView = nil;
_maskView.hidden = YES;
}];
}
}
#pragma mark - sortDelegate
- (void)getSortValueSelectRow:(NSString *)state{
if (state.length > 0) {
self.orderDirection = state;
CLog(@"%@",state);
}
}
#pragma mark - boltDelegate
- (void)getBoltValueSelectRow:(NSString *)state{
self.state = state;
CLog(@"%@",state);
}
- (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike;
CLog(@"%@",titleLike);
}
- (void)getBillNumber:(NSString *)billNumber{
self.billNumberLike = billNumber;
CLog(@"%@",billNumber);
}
- (void)clearBoltInformation{
//清空所有条件
if (self.billNumberLike.length > 0) {
self.billNumberLike = @"";
}
if (self.titleLike.length > 0) {
self.titleLike = @"";
}
if (self.state.length > 0) {
self.state = @"";
}
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"SurveyID";
SurveyListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[SurveyListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (self.dataArr.count > 0) {
Survey *survey = self.dataArr[indexPath.row];
[cell setSurvey:survey];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Survey *survey = nil;
if (self.dataArr.count > 0) {
survey = self.dataArr[indexPath.row];
}
if ([survey.state isEqualToString:SURVEY_STATE_INITIAL]) {
NewSurveyViewController *nvc = [[NewSurveyViewController alloc]init];
nvc.survey = survey;
nvc.navTitle = @"修改行情调研单";
[self PushViewController:nvc animated:YES];
}else if([survey.state isEqualToString:SURVEY_STATE_SUBMITTED] || [survey.state isEqualToString:SURVEY_STATE_INSURVEY]|| [survey.state isEqualToString:SURVEY_STATE_FINISHED]){
SurveyDetailViewController *svc = [SurveyDetailViewController new];
svc.survey = survey;
svc.surveyUuid = survey.uuid;
[self PushViewController:svc animated:YES];
}
}
- (void)createBackBtn{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
btn.frame = CGRectMake(0, 0, 12, 20);
[btn addTarget:self action:@selector(backRV) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithCustomView:btn];
self.navigationItem.leftBarButtonItem = back;
}
- (void)backRV{
[self PopToRootViewControllerAnimated:YES];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
......
//
// GXFProcessMaterialItemView.h
// XFFruit
//
// Created by freecui on 15/9/6.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTUIView.h"
@interface GXFProcessMaterialItemView : IBTUIView
@end
@class GXFProcessMaterial;
@interface GXFProcessMaterialItemView (configure)
- (void)updateWithProcessMaterial: (GXFProcessMaterial *)processMaterial;
@end
#define ICR_ProcessMaterial_ITEM_HEIGTH (130.0f)
\ No newline at end of file
//
// GXFProcessMaterialItemView.m
// XFFruit
//
// Created by freecui on 15/9/6.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFProcessMaterialItemView.h"
@implementation GXFProcessMaterialItemView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// GXFProcessProductItemView.h
// XFFruit
//
// Created by freecui on 15/9/6.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTUIView.h"
@interface GXFProcessProductItemView : IBTUIView
@end
//
// GXFProcessProductItemView.m
// XFFruit
//
// Created by freecui on 15/9/6.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GXFProcessProductItemView.h"
@implementation GXFProcessProductItemView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@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