Commit bc476c75 authored by zhu's avatar zhu

保存删除逻辑

parent f7abd79d
......@@ -103,7 +103,7 @@ typedef enum : NSUInteger {
UIView *footView2=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
footView2.backgroundColor=[UIColor clearColor];
NSArray *ary=[NSArray arrayWithObjects:@"商品",@"价格",@"包装规格",@"包装数量", nil];
// NSArray *ary=[NSArray arrayWithObjects: nil];
// NSArray *ary=[NSArray arrayWithObjects: nil];
CGFloat gipWidth = (ScreenSize.width-(((RightWidth+70)+(LeftWidth+35))+(35+70)))/3;
for (int i=0; i< ary.count;i++ ) {
......@@ -120,9 +120,9 @@ typedef enum : NSUInteger {
if (i==3) {
lable.frame=CGRectMake(ScreenSize.width-RightWidth-70, 0, 70,TableHeight);
}
// UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i,0, headWidth, 50)];
// UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i,0, headWidth, 50)];
lable.text=[ary objectAtIndex:i];
lable.textColor=HexColor(@"444444");
lable.textColor=GXF_CONTENT_COLOR;
[footView2 addSubview:lable];
}
......@@ -133,7 +133,7 @@ typedef enum : NSUInteger {
[self.addDetailedButton setFrame:CGRectMake(0, 0, ScreenSize.width, TableHeight)];
[self.addDetailedButton setTitle:@"+ 点击添加商品明细" forState:UIControlStateNormal];
[self.addDetailedButton addTarget:self action:@selector(addShopeDetailed) forControlEvents:UIControlEventTouchUpInside];
[self.addDetailedButton setTitleColor:HexColor(@"444444") forState:UIControlStateNormal];
[self.addDetailedButton setTitleColor:GXF_CONTENT_COLOR forState:UIControlStateNormal];
self.FootLabel=[[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, footView3.size.height-1, footView3.size.width-2*LeftMargin, 1))];
self.FootLabel.backgroundColor = HexColor(@"e5e5e5");
self.FootLabel.font = FontSize(TitleSize);
......@@ -212,10 +212,10 @@ typedef enum : NSUInteger {
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
Cell.selectionStyle = UITableViewCellSelectionStyleNone;
// Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;向左箭头
[self showShopDetail:Cell indexPath:indexPath];
// Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;向左箭头
// [self showShopDetail:Cell indexPath:indexPath];
}
[self showShopDetail:Cell indexPath:indexPath];
if (Cell.isSelected==YES) {
Cell.arrowView.image = [UIImage imageNamed:@"arrowdown"];
Cell.backgroundColor=XXFBgColor;
......@@ -227,7 +227,8 @@ typedef enum : NSUInteger {
Cell.subSview.hidden=YES;
}
[Cell.button addTarget:self action:@selector(didtoucher) forControlEvents:UIControlEventTouchUpInside];
Cell.button.tag=indexPath.row;
[Cell.button addTarget:self action:@selector(didtoucher:) forControlEvents:UIControlEventTouchUpInside];
return Cell;
}
......@@ -282,7 +283,7 @@ typedef enum : NSUInteger {
[self.users addObject:[user dictForCommit]];
}
_personLabel.text = textStr;
_personLabel.textColor = HexColor(@"444444");
_personLabel.textColor = GXF_CONTENT_COLOR;
};
cvc.isMoreChose = NO;
......@@ -311,7 +312,7 @@ typedef enum : NSUInteger {
if (indexPath.row == 0) {
_titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
_titleField.textAlignment = NSTextAlignmentRight;
_titleField.textColor = HexColor(@"444444");
_titleField.textColor = GXF_CONTENT_COLOR;
_titleField.placeholder = @"输入采购通知标题";
_titleField.font = FontSize(15);
_titleField.returnKeyType = UIReturnKeyDone;
......@@ -335,7 +336,7 @@ typedef enum : NSUInteger {
}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.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = FontSize(TitleSize);
[cell.contentView addSubview:contentLabel];
if (indexPath.row == 1) {
......@@ -344,7 +345,7 @@ typedef enum : NSUInteger {
[self preferDataInPersonLabel];
}
}
}
}
-(BOOL)comperIndexpath:(NSIndexPath *)indexPath
{
for (NSIndexPath *path in selectCellAry) {
......@@ -366,7 +367,7 @@ typedef enum : NSUInteger {
}
}
_personLabel.text = personStr;
_personLabel.textColor = HexColor(@"444444");
_personLabel.textColor = GXF_CONTENT_COLOR;
}
if (self.users > 0) {
......@@ -377,6 +378,7 @@ typedef enum : NSUInteger {
//添加商品明细
-(void)addShopeDetailed
{
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
// 回调
svc.choseShopDetail = ^(ShopDetail *shopDetail){
......@@ -405,13 +407,30 @@ typedef enum : NSUInteger {
}
//编辑
- (void)didtoucher
- (void)didtoucher:(UIButton*)button
{
// EditorShopDetail
ShopDetail *shopDetail=[_shopeArr objectAtIndex:button.tag];
shopDetail.IsXiuGai=YES;
// EditorShopDetail
ShopDetaileViewController *svc = [[ShopDetaileViewController alloc] init];
svc.choseShopDetail = ^(ShopDetail *Detail){
if (Detail.IsDeleted) {
[_shopeArr removeObjectAtIndex:button.tag];
}else{
[_shopeArr replaceObjectAtIndex:button.tag withObject:Detail];
}
[mingXiTableView reloadData];
// NSIndexPath *indexPath_1=[NSIndexPath indexPathForRow:button.tag inSection:0];
// NSArray *indexArray=[NSArray arrayWithObject:indexPath_1];
// [mingXiTableView reloadRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationLeft];
};
svc.shopDetail=shopDetail;
svc.title = [IBTCommon localizableString:@"EditorShopDetail"];
[self PushViewController:svc animated:YES];
//
//
NSLog(@"123213232332323223");
}
#pragma mark delegate
......@@ -466,13 +485,13 @@ typedef enum : NSUInteger {
}
/*
#pragma mark - Navigation
#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 {
// 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
......@@ -18,5 +18,7 @@
@property (nonatomic,strong)NSString *packageUnitPrice;//包装单价
@property (nonatomic,strong)NSString *totalMoney;//总金额
@property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,assign)BOOL IsDeleted;//是否删除
@property (nonatomic,assign)BOOL IsXiuGai;//是否删除
@end
......@@ -93,7 +93,7 @@
// }
lable.text=[array objectAtIndex:i];
lable.font=FontSize(TitleSize-2);
[lable setTextColor:HexColor(@"444444")];
[lable setTextColor:GXF_CONTENT_COLOR];
[self.subSview addSubview:lable];
UILabel*shopeLable= [self.shopDetailAry1 objectAtIndex:i];
......@@ -104,7 +104,7 @@
}
shopeLable.font=FontSize(TitleSize-2);
[shopeLable setTextColor:HexColor(@"444444")];
[shopeLable setTextColor:GXF_CONTENT_COLOR];
// shopeLable.backgroundColor=[UIColor redColor];
[self.subSview addSubview:shopeLable];
}
......@@ -113,13 +113,13 @@
lable.text=[array1 objectAtIndex:i];
lable.font=FontSize(TitleSize-2);
[lable setTextColor:HexColor(@"444444")];
[lable setTextColor:GXF_CONTENT_COLOR];
[self.subSview addSubview:lable];
UILabel*shopeLable= [self.shopDetailAry2 objectAtIndex:i];
shopeLable.frame=CGRectMake(lable.frame.origin.x-LeftMargin+lable.frame.size.width, lable.frame.origin.y,(ScreenSize.width-2*LeftMargin)/4, 10);
shopeLable.font=FontSize(TitleSize-2);
[shopeLable setTextColor:HexColor(@"444444")];
[shopeLable setTextColor:GXF_CONTENT_COLOR];
// shopeLable.backgroundColor=[UIColor redColor];
[self.subSview addSubview:shopeLable];
}
......
......@@ -88,6 +88,7 @@ typedef enum : NSUInteger {
[_dataArr addObject:@"包装单价"];
[_dataArr addObject:@"总金额"];
[_dataArr addObject:@"备注"];
}
-(void)setupSubviews
......@@ -113,6 +114,27 @@ typedef enum : NSUInteger {
[self.view addSubview:_tableView];
}
- (void)setviewsData
{
if (self.shopDetail!=nil) {
_productLabel.text=self.shopDetail.merchandise;//商品
merchandise.text=self.shopDetail.merchandise;
packageUnit.text=self.shopDetail.packageUnit;
_PackagingLable.text=self.shopDetail.packageUnit;//包装单位
packageSpecification.text=self.shopDetail.packageSpecification;//包装规格
packageQuantity.text=self.shopDetail.packageQuantity; //包装数量
foundationQuantity.text=self.shopDetail.foundationQuantity; //基础数量
foundationUnitPrice.text=self.shopDetail.foundationUnitPrice; //基础单价
packageUnitPrice.text=self.shopDetail.packageUnitPrice; //包装单价
totalMoney.text=self.shopDetail.totalMoney; //总金额
remark.text=self.shopDetail.remark;
_productLabel.textColor=GXF_CONTENT_COLOR;
_PackagingLable.textColor=GXF_CONTENT_COLOR;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......@@ -120,8 +142,25 @@ typedef enum : NSUInteger {
#pragma mark - 按钮点击事件
- (void)btnClick:(UIButton *)btn{
switch (btn.tag) {
case SaveTag:
case SaveTag://删除
{
if (self.shopDetail!=nil) {
ShopDetail *shopDetail=self.shopDetail;
if (shopDetail.IsXiuGai==YES) {
shopDetail.IsDeleted=YES;
self.choseShopDetail(shopDetail);//回调
[self PopViewControllerAnimated:YES];
}else
{
[self clearShopDetail];
}
}else
{
[self clearShopDetail];
}
// if ([self checkSurvey]) {
// [self saveSurvey:@"initial" message:@"正在保存..."];
// }
......@@ -131,6 +170,7 @@ typedef enum : NSUInteger {
{
if ([self informationComplete]) {
ShopDetail *shopDetail=self.shopDetail;
shopDetail.IsDeleted=NO;
self.choseShopDetail(shopDetail);//回调
[self PopViewControllerAnimated:YES];
// [self saveSurvey:@"submitted" message:@"正在提交..."];
......@@ -141,6 +181,24 @@ typedef enum : NSUInteger {
break;
}
}
- (void)clearShopDetail
{
_productLabel.text=@"选择商品";//商品
merchandise.text=@"";
packageUnit.text=@"";
_PackagingLable.text=@"选择包装单位";//包装单位
packageSpecification.text=@"";//包装规格
packageQuantity.text=@""; //包装数量
foundationQuantity.text=@""; //基础数量
foundationUnitPrice.text=@""; //基础单价
packageUnitPrice.text=@""; //包装单价
totalMoney.text=@""; //总金额
remark.text=@"";
_productLabel.textColor=GXF_PLACEHOLDER_COLOR;
_PackagingLable.textColor=GXF_PLACEHOLDER_COLOR;
}
- (BOOL)informationComplete{
self.shopDetail=[[ShopDetail alloc]init];
self.shopDetail.merchandise=merchandise.text;
......@@ -246,13 +304,13 @@ typedef enum : NSUInteger {
- (void)clearAllInformation{
_titleField.text = @"";
_productLabel.text = @"请输入商品";
_productLabel.textColor = HexColor(@"bbbbbb");
_productLabel.textColor = GXF_PLACEHOLDER_COLOR;
_startDateLabel.text = @"选择日期";
_startDateLabel.textColor = HexColor(@"bbbbbb");
_startDateLabel.textColor = GXF_PLACEHOLDER_COLOR;
_endDateLabel.text = @"选择日期";
_endDateLabel.textColor = HexColor(@"bbbbbb");
_endDateLabel.textColor = GXF_PLACEHOLDER_COLOR;
_personLabel.text = @"选择调研人员";
_personLabel.textColor = HexColor(@"bbbbbb");
_personLabel.textColor = GXF_PLACEHOLDER_COLOR;
_noteTextView.text = @"";
//清空数据
self.titleStr = @"";
......@@ -303,7 +361,7 @@ typedef enum : NSUInteger {
if (indexPath.row == 0||indexPath.row==3) {
UILabel *contentLabel = [[UILabel alloc]initWithFrame:(CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight))];
contentLabel.textAlignment= NSTextAlignmentRight;
contentLabel.textColor = HexColor(@"bbbbbb");
contentLabel.textColor = GXF_PLACEHOLDER_COLOR;
contentLabel.font = FontSize(TitleSize);
[cell.contentView addSubview:contentLabel];
if (indexPath.row==0) {
......@@ -321,7 +379,7 @@ typedef enum : NSUInteger {
{
_titleField = [[UITextField alloc] initWithFrame:CGRectMake(100+LeftMargin, 0, ScreenSize.width - 100 - LeftMargin*2-10, TableHeight)];
_titleField.textAlignment = NSTextAlignmentRight;
_titleField.textColor = HexColor(@"444444");
_titleField.textColor = GXF_CONTENT_COLOR;
_titleField.placeholder = @"输入调研标题";
_titleField.font = FontSize(15);
_titleField.returnKeyType = UIReturnKeyDone;
......@@ -358,6 +416,7 @@ typedef enum : NSUInteger {
}
[self setviewsData];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
......@@ -368,7 +427,7 @@ typedef enum : NSUInteger {
Product *product=products [0];
_productLabel.text = [NSString stringWithFormat:@"%@[%@]",product.name,product.code];
merchandise.text=[NSString stringWithFormat:@"%@[%@]",product.name,product.code];
_productLabel.textColor = HexColor(@"444444");
_productLabel.textColor = GXF_CONTENT_COLOR;
self.productNameStr = product.name;
self.productUuidStr = product.uuid;
self.productCodeStr = product.code;
......@@ -382,7 +441,7 @@ typedef enum : NSUInteger {
_PackagingLable.text = [NSString stringWithFormat:@"%@",Packaging];
packageUnit.text=[NSString stringWithFormat:@"%@",Packaging];
_PackagingLable.textColor = HexColor(@"444444");
_PackagingLable.textColor = GXF_CONTENT_COLOR;
};
......@@ -404,7 +463,7 @@ typedef enum : NSUInteger {
}
}
_personLabel.text = personStr;
_personLabel.textColor = HexColor(@"444444");
_personLabel.textColor = GXF_CONTENT_COLOR;
}
if (self.users > 0) {
......@@ -415,7 +474,7 @@ typedef enum : NSUInteger {
- (void)preferDataInProductLabel{
if (self.survey) {
_productLabel.text = [IBTCommon checkString:self.survey.productName];
_productLabel.textColor = HexColor(@"444444");
_productLabel.textColor = GXF_CONTENT_COLOR;
self.productCodeStr = [IBTCommon checkString:self.survey.productCode];
self.productNameStr = [IBTCommon checkString:self.survey.productName];
self.productUuidStr = [IBTCommon checkString:self.survey.productUuid];
......@@ -445,11 +504,11 @@ typedef enum : NSUInteger {
}
- (void)okTimeView:(NSDate *)time{
if (_isClickStart) {
_startDateLabel.textColor = HexColor(@"444444");
_startDateLabel.textColor = GXF_CONTENT_COLOR;
_startDateLabel.text = [IBTCommon stringFromDate:time];
self.beginDateStr = [time httpParameterString];
}else{
_endDateLabel.textColor = HexColor(@"444444");
_endDateLabel.textColor = GXF_CONTENT_COLOR;
_endDateLabel.text = [IBTCommon stringFromDate:time];
self.endDateStr = [time httpParameterString];
}
......
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