//
|
// PBCheckTaskViewController.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2020/8/18.
|
// Copyright © 2020 ProBIM. All rights reserved.
|
//
|
|
#import "PBCheckTaskViewController.h"
|
#import "PBExamineAddModel.h"
|
#import "PBExamineListModel.h"
|
#import "PBExamineInputTableViewCell.h"
|
#import "PBEditTimeTableViewCell.h"
|
#import "PBListTableViewCell.h"
|
#import "PBCheckViewController.h"
|
#import "PBRoleModel.h"
|
#import "PBEditTextController.h"
|
#import "PBEditPersonView.h"
|
#import "PBEditTimeView.h"
|
#import "PBProjectModel.h"
|
#import "PBPersonModel.h"
|
#import "PBArtifactsViewController.h"
|
#import "PBComponentHierarchyView.h"
|
#import "PBTextInputTableViewCell.h"
|
#import "PBTopTitleTableViewCell.h"
|
#import "PBTimeChooseTableViewCell.h"
|
#import "PBPersonChooseTableViewCell.h"
|
#import "PBArtifactsListTableViewCell.h"
|
#import "MSSAutoresizeLabelFlow.h"
|
#import "PBRecordViewController.h"
|
#import "PBPersonListViewController.h"
|
#import "PBSelectedPersonController.h"
|
#import "PBEAddImageView.h"
|
#import "PBCheckHeaderView.h"
|
#import "PBVideoPlayViewController.h"
|
static NSString *const inputCellID = @"InputCellID";
|
static NSString *const titleCellID = @"titleCellID";
|
static NSString *const timeChooseCellID = @"timeChooseCellID";
|
static NSString *const personCellID = @"personCellID";
|
static NSString *const listCellID = @"listCellID";
|
|
@interface PBCheckTaskViewController ()<UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate>
|
@property (nonatomic, strong) UITableView *tableView;
|
@property (nonatomic, strong) NSMutableArray<PBExamineAddModel *> *dataListM;
|
@property (nonatomic, strong) NSDictionary *examinDetailDic;
|
@property (nonatomic, strong) PBRoleModel *roleModel;
|
@property (nonatomic, assign) BOOL isEdit;
|
@property (nonatomic, strong) PBEditPersonView *editPersonView;
|
@property (nonatomic, strong) PBEditTimeView *editTimeView;;
|
@property (nonatomic, weak) UIButton *typeListBtn;
|
@property (nonatomic, strong) NSDictionary *typeDict;
|
@property (nonatomic, strong) PBComponentHierarchyView *componentHierarchyView;
|
@property (nonatomic, strong) UIView *backgroundView;
|
@property (nonatomic, strong) UIView *typeBackView;
|
@property (nonatomic, strong) MSSAutoresizeLabelFlow *typeListRecordV;
|
@property (nonatomic, assign) BOOL isCheck;
|
@property (nonatomic, strong) PBCheckHeaderView *tableheaderView1;
|
@end
|
|
@implementation PBCheckTaskViewController
|
|
- (void)viewWillAppear:(BOOL)animated {
|
[super viewWillAppear:animated];
|
self.isCheck = NO;
|
// [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
|
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.f) {
|
self.edgesForExtendedLayout = UIRectEdgeNone;
|
self.navigationController.interactivePopGestureRecognizer.enabled = NO; //让rootView禁止滑动
|
}
|
}
|
- (void)viewDidLoad {
|
[super viewDidLoad];
|
[PBNoteCenter addObserver:self selector:@selector(updateArtifacts:) name:PBNoteCenterUpdateArtifacts object:nil];
|
[PBNoteCenter addObserver:self selector:@selector(updatePerson:) name:PBNoteCenterUpdatePerson object:nil];
|
[self setupNav];
|
[self loadData];
|
[self loadRelevantData];
|
}
|
|
- (void)updateArtifacts:(NSNotification *)noti {
|
PBExamineAddModel *examineAddModel = self.dataListM[6];
|
examineAddModel.dataArr = noti.object;
|
NSIndexPath *path = [NSIndexPath indexPathForRow:6 inSection:0];
|
[self.tableView reloadRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationFade];
|
}
|
- (void)updatePerson:(NSNotification *)noti {
|
if (self.isCheck) {
|
return;
|
}
|
PBExamineAddModel *examineAddModel = self.dataListM[4];
|
PBPersonModel *originalPersonModel = examineAddModel.personArr[0];
|
examineAddModel.personArr = noti.object;
|
NSIndexPath *path = [NSIndexPath indexPathForRow:4 inSection:0];
|
if (examineAddModel.personArr.count > 0) {
|
PBPersonModel *personModel = examineAddModel.personArr[0];
|
if ([personModel.UserId isEqualToString:originalPersonModel.UserId]) {
|
return;
|
}
|
[self ModifyMissionCheckerWithUserId:personModel.UserId andIndexPath:path andPersonModel:originalPersonModel];
|
}
|
}
|
- (void)setupNav {
|
self.view.backgroundColor = [UIColor whiteColor];
|
NSString *btnTitle = @"-";
|
if (self.typeArr.count > 0) {
|
self.typeDict = self.typeArr[0];
|
btnTitle = [NSString stringWithFormat:@"%@ ⋁",[self.typeDict valueForKey:@"aedt_name"]];
|
}
|
UIButton *typeListBtn = [[UIButton alloc] init];
|
[typeListBtn setTitle:btnTitle forState:UIControlStateNormal];
|
[typeListBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
|
[typeListBtn setTitleColor:PBColor(169, 176, 185) forState:UIControlStateDisabled];
|
[typeListBtn addTarget:self action:@selector(typeListShow) forControlEvents:UIControlEventTouchUpInside];
|
self.typeListBtn = typeListBtn;
|
self.navigationItem.titleView = typeListBtn;
|
UIBarButtonItem *backNavItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Doc_preview_back"] style:UIBarButtonItemStylePlain target:self action:@selector(backItemAction)];
|
self.navigationItem.leftBarButtonItem = backNavItem;
|
UIBarButtonItem *stateNavItem = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:self action:nil];
|
[stateNavItem setImage:[[UIImage imageNamed:@""] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
[stateNavItem setImageInsets:UIEdgeInsetsMake(0, 20, 0, -20)];
|
self.navigationItem.rightBarButtonItem = stateNavItem;
|
}
|
- (void)backItemAction {
|
[self.navigationController popViewControllerAnimated:YES];
|
}
|
- (void)loadData {
|
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"examineAdd3" ofType:@"plist"];
|
NSArray *list = [NSArray arrayWithContentsOfFile:plistPath];
|
NSMutableArray *listM = [[NSMutableArray alloc] init];
|
for (NSInteger i = 0; i < list.count; i++) {
|
NSDictionary *dict = list[i];
|
PBExamineAddModel *model = [PBExamineAddModel yy_modelWithDictionary:dict];
|
model.isAddExamine = YES;
|
// model.isIssueManage = self.isIssueManage;
|
|
[listM addObject:model];
|
}
|
self.dataListM = listM;
|
}
|
#pragma mark - 加载检查相关数据
|
- (void)loadRelevantData {
|
[YJProgressHUD showProgress:@"" inView:self.view];
|
[[PBNetworkTools sharedTools] RequestGetItemWithExamineID:self.examineListModel.ExamineID andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) {
|
if (error) {
|
[YJProgressHUD showMessage:@"加载详情失败" inView:self.view];
|
return;
|
}
|
NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
NSLog(@"%@",str);
|
PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str];
|
if (networkModel.Ret == 1) {
|
self.examinDetailDic = networkModel.Data;
|
self.roleModel = [PBRoleModel yy_modelWithDictionary:networkModel.Data];
|
[self collatingDetailedData];
|
}else {
|
[YJProgressHUD showMessage:networkModel.Msg inView:self.view];
|
}
|
}];
|
}
|
- (void)collatingDetailedData {
|
for (PBExamineAddModel *examineAddModel in self.dataListM) {
|
if ([examineAddModel.cellType isEqualToString:@"time"] || [examineAddModel.cellType isEqualToString:@"input"]){
|
NSString *dataStr = [self.examinDetailDic valueForKey:examineAddModel.key];
|
if ([dataStr isKindOfClass:[NSNull class]]) {
|
examineAddModel.dataStr = nil;
|
}else {
|
if ([examineAddModel.cellType isEqualToString:@"time"]) {
|
NSRange range = [dataStr rangeOfString:@"T"];
|
dataStr = [dataStr substringToIndex:range.location];
|
|
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
//需要设置为和字符串相同的格式
|
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
|
NSDate *localDate = [dateFormatter dateFromString:dataStr];
|
NSDateFormatter *dateFormat1 = [[NSDateFormatter alloc] init];
|
[dateFormat1 setDateFormat:@"yyyy年M月d日"];
|
NSString *timeStr = [dateFormat1 stringFromDate:localDate];
|
examineAddModel.dataStr = timeStr;
|
}else {
|
examineAddModel.dataStr = dataStr;
|
}
|
}
|
}else if ([examineAddModel.cellType isEqualToString:@"list"]) {
|
examineAddModel.dataArr = [self.examinDetailDic valueForKey:examineAddModel.key];
|
}else if ([examineAddModel.cellType isEqualToString:@"person"]) {
|
PBPersonModel *personModel = [[PBPersonModel alloc] init];
|
personModel.RealName = [self.examinDetailDic valueForKey:examineAddModel.key];
|
examineAddModel.personArr = @[personModel];
|
}else if ([examineAddModel.cellType isEqualToString:@"choose"]) {
|
NSDictionary *dict = @{@"aedt_name" : [self.examinDetailDic valueForKey:examineAddModel.key], @"aedt_guid" : @""};
|
examineAddModel.dataDict = dict;
|
self.typeDict = dict;
|
}
|
}
|
[self setupUI];
|
}
|
- (void)setupUI {
|
__weak typeof(self) weakSelf = self;
|
NSString *btnTitle = [NSString stringWithFormat:@"%@ ⋁",[self.typeDict valueForKey:@"aedt_name"]];
|
[self.typeListBtn setTitle:btnTitle forState:UIControlStateNormal];
|
NSString *result = [self.examinDetailDic valueForKey:@"ExamineResult"];
|
NSString *flagStr = [result substringToIndex:1];
|
UIImage *image;
|
if ([flagStr isEqualToString:@"A"]) {
|
image = [UIImage imageNamed:@"Rectify_ check"];
|
}else if ([flagStr isEqualToString:@"B"]) {
|
image = [UIImage imageNamed:@"Rectify_ rectification"];
|
}else if ([flagStr isEqualToString:@"C"]) {
|
image = [UIImage imageNamed:@"Rectify_ acceptance"];
|
}else if ([flagStr isEqualToString:@"D"]) {
|
image = [UIImage imageNamed:@"Rectify_ qualified"];
|
}else {
|
image = [UIImage imageNamed:@""];
|
}
|
[self.navigationItem.rightBarButtonItem setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
|
self.view.backgroundColor = PBColor(244, 245, 246);
|
// UIView *bgView = [[UIView alloc] init];
|
// bgView.backgroundColor = PBColor(244, 245, 246);
|
// [self.view addSubview:bgView];
|
// [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
// make.top.equalTo(self.view).offset(70);
|
// make.left.right.bottom.equalTo(self.view);
|
// }];
|
// __weak typeof(self) weakSelf = self;
|
self.tableView = [[UITableView alloc] init];
|
self.tableView.backgroundColor = PBColor(244, 245, 246);
|
self.tableView.dataSource = self;
|
self.tableView.delegate = self;
|
self.tableView.bounces = NO;
|
self.tableView.rowHeight = UITableViewAutomaticDimension;
|
self.tableView.estimatedRowHeight = 100.f;
|
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
|
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
|
[self.tableView registerClass:[PBTextInputTableViewCell class] forCellReuseIdentifier:inputCellID];
|
[self.tableView registerClass:[PBTopTitleTableViewCell class] forCellReuseIdentifier:titleCellID];
|
[self.tableView registerClass:[PBTimeChooseTableViewCell class] forCellReuseIdentifier:timeChooseCellID];
|
[self.tableView registerClass:[PBPersonChooseTableViewCell class] forCellReuseIdentifier:personCellID];
|
[self.tableView registerClass:[PBArtifactsListTableViewCell class] forCellReuseIdentifier:listCellID];
|
[self.view addSubview:self.tableView];
|
CGFloat bottomH = 64.f;
|
if (IS_IPHONE_X) {
|
bottomH = 64.f + IPHONE_X_BOTTOM;
|
}
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(self.view);
|
make.left.equalTo(self.view).offset(10);
|
make.right.equalTo(self.view).offset(-10);
|
make.bottom.equalTo(self.view).offset(-(bottomH));
|
}];
|
//设置图片 如有有图片 显
|
NSArray *imageArr = [self.examinDetailDic valueForKey:@"imges"];
|
if (imageArr.count > 0) {
|
// self.tableheaderView = [[PBEAddImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 100)];
|
//// self.tableheaderView.ChooseImageBlock = ^{
|
//// [weakSelf.view endEditing:YES];
|
//// [weakSelf takePhotoLibrary];
|
//// };
|
//// self.tableheaderView.DeleteImageBlock = ^(NSInteger index) {
|
//// [weakSelf.selectedPhotos removeObjectAtIndex:index];
|
//// [weakSelf.selectAssetArr removeObjectAtIndex:index];
|
//// [weakSelf setTableHeaderViewImage];
|
//// };
|
//
|
// self.tableheaderView.projectModel = self.projectModel;
|
// self.tableheaderView.isAddExamine = NO;
|
// self.tableheaderView.detailsImageArr = imageArr;
|
self.tableheaderView1 = [[PBCheckHeaderView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 100)];
|
self.tableheaderView1.PlayVideoUrlBlock = ^(NSString * _Nonnull url) {
|
[weakSelf.view endEditing:YES];
|
NSLog(@"打开视频");
|
PBVideoPlayViewController *playVC = [[PBVideoPlayViewController alloc] init];
|
playVC.url = url;
|
[weakSelf.navigationController pushViewController:playVC animated:YES];
|
};
|
self.tableheaderView1.projectModel = self.projectModel;
|
self.tableheaderView1.isAddExamine = NO;
|
self.tableheaderView1.detailsImageArr = imageArr;
|
self.tableView.tableHeaderView = self.tableheaderView1;
|
}
|
|
|
UIButton *recordBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"recording"]];
|
[recordBtn addTarget:self action:@selector(recordAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.view addSubview:recordBtn];
|
[recordBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(self.tableView.mas_bottom).offset(15);
|
make.left.equalTo(self.view).offset(20);
|
make.size.mas_equalTo(CGSizeMake(93, 24));
|
}];
|
|
UIButton *checkBtn = [[UIButton alloc] init];
|
[checkBtn setImage:[UIImage imageNamed:@"inspect_disable"] forState:UIControlStateDisabled];
|
[checkBtn setImage:[UIImage imageNamed:@"inspect"] forState:UIControlStateNormal];
|
[checkBtn addTarget:self action:@selector(checkAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.view addSubview:checkBtn];
|
[checkBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(self.tableView.mas_bottom).offset(10);
|
make.right.equalTo(self.view).offset(-10);
|
make.size.mas_equalTo(CGSizeMake(100, 34));
|
}];
|
if (self.roleModel.User_IsChecker) {
|
checkBtn.enabled = YES;
|
}else {
|
checkBtn.enabled = NO;
|
}
|
}
|
#pragma mark - 流转记录
|
- (void)recordAction {
|
PBRecordViewController *recordVC = [[PBRecordViewController alloc] init];
|
recordVC.examineListModel = self.examineListModel;
|
recordVC.examineDetailDic = self.examinDetailDic;
|
recordVC.projectModel = self.projectModel;
|
recordVC.roleModel = self.roleModel;
|
// recordVC.recordListM = [[self.examinDetailDic valueForKey:@"RecordWithAttachments"] mutableCopy];
|
[self.navigationController pushViewController:recordVC animated:YES];
|
}
|
#pragma mark - 检查方法
|
- (void)checkAction {
|
self.isCheck = YES;
|
PBCheckViewController *checkVC = [[PBCheckViewController alloc] init];
|
checkVC.examineListModel = self.examineListModel;
|
checkVC.projectModel = self.projectModel;
|
checkVC.levelArr = self.levelArr;
|
checkVC.stateArr = self.stateArr;
|
// checkVC.CkeckCompleteBlock = ^{
|
// [self.navigationController popViewControllerAnimated:NO];
|
// };
|
[self.navigationController pushViewController:checkVC animated:YES];
|
}
|
#pragma mark - UITableViewDataSource
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
return 8;
|
}
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
__weak typeof(self) weakSelf = self;
|
if (indexPath.row == 0) {
|
PBTextInputTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:inputCellID forIndexPath:indexPath];
|
PBExamineAddModel *examineAddModel = self.dataListM[indexPath.row];
|
cell.examineAddModel = examineAddModel;
|
NSString *originalStr = examineAddModel.dataStr;
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
cell.endEditBlock = ^(NSString * _Nonnull text) {
|
if ([text isEqualToString:originalStr]) {
|
return;
|
}
|
NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init];
|
[dictM setValue:text forKey:@"Title"];
|
[dictM setValue:@"1" forKey:@"modify_flag"];
|
[self ModifyMissionInfoWithData:dictM andIndexPath:indexPath andOriginalData:originalStr];
|
};
|
return cell;
|
} else if (indexPath.row == 1 || indexPath.row == 5) {
|
PBTopTitleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:titleCellID forIndexPath:indexPath];
|
PBExamineAddModel *examineAddModel = self.dataListM[indexPath.row];
|
cell.examineAddModel = examineAddModel;
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
return cell;
|
}else if (indexPath.row == 2 || indexPath.row == 3) {
|
PBTimeChooseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:timeChooseCellID forIndexPath:indexPath];
|
PBExamineAddModel *examineAddModel = self.dataListM[indexPath.row];
|
cell.examineAddModel = examineAddModel;
|
NSString *originalStr = examineAddModel.dataStr;
|
// cell.ChooseBlock = ^{
|
// [self.view endEditing:YES];
|
// [PBKeyWindow addSubview:self.editTimeView];
|
// self.editTimeView.examineAddModel = self.dataListM[indexPath.row];
|
// self.editTimeView.ChooseCompleteBlock = ^(BOOL isSelsected){
|
// if (isSelsected) {
|
// if ([examineAddModel.dataStr isEqualToString:originalStr]) {
|
// return;
|
// }
|
// NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init];
|
// if (indexPath.row == 2) {
|
// [dictM setValue:examineAddModel.dataStr forKey:@"BeginTimeStr"];
|
// }else {
|
// [dictM setValue:examineAddModel.dataStr forKey:@"EndTimeStr"];
|
// }
|
// [dictM setValue:@"2" forKey:@"modify_flag"];
|
// [weakSelf ModifyMissionInfoWithData:dictM andIndexPath:indexPath andOriginalData:originalStr];
|
// }
|
// };
|
// [self.editTimeView show];
|
// };
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
return cell;
|
}else if (indexPath.row == 4) {
|
PBPersonChooseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:personCellID forIndexPath:indexPath];
|
PBExamineAddModel *examineAddModel = self.dataListM[indexPath.row];
|
cell.examineAddModel = examineAddModel;
|
// cell.ChooseBlock = ^{
|
// [self.view endEditing:YES];
|
// PBPersonListViewController *personListVC = [[PBPersonListViewController alloc] init];
|
// personListVC.projectModel = self.projectModel;
|
// personListVC.isMultiSelect = NO;
|
// personListVC.selectList = examineAddModel.personArr.mutableCopy;
|
// [self.navigationController pushViewController:personListVC animated:YES];
|
// };
|
cell.LookAllBlock = ^{
|
PBSelectedPersonController *selectedPersonVC = [[PBSelectedPersonController alloc] init];
|
selectedPersonVC.selectList = examineAddModel.personArr.mutableCopy;
|
[self.navigationController pushViewController:selectedPersonVC animated:YES];
|
};
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
return cell;
|
}else if (indexPath.row == 6 || indexPath.row == 7) {
|
PBArtifactsListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:listCellID forIndexPath:indexPath];
|
PBExamineAddModel *examineAddModel = self.dataListM[indexPath.row];
|
cell.examineAddModel = examineAddModel;
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
cell.ChooseBlock = ^{
|
[self.view endEditing:YES];
|
if (indexPath.row == 6 || indexPath.row == 7) {
|
return;
|
}
|
PBArtifactsViewController *artifactsVC = [[PBArtifactsViewController alloc] init];
|
artifactsVC.examineAddModel = examineAddModel;
|
artifactsVC.projectModel = self.projectModel;
|
[self.navigationController pushViewController:artifactsVC animated:YES];
|
};
|
if (indexPath.row == 6) {
|
[self.view endEditing:YES];
|
cell.ToViewBlock = ^(NSInteger index) {
|
NSLog(@"查看模型========");
|
NSDictionary *dict = examineAddModel.dataArr[index];
|
[self getCategoryArrayByBmGuidWithGuid:[dict valueForKey:@"bm_guid"]];
|
};
|
}
|
return cell;
|
}else {
|
return nil;
|
}
|
}
|
|
- (void)getCategoryArrayByBmGuidWithGuid:(NSString *)guid {
|
[YJProgressHUD showProgress:@"" inView:self.view];
|
[[PBNetworkTools sharedTools] GetCategoryArrayByBmGuidWithGuid:guid andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) {
|
if (error) {
|
NSLog(@"%@",error);
|
[YJProgressHUD showMessage:@"修改失败" inView:self.view];
|
return;
|
}
|
NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
NSLog(@"%@",str);
|
PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str];
|
if (networkModel.Ret == 1) {
|
[YJProgressHUD hide];
|
[PBKeyWindow addSubview:self.componentHierarchyView];
|
self.componentHierarchyView.dataArr = networkModel.Data;
|
[self.componentHierarchyView show];
|
}else {
|
[YJProgressHUD showMessage:networkModel.Msg inView:self.view];
|
}
|
|
}];
|
}
|
- (void)ModifyMissionInfoWithData:(NSMutableDictionary *)dictM andIndexPath:(NSIndexPath *)indexPath andOriginalData:(NSString *)data {
|
[dictM setValue:self.examineListModel.ExamineID forKey:@"ExamineID"];
|
[dictM setValue:self.projectModel.organizeid forKey:@"OrganizeId"];
|
[YJProgressHUD showProgress:@"" inView:self.view];
|
[[PBNetworkTools sharedTools] ModifyMissionInfoWithDictM:dictM andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) {
|
if (error) {
|
[YJProgressHUD showMessage:@"保存失败" inView:self.view];
|
NSLog(@"%@",error);
|
}
|
NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
NSLog(@"%@",str);
|
PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str];
|
if (networkModel.Ret == 1) {
|
[YJProgressHUD showMessage:@"修改成功" inView:self.view];
|
if (indexPath) {
|
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
|
}else {
|
PBExamineAddModel *examineAddModel = self.dataListM[8];
|
self.typeDict = examineAddModel.dataDict;
|
NSString *btnTitle = [NSString stringWithFormat:@"%@ ⋁",[self.typeDict valueForKey:@"aedt_name"]];
|
[self.typeListBtn setTitle:btnTitle forState:UIControlStateNormal];
|
}
|
}else {
|
[YJProgressHUD showMessage:networkModel.Msg inView:self.view];
|
if (indexPath.row == 0 || indexPath.row == 2 || indexPath.row == 3) {
|
PBExamineAddModel *examineAddModel = self.dataListM[indexPath.row];
|
examineAddModel.dataStr = data;
|
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
|
}
|
}
|
}];
|
}
|
- (void)ModifyMissionCheckerWithUserId:(NSString *)userId andIndexPath:(NSIndexPath *)indexPath andPersonModel:(PBPersonModel *)personModel {
|
[YJProgressHUD showProgress:@"" inView:self.view];
|
[[PBNetworkTools sharedTools] ModifyMissionCheckerWithExamineID:self.examineListModel.ExamineID andOrganizeId:self.projectModel.organizeid andCheckerUserId:userId andCallBack:^(NSURLSessionDataTask *task, id response, NSError *error) {
|
if (error) {
|
[YJProgressHUD showMessage:@"保存失败" inView:self.view];
|
NSLog(@"%@",error);
|
}
|
NSString *str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
NSLog(@"%@",str);
|
PBNetworkModel *networkModel = [PBNetworkModel yy_modelWithJSON:str];
|
if (networkModel.Ret == 1) {
|
[YJProgressHUD showMessage:@"修改成功" inView:self.view];
|
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
|
}else {
|
[YJProgressHUD showMessage:networkModel.Msg inView:self.view];
|
PBExamineAddModel *examineAddModel = self.dataListM[indexPath.row];
|
examineAddModel.personArr = @[personModel];
|
}
|
}];
|
}
|
|
- (void)setProjectModel:(PBProjectModel *)projectModel {
|
_projectModel = projectModel;
|
}
|
- (void)setIsAddExamine:(BOOL)isAddExamine {
|
_isAddExamine = isAddExamine;
|
}
|
|
- (void)setExamineListModel:(PBExamineListModel *)examineListModel {
|
_examineListModel = examineListModel;
|
if ([examineListModel.ExaminerID isEqualToString:UserID]) {
|
self.isEdit = YES;
|
}else {
|
self.isEdit = NO;
|
}
|
}
|
- (PBEditTimeView *)editTimeView {
|
if (_editTimeView == nil) {
|
_editTimeView = [[PBEditTimeView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
_editTimeView.visualViewHeight = 300;
|
}
|
return _editTimeView;
|
}
|
- (PBEditPersonView *)editPersonView {
|
if (_editPersonView == nil) {
|
_editPersonView = [[PBEditPersonView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
_editPersonView.isChooseOne = YES;
|
CGFloat bottomH = 0.f;
|
if (IS_IPHONE_X) {
|
bottomH = 34.f;
|
}
|
_editPersonView.visualViewHeight = 468.f + bottomH;
|
_editPersonView.isExamineChoose = YES;
|
}
|
return _editPersonView;
|
}
|
- (void)dealloc {
|
[PBNoteCenter removeObserver:self];
|
}
|
|
- (void)setStateArr:(NSArray *)stateArr {
|
_stateArr = stateArr;
|
}
|
- (void)setLevelArr:(NSArray *)levelArr {
|
_levelArr = levelArr;
|
}
|
- (void)setTypeArr:(NSArray *)typeArr {
|
_typeArr = typeArr;
|
}
|
- (PBComponentHierarchyView *)componentHierarchyView {
|
if (_componentHierarchyView == nil) {
|
_componentHierarchyView = [[PBComponentHierarchyView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
CGFloat bottomH = 0.f;
|
if (IS_IPHONE_X) {
|
bottomH = 34.f;
|
}
|
_componentHierarchyView.visualViewHeight = 214.f + bottomH;
|
}
|
return _componentHierarchyView;
|
}
|
- (void)backTapped:(UITapGestureRecognizer *)sender {
|
[self hideDropDown];
|
}
|
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
|
// if ([NSStringFromClass([touch.view class]) isEqualToString:@"MSSAutoresizeLabelFlow"]) {
|
// return NO;
|
// } else {
|
// return YES;
|
// }
|
if (touch.view == self.backgroundView) {
|
return YES;
|
} else {
|
return NO;
|
}
|
}
|
- (void)typeListShow {
|
if (self.typeArr.count <= 0) {
|
[YJProgressHUD showMessage:@"没有类型相关数据" inView:self.view];
|
return;
|
}
|
[self.view addSubview:self.backgroundView];
|
[self.backgroundView addSubview:self.typeBackView];
|
[self.typeBackView circleViewWithRadius:6];
|
[self.typeBackView addSubview:self.typeListRecordV];
|
[UIView animateWithDuration:0.5 animations:^{
|
self.typeBackView.frame = CGRectMake(0, 0, PBScreenWidth, 176);
|
self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
|
}completion:^(BOOL finished) {
|
// self->_isShow = YES;
|
|
}];
|
self.typeListBtn.enabled = NO;
|
self.navigationItem.leftBarButtonItem.enabled = NO;
|
}
|
- (void)hideDropDown{
|
[UIView animateWithDuration:0.5 animations:^{
|
self.typeBackView.frame = CGRectMake(0, -176, PBScreenWidth, 176);
|
self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
|
}completion:^(BOOL finished) {
|
[self.backgroundView removeFromSuperview];
|
[self.typeBackView removeFromSuperview];
|
[self.typeListRecordV removeFromSuperview];
|
// self->_isShow = NO;
|
}];
|
self.typeListBtn.enabled = YES;
|
self.navigationItem.leftBarButtonItem.enabled = YES;
|
}
|
- (UIView *)backgroundView {
|
if (_backgroundView == nil) {
|
_backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0 , 0, PBScreenWidth, self.view.height)];
|
_backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
|
[_backgroundView setOpaque:NO];
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backTapped:)];
|
tap.delegate = self;
|
[_backgroundView addGestureRecognizer:tap];
|
}
|
return _backgroundView;
|
}
|
- (MSSAutoresizeLabelFlow *)typeListRecordV {
|
NSMutableArray *arrM = [[NSMutableArray alloc] init];
|
for (NSInteger i = 0; i < self.typeArr.count; i++) {
|
NSString *str = [self.typeArr[i] valueForKey:@"aedt_name"];
|
[arrM addObject:str];
|
}
|
NSArray *array = arrM.copy;
|
if (_typeListRecordV == nil) {
|
_typeListRecordV = [[MSSAutoresizeLabelFlow alloc] initWithFrame:CGRectMake(0, 25, PBScreenWidth, 126) titles:array selectedHandler:^(NSUInteger index, NSString *title) {
|
__weak typeof(self) weakSelf = self;
|
NSDictionary *typeDic = self.typeArr[index];
|
NSString *guidStr = [typeDic valueForKey:@"aedt_guid"];
|
NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init];
|
[dictM setValue:guidStr forKey:@"aedt_guid"];
|
[dictM setValue:@"3" forKey:@"modify_flag"];
|
PBExamineAddModel *examineAddModel = self.dataListM[8];
|
examineAddModel.dataDict = typeDic;
|
[weakSelf ModifyMissionInfoWithData:dictM andIndexPath:nil andOriginalData:nil];
|
[self hideDropDown];
|
}];
|
}
|
return _typeListRecordV;
|
}
|
- (UIView *)typeBackView {
|
if (_typeBackView == nil) {
|
_typeBackView = [[UIView alloc] initWithFrame:CGRectMake(0, -176, PBScreenWidth, 176)];
|
_typeBackView.backgroundColor = [UIColor whiteColor];
|
}
|
return _typeBackView;
|
}
|
/*
|
#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
|