Commit cad79801 authored by freecui's avatar freecui

解决冲突

parents d357fa51 0c02d72c
This diff is collapsed.
......@@ -2,12 +2,9 @@
<Workspace
version = "1.0">
<FileRef
location = "group:/Users/mac/Desktop/folder/XFFruit.xcodeproj">
location = "group:XFFruit.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
<FileRef
location = "group:XFFruit.xcodeproj">
</FileRef>
</Workspace>
......@@ -231,6 +231,7 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//1.7 商品单位
- (void)getProductunitWithPage_number:(NSUInteger)page_number
page_size:(NSUInteger)page_size
......@@ -252,6 +253,27 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
failure:(void (^)(id))fail;
//添加采购单
- (void)savePurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//获取采购单列表
- (void)queryPurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//获取采购单详情
- (void)getPurchaseResultWithPurchaseUuid:(NSString *)purchaseUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//审核/拒绝/供应商确认/结束/作废采购单
- (void)dealByActionWithPurchaseUuid:(NSString *)purchaseUuid
action:(NSString *)action
remark:(NSString *)remark
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
@end
......@@ -80,11 +80,19 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
XFFHttp_GetVendor,
//仓库
XFFHttp_GetWarehouse,
//商品单位
XFFHttp_GetProductunit,
//加工单
XFFHttp_QueryProcess,
XFFHttp_GetProcess
XFFHttp_GetProcess,
//采购单
XFFHttp_PurchaseSave,
XFFHttp_QueryPurchase,
XFFHttp_GetPurchaseDetail,
XFFHttp_DealByActionPurchase
};
static NSString * const ICRHTTPInterface[] = {
......@@ -145,12 +153,20 @@ static NSString * const ICRHTTPInterface[] = {
[XFFHttp_GetVendor] = @"data/vendor/download",
//仓库
[XFFHttp_GetWarehouse] = @"data/warehouse/download",
//商品单位
[XFFHttp_GetProductunit] = @"data/productunit",
//加工单
[XFFHttp_QueryProcess ] = @"process/query",
[XFFHttp_GetProcess ] = @"process/get",
//采购单
[XFFHttp_PurchaseSave] = @"purchase/bill/save",
[XFFHttp_QueryPurchase] = @"purchase/bill/query",
[XFFHttp_GetPurchaseDetail] = @"purchase/bill/get",
[XFFHttp_DealByActionPurchase] = @"purchase/bill/action"
};
static NSString * const ICRAttachmentTypeValue[] = {
......@@ -1323,7 +1339,9 @@ acceptTypeJson:YES
//添加行情调研单
- (void)saveSurveyWithAuthenticode:(id)data success:(void (^)(id))succ failure:(void (^)(id))fail
- (void)saveSurveyWithAuthenticode:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail
{
if (!data) {
if (fail) {
......@@ -1827,4 +1845,138 @@ acceptTypeJson:YES
}
//添加采购单
- (void)savePurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail
{
if (!data) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *currentTime = [[NSDate date] httpParameterString];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_PurchaseSave] stringByAppendingFormat:@"?time=%@&operId=%@&operName=%@",currentTime,userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self POST:encodeUrlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//获取行情调研单列表
- (void)queryPurchaseWithData:(id)data
success:(void (^)(id))succ
failure:(void (^)(id))fail{
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSDictionary *dict = data;
NSString *urlStr = [[self class] UrlForPluginHTTPAction:XFFHttp_QueryPurchase];
[self POST:urlStr
parameters:dict
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
//获取采购单详情
- (void)getPurchaseResultWithPurchaseUuid:(NSString *)purchaseUuid
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!purchaseUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetPurchaseDetail] stringByAppendingFormat:@"/%@",purchaseUuid];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
- (void)dealByActionWithPurchaseUuid:(NSString *)purchaseUuid
action:(NSString *)action
remark:(NSString *)remark
version:(NSNumber *)version
success:(void (^)(id))succ
failure:(void (^)(id))fail{
if (!purchaseUuid) {
if (fail) {
fail( [[self class] ErrorWithMsg:ERROR_PARAMETER code:0] );
}
return;
}
void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
CLog(@"%@", responseObject);
if (succ) {
succ( responseObject );
}
};
void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
CLog(@"%@", error);
if (fail) {
fail( error );
}
};
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetPurchaseDetail] stringByAppendingFormat:@"/%@?action=%@&remark=%@&version=%@&time=%@&operId=%@&operName=%@",purchaseUuid,action,remark,version,[[NSDate date] httpParameterString],userUtil.userCode,userUtil.displayName];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self GET:encodeUrlStr
parameters:nil
needToken:NO
acceptTypeJson:YES
success:success
failure:failure];
}
@end
//
// ChooseParentViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/9/2.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "MaskCell.h"
#import "MJRefresh.h"
@interface ChooseParentViewController : ICRBaseViewController
@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)NSMutableArray *indexArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)UITextField *selectTextFiled;
@property (nonatomic,assign) BOOL isRefresh;
- (void)endRefreshing;
- (void)getBaseDataFromServer;
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath;
- (void)deleteTextFieldStr;
@end
//
// ChooseParentViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/9/2.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ChooseParentViewController.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseParentViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@end
@implementation ChooseParentViewController
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boxValueChanged:) name:UITextFieldTextDidChangeNotification object:nil];
[self initData];
[self bulidLayout];
[self createRefresh];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
self.indexArr = [NSMutableArray array];
}
#pragma mark - 布局
- (void)bulidLayout
{
self.selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
self.selectTextFiled.textAlignment = NSTextAlignmentLeft;
self.selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
self.selectTextFiled.delegate = self;
self.selectTextFiled.font = GXF_FIFTEENTEN_SIZE;
[self.view addSubview:self.selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
self.selectTextFiled.leftView = leftView;
self.selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deleteTextFieldStr) forControlEvents:UIControlEventTouchUpInside];
self.selectTextFiled.rightView = rightView;
self.selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)createRefresh{
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
if (self.isRefresh) {
return ;
}
self.isRefresh = YES;
[self getBaseDataFromServer];
}];
}
#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 = @"cellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)keyboardHidden{
[self.selectTextFiled resignFirstResponder];
}
- (void)deleteTextFieldStr{
self.selectTextFiled.text = @"";
}
#pragma mark - 结束刷新
- (void)endRefreshing{
self.isRefresh = NO;
[self.tableView.header endRefreshing];
}
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
for (NSIndexPath *path in self.indexArr) {
if (path.row == indexPath.row) {
return YES;
}
}
return NO;
}
#pragma mark -childFunction
-(void)getBaseDataFromServer
{
}
- (void)sureClick
{
}
- (void)boxValueChanged:(NSNotification *)fication
{
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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.
}
*/
@end
......@@ -36,7 +36,7 @@
}
+ (void)customNavigationbarAppearance {
[UINavigationBar appearance].barTintColor = HexColor(@"7ebf74");
[UINavigationBar appearance].barTintColor = GXF_NAVIGAYION_COLOR;
[UINavigationBar appearance].tintColor = ICR_NAVIBAR_ITEM_COLOR;
//Universal
......
......@@ -9,10 +9,13 @@
#ifndef XFFruit_ICRNotificationMacro_h
#define XFFruit_ICRNotificationMacro_h
#define SetProductTotalPrice @"setProductTotalPrice"
#define KNOTIFICATION_changeIsSelectedFunctions @"KNOTIFICATION_changeIsSelectedFunctions"
//Avatar
#define KNOTIFICATION_saveMaterial @"KNOTIFICATION_saveMaterial"
#define KNOTIFICATION_editMaterial @"KNOTIFICATION_editMaterial"
......@@ -20,4 +23,5 @@
#define KNOTIFICATION_saveProduct @"KNOTIFICATION_saveProduct"
#define KNOTIFICATION_editProduct @"KNOTIFICATION_editProduct"
#define KNOTIFICATION_deleteProduct @"KNOTIFICATION_deleteProduct"
#endif
......@@ -38,5 +38,6 @@
+ (NSString *)checkString:(NSString *)str;
+ (BOOL)checkStringIsNilOrSpance: (NSString *)str;
+ (NSMutableAttributedString *)setTextViewFontOfString:(NSString *)string paragraphStyle:(NSInteger)lineHeight fontSize:(float)size color:(UIColor *)color;
+ (NSString *)trimmingCharacters:(NSString *)str;
+ (int)compareDate:(NSString*)oneDate withDate:(NSString*)twoDate;
@end
......@@ -213,5 +213,30 @@
return attributeStr;
}
+ (NSString *)trimmingCharacters:(NSString *)str{
NSString *newStr = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
return newStr;
}
+ (int)compareDate:(NSString*)oneDate withDate:(NSString*)twoDate{
int ci;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *dt1 = [[NSDate alloc] init];
NSDate *dt2 = [[NSDate alloc] init];
dt1 = [df dateFromString:oneDate];
dt2 = [df dateFromString:twoDate];
NSComparisonResult result = [dt1 compare:dt2];
switch (result)
{
//date02比date01大
case NSOrderedAscending: ci=1; break;
//date02比date01小
case NSOrderedDescending: ci=-1; break;
//date02=date01
case NSOrderedSame: ci=0; break;
default: NSLog(@"erorr dates %@, %@", dt2, dt1); break;
}
return ci;
}
@end
......@@ -85,14 +85,61 @@
#define IBT_BIN_HIGHLIGHT_ALPHA (.6f)
#define XXFBgColor RGBA(246,246,246,1)
#define HexColor(colorStr) [UIColor colorWithHexString:colorStr]
#define RGBA(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]
#define ScreenSize ([[UIScreen mainScreen] bounds].size)
#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define FontSize(num) [UIFont systemFontOfSize:num]
#define AppWindow [[UIApplication sharedApplication].delegate window]
#define XXFBgColor RGBA(246,246,246,1)
#define HexColor(colorStr) [UIColor colorWithHexString:colorStr]
#define RGBA(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]
#define ScreenSize ([[UIScreen mainScreen] bounds].size)
#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define FontSize(num) [UIFont systemFontOfSize:num]
#define AppWindow [[UIApplication sharedApplication].delegate window]
#define GXF_NSUSERFEFTAULTS [NSUserDefaults standardUserDefaults]
#define GXF_NAVIGAYION_COLOR HexColor(@"7ebf74")
#define GXF_SAVE_COLOR HexColor(@"50bd62")
#define GXF_COMMIT_COLOR HexColor(@"f69100")
#define GXF_PLACEHOLDER_COLOR HexColor(@"bbbbbb")
#define GXF_CONTENT_COLOR HexColor(@"444444")
#define GXF_CELL_COLOR HexColor(@"aaaaaa")
#define GXF_LINE_COLOR HexColor(@"e5e5e5")
#define GXF_DETAIL_COLOR HexColor(@"888888")
#define GXF_LEFTSIX_COLOR HexColor(@"666666")
#define GXF_THREETEENTH_SIZE FontSize(13)
#define GXF_FOURTEENTH_SIZE FontSize(14)
#define GXF_FIFTEENTEN_SIZE FontSize(15)
#define GXF_SIXTEENTEH_SIZE FontSize(16)
#define GXF_SEVENTEENTH_SIZE FontSize(17)
//refreshUpdateDate
#define SurveyUpdateDate @"surveyUpdateDate"
#define ChooseProductUpdateDate @"chooseProductUpdateDate"
#define ChoosePersonUpdateDate @"choosePersonUpdateDate"
#define ChooseVendorUpdateDate @"chooseVendorUpdateDate"
#define ChooseWarehouseUpdateDate @"chooseWarehouseUpdateDate"
#define PurchaseUpdateDate @"purchaseUpdateDate"
//行情调研状态
//initial(未提交),submitted(已提交),insurvey(调研中),finished(已完成)
#define SURVEY_STATE_INITIAL @"initial"
#define SURVEY_STATE_SUBMITTED @"submitted"
#define SURVEY_STATE_INSURVEY @"insurvey"
#define SURVEY_STATE_FINISHED @"finished"
//采购单状态
#define PURCHASE_STATE_INITIAL @"initial"
#define PURCHASE_STATE_SUBMITTED @"submitted"
#define PURCHASE_STATE_REJECTED @"rejected"
#define PURCHASE_STATE_APPROVED @"approved"
#define PURCHASE_STATE_SHIPPING @"shipping"
#define PURCHASE_STATE_FINISHED @"finished"
#define ShowMessage(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show]
//类型
#define GXF_Critical @"critical"//紧急
#define GXF_Normal @"normal"//普通
#endif
......@@ -18,7 +18,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = HexColor(@"f8f8f8");
self.view.backgroundColor = XXFBgColor;
}
......
......@@ -128,7 +128,7 @@
case kFunctionNewSurvey://新建行情
{
NewSurveyViewController *svc = [[NewSurveyViewController alloc] init];
svc.title = [IBTCommon localizableString:@"AddSurvey"];
svc.navTitle = [IBTCommon localizableString:@"AddSurvey"];
[self PushViewController:svc animated:YES];
}
break;
......@@ -136,7 +136,6 @@
{
SurveyViewController *svc = [[SurveyViewController alloc] init];
svc.title = [IBTCommon localizableString:@"Survey"];
svc.navigationItem.hidesBackButton = YES;
[self PushViewController:svc animated:YES];
}
break;
......
......@@ -23,7 +23,7 @@
#import "GXFProcessMaterialTableViewCell.h"
#import "GXFProcessProductTableViewCell.h"
#import "ProductCell.h"
#import "ProductBillCell.h"
typedef NS_ENUM(NSUInteger, processType){
kMaterial = 0,
kProduct
......@@ -476,8 +476,8 @@ typedef NS_ENUM(NSInteger, cellRow) {
} else {
ProductCell *cell = (ProductCell *)[tableView cellForRowAtIndexPath:indexPath];
ProductBillCell *cell = (ProductBillCell *)[tableView cellForRowAtIndexPath:indexPath];
// ProductCell *cell = (ProductCell *)[tableView cellForRowAtIndexPath:indexPath];
CGRect Linefrmame = cell.lineLabel.frame;
CGRect showfrmame = cell.showView.frame;
if (Linefrmame.origin.y == GXF_TABLEVIEW_NOMALCELL_HEIGHT - 1) {
......
......@@ -67,12 +67,12 @@ typedef enum : NSUInteger {
label.text = @"新增商品明细";
label.textAlignment = NSTextAlignmentCenter;
label.backgroundColor = XXFBgColor;
label.textColor = HexColor(@"444444");
label.font = FontSize(15);
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[_bgView addSubview:label];
UIButton *dissBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bgView.frame) - TopHeight, 0, TopHeight, TopHeight) target:self sel:@selector(btnClick:) tag:DissTag image:nil title:@"关闭" titleColor:HexColor(@"444444") isCorner:NO corner:0 bgColor:nil];
dissBtn.titleLabel.font = FontSize(15);
UIButton *dissBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bgView.frame) - TopHeight, 0, TopHeight, TopHeight) target:self sel:@selector(btnClick:) tag:DissTag image:nil title:@"关闭" titleColor:GXF_CONTENT_COLOR isCorner:NO corner:0 bgColor:nil];
dissBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[_bgView addSubview:dissBtn];
......@@ -84,10 +84,10 @@ typedef enum : NSUInteger {
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
UIButton *delBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (CGRectGetWidth(_bgView.frame) - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:6001 image:nil title:@"删除" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"50bd62")];
UIButton *delBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (CGRectGetWidth(_bgView.frame) - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:6001 image:nil title:@"删除" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[footView addSubview:delBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(delBtn.frame.origin.x + delBtn.frame.size.width + LeftMargin, 10, (CGRectGetWidth(_bgView.frame) - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:1001 image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"f69100")];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(delBtn.frame.origin.x + delBtn.frame.size.width + LeftMargin, 10, (CGRectGetWidth(_bgView.frame) - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:1001 image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[footView addSubview:commitBtn];
// [self.view addSubview:footView];
......@@ -136,8 +136,8 @@ typedef enum : NSUInteger {
if (indexPath.row == 0 || indexPath.row == 1 ) {
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, CGRectGetWidth(_bgView.frame) - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb");
contentLabel.font = FontSize(15);
contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) {
contentLabel.text = @"选择商品";
......@@ -153,7 +153,7 @@ typedef enum : NSUInteger {
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1;
self.remarkTextView.maxNumberOfLines = 2;
self.remarkTextView.font = FontSize(15);
self.remarkTextView.font = GXF_FIFTEENTEN_SIZE;
self.remarkTextView.textAlignment = NSTextAlignmentRight;
self.remarkTextView.delegate = self;
self.remarkTextView.returnKeyType = UIReturnKeyDone;
......@@ -163,15 +163,15 @@ typedef enum : NSUInteger {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, CGRectGetWidth(_bgView.frame) - 100 - LeftMargin*2-30, TableHeight)];
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = HexColor(@"444444");
textField.font = FontSize(15);
textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE;
textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self;
[cell.contentView addSubview:textField];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame) + 5, 0, 20, TableHeight)];
label.textColor = HexColor(@"444444");
label.font = FontSize(15);
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
if (indexPath.row == 2) {
label.text = @"斤";
......@@ -208,7 +208,7 @@ typedef enum : NSUInteger {
ChooseProductViewController *cvc = [ChooseProductViewController new];
cvc.choseProduct = ^(Product *product){
self.productNameLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
self.productNameLabel.textColor = HexColor(@"444444");
self.productNameLabel.textColor = GXF_CONTENT_COLOR;
};
cvc.isMoreChose = NO;
[self.delegate pushViewController:cvc];
......@@ -218,7 +218,7 @@ typedef enum : NSUInteger {
tvc.dataArr = @[@"筐",@"斤"];
tvc.choseType = ^(NSString *type){
self.productTypeLabel.text = type;
self.productTypeLabel.textColor = HexColor(@"444444");
self.productTypeLabel.textColor = GXF_CONTENT_COLOR;
};
[self.delegate pushViewController:tvc];
}
......
......@@ -6,10 +6,9 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "ChooseParentViewController.h"
typedef void(^ChoseType)(NSString *type);
@interface ChooseTypeViewController : ICRBaseViewController
@interface ChooseTypeViewController : ChooseParentViewController
@property (nonatomic,copy)ChoseType choseType;
@property (nonatomic,copy)NSArray *dataArr;
@end
......@@ -7,81 +7,37 @@
//
#import "ChooseTypeViewController.h"
#import "MaskCell.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseTypeViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@interface ChooseTypeViewController ()
{
UITextField *_selectTextFiled;
NSIndexPath *_currentIndexPath;
}
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation ChooseTypeViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self bulidLayout];
self.title = @"类型";
[self.dataArr addObject:@"紧急"];
[self.dataArr addObject:@"普通"];
}
- (void)bulidLayout
{
self.view.backgroundColor = HexColor(@"f8f8f8");
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = FontSize(15);
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)createRefresh{}
- (void)sureClick{
if (self.dataArr.count > 0) {
NSString *type = self.dataArr[_currentIndexPath.row];
self.choseType(type);
if (_currentIndexPath) {
NSString *type = self.dataArr[_currentIndexPath.row];
self.choseType(type);
}
}
[self PopViewControllerAnimated:YES];
}
- (void)deletePerson {
_selectTextFiled.text = @"";
_currentIndexPath = nil;
[self.tableView reloadData];
}
#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 = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
......@@ -104,7 +60,6 @@
if (self.dataArr.count > 0) {
NSString *type = self.dataArr[indexPath.row];
[cell setTitleStr:type];
}
return cell;
}
......@@ -117,15 +72,8 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
NSString *type = self.dataArr[indexPath.row];
_selectTextFiled.text = type;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -6,10 +6,9 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "ChooseParentViewController.h"
typedef void(^ChoseVendor)(NSArray *vendor);
@interface ChooseVendorViewController : ICRBaseViewController
@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
@interface ChooseVendorViewController : ChooseParentViewController
@property (nonatomic,copy)ChoseVendor choseVendor;
@end
......@@ -7,44 +7,40 @@
//
#import "ChooseVendorViewController.h"
#import "MaskCell.h"
#import "Vendor.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseVendorViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@interface ChooseVendorViewController ()
{
UITextField *_selectTextFiled;
NSIndexPath *_currentIndexPath;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *indexArr;
@end
@implementation ChooseVendorViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self bulidLayout];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
self.indexArr = [NSMutableArray array];
[self fetchVendorList];
//记录更新时间
self.tableView.header.lastUpdatedTimeKey = ChooseVendorUpdateDate;
self.title = @"选择供应商";
[self fetchVendorList:@""];
}
- (void)getBaseDataFromServer{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchVendorList];
[strongSelf endRefreshing];
[strongSelf fetchVendorList:@""];
}else{
[IBTLoadingView showTips:data];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
......@@ -54,64 +50,38 @@
}
#pragma mark -成功
- (void)fetchVendorList{
- (void)fetchVendorList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Vendor TableName], @"uuid"];
NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [Vendor TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Vendor TableName], @"uuid"];
}
return [db executeQuery:sql];
};
__weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[strongSelf.tableView reloadData];
if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseVendorUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseVendorUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[Vendor class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}
#pragma mark - 插入数据
- (void)bulidLayout
{
self.view.backgroundColor = HexColor(@"f8f8f8");
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = FontSize(15);
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)sureClick{
if (self.isMoreChose) {
NSMutableArray *arr = [[NSMutableArray alloc]init];
......@@ -133,24 +103,12 @@
}
- (void)deletePerson {
if (self.isMoreChose) {
[self.indexArr removeAllObjects];
}else{
_currentIndexPath = nil;
}
_selectTextFiled.text = @"";
[self.tableView reloadData];
- (void)deleteTextFieldStr {
[super deleteTextFieldStr];
[self boxValueChanged:nil];
}
#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 = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
......@@ -178,15 +136,24 @@
}
}
if (self.dataArr.count > 0) {
Vendor *vendor = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
[cell setTitleStr:proStr];
if (indexPath.row == 0) {
NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Vendor *vendor = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
[cell setTitleStr:proStr];
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
return;
}
if (self.isMoreChose == YES) {
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
......@@ -194,31 +161,16 @@
[self.indexArr addObject:indexPath];
}
NSString *personStr = @"";
for (NSIndexPath *index in self.indexArr) {
Vendor *vendor = self.dataArr[index.row];
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",vendor.name];
}else{
personStr = [personStr stringByAppendingFormat:@"、%@",vendor.name];
}
}
_selectTextFiled.text = personStr;
}else{
}else{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
Vendor *vendor = self.dataArr[indexPath.row];
_selectTextFiled.text = vendor.name;
}
}
- (BOOL)hasIndexPath:(NSIndexPath *)indexPath{
for (NSIndexPath *path in self.indexArr) {
if (path.row == indexPath.row) {
......@@ -228,10 +180,19 @@
return NO;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
#pragma mark - 按钮事件
- (void)boxValueChanged:(NSNotification *)fication{
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchVendorList:tilkeStr];
}
- (void)tableViewRefresh{
_currentIndexPath = nil;
if (self.indexArr.count > 0) {
[self.indexArr removeAllObjects];
}
[self.tableView reloadData];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -6,10 +6,10 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "ChooseParentViewController.h"
#import "Warehouse.h"
typedef void(^ChoseWarehouse)(Warehouse *warehouse);
@interface ChooseWarehouseViewController : ICRBaseViewController
@interface ChooseWarehouseViewController : ChooseParentViewController
@property (nonatomic,copy)ChoseWarehouse choseWarehouse;
@end
......@@ -7,42 +7,37 @@
//
#import "ChooseWarehouseViewController.h"
#import "MaskCell.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseWarehouseViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@interface ChooseWarehouseViewController ()
{
UITextField *_selectTextFiled;
NSIndexPath *_currentIndexPath;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation ChooseWarehouseViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self bulidLayout];
//记录更新时间
self.tableView.header.lastUpdatedTimeKey = ChooseWarehouseUpdateDate;
self.title = @"选择仓库";
[self fetchWarehouseList:@""];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
[self fetchWarehouseList];
- (void)getBaseDataFromServer{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchWarehouseList];
[self endRefreshing];
[strongSelf fetchWarehouseList:@""];
}else{
[IBTLoadingView showTips:data];
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
......@@ -53,18 +48,31 @@
}
#pragma mark -成功
- (void)fetchWarehouseList{
- (void)fetchWarehouseList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Warehouse TableName], @"uuid"];
NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [Warehouse TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Warehouse TableName], @"uuid"];
}
return [db executeQuery:sql];
};
__weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[strongSelf.tableView reloadData];
if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseWarehouseUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseWarehouseUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
......@@ -72,64 +80,24 @@
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}
- (void)bulidLayout
{
self.view.backgroundColor = HexColor(@"f8f8f8");
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = FontSize(15);
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)sureClick{
if (self.dataArr.count > 0) {
Warehouse *warehouse = self.dataArr[_currentIndexPath.row];
self.choseWarehouse(warehouse);
if (_currentIndexPath) {
Warehouse *warehouse = self.dataArr[_currentIndexPath.row];
self.choseWarehouse(warehouse);
}
}
[self PopViewControllerAnimated:YES];
}
- (void)deletePerson {
_selectTextFiled.text = @"";
_currentIndexPath = nil;
[self.tableView reloadData];
- (void)deleteTextFieldStr {
[super deleteTextFieldStr];
}
#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 = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
......@@ -150,11 +118,16 @@
cell.Commitbtn.hidden = YES;
}
if (self.dataArr.count > 0) {
Warehouse *warehouse = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
[cell setTitleStr:proStr];
if (indexPath.row == 0) {
NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Warehouse *warehouse = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
[cell setTitleStr:proStr];
}
}
return cell;
}
......@@ -167,15 +140,21 @@
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
Warehouse *warehouse = self.dataArr[indexPath.row];
_selectTextFiled.text = warehouse.name;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
#pragma mark - 按钮事件
- (void)boxValueChanged:(NSNotification *)fication{
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchWarehouseList:tilkeStr];
}
- (void)tableViewRefresh{
_currentIndexPath = nil;
if (self.indexArr.count > 0) {
[self.indexArr removeAllObjects];
}
[self.tableView reloadData];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -7,7 +7,7 @@
//
#import "ICRBaseViewController.h"
#import "PurchaseBill.h"
@interface NewPurchaseViewController : ICRBaseViewController
@property (nonatomic,strong)PurchaseBill *purchaseBill;
@end
......@@ -8,34 +8,52 @@
#import "NewPurchaseViewController.h"
#import "TopPurchaseView.h"
#import "ProductViewController.h"
#import "ProductBillViewController.h"
#import "AddProductViewController.h"
#import "PurchaseBillProduct.h"
#import "PurchaseViewController.h"
#define TopHeight 328
#define BottomHeight 300
#define SpaceHeight 20
#define BottomViewHeight 60
typedef enum : NSUInteger {
SaveTag = 8000,
CommitTag,
} BtnTag;
@interface NewPurchaseViewController ()<TopPurchaseViewDelegate,ProductViewDelegate>
@interface NewPurchaseViewController ()<TopPurchaseViewDelegate>
{
UIScrollView *_scrollView;
TopPurchaseView *_purchaseView;
UIView *_bottomView;
ProductViewController *_pvc ;
AddProductViewController *_avc;
ProductBillViewController *_pvc ;
id uuidObject;
id billNumberObject;
NSNumber *versionObject;
}
@property (nonatomic,strong)NSString *state;
@end
@implementation NewPurchaseViewController
- (instancetype)init{
self = [super init];
if (self) {
//监听值的改变
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setProductTotalPrice:) name:SetProductTotalPrice object:nil];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
//布局
[self bulidLayout];
//数据默认值
uuidObject = [NSNull null];
billNumberObject = [NSNull null];
versionObject = [NSNumber numberWithInteger:0];
}
......@@ -51,10 +69,10 @@ typedef enum : NSUInteger {
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenSize.height - BottomViewHeight - 64, ScreenSize.width, BottomViewHeight)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"50bd62")];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[footView addSubview:saveBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(saveBtn.frame) + 15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"f69100")];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(saveBtn.frame) + 15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[footView addSubview:commitBtn];
[self.view addSubview:footView];
......@@ -67,34 +85,145 @@ typedef enum : NSUInteger {
_bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView];
_pvc = [[ProductViewController alloc]init];
_pvc.delegate = self;
_pvc = [[ProductBillViewController alloc]init];
_pvc.viewFrame = _bottomView.bounds;
[_bottomView addSubview:_pvc.view];
}
- (void)setProductTotalPrice:(NSNotification *)fication{
//计算总金额
//其他费用 + 商品总金额
float otherPrice = [_purchaseView.otherPriceFiled.text floatValue];
NSMutableArray *purchaseProduct = _pvc.productArr;
float totalPrice = 0;
for (PurchaseBillProduct *billProduct in purchaseProduct) {
totalPrice += [billProduct.total floatValue];
}
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.2f",totalPrice + otherPrice];
_purchaseView.chargePurchase = [NSNumber numberWithFloat:otherPrice];
_purchaseView.total = [NSNumber numberWithFloat:totalPrice+otherPrice];
}
- (void)btnClick:(UIButton *)btn{
switch (btn.tag) {
case SaveTag:
{
if ([self checkPurchase]) {
[self getDataFromServer:PURCHASE_STATE_INITIAL msg:@"正在保存..."];
}
}
break;
case CommitTag:{
if ([self checkPurchase]) {
[self getDataFromServer:PURCHASE_STATE_SUBMITTED msg:@"正在提交..."];
}
}
break;
default:
break;
}
}
- (void)getDataFromServer:(NSString *)state msg:(NSString *)msg{
//保存
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"];
if (success == 1) {
//成功
if ([state isEqualToString:PURCHASE_STATE_INITIAL]) {//保存成功
NSString *uuidS = data[@"data"][@"uuid"];
NSString *billNumberS = data[@"data"][@"billNumber"];
NSNumber *versionN = data[@"data"][@"version"];
uuidObject = uuidS;
billNumberObject = billNumberS;
versionObject = versionN;
[IBTLoadingView showTips:[NSString stringWithFormat:@"当前单据%@已保存成功",billNumberS]];
}else{//提交成功
PurchaseViewController *svc = [PurchaseViewController new];
[self PushViewController:svc animated:YES];
}
}else{
[IBTLoadingView showTips:message];
}
}
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
if(self.purchaseBill.uuid.length > 0 && uuidObject == [NSNull null]){
uuidObject = self.purchaseBill.uuid;
}
if (self.purchaseBill.billNumber > 0 && billNumberObject == [NSNull null]) {
billNumberObject = self.purchaseBill.billNumber;
}
if (self.purchaseBill && [versionObject integerValue] == 0) {
versionObject = self.purchaseBill.version;
}
NSMutableArray *billProducts = [NSMutableArray array];
for (PurchaseBillProduct *billProduct in _pvc.productArr) {
[billProducts addObject:[billProduct dictForCommit]];
}
NSDictionary *dict = @{@"uuid":uuidObject,
@"version":versionObject,
@"billnumber":billNumberObject,
@"state":state,
@"type":[IBTCommon checkString:_purchaseView.type],
@"noticeUuid":[IBTCommon checkString:_purchaseView.noticeUuid],
@"noticeNumber":[IBTCommon checkString:_purchaseView.noticeNumber],
@"vendor_uuid":[IBTCommon checkString:_purchaseView.vendor_uuid],
@"vendor_code":[IBTCommon checkString:_purchaseView.vendor_code],
@"vendor_name":[IBTCommon checkString:_purchaseView.vendor_name],
@"receiveWrh_uuid":[IBTCommon checkString:_purchaseView.receiveWrh_uuid],
@"receiveWrh_code":[IBTCommon checkString:_purchaseView.receiveWrh_code],
@"receiveWrh_name":[IBTCommon checkString:_purchaseView.receiveWrh_name],
@"total":_purchaseView.total,
@"charge":_purchaseView.chargePurchase,
@"remark":_purchaseView.remark,
@"products":billProducts};
[IBTLoadingView showProgressLabel:msg];
[[ICRHTTPController sharedController] savePurchaseWithData:dict success:succ failure:fail];
}
#pragma mark - checkNull
- (BOOL)checkPurchase{
_purchaseView.remark = _purchaseView.remarkTextView.text;
if (_purchaseView.type.length == 0 ) {
ShowMessage(@"采购类型不能为空");
return NO;
}
if (_purchaseView.vendor_uuid.length == 0 ) {
ShowMessage(@"供应商不能为空");
return NO;
}
if (_purchaseView.receiveWrh_uuid.length == 0 ) {
ShowMessage(@"收货仓库不能为空");
return NO;
}
if (_pvc.productArr.count == 0) {
ShowMessage(@"采购商品不能为空");
return NO;
}
if ([_purchaseView.total floatValue] < 0 || !_purchaseView.total) {
ShowMessage(@"金额不能为空");
return NO;
}
return YES;
}
#pragma mark - TopPurchaseViewDelegate
- (void)pushNextViewController:(id)vc{
[self PushViewController:vc animated:YES];
}
#pragma mark - ProductViewDelegate
- (void)pushViewController:(id)cvc selfController:(id)avc{
_avc = avc;
[self PushViewController:cvc animated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if (_avc) {
[AppWindow addSubview:_avc.view];
}
}
#pragma mark - 协议方法
- (void)hiddenKeyBoard{
......
......@@ -7,15 +7,12 @@
//
#import "ICRBaseViewController.h"
@protocol ProductViewDelegate <NSObject>
- (void)pushViewController:(id)cvc selfController:(id)avc;
@end
@interface ProductViewController : ICRBaseViewController
@interface ProductBillViewController: ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *productArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame;
@property (nonatomic,assign)BOOL isHiddenEdit;
@property (nonatomic,weak)id<ProductViewDelegate>delegate;
@end
......@@ -6,22 +6,22 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ProductViewController.h"
#import "ProductBillViewController.h"
#import "FooterCell.h"
#import "HeaderCell.h"
#import "ProductCell.h"
#import "AddProductViewController.h"
#import "ProductBillCell.h"
#import "PurchaseBillProduct.h"
#define TableHeight 44
#define ShowHeight 100
@interface ProductViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate,AddProductViewDelegate>
@interface ProductBillViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
{
CGRect _tableFrame;
NSMutableArray *_selectRowArr;//记录当前选中的cell
AddProductViewController *_avc;
}
@end
@implementation ProductViewController
@implementation ProductBillViewController
- (void)viewDidLoad {
[super viewDidLoad];
......@@ -35,8 +35,25 @@
if (!self.productArr) {
self.productArr = [NSMutableArray array];
}
[self.productArr addObject:@"ffff"];
[self.productArr addObject:@"fffff"];
// PurchaseBillProduct *billProduct = [PurchaseBillProduct new];
//
// billProduct.product_name = @"dd";
// billProduct.product_uuid = @"402880e64e287fe2014e28895b8a0032";
// billProduct.product_code = @"农夫山泉";
// billProduct.qpc = [NSNumber numberWithFloat:22];
// billProduct.unit = @"筐";
// billProduct.qty = [NSNumber numberWithFloat:23];
// billProduct.price = [NSNumber numberWithFloat:333];
// billProduct.baseQty = [NSNumber numberWithFloat:333];
// billProduct.basePrice = [NSNumber numberWithFloat:33];
// billProduct.total = [NSNumber numberWithFloat:25];
// billProduct.remark = @"hshshshsh";
// billProduct.qpcStr = @"fdsfdsfdsa";
// [self.productArr addObject:billProduct];
// [self.productArr addObject:billProduct];
if (self.productArr.count > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil];
}
}
- (void)setViewFrame:(CGRect)viewFrame{
......@@ -64,33 +81,9 @@
}
#pragma mark - footerDelegate
- (void)addClick{
// [self.productArr addObject:@"dddd"];
// [self.tableView reloadData];
if (_avc == nil) {
_avc = [[AddProductViewController alloc]init];
_avc.delegate = self;
_avc.view.backgroundColor = RGBA(0, 0, 0, 0.5);
[AppWindow addSubview:_avc.view];
}
}
#pragma mark - addProductViewDelegate
- (void)dissmiss{
if (_avc) {
[_avc.view removeFromSuperview];
_avc = nil;
}
}
- (void)pushViewController:(id)cvc{
if (_avc) {
[_avc.view removeFromSuperview];
}
if ([self.delegate respondsToSelector:@selector(pushViewController:selfController:)]) {
[self.delegate pushViewController:cvc selfController:_avc];
}
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
......@@ -100,10 +93,10 @@
return self.productArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"ProductCell";
ProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
static NSString *cellID = @"ProductBillCell";
ProductBillCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[ProductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell = [[ProductBillCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (self.isHiddenEdit) {
cell.editBtn.hidden = YES;
......@@ -112,10 +105,10 @@
if ([self isHaveIndexPath:indexPath]) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = 200-1;
Linefrmame.origin.y = ShowHeight + TableHeight -1;
cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = 150;
showfrmame.size.height = ShowHeight;
cell.showView.frame = showfrmame;
cell.backgroundColor = XXFBgColor;
}else{
......@@ -130,6 +123,13 @@
}
cell.editBtn.tag = indexPath.row;
[cell.editBtn addTarget:self action:@selector(editClick:) forControlEvents:UIControlEventTouchUpInside];
if (self.productArr.count > 0) {
PurchaseBillProduct *billP = self.productArr[indexPath.row];
[cell setBillProduct:billP row:indexPath.row];
}
return cell;
}
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
......@@ -142,14 +142,14 @@
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
ProductCell *cell = (ProductCell *)[tableView cellForRowAtIndexPath:indexPath];
ProductBillCell *cell = (ProductBillCell *)[tableView cellForRowAtIndexPath:indexPath];
CGRect Linefrmame = cell.lineLabel.frame;
CGRect showfrmame = cell.showView.frame;
if (Linefrmame.origin.y == TableHeight - 1) {
cell.smallImageView.image = [UIImage imageNamed:@"arrowdown"];
Linefrmame.origin.y = 200-1;
showfrmame.size.height = 150;
Linefrmame.origin.y = ShowHeight + TableHeight - 1;
showfrmame.size.height = ShowHeight;
cell.backgroundColor = [UIColor whiteColor];
[_selectRowArr addObject:indexPath];
}else{
......@@ -165,7 +165,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if ([self isHaveIndexPath:indexPath]) {
return 200;
return ShowHeight + TableHeight;
}
return TableHeight;
}
......
......@@ -10,26 +10,30 @@
@interface PurchaseBill : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *version;//版本
@property (nonatomic,strong)NSNumber *version;//版本
@property (nonatomic,strong)NSString *noticeUuid;//采购通知单uuid
@property (nonatomic,strong)NSString *noticeNumber;//采购通知单号
@property (nonatomic,strong)NSString *billNumber;//采购单号
@property (nonatomic,strong)NSString *vendor_uuid;//供应商uuid
@property (nonatomic,strong)NSString *vendor_code;//供应商代码
@property (nonatomic,strong)NSString *vendor_name;//供应商姓名
@property (nonatomic,strong)NSString *total;//总金额
@property (nonatomic,strong)NSString *endDate;//调研结束时间
@property (nonatomic,strong)NSString *receiveWrh_uuid;//收货uuid
@property (nonatomic,strong)NSString *receiveWrh_code;//收货代码
@property (nonatomic,strong)NSString *receiveWrh_name;//收货姓名
@property (nonatomic,strong)NSString *rejectCause;//拒绝原因
@property (nonatomic,strong)NSNumber *total;//总金额
@property (nonatomic,strong)NSNumber *charge;//费用
@property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,strong)NSString *state;// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
@property (nonatomic,strong)NSString *vendorConfirmTime;//供应商确认时间
@property (nonatomic,strong)NSString *create_time;//创建时间
@property (nonatomic,strong)NSString *create_id;//创建人代码
@property (nonatomic,strong)NSString *create_operName;//创建人名称
@property (nonatomic,strong)NSString *lastModified_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码
@property (nonatomic,strong)NSString *lastModified_operName;//最后修改人名称
@property (nonatomic,strong)NSString *lastModify_time;//最后修改时间
@property (nonatomic,strong)NSString *lastModify_id;//最后修改人代码
@property (nonatomic,strong)NSString *lastModify_operName;//最后修改人名称
@property (nonatomic,strong)NSString *type;//类型
@property (nonatomic,strong)NSArray *products;
@end
//
// PurchaseBillProduct.h
// XFFruit
//
// Created by n22 on 15/8/31.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "IBTModel.h"
@interface PurchaseBillProduct : IBTModel
@property (nonatomic,strong)NSString *uuid;//唯一标识
@property (nonatomic,strong)NSString *product_uuid;//商品uuid
@property (nonatomic,strong)NSString *product_code;//商品代码
@property (nonatomic,strong)NSString *product_name;//商品名称
@property (nonatomic,strong)NSNumber *qpc;//包装规格
@property (nonatomic,strong)NSString *qpcStr;//包装规格描述
@property (nonatomic,strong)NSString *unit;//包装单位
@property (nonatomic,strong)NSNumber *qty;//包装数量
@property (nonatomic,strong)NSNumber *price;//包装单价
@property (nonatomic,strong)NSNumber *baseQty;//基础数量
@property (nonatomic,strong)NSNumber *basePrice;//基础单价
@property (nonatomic,strong)NSNumber *total;// 金额
@property (nonatomic,strong)NSString *remark;//备注
@end
//
// PurchaseBillProduct.m
// XFFruit
//
// Created by n22 on 15/8/31.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "PurchaseBillProduct.h"
@implementation PurchaseBillProduct
@end
......@@ -7,26 +7,25 @@
//
#import <UIKit/UIKit.h>
@interface ProductCell : UITableViewCell
#import "PurchaseBillProduct.h"
@interface ProductBillCell : UITableViewCell
@property (nonatomic,strong)UIImageView *smallImageView;
@property (nonatomic,strong)UIButton *editBtn;
@property (nonatomic,strong)UILabel *seqLabel;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *priceLabel;
//@property (nonatomic,strong)UILabel *standardLabel;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIView *showView;
@property (nonatomic,strong)UILabel *showTitleLabel;
@property (nonatomic,strong)UILabel *showStandLabel;
@property (nonatomic,strong)UILabel *showCountLabel;
@property (nonatomic,strong)UILabel *showBaseCountLabel;
@property (nonatomic,strong)UILabel *showDateLabel;
@property (nonatomic,strong)UILabel *basePriceLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel;
@property (nonatomic,strong)UILabel *placeLabel;
@property (nonatomic,strong)UILabel *qualityLabel;
@property (nonatomic,strong)UILabel *remarkLabel;
@property (nonatomic,strong)UILabel *showPriceLabel;
@property (nonatomic,strong)UILabel *showBasePriceLabel;
@property (nonatomic,strong)UILabel *showTotalLabel;
@property (nonatomic,strong)UILabel *showNoteLabel;
- (void)setBillProduct:(PurchaseBillProduct *)billProduct row:(NSInteger)row;
@end
......@@ -47,17 +47,17 @@
}
- (void)preferData{
//initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
if ([self.state isEqualToString:@"initial"]) {
if ([self.state isEqualToString:PURCHASE_STATE_INITIAL]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([self.state isEqualToString:@"submitted"]) {
}else if ([self.state isEqualToString:PURCHASE_STATE_SUBMITTED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else if ([self.state isEqualToString:@"rejected"]) {
}else if ([self.state isEqualToString:PURCHASE_STATE_REJECTED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
}else if ([self.state isEqualToString:@"approved"]) {
}else if ([self.state isEqualToString:PURCHASE_STATE_APPROVED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:3 inSection:0];
}else if ([self.state isEqualToString:@"shipping"]) {
}else if ([self.state isEqualToString:PURCHASE_STATE_SHIPPING]) {
_currentIndexPath = [NSIndexPath indexPathForRow:4 inSection:0];
}else if ([self.state isEqualToString:@"finished"]) {
}else if ([self.state isEqualToString:PURCHASE_STATE_FINISHED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:5 inSection:0];
}
_billView.hidden = YES;
......@@ -80,7 +80,7 @@
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
[button setTitle:arr[i] forState:UIControlStateNormal];
[button setTitleColor:HexColor(@"888888") forState:UIControlStateNormal];
[button setTitleColor:GXF_DETAIL_COLOR forState:UIControlStateNormal];
if (i == 0) {
button.enabled = NO;
_currentBtn = button;
......@@ -94,8 +94,8 @@
_clearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_clearBtn.frame = CGRectMake(0, CGRectGetMaxY(_leftView.frame), self.frame.size.width, BottomHeight);
[_clearBtn setTitle:@"清空选项" forState:UIControlStateNormal];
[_clearBtn setTitleColor:HexColor(@"444444") forState:UIControlStateNormal];
_clearBtn.titleLabel.font = FontSize(15);
[_clearBtn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
_clearBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[_clearBtn addTarget:self action:@selector(clearBolt) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_clearBtn];
}
......@@ -105,15 +105,15 @@
_billView.backgroundColor = [UIColor whiteColor];
[self addSubview:_billView];
UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
titleLabel.font = FontSize(15);
titleLabel.font = GXF_FIFTEENTEN_SIZE;
titleLabel.text = @"类似于:";
[_billView addSubview:titleLabel];
self.billFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.billFiled.textAlignment = NSTextAlignmentLeft;
self.billFiled.textColor = HexColor(@"444444");
self.billFiled.textColor = GXF_CONTENT_COLOR;
self.billFiled.placeholder = @"输入类似采购单号";
self.billFiled.borderStyle = UITextBorderStyleRoundedRect;
self.billFiled.font = FontSize(15);
self.billFiled.font = GXF_FIFTEENTEN_SIZE;
self.billFiled.returnKeyType = UIReturnKeyDone;
self.billFiled.delegate = self;
[_billView addSubview:self.billFiled];
......@@ -123,16 +123,16 @@
_noticeView.backgroundColor = [UIColor whiteColor];
[self addSubview:_noticeView];
UILabel *billLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
billLabel.font = FontSize(15);
billLabel.font = GXF_FIFTEENTEN_SIZE;
billLabel.text = @"类似于:";
[_noticeView addSubview:billLabel];
self.noticeFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(billLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.noticeFiled.textAlignment = NSTextAlignmentLeft;
self.noticeFiled.textColor = HexColor(@"444444");
self.noticeFiled.textColor = GXF_CONTENT_COLOR;
self.noticeFiled.placeholder = @"输入类似采购通知单号";
self.noticeFiled.borderStyle = UITextBorderStyleRoundedRect;
self.noticeFiled.font = FontSize(15);
self.noticeFiled.font = GXF_FIFTEENTEN_SIZE;
self.noticeFiled.returnKeyType = UIReturnKeyDone;
self.noticeFiled.delegate = self;
[_noticeView addSubview:self.noticeFiled];
......@@ -236,17 +236,17 @@
NSString *stateStr = @"";
if (indexPath.row == 0) {
stateStr = @"initial";
stateStr = PURCHASE_STATE_INITIAL;
}else if(indexPath.row == 1){
stateStr = @"submitted";
stateStr = PURCHASE_STATE_SUBMITTED;
}else if(indexPath.row == 2){
stateStr = @"rejected";
stateStr = PURCHASE_STATE_REJECTED;
}else if(indexPath.row == 3){
stateStr = @"approved";
stateStr = PURCHASE_STATE_APPROVED;
}else if(indexPath.row == 4){
stateStr = @"shipping";
stateStr = PURCHASE_STATE_SHIPPING;
}else if(indexPath.row == 5){
stateStr = @"finished";
stateStr = PURCHASE_STATE_FINISHED;
}
[self.delegate getBoltValueSelectRow:stateStr];
}
......
......@@ -9,8 +9,6 @@
#import "PurchaseCell.h"
#define TitleSize 16
#define ContentSize 14
#define TitleColor @"444444"
#define ContentColor @"aaaaaa"
#define LeftMargin 90
#define TopMargin 10
#define TitleHeight 20
......@@ -36,25 +34,25 @@
self.stateBtn.enabled = NO;
self.billNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
self.billNumberLabel.textColor = HexColor(TitleColor);
self.billNumberLabel.textColor = GXF_CONTENT_COLOR;
self.billNumberLabel.font = FontSize(TitleSize);
self.noticeNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.billNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight*2))];
self.noticeNumberLabel.numberOfLines = 0;
self.noticeNumberLabel.textColor = HexColor(ContentColor);
self.noticeNumberLabel.textColor = GXF_CELL_COLOR;
self.noticeNumberLabel.font = FontSize(ContentSize);
self.createOperNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.noticeNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.createOperNameLabel.textColor = HexColor(ContentColor);
self.createOperNameLabel.textColor = GXF_CELL_COLOR;
self.createOperNameLabel.font = FontSize(ContentSize);
self.createTimeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.createOperNameLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.createTimeLabel.textColor = HexColor(ContentColor);
self.createTimeLabel.textColor = GXF_CELL_COLOR;
self.createTimeLabel.font = FontSize(ContentSize);
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin - TopMargin * 2, 1))];;
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.stateBtn];
[self.contentView addSubview:self.billNumberLabel];
......@@ -71,25 +69,25 @@
self.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",purchaseBill.create_operName] ;
self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",purchaseBill.create_time];
NSString *stateStr = @"";
if ([purchaseBill.state isEqualToString:@"initial"]) {
if ([purchaseBill.state isEqualToString:PURCHASE_STATE_INITIAL]) {
stateStr = @"未提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"submitted"]) {
}else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_SUBMITTED]) {
stateStr = @"已提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"rejected"]) {
}else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_REJECTED]) {
stateStr = @"已拒绝";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"approved"]) {
}else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_APPROVED]) {
stateStr = @"已审批";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"shipping"]) {
}else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_SHIPPING]) {
stateStr = @"发运中";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([purchaseBill.state isEqualToString:@"finished"]) {
}else if ([purchaseBill.state isEqualToString:PURCHASE_STATE_FINISHED]) {
stateStr = @"已完成";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}
......
......@@ -23,6 +23,22 @@
@property (nonatomic,strong)UITextField *otherPriceFiled;//其他费用
@property (nonatomic,strong)UILabel *purchasePriceLabel;//总金额
@property (nonatomic,strong)HPGrowingTextView *remarkTextView;//备注
//数据
@property (nonatomic,strong)NSString *noticeUuid;
@property (nonatomic,strong)NSString *noticeNumber;
@property (nonatomic,strong)NSString *billNumber;
@property (nonatomic,strong)NSString *type;
@property (nonatomic,strong)NSString *vendor_uuid;
@property (nonatomic,strong)NSString *vendor_code;
@property (nonatomic,strong)NSString *vendor_name;
@property (nonatomic,strong)NSString *receiveWrh_uuid;
@property (nonatomic,strong)NSString *receiveWrh_code;
@property (nonatomic,strong)NSString *receiveWrh_name;
@property (nonatomic,strong)NSNumber *total;
@property (nonatomic,strong)NSNumber *chargePurchase;
@property (nonatomic,strong)NSString *remark;
@property (nonatomic,weak)id <TopPurchaseViewDelegate>delegate;
......
......@@ -14,12 +14,10 @@
#import "ChooseWarehouseViewController.h"
#import "Vendor.h"
#define LeftMargin 15
#define TopMargin 20
#define LeftWidth 80
#define TableHeight 44
#define SpaceHeight 10
#define TitleSize 15
#define TopMargin 10
#define TableHeight 44
@interface TopPurchaseView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{
UITableView *_tableView;
......@@ -67,7 +65,7 @@
cell = [[SurveyCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.row !=4 && indexPath.row != 5 && indexPath.row != 6) {
if (indexPath.row > 0 && indexPath.row < 4) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
[self createViewInCell:cell indexPath:indexPath];
......@@ -79,18 +77,19 @@
if (indexPath.row == 4 ) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-30, TableHeight)];
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = HexColor(@"444444");
textField.font = FontSize(15);
textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE;
textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self;
[cell.contentView addSubview:textField];
self.otherPriceFiled = textField;
self.otherPriceFiled.placeholder = @"请输入其他费用";
[self.otherPriceFiled addTarget:self action:@selector(boxValueChanged:) forControlEvents:UIControlEventEditingChanged];
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(textField.frame) + 5, 0, 20, TableHeight)];
label.text = @"元";
label.textColor = HexColor(@"444444");
label.font = FontSize(TitleSize);
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
}else if (indexPath.row == _dataArr.count -1){
......@@ -98,7 +97,7 @@
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1;
self.remarkTextView.maxNumberOfLines = 2;
self.remarkTextView.font = FontSize(15);
self.remarkTextView.font = GXF_FIFTEENTEN_SIZE;
self.remarkTextView.textAlignment = NSTextAlignmentRight;
self.remarkTextView.delegate = self;
self.remarkTextView.returnKeyType = UIReturnKeyDone;
......@@ -107,11 +106,11 @@
}else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-15, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb");
contentLabel.font = FontSize(TitleSize);
contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 0) {
contentLabel.text = @"选择采购通知";
contentLabel.text = @"采购通知单号";
self.purchaseNoticeLabel = contentLabel;
}else if(indexPath.row == 1){
......@@ -132,22 +131,32 @@
self.purchasePriceLabel = contentLabel;
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(contentLabel.frame)+ 5, 0, 20, TableHeight)];
label.text = @"元";
label.textColor = HexColor(@"444444");
label.font = FontSize(TitleSize);
label.textColor = GXF_CONTENT_COLOR;
label.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:label];
}
}
[self prepareDataInCell];
}
- (void)prepareDataInCell{
if (self.total) {
self.purchasePriceLabel.text = [self.total stringValue];
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 2){
ChooseVendorViewController *cvc = [ChooseVendorViewController new];
cvc.title = @"供应商";
cvc.choseVendor = ^(NSArray *vendors){
if (vendors.count > 0) {
Vendor *vendor = vendors[0];
self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
self.purchaseSupplierLabel.textColor = HexColor(@"444444");
self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
self.purchaseSupplierLabel.textColor = GXF_CONTENT_COLOR;
self.vendor_uuid = vendor.uuid;
self.vendor_code = vendor.code;
self.vendor_name = vendor.name;
}
};
......@@ -155,19 +164,24 @@
[self.delegate pushNextViewController:cvc];
}else if(indexPath.row == 1){
ChooseTypeViewController *tvc = [[ChooseTypeViewController alloc]init];
tvc.title = @"类型";
tvc.dataArr = @[@"普通",@"紧急"];
tvc.choseType = ^(NSString *type){
self.purchaseTypeLabel.text = type;
self.purchaseTypeLabel.textColor = HexColor(@"444444");
self.purchaseTypeLabel.textColor = GXF_CONTENT_COLOR;
if ([type isEqualToString:@"紧急"]) {
self.type = GXF_Critical;
}else{
self.type = GXF_Normal;
}
};
[self.delegate pushNextViewController:tvc];
}else if(indexPath.row == 3){
ChooseWarehouseViewController *wvc = [[ChooseWarehouseViewController alloc]init];
wvc.title = @"仓库";
wvc.choseWarehouse = ^(Warehouse *warehouse){
self.purchaseStoreLabel.text = [NSString stringWithFormat:@"%@[%@]",warehouse.name,warehouse.code];
self.purchaseStoreLabel.textColor = HexColor(@"444444");
self.purchaseStoreLabel.textColor = GXF_CONTENT_COLOR;
self.receiveWrh_uuid = warehouse.uuid;
self.receiveWrh_code = warehouse.code;
self.receiveWrh_name = warehouse.name;
};
[self.delegate pushNextViewController:wvc];
}
......@@ -184,6 +198,11 @@
[self.delegate hiddenKeyBoard];
}
- (void)boxValueChanged:(UITextField *)textFiled{
if (self.otherPriceFiled.text.length > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:SetProductTotalPrice object:nil];
}
}
@end
......@@ -88,10 +88,10 @@ typedef enum : NSUInteger {
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 50)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:HexColor(@"50bd62")];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_SAVE_COLOR];
[footView addSubview:saveBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(saveBtn.frame.origin.x + saveBtn.frame.size.width + LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:HexColor(@"f69100")];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(saveBtn.frame.origin.x + saveBtn.frame.size.width + LeftMargin, 10, (ScreenSize.width - LeftMargin*3)/2, BtnHeight) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:CornerRadius bgColor:GXF_COMMIT_COLOR];
[footView addSubview:commitBtn];
// [self.view addSubview:footView];
......
......@@ -50,11 +50,11 @@
//initial(未提交),submitted(已提交),insurvey(调研中)
if ([self.state isEqualToString:@"none"]) {
_currentIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
}else if ([self.state isEqualToString:@"initial"]) {
}else if ([self.state isEqualToString:SURVEY_STATE_INITIAL]) {
_currentIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
}else if ([self.state isEqualToString:@"submitted"]) {
}else if ([self.state isEqualToString:SURVEY_STATE_SUBMITTED]) {
_currentIndexPath = [NSIndexPath indexPathForRow:2 inSection:0];
}else if ([self.state isEqualToString:@"insurvey"]) {
}else if ([self.state isEqualToString:SURVEY_STATE_INSURVEY]) {
_currentIndexPath = [NSIndexPath indexPathForRow:3 inSection:0];
}
_titleView.hidden = YES;
......@@ -77,7 +77,7 @@
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(0, LeftHeight * i , LeftMargin ,LeftHeight);
[button setTitle:arr[i] forState:UIControlStateNormal];
[button setTitleColor:HexColor(@"888888") forState:UIControlStateNormal];
[button setTitleColor:GXF_DETAIL_COLOR forState:UIControlStateNormal];
if (i == 0) {
button.enabled = NO;
_currentBtn = button;
......@@ -91,8 +91,8 @@
_clearBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_clearBtn.frame = CGRectMake(0, CGRectGetMaxY(_leftView.frame), self.frame.size.width, BottomHeight);
[_clearBtn setTitle:@"清空选项" forState:UIControlStateNormal];
[_clearBtn setTitleColor:HexColor(@"444444") forState:UIControlStateNormal];
_clearBtn.titleLabel.font = FontSize(15);
[_clearBtn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
_clearBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[_clearBtn addTarget:self action:@selector(clearBolt) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_clearBtn];
}
......@@ -102,15 +102,15 @@
_titleView.backgroundColor = [UIColor whiteColor];
[self addSubview:_titleView];
UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
titleLabel.font = FontSize(15);
titleLabel.font = GXF_FIFTEENTEN_SIZE;
titleLabel.text = @"类似于:";
[_titleView addSubview:titleLabel];
self.titleFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(titleLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.titleFiled.textAlignment = NSTextAlignmentLeft;
self.titleFiled.textColor = HexColor(@"444444");
self.titleFiled.textColor = GXF_CONTENT_COLOR;
self.titleFiled.placeholder = @"输入类似标题";
self.titleFiled.borderStyle = UITextBorderStyleRoundedRect;
self.titleFiled.font = FontSize(15);
self.titleFiled.font = GXF_FIFTEENTEN_SIZE;
self.titleFiled.returnKeyType = UIReturnKeyDone;
self.titleFiled.delegate = self;
[_titleView addSubview:self.titleFiled];
......@@ -120,16 +120,16 @@
_billNumberView.backgroundColor = [UIColor whiteColor];
[self addSubview:_billNumberView];
UILabel *billLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, (ScreenSize.width - LeftMargin - 10*2), 20)];
billLabel.font = FontSize(15);
billLabel.font = GXF_FIFTEENTEN_SIZE;
billLabel.text = @"类似于:";
[_billNumberView addSubview:billLabel];
self.billFiled = [[UITextField alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(billLabel.frame) + 10, (ScreenSize.width - LeftMargin - 10*2), 30)];
self.billFiled.textAlignment = NSTextAlignmentLeft;
self.billFiled.textColor = HexColor(@"444444");
self.billFiled.textColor = GXF_CONTENT_COLOR;
self.billFiled.placeholder = @"输入类似单号";
self.billFiled.borderStyle = UITextBorderStyleRoundedRect;
self.billFiled.font = FontSize(15);
self.billFiled.font = GXF_FIFTEENTEN_SIZE;
self.billFiled.returnKeyType = UIReturnKeyDone;
self.billFiled.delegate = self;
[_billNumberView addSubview:self.billFiled];
......
......@@ -7,7 +7,6 @@
//
#import "MaskCell.h"
#define TitleSize 14
#define LeftMargin 20
#define TableHeight 45
#define BtnSize 14
......@@ -29,14 +28,14 @@
{
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, self.totalWidth - LeftMargin - BtnSize, self.totalHeight))];
self.titleLabel.textAlignment= NSTextAlignmentLeft;
self.titleLabel.textColor = HexColor(@"666666");
self.titleLabel.font = FontSize(TitleSize);
self.titleLabel.textColor = GXF_LEFTSIX_COLOR;
self.titleLabel.font = GXF_FOURTEENTH_SIZE;
self.Commitbtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(self.totalWidth- LeftMargin - BtnSize, 10, BtnSize, BtnSize) target:nil sel:nil tag:0 image:@"selected" title:nil titleColor:nil isCorner:NO corner:0 bgColor:nil];
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.totalHeight-1, self.totalWidth - LeftMargin * 2, 1))];
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.font = FontSize(TitleSize);
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.lineLabel.font = GXF_FOURTEENTH_SIZE;
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.lineLabel];
[self.contentView addSubview:self.Commitbtn];
......
......@@ -25,12 +25,12 @@
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 0, 100, 44))];
self.titleLabel.textAlignment= NSTextAlignmentLeft;
self.titleLabel.textColor = HexColor(@"666666");
self.titleLabel.font = FontSize(TitleSize);
self.titleLabel.textColor = GXF_LEFTSIX_COLOR;
self.titleLabel.font = GXF_FIFTEENTEN_SIZE;
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, 44-1, ScreenSize.width - LeftMargin * 2, 1))];
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.font = FontSize(TitleSize);
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.lineLabel.font = GXF_FIFTEENTEN_SIZE;
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.lineLabel];
}
......
......@@ -7,11 +7,6 @@
//
#import "SurveyListCell.h"
#define TitleSize 16
#define ContentSize 14
#define TitleColor @"444444"
#define ContentColor @"aaaaaa"
#define LeftMargin 90
#define TopMargin 10
#define TitleHeight 20
......@@ -31,33 +26,33 @@
{
self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
self.stateBtn.titleLabel.font = FontSize(ContentSize);
self.stateBtn.titleLabel.font = GXF_FOURTEENTH_SIZE;
[self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.stateBtn.enabled = NO;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
self.titleLabel.textColor = HexColor(TitleColor);
self.titleLabel.font = FontSize(TitleSize);
self.titleLabel.textColor = GXF_CONTENT_COLOR;
self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
self.billnumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.titleLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.billnumberLabel.textColor = HexColor(ContentColor);
self.billnumberLabel.font = FontSize(ContentSize);
self.billnumberLabel.textColor = GXF_CELL_COLOR;
self.billnumberLabel.font = GXF_FOURTEENTH_SIZE;
self.productnameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.billnumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.productnameLabel.textColor = HexColor(ContentColor);
self.productnameLabel.font = FontSize(ContentSize);
self.productnameLabel.textColor = GXF_CELL_COLOR;
self.productnameLabel.font = GXF_FOURTEENTH_SIZE;
self.begindateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.productnameLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.begindateLabel.textColor = HexColor(ContentColor);
self.begindateLabel.font = FontSize(ContentSize);
self.begindateLabel.textColor = GXF_CELL_COLOR;
self.begindateLabel.font = GXF_FOURTEENTH_SIZE;
self.enddateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.begindateLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
self.enddateLabel.textColor = HexColor(ContentColor);
self.enddateLabel.font = FontSize(ContentSize);
self.enddateLabel.textColor = GXF_CELL_COLOR;
self.enddateLabel.font = GXF_FOURTEENTH_SIZE;
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin - TopMargin * 2, 1))];;
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.stateBtn];
[self.contentView addSubview:self.titleLabel];
......@@ -77,17 +72,17 @@
self.begindateLabel.text = [NSString stringWithFormat:@"开始时间:%@",[survey.beginDate substringToIndex:10]];
self.enddateLabel.text = [NSString stringWithFormat:@"结束时间:%@",[survey.endDate substringToIndex:10]];
NSString *stateStr = @"";
if ([survey.state isEqualToString:@"initial"]) {
if ([survey.state isEqualToString:SURVEY_STATE_INITIAL]) {
stateStr = @"未提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"initial"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"submitted"]) {
}else if ([survey.state isEqualToString:SURVEY_STATE_SUBMITTED]) {
stateStr = @"已提交";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"insurvey"]) {
}else if ([survey.state isEqualToString:SURVEY_STATE_INSURVEY]) {
stateStr = @"调研中";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
}else if ([survey.state isEqualToString:@"finished"]) {
}else if ([survey.state isEqualToString:SURVEY_STATE_FINISHED]) {
stateStr = @"已完成";
[self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
}
......
......@@ -12,10 +12,7 @@
#define TitleHeight 20
#define LeftWidth 100
#define TableHeight 150
#define TitleSize 16
#define ContentSize 14
#define TitleColor @"444444"
#define ContentColor @"aaaaaa"
@implementation SurveyResultCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
......@@ -33,32 +30,32 @@
self.imageBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftWidth, TableHeight - TopMargin*2);
self.dateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.imageBtn.frame) + TopMargin, TopMargin, ScreenSize.width - TopMargin*2 - LeftWidth, TitleHeight))];
self.dateLabel.textColor = HexColor(ContentColor);
self.dateLabel.font = FontSize(ContentSize);
self.dateLabel.textColor = GXF_CELL_COLOR;
self.dateLabel.font = GXF_FOURTEENTH_SIZE;
self.userNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.dateLabel.frame), CGRectGetMaxY(self.dateLabel.frame), CGRectGetWidth(self.dateLabel.frame), 30))];
self.userNameLabel.textColor = HexColor(TitleColor);
self.userNameLabel.font = FontSize(TitleSize);
self.userNameLabel.textColor = GXF_CONTENT_COLOR;
self.userNameLabel.font = GXF_SIXTEENTEH_SIZE;
self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.userNameLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
self.placeLabel.textColor = HexColor(ContentColor);
self.placeLabel.font = FontSize(ContentSize);
self.placeLabel.textColor = GXF_CELL_COLOR;
self.placeLabel.font = GXF_FOURTEENTH_SIZE;
self.priceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.placeLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
self.priceLabel.textColor = HexColor(ContentColor);
self.priceLabel.font = FontSize(ContentSize);
self.priceLabel.textColor = GXF_CELL_COLOR;
self.priceLabel.font = GXF_FOURTEENTH_SIZE;
self.capacityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.priceLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
self.capacityLabel.textColor = HexColor(ContentColor);
self.capacityLabel.font = FontSize(ContentSize);
self.capacityLabel.textColor = GXF_CELL_COLOR;
self.capacityLabel.font = GXF_FOURTEENTH_SIZE;
self.qualityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.userNameLabel.frame), CGRectGetMaxY(self.capacityLabel.frame), CGRectGetWidth(self.userNameLabel.frame), TitleHeight))];
self.qualityLabel.textColor = HexColor(ContentColor);
self.qualityLabel.font = FontSize(ContentSize);
self.qualityLabel.textColor = GXF_CELL_COLOR;
self.qualityLabel.font = GXF_FOURTEENTH_SIZE;
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(TopMargin,TableHeight-1, ScreenSize.width - TopMargin * 2, 1))];;
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.imageBtn];
[self.contentView addSubview:self.dateLabel];
......@@ -76,7 +73,7 @@
self.dateLabel.text = [NSString stringWithFormat:@"%@",surveyResult.feedbackTime];
self.userNameLabel.text = [NSString stringWithFormat:@"反馈人:%@",surveyResult.userName];
self.placeLabel.text = [NSString stringWithFormat:@"产地:%@",surveyResult.place];
NSMutableAttributedString *attributeStr1 = [IBTCommon setTextViewFontOfString:@"价格:" paragraphStyle:0 fontSize:ContentSize color:HexColor(ContentColor)];
NSMutableAttributedString *attributeStr1 = [IBTCommon setTextViewFontOfString:@"价格:" paragraphStyle:0 fontSize:ContentSize color:GXF_CELL_COLOR];
NSString *str = [NSString stringWithFormat:@"%@",surveyResult.price];
[attributeStr1 appendAttributedString:[IBTCommon setTextViewFontOfString:str paragraphStyle:0 fontSize:ContentSize color:[UIColor redColor]]];
self.priceLabel.attributedText = attributeStr1;
......
......@@ -6,12 +6,11 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "ChooseParentViewController.h"
#import "Product.h"
typedef void(^ChoseProduct)(Product *product);
@interface ChooseProductViewController : ICRBaseViewController
@interface ChooseProductViewController : ChooseParentViewController
@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
@property (nonatomic,copy)ChoseProduct choseProduct;
@end
......@@ -7,38 +7,29 @@
//
#import "ChooseProductViewController.h"
#import "MaskCell.h"
#define TopMargin 50
#define TableHeight 50
@interface ChooseProductViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@interface ChooseProductViewController ()
{
UITextField *_selectTextFiled;
NSMutableArray *_indexArr;
NSIndexPath *_currentIndexPath;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation ChooseProductViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self bulidLayout];
//记录更新时间
self.tableView.header.lastUpdatedTimeKey = ChooseProductUpdateDate;
self.title = @"选择商品";
[self fetchProductList:@""];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
_indexArr = [NSMutableArray array];
[self fetchProductList];
- (void)getBaseDataFromServer{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchProductList];
[strongSelf endRefreshing];
[strongSelf fetchProductList:@""];
};
void(^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
......@@ -47,21 +38,31 @@
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getProductWithPage_number:0 page_size:100 success:succ failure:fail];
}
#pragma mark -成功
- (void)fetchProductList{
- (void)fetchProductList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Product TableName], @"uuid"];
NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [Product TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Product TableName], @"uuid"];
}
return [db executeQuery:sql];
};
__weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[strongSelf.tableView reloadData];
if (![GXF_NSUSERFEFTAULTS objectForKey:ChooseProductUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChooseProductUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
......@@ -70,67 +71,20 @@
fetchResultsBlock:fetchResultsBlk];
}
- (void)bulidLayout
{
self.view.backgroundColor = HexColor(@"f8f8f8");
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = FontSize(15);
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)sureClick{
if(self.isMoreChose){
}else{
if (self.dataArr.count > 0) {
Product *product = self.dataArr[_currentIndexPath.row];
self.choseProduct(product);
if (_currentIndexPath) {
Product *product = self.dataArr[_currentIndexPath.row];
self.choseProduct(product);
}
}
}
[self PopViewControllerAnimated:YES];
}
- (void)deletePerson {
_selectTextFiled.text = @"";
[_indexArr removeAllObjects];
_currentIndexPath = nil;
[self.tableView reloadData];
}
#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 = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
......@@ -158,54 +112,56 @@
}
}
if (self.dataArr.count > 0) {
Product *product = self.dataArr[indexPath.row];
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
[cell setTitleStr:proStr];
if (indexPath.row == 0) {
NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
Product *product = self.dataArr[indexPath.row];
cell.titleLabel.textColor = GXF_LEFTSIX_COLOR;
NSString *proStr = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
[cell setTitleStr:proStr];
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
return;
}
if (self.isMoreChose == YES) {
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
if (![self isHaveIndexPath:indexPath]) {
[_indexArr addObject:indexPath];
}
NSString *personStr = @"";
for (NSIndexPath *index in _indexArr) {
Product *product = self.dataArr[index.row];
personStr = [personStr stringByAppendingFormat:@"%@、",product.name];
[self.indexArr addObject:indexPath];
}
_selectTextFiled.text = personStr;
}else{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
Product *procuct = self.dataArr[indexPath.row];
_selectTextFiled.text = procuct.name;
}
}
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
for (NSIndexPath *path in _indexArr) {
if (path.row == indexPath.row) {
return YES;
}
}
return NO;
#pragma mark - 父类方法
- (void)deleteTextFieldStr {
[super deleteTextFieldStr];
[self boxValueChanged:nil];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
#pragma mark - 按钮事件
- (void)boxValueChanged:(NSNotification *)fication{
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchProductList:tilkeStr];
}
- (void)tableViewRefresh{
_currentIndexPath = nil;
[self.tableView reloadData];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
......
......@@ -6,13 +6,12 @@
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
#import "ChooseParentViewController.h"
typedef void(^ChosePerson)(NSArray *user);
@interface ChosePersonViewController : ICRBaseViewController
@interface ChosePersonViewController : ChooseParentViewController
@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
@property (nonatomic,copy)ChosePerson chosePerson;
@end
......@@ -7,40 +7,32 @@
//
#import "ChosePersonViewController.h"
#import "MaskCell.h"
#import "SurveyUser.h"
#import "User.h"
#define TopMargin 50
#define TableHeight 50
@interface ChosePersonViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
{
UITextField *_selectTextFiled;
@interface ChosePersonViewController (){
NSIndexPath *_currentIndexPath;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *indexArr;
@end
@implementation ChosePersonViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initData];
[self bulidLayout];
self.tableView.header.lastUpdatedTimeKey = ChoosePersonUpdateDate;
self.title = @"选择人员";
[self fetchUserList:@""];
}
- (void)initData{
self.dataArr = [NSMutableArray array];
self.indexArr = [NSMutableArray array];
[self fetchUserList];
- (void)getBaseDataFromServer{
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf fetchUserList];
[strongSelf endRefreshing];
[strongSelf fetchUserList:@""];
};
void(^fail)(id) = ^(id data) {
......@@ -50,66 +42,37 @@
[IBTLoadingView showProgressLabel:@"正在加载..."];
[[ICRHTTPController sharedController] getUserWithPage_number:0 page_size:100 success:succ failure:fail];
}
#pragma mark -成功
- (void)fetchUserList{
- (void)fetchUserList:(NSString *)titleStr{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [User TableName], @"uuid"];
NSString * sql = @"";
if (titleStr.length > 0) {
sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE NAME LIKE '%%%@%%' ORDER BY %@", [User TableName],titleStr, @"uuid"];
}else{
sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [User TableName], @"uuid"];
}
return [db executeQuery:sql];
};
__weak typeof(self)weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[strongSelf.tableView reloadData];
if (![GXF_NSUSERFEFTAULTS objectForKey:ChoosePersonUpdateDate]) {
[GXF_NSUSERFEFTAULTS setObject:[NSDate date] forKey:ChoosePersonUpdateDate];
[GXF_NSUSERFEFTAULTS synchronize];
[self getBaseDataFromServer];
}else{
[strongSelf.dataArr removeAllObjects];
[strongSelf.dataArr addObject:self.tableView.header.lastUpdatedTime];
[strongSelf.dataArr addObjectsFromArray:fetchedObjects];
[self tableViewRefresh];
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[User class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
}
#pragma mark - 插入数据
- (void)bulidLayout
{
self.view.backgroundColor = HexColor(@"f8f8f8");
_selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
_selectTextFiled.textAlignment = NSTextAlignmentLeft;
_selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
_selectTextFiled.delegate = self;
_selectTextFiled.font = FontSize(15);
[self.view addSubview:_selectTextFiled];
UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
leftView.image = [UIImage imageNamed:@"search"];
_selectTextFiled.leftView = leftView;
_selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
[rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
rightView.frame = CGRectMake(0, 0, 35, 40);
[rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
_selectTextFiled.rightView = rightView;
_selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = rightItem;
}
- (void)sureClick{
if (self.isMoreChose) {
NSMutableArray *arr = [[NSMutableArray alloc]init];
......@@ -121,50 +84,25 @@
survey.userName = user.name;
[arr addObject:survey];
}
if (arr.count == 0) {
SurveyUser *user = [[SurveyUser alloc]init];
user.userUuid = @"5a7417014e4c2928014e4dea21fb002f";
user.userName = @"栗阳";
user.userCode = @"admin";
[arr addObject:user];
self.chosePerson(arr);
}else{
self.chosePerson(arr);
}
self.chosePerson(arr);
}else{
NSMutableArray *arr = [[NSMutableArray alloc]init];
if (self.dataArr.count > 0) {
User *user = self.dataArr[_currentIndexPath.row];
SurveyUser * survey = [[SurveyUser alloc]init];
survey.userUuid = user.uuid;
survey.userCode = user.login;
survey.userName = user.name;
[arr addObject:survey];
self.chosePerson(arr);
if (_currentIndexPath) {
User *user = self.dataArr[_currentIndexPath.row];
SurveyUser * survey = [[SurveyUser alloc]init];
survey.userUuid = user.uuid;
survey.userCode = user.login;
survey.userName = user.name;
[arr addObject:survey];
self.chosePerson(arr);
}
}
}
[self PopViewControllerAnimated:YES];
}
- (void)deletePerson {
if (self.isMoreChose) {
[self.indexArr removeAllObjects];
}else{
_currentIndexPath = nil;
}
_selectTextFiled.text = @"";
[self.tableView reloadData];
}
#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 = @"MaskCell";
MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
......@@ -192,58 +130,54 @@
}
}
if (self.dataArr.count > 0) {
User *user = self.dataArr[indexPath.row];
[cell setTitleStr:user.name];
if (indexPath.row == 0) {
NSString *dateStr = [self.dataArr[indexPath.row] httpParameterString];
cell.titleLabel.textColor = GXF_CONTENT_COLOR;
[cell setTitleStr:[NSString stringWithFormat:@"上次更新时间:%@",dateStr]];
}else{
User *user = self.dataArr[indexPath.row];
[cell setTitleStr:user.name];
}
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == 0) {
return;
}
if (self.isMoreChose == YES) {
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
if (![self isHaveIndexPath:indexPath]) {
cell.Commitbtn.hidden = NO;
[self.indexArr addObject:indexPath];
}else{
cell.Commitbtn.hidden = YES;
[self.indexArr removeObject:indexPath];
}
NSString *personStr = @"";
for (NSIndexPath *index in self.indexArr) {
User *user = self.dataArr[index.row];
if (personStr.length == 0) {
personStr = [personStr stringByAppendingFormat:@"%@",user.name];
}else{
personStr = [personStr stringByAppendingFormat:@"、%@",user.name];
}
}
_selectTextFiled.text = personStr;
}else{
MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
currentCell.Commitbtn.hidden = YES;
MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.Commitbtn.hidden = NO;
_currentIndexPath = indexPath;
User *user = self.dataArr[indexPath.row];
_selectTextFiled.text = user.name;
}
}
- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
for (NSIndexPath *path in self.indexArr) {
if (path.row == indexPath.row) {
return YES;
}
}
return NO;
- (void)deleteTextFieldStr{
[super deleteTextFieldStr];
[self boxValueChanged:nil];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
#pragma mark - 按钮事件
- (void)boxValueChanged:(NSNotification *)fication{
NSString *tilkeStr = [IBTCommon trimmingCharacters:self.selectTextFiled.text];
[self fetchUserList:tilkeStr];
}
- (void)tableViewRefresh{
_currentIndexPath = nil;
if (self.indexArr.count > 0) {
[self.indexArr removeAllObjects];
}
[self.tableView reloadData];
}
......
......@@ -13,9 +13,9 @@
#define BottomHeight 50
#define LeftMargin 20
#define LeftWidth 100
#define LeftHeight 30
#define LeftHeight 20
#define TopMargin 15
#define ContentMargin 10
typedef enum : NSUInteger {
DetailTag = 6000,
......@@ -37,6 +37,8 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)UILabel *endDateLabel;
@property (nonatomic,strong)UILabel *userLabel;
@property (nonatomic,strong)UILabel *noteLabel;
@property (nonatomic,strong)UILabel *lefeNoteLabel;
@end
@implementation SurveyDetailViewController
......@@ -103,16 +105,16 @@ typedef enum : NSUInteger {
- (void)fetchtSurveyDetail{
self.billNumberLabel.text = [IBTCommon checkString:self.survey.billNumber];
if ([self.survey.state isEqualToString:@"initial"]) {
if ([self.survey.state isEqualToString:SURVEY_STATE_INITIAL]) {
self.stateLabel.textColor = [UIColor redColor];
self.stateLabel.text = @"未提交";
}else if ([self.survey.state isEqualToString:@"submitted"]) {
}else if ([self.survey.state isEqualToString:SURVEY_STATE_SUBMITTED]) {
self.stateLabel.textColor = [UIColor greenColor];
self.stateLabel.text = @"已提交";
}else if ([self.survey.state isEqualToString:@"insurvey"]) {
}else if ([self.survey.state isEqualToString:SURVEY_STATE_INSURVEY]) {
self.stateLabel.textColor = [UIColor grayColor];
self.stateLabel.text = @"调研中";
}else if ([self.survey.state isEqualToString:@"finished"]) {
}else if ([self.survey.state isEqualToString:SURVEY_STATE_FINISHED]) {
self.stateLabel.textColor = [UIColor blackColor];
self.stateLabel.text = @"已完成";
}
......@@ -142,34 +144,34 @@ typedef enum : NSUInteger {
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)];
_scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.backgroundColor = HexColor(@"f8f8f8");
_scrollView.backgroundColor = XXFBgColor;
[self.view addSubview:_scrollView];
UIButton *endBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin*2, 40) target:self sel:@selector(btnClick:) tag:EndTag image:nil title:@"结束" titleColor:[UIColor whiteColor] isCorner:YES corner:8 bgColor:HexColor(@"f69100")];
UIButton *endBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height - 64 - BottomHeight +5, ScreenSize.width - LeftMargin*2, 40) target:self sel:@selector(btnClick:) tag:EndTag image:nil title:@"结束" titleColor:[UIColor whiteColor] isCorner:YES corner:8 bgColor:GXF_COMMIT_COLOR];
[self.view addSubview:endBtn];
_surveyView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*9+LeftMargin/2)];
_surveyView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight * 9+ ContentMargin * 10)];
_surveyView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_surveyView];
UILabel *tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)];
UILabel *tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, ContentMargin, LeftWidth*2, LeftHeight)];
tagLabel.text = @"【调研内容】";
tagLabel.font = FontSize(17);
tagLabel.font = GXF_SEVENTEENTH_SIZE;
tagLabel.textColor = HexColor(@"7ebf74");
[_surveyView addSubview:tagLabel];
NSArray *leftArr = @[@"单号:",@"状态:",@"标题:",@"商品:",@"开始日期:",@"截止日期:",@"调研人员:",@"备注:"];
for (NSInteger i = 0 ; i < leftArr.count; i++) {
UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, LeftWidth, LeftHeight)];
leftLabel.font = FontSize(17);
UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, CGRectGetMaxY(tagLabel.frame) + ContentMargin+ (LeftHeight + ContentMargin) *i, LeftWidth, LeftHeight)];
leftLabel.font = GXF_SEVENTEENTH_SIZE;
leftLabel.text = leftArr[i];
leftLabel.textColor = HexColor(@"888888");
leftLabel.textColor = GXF_DETAIL_COLOR;
[_surveyView addSubview:leftLabel];
UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, _surveyView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
rightLabel.font = FontSize(17);
rightLabel.textColor = HexColor(@"888888");
UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), CGRectGetMaxY(tagLabel.frame) + ContentMargin+ (LeftHeight + ContentMargin) *i, _surveyView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
rightLabel.font = GXF_SEVENTEENTH_SIZE;
rightLabel.textColor = GXF_DETAIL_COLOR;
if (i == 0) {
self.billNumberLabel = rightLabel;
}else if (i == 1) {
......@@ -183,10 +185,12 @@ typedef enum : NSUInteger {
}else if(i == 5){
self.endDateLabel = rightLabel;
}else if(i == 6){
rightLabel.numberOfLines = 0;
self.userLabel = rightLabel;
}else if(i == 7){
rightLabel.numberOfLines = 0;
self.noteLabel = rightLabel;
self.lefeNoteLabel = leftLabel;
}
[_surveyView addSubview:rightLabel];
}
......@@ -199,7 +203,7 @@ typedef enum : NSUInteger {
UILabel *resultLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)];
resultLabel.text = @"【行情反馈】";
resultLabel.font = FontSize(17);
resultLabel.font = GXF_SEVENTEENTH_SIZE;
resultLabel.textColor = HexColor(@"7ebf74");
[_bottomView addSubview:resultLabel];
......@@ -261,13 +265,24 @@ typedef enum : NSUInteger {
- (void)setNoteHeight
{
CGFloat height = [self.noteLabel calculateHeight];
CGFloat personHeight = [self.userLabel calculateHeight];
CGRect personFrame = self.userLabel.frame;
personFrame.size.height = personHeight;
self.userLabel.frame = personFrame;
CGFloat noteHeight = [self.noteLabel calculateHeight];
CGRect noteFrame = self.noteLabel.frame;
noteFrame.size.height = height;
noteFrame.size.height = noteHeight;
noteFrame.origin.y = CGRectGetMaxY(self.userLabel.frame)+ ContentMargin;
self.noteLabel.frame = noteFrame;
CGFloat totalHeight = height + LeftHeight*9;
CGRect leftNoteFrame = self.lefeNoteLabel.frame;
leftNoteFrame.origin.y = CGRectGetMaxY(self.userLabel.frame)+ ContentMargin;
self.lefeNoteLabel.frame = leftNoteFrame;
CGFloat totalHeight = noteHeight + (LeftHeight * 7+ ContentMargin*10) + personHeight;
CGRect surveyFrame = _surveyView.frame;
surveyFrame.size.height = totalHeight;
_surveyView.frame = surveyFrame;
......
......@@ -77,6 +77,8 @@ typedef enum : NSUInteger {
_currentPage = 0;
[self getData];
}];
self.tableView.header.lastUpdatedTimeKey = SurveyUpdateDate;
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (_isLoadMore) {
return ;
......@@ -95,8 +97,8 @@ typedef enum : NSUInteger {
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if ([ICRUserUtil sharedInstance].needFresh) {
[self getData];
if ([ICRUserUtil sharedInstance].needFresh && self.tableView != nil) {
[self.tableView.header beginRefreshing];
}
}
......@@ -193,6 +195,9 @@ typedef enum : NSUInteger {
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];
}
......@@ -204,12 +209,13 @@ typedef enum : NSUInteger {
- (void)createTableView
{
_sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
_sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:HexColor(@"888888") isCorner:NO corner:0 bgColor:nil];
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:HexColor(@"888888") isCorner:NO corner:0 bgColor:nil];
_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];
......@@ -245,20 +251,21 @@ typedef enum : NSUInteger {
#pragma mark - 确定
- (void)sureClick{
[_boltView.titleFiled resignFirstResponder];
[_boltView.billFiled resignFirstResponder];
//请求
[self getData];
//还原数据
if (_sortView) {
[self hiddenSortMaskView:YES];
}
if (_boltView) {
[self hiddenBoltMaskView:YES];
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];
}
}
self.navigationItem.rightBarButtonItem = nil;
}
#pragma mark -按钮事件
......@@ -273,7 +280,6 @@ typedef enum : NSUInteger {
[btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
[self hiddenSortMaskView:YES];
currentBtn = nil;
self.navigationItem.rightBarButtonItem = nil;
}else{
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) {
......@@ -287,7 +293,6 @@ typedef enum : NSUInteger {
_sortView.frame = sortFrame;
}];
}
self.navigationItem.rightBarButtonItem = _sureBtn;
currentBtn = btn;
}
}else if(btn.tag == BoltTag){
......@@ -298,13 +303,12 @@ typedef enum : NSUInteger {
[btn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
[self hiddenBoltMaskView:YES];
currentBtn = nil;
self.navigationItem.rightBarButtonItem = 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 = HexColor(@"f8f8f8");
_boltView.backgroundColor = XXFBgColor;
_boltView.delegate = self;
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"不限",@"未提交",@"已提交" ,@"调研中",nil];
[_maskView addSubview:_boltView];
......@@ -314,7 +318,6 @@ typedef enum : NSUInteger {
_boltView.frame = sortFrame;
}];
currentBtn = btn;
self.navigationItem.rightBarButtonItem = _sureBtn;
}
}
......@@ -363,21 +366,21 @@ typedef enum : NSUInteger {
- (void)getSortValueSelectRow:(NSString *)state{
if (state.length > 0) {
self.orderDirection = state;
NSLog(@"%@",state);
CLog(@"%@",state);
}
}
#pragma mark - boltDelegate
- (void)getBoltValueSelectRow:(NSString *)state{
self.state = state;
NSLog(@"%@",state);
CLog(@"%@",state);
}
- (void)getTitleLike:(NSString *)titleLike{
self.titleLike = titleLike;
NSLog(@"%@",titleLike);
CLog(@"%@",titleLike);
}
- (void)getBillNumber:(NSString *)billNumber{
self.billNumberLike = billNumber;
NSLog(@"%@",billNumber);
CLog(@"%@",billNumber);
}
- (void)clearBoltInformation{
//清空所有条件
......@@ -419,13 +422,13 @@ typedef enum : NSUInteger {
if (self.dataArr.count > 0) {
survey = self.dataArr[indexPath.row];
}
if ([survey.state isEqualToString:@"initial"]) {
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:@"submitted"] || [survey.state isEqualToString:@"insurvey"]|| [survey.state isEqualToString:@"finished"]){
}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;
......
......@@ -47,10 +47,10 @@ typedef enum : NSUInteger {
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenSize.height - BottomViewHeight - 64, ScreenSize.width, BottomViewHeight)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"50bd62")];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_SAVE_COLOR];
[footView addSubview:saveBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(saveBtn.frame) + 15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"f69100")];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(saveBtn.frame) + 15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:GXF_COMMIT_COLOR];
[footView addSubview:commitBtn];
[self.view addSubview:footView];
......
......@@ -61,9 +61,9 @@
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:arr[i] forState:UIControlStateNormal];
btn.frame = CGRectMake(SpaceWidth + (BtnWidth+SpaceWidth) * i, 0, BtnWidth, ContentHeight);
[btn setTitleColor:HexColor(@"444444") forState:UIControlStateNormal];
[btn setTitleColor:HexColor(@"50bd62") forState:UIControlStateDisabled];
btn.titleLabel.font = FontSize(16);
[btn setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
[btn setTitleColor:GXF_SAVE_COLOR forState:UIControlStateDisabled];
btn.titleLabel.font = GXF_SIXTEENTEH_SIZE;
btn.tag = i + BeginTag;
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btn];
......
......@@ -8,7 +8,6 @@
#import "FooterCell.h"
#define HeadWidth 70
#define TitleSize 15
#define LeftMargin 13
@interface FooterCell ()
@property (nonatomic,strong)NSString *title;
......@@ -30,13 +29,13 @@
addBtn.frame = CGRectMake(0, 0, self.frame.size.width, 50);
[addBtn setTitle:self.title forState:UIControlStateNormal];
addBtn.backgroundColor = [UIColor whiteColor];
[addBtn setTitleColor:HexColor(@"bbbbbb") forState:UIControlStateNormal];
[addBtn setTitleColor:GXF_PLACEHOLDER_COLOR forState:UIControlStateNormal];
[addBtn addTarget:self action:@selector(addBtn) forControlEvents:UIControlEventTouchUpInside];
addBtn.titleLabel.font = FontSize(15);
addBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:addBtn];
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.frame.size.height-1, ScreenSize.width - LeftMargin * 2, 1))];
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.font = FontSize(TitleSize);
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.lineLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:self.lineLabel];
}
......
......@@ -7,8 +7,6 @@
//
#import "HeaderCell.h"
//#define HeadWidth 70
#define TitleSize 15
#define LeftMargin 13
#define LeftWidth 45
#define RightWidth 30
......@@ -34,15 +32,15 @@
CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count;
for (NSInteger i = 0; i < self.arr.count; i++) {
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i, 0, headWidth, self.frame.size.height)];
label.font = FontSize(TitleSize);
label.font = GXF_FIFTEENTEN_SIZE;
label.textAlignment = NSTextAlignmentLeft;
label.textColor = HexColor(@"bbbbbb");
label.textColor = GXF_PLACEHOLDER_COLOR;
label.text = self.arr[i];
[self addSubview:label];
}
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.frame.size.height-1, ScreenSize.width - LeftMargin * 2, 1))];
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.font = FontSize(TitleSize);
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.lineLabel.font = GXF_FIFTEENTEN_SIZE;
[self addSubview:self.lineLabel];
}
@end
......@@ -11,8 +11,6 @@
#define TableHeight 44
#define SmallSize 15
#define SmallWidth 20
#define ContentColor @"444444"
#define ContentSize 16
#define SpaceMargin 1
#define LeftWidth 45
#define RightWidth 30
......@@ -42,27 +40,27 @@
self.smallImageView.image = [UIImage imageNamed:@"delete"];
self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.smallImageView.frame), 0, SmallWidth, TableHeight))];
self.seqLabel.textColor = HexColor(ContentColor);
self.seqLabel.textColor = GXF_CONTENT_COLOR;
self.seqLabel.text = @"13";
self.seqLabel.font = FontSize(ContentSize);
self.seqLabel.font = GXF_SIXTEENTEH_SIZE;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.titleLabel.textAlignment = NSTextAlignmentLeft;
self.titleLabel.textColor = HexColor(ContentColor);
self.titleLabel.textColor = GXF_CONTENT_COLOR;
self.titleLabel.text = @"苹果桃子";
self.titleLabel.font = FontSize(ContentSize);
self.titleLabel.font = GXF_SIXTEENTEH_SIZE;
self.baseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.baseCountLabel.textAlignment = NSTextAlignmentLeft;
self.baseCountLabel.textColor = HexColor(ContentColor);
self.baseCountLabel.textColor = GXF_CONTENT_COLOR;
self.baseCountLabel.text = @"30000";
self.baseCountLabel.font = FontSize(ContentSize);
self.baseCountLabel.font = GXF_SIXTEENTEH_SIZE;
self.dateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.baseCountLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.dateLabel.textAlignment = NSTextAlignmentLeft;
self.dateLabel.text = @"2015-04-05";
self.dateLabel.textColor = HexColor(ContentColor);
self.dateLabel.font = FontSize(ContentSize);
self.dateLabel.textColor = GXF_CONTENT_COLOR;
self.dateLabel.font = GXF_SIXTEENTEH_SIZE;
self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
self.showView.hidden = YES;
......@@ -120,7 +118,7 @@
self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth, TableHeight);
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin * 2, 1))];;
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:self.smallImageView];
[self.contentView addSubview:self.seqLabel];
[self.contentView addSubview:self.titleLabel];
......
......@@ -13,7 +13,6 @@
#define LeftWidth 80
#define TableHeight 44
#define SpaceHeight 10
#define TitleSize 16
@interface TopSheetView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
{
......@@ -74,8 +73,8 @@
if (indexPath.row == 0 || indexPath.row == 2 || indexPath.row == 3) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
textField.textAlignment = NSTextAlignmentRight;
textField.textColor = HexColor(@"444444");
textField.font = FontSize(15);
textField.textColor = GXF_CONTENT_COLOR;
textField.font = GXF_FIFTEENTEN_SIZE;
textField.returnKeyType = UIReturnKeyDone;
textField.delegate = self;
[cell.contentView addSubview:textField];
......@@ -95,7 +94,7 @@
self.remarkTextView.contentInset = UIEdgeInsetsMake(5, 5, 5, 0);
self.remarkTextView.minNumberOfLines = 1;
self.remarkTextView.maxNumberOfLines = 2;
self.remarkTextView.font = FontSize(15);
self.remarkTextView.font = GXF_FIFTEENTEN_SIZE;
self.remarkTextView.textAlignment = NSTextAlignmentRight;
self.remarkTextView.delegate = self;
self.remarkTextView.returnKeyType = UIReturnKeyDone;
......@@ -104,8 +103,8 @@
}else{
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb");
contentLabel.font = FontSize(TitleSize);
contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = GXF_FIFTEENTEN_SIZE;
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 1) {
contentLabel.text = @"选择供应商";
......
......@@ -15,4 +15,5 @@
#import "IBTConstants.h"
#import "ICRAppMacro.h"
#import "ICRNotificationMacro.h"
#endif
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