| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- //
- // B2BSchedulingSettingVC.m
- // shiku_im
- //
- // Created by liyangyang-pc on 17/3/13.
- // Copyright © 2017年 UAS. All rights reserved.
- //
- #import "B2BSchedulingSettingVC.h"
- #import "JLFastenSchedulingCell.h" //固定班次
- #import "JLFreeSchedulingCell.h" //自由班次
- #import "B2BChangeClassVC.h"
- #import "MJExtension.h"
- #import "JLSchedulingModel.h" //班次模型
- #import "JLFastenSchedulingCellfirest.h"
- @interface B2BSchedulingSettingVC ()<UITableViewDelegate,UITableViewDataSource>
- @property (strong , nonatomic) UITableView *tableView;
- @property (strong , nonatomic) NSMutableArray *dataArr;
- @property(nonatomic,strong)MBProgressHUD * hub;
- @end
- @implementation B2BSchedulingSettingVC
- {
- UIImageView *_noDataImage;//没数据图片
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- self.view.backgroundColor = BGB_COLOR;
- [self setNavi];
- [self setTabelView];
- _dataArr = [NSMutableArray array];
-
- _noDataImage = [UIImageView new];
- _noDataImage.image = [UIImage imageNamed:@"crm_all_noData"];
- _noDataImage.hidden = YES;
- [self.view addSubview:_noDataImage];
- [_noDataImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(100);
- make.height.mas_equalTo(126);
- make.center.equalTo(self.view);
- }];
-
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:YES];
- if (_dataArr.count != 0) {
- [_dataArr removeAllObjects];
- }
-
- [SVProgressHUD showWithStatus:@"正在加载中"];
- self.tableView.userInteractionEnabled = NO;
- [self loadData];
-
- }
- #pragma mark --获取详情数据
- - (void)loadData{
-
- [B2BHTTPRequest Get:B2B_DaKa_Class_get_All pageSize:0 condition:@"" Completion:^(id ObjectData, NSError *error) {
- if (error == nil) {
- // DLog(@"%@",ObjectData);
- [MBProgressHUD hideHUD];
- JLSchedulingModel *model = [JLSchedulingModel mj_objectWithKeyValues:ObjectData[@"data"]];
- [_dataArr addObject:model];
-
- SLog(@"%@",model.wd_day);
-
- [self.tableView reloadData];
-
- if (_dataArr.count == 0) {
- _noDataImage.hidden = NO;
- }else
- _noDataImage.hidden = YES;
-
- }else{
- [MBProgressHUD hideHUD];
- _noDataImage.hidden = NO;
- if (error.code==-1009)
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_networkDisconnect") ToNavi:self.navigationController withColor:nil];
- }else if (error.code==-1001)
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_networkTimeOut") ToNavi:self.navigationController withColor:nil];
- }
- else{
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_getDataFaild") ToNavi:self.navigationController withColor:nil];
-
- }
-
- }
- }];
-
-
-
- }
- - (void)setNavi{
-
-
- UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeSystem];
- btn2.frame = CGRectMake(0, 5, 22, 22);
- UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(0, iOS11?5:0, 22, 22)];
- image.image = [UIImage imageNamed:@"icon_back_nor3"];
- [btn2 addSubview:image];
- [btn2 addTarget:self action:@selector(backView) forControlEvents:UIControlEventTouchUpInside];
- UIBarButtonItem *bbi2 = [[UIBarButtonItem alloc]initWithCustomView:btn2];
- self.navigationItem.leftBarButtonItems = @[bbi2];
- //
-
- self.title = Localized(@"UU_work_OA_punchClock_SchedulingSetting");
-
-
- }
- - (void)setTabelView
- {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 2, self_width, self_height) style:UITableViewStylePlain];
-
- _tableView.delegate=self;
- _tableView.dataSource=self;
- _tableView.backgroundColor = Color(235, 233, 233, 1.0);
- _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- [self.view addSubview:_tableView];
- }
- #pragma mark -- 创建排版
- - (void)createAction
- {
- B2BChangeClassVC *vc = [[ B2BChangeClassVC alloc] init];
- vc.type = work_add_Sch;
- [self.navigationController pushViewController:vc animated:YES];
-
-
- }
- - (void)backView
- {
- [self.navigationController popViewControllerAnimated:YES];
-
- }
- #pragma tableView delegate
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return self.dataArr.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- // if (indexPath.row == 1) {
- // JLFreeSchedulingCell *cell = [JLFreeSchedulingCell cellWithTableView:tableView];
- // return cell;
- //
- //
- // }else
-
-
-
- // if (indexPath.row > 0){
- //
- // JLFastenSchedulingCell *cell = [JLFastenSchedulingCell cellWithTableView:tableView];
- // if (self.dataArr.count == 0) {
- //
- // }else{
- //
- // cell.model = self.dataArr[indexPath.row];
- //
- // }
- // UIImageView *delteimage = [[UIImageView alloc] initWithFrame:CGRectMake(self_width -35, 22, 15, 15)];
- // delteimage.image = [UIImage imageNamed:@"icon_delete_nor"];
- // [cell.contentView addSubview:delteimage];
- //
- // UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- // button.frame = CGRectMake(self_width -50, 0, 50, 50);
- // button.backgroundColor = [UIColor clearColor];
- // [button addTarget:self action:@selector(deleteAction:) forControlEvents:UIControlEventTouchUpInside];
- // button.tag = indexPath.row;
- // [cell.contentView addSubview:button];
- //
- //
- //
- //
- // return cell;
- //
- // }else{
-
- JLFastenSchedulingCellfirest *cell = [JLFastenSchedulingCellfirest cellWithTableView:tableView];
-
-
- cell.model = self.dataArr[0];
-
-
- return cell;
-
- //}
-
-
-
-
-
-
- }
- #pragma mark -- 删除班次
- - (void)deleteAction:(UIButton *)btn
- {
-
- [UASAlertView showWithTitle:nil content:Localized(@"UU_work_OA_PC_SchedulingSetting_DeleteTitle") sureTitle:Localized(@"UU_custom_yes") cancelTitle:Localized(@"UU_custom_no") click:^(NSInteger index) {
- if (index == 2) {
- JLSchedulingModel *model = _dataArr[btn.tag];
- [LYHTTPRequest Get:KQin_schedulingSetting_delete page:0 condition:model.wd_code Completion:^(id ObjectData, NSError *error) {
- if (error == nil) {
- [_dataArr removeObjectAtIndex:btn.tag];
- [self.tableView reloadData];
-
- }else{
-
- if (error.code==-1009)
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_networkDisconnect") ToNavi:self.navigationController withColor:nil];
- }else if (error.code==-1001)
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_networkTimeOut") ToNavi:self.navigationController withColor:nil];
- }
-
- else{
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_deleteFaild") ToNavi:self.navigationController withColor:nil];
-
- }
-
-
- }
-
-
- }];
- }
-
- }];
-
-
- }
- - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
- {
-
-
- if (buttonIndex == 0) {
-
- JLSchedulingModel *model = _dataArr[alertView.tag];
- [LYHTTPRequest Get:KQin_schedulingSetting_delete page:0 condition:model.wd_code Completion:^(id ObjectData, NSError *error) {
- if (error == nil) {
- [_dataArr removeObjectAtIndex:alertView.tag];
- [self.tableView reloadData];
-
- }else{
-
- if (error.code==-1009)
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_networkDisconnect") ToNavi:self.navigationController withColor:nil];
- }else if (error.code==-1001)
- {
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_networkTimeOut") ToNavi:self.navigationController withColor:nil];
- }
-
- else{
- [JOShowMessageFromNavi showDropViewWithMessage:Localized(@"UU_custom_deleteFaild") ToNavi:self.navigationController withColor:nil];
-
- }
-
-
- }
-
-
- }];
-
-
-
- }else{
-
-
- }
-
-
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- // if (indexPath.row == 1) {
- // return 64+8;
- // }
-
- return 84+8+10;
-
-
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {[tableView deselectRowAtIndexPath:indexPath animated:NO];
- if (indexPath.row == 1000000) {
-
- }else{
-
- B2BChangeClassVC *vc = [[ B2BChangeClassVC alloc] init];
- vc.type = work_change_Sch;
- // if (indexPath.row == 0) {
- // vc.model = _dataArr[indexPath.row];
- // }else{
- // vc.model = _dataArr[indexPath.row-1];
- // }
- vc.model = _dataArr[indexPath.row];
- [self.navigationController pushViewController:vc animated:YES];
-
-
- }
-
-
- }
- /*
- #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
|