Commit 2370cb39 authored by Sandy's avatar Sandy

1.许可证审批状态增加“申请审批” 。

2.中级审批权可以审批对应级别的许可证。
3.增加申请审批权限控制
parent 58bceca3
[
[
{
"id": "10",
"name": "系统管理",
......@@ -460,4 +460,4 @@
}
]
}
]
\ No newline at end of file
]
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--Business View Controller-->
......
......@@ -6,18 +6,18 @@
// Copyright © 2015年 free. All rights reserved.
//
#import "GTOLicenceCheckListViewController.h"
#import "GTOLicenceListCellContentView.h"
#import "GTOAlertInfoLicenceViewController.h"
#import "GTODisplayResult.h"
#import "GTOLicence.h"
#import "SortMaskView.h"
#import "MJRefresh.h"
#import "GTOLicenceCheckBoltView.h"
#import "QueryOrderNew.h"
#import "GTOAlertInfoLicenceViewController.h"
#import "GTOLicenceCheckListViewController.h"
#import "GTOLicenceListCellContentView.h"
#import "GTOLiceneResultViewController.h"
#import "GTODisplayResult.h"
#import "GTOQuestionManager.h"
#import "GTOPioneeringSurveyItem.h"
#import "GTOQuestionManager.h"
#import "MJRefresh.h"
#import "QueryOrderNew.h"
#import "SortMaskView.h"
#import "GTOAnswer.h"
#import "GTOQuestion.h"
......@@ -34,8 +34,7 @@ typedef enum : NSUInteger {
} BtnTag;
static NSString *cellID = @"licenceListCell";
@interface GTOLicenceCheckListViewController ()<UITableViewDataSource,UITableViewDelegate,SortMaskViewDelegate,GTOLicenceCheckBoltViewDelegate,GTOAlertInfoLicenceViewControllerDelegate>
{
@interface GTOLicenceCheckListViewController () <UITableViewDataSource, UITableViewDelegate, SortMaskViewDelegate, GTOLicenceCheckBoltViewDelegate, GTOAlertInfoLicenceViewControllerDelegate> {
UIView *_maskView;
UIButton *currentBtn;
SortMaskView *_sortView;
......@@ -48,12 +47,12 @@ static NSString *cellID = @"licenceListCell";
NSInteger _currentPage;
}
@property (nonatomic,strong)NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *dataArr;
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic,strong)NSString *billNumberLike;
@property (nonatomic,strong)NSString *riskGrade;
@property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序)
@property (nonatomic, strong) NSString *billNumberLike;
@property (nonatomic, strong) NSString *riskGrade;
@property (nonatomic, strong) NSString *orderDirection;// asc(升序),desc(降序)
@property (nonatomic, strong) GTOAlertInfoLicenceViewController *alertInfoVC;
@property (nonatomic, assign) BOOL d_isClosed; //点击弹框的“关闭”按钮
@property (nonatomic, strong) GTOLicence *d_currentLicence;//当前点击的列表的cell
......@@ -61,7 +60,8 @@ static NSString *cellID = @"licenceListCell";
@implementation GTOLicenceCheckListViewController
- (void)viewDidLoad {
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"许可证审批列表";
self.view.backgroundColor = XXFBgColor;
......@@ -70,27 +70,26 @@ static NSString *cellID = @"licenceListCell";
[self createTableView];
[self createRefresh];
[self getData];
}
- (void)viewWillAppear:(BOOL)animated{
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self getData];
}
- (void)initData{
- (void)initData
{
self.dataArr = [NSMutableArray array];
// if (self.assessorVendor.length > 0) {
// self.vendorLike = self.assessorVendor;
// }
}
- (void)getData{
- (void)getData
{
// [ICRUserUtil sharedInstance].needFresh = NO;
__weak typeof(self)weakSelf = self;
void(^succ)(id) = ^(id data) {
__weak typeof(self) weakSelf = self;
void (^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
__strong __typeof(weakSelf) strongSelf = weakSelf;
[strongSelf fetchtPuchaseList:data];
};
void(^fail)(id) = ^(id data) {
void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
......@@ -98,7 +97,7 @@ static NSString *cellID = @"licenceListCell";
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
//排序条件
NSMutableArray *orderArr =[NSMutableArray array];
NSMutableArray *orderArr = [NSMutableArray array];
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrderNew *order = [QueryOrderNew new];
order.field = @"billnumber";
......@@ -110,59 +109,58 @@ static NSString *cellID = @"licenceListCell";
order.field = @"lastModify_time";
order.direction = @"desc";
[orderArr addObject:[order dictForCommit]];
}
// //筛选条件
// id stateObject = [NSNull null];
// if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
// stateObject = self.state;
// }
// //筛选条件
// id stateObject = [NSNull null];
// if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
// stateObject = self.state;
// }
id billNumberObject = [NSNull null];
if (self.billNumberLike.length > 0) {
billNumberObject = self.billNumberLike;
}
// id repairNumberObject = [NSNull null];
// if (self.repairNumberLike.length > 0) {
// repairNumberObject = self.repairNumberLike;
// }
// id repairNumberObject = [NSNull null];
// if (self.repairNumberLike.length > 0) {
// repairNumberObject = self.repairNumberLike;
// }
id riskGradeObject = [NSNull null];
if (self.riskGrade.length > 0 && ![self.riskGrade isEqualToString:@"none"]) {
riskGradeObject = self.riskGrade;
}
NSDictionary *dict = @{
@"userUuid":userUtil.f_user_uuid,
@"billNumberLike":billNumberObject,
@"state":GTO_LICENCE__STATE_SUBMITTED,
@"repairUuid":@"",
@"repairNumberLike":[NSNull null],//repairNumberObject,
@"riskGrade":riskGradeObject,
@"queryOrders":orderArr,
@"pageNumber":@(_currentPage),
@"pageSize":@(20)};
@"userUuid" : userUtil.f_user_uuid,
@"billNumberLike" : billNumberObject,
@"state" : [NSNull null],
@"repairUuid" : @"",
@"repairNumberLike" : [NSNull null],// repairNumberObject,
@"riskGrade" : riskGradeObject,
@"queryOrders" : orderArr,
@"pageNumber" : @(_currentPage),
@"pageSize" : @(20)
};
ICRHTTPController *httpC = [ICRHTTPController sharedController];
[httpC getLicenceListWithData:dict success:succ failure:fail];
}
- (void)fetchtPuchaseList:(id)data{
- (void)fetchtPuchaseList:(id)data
{
if (data) {
NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ;
NSString *message = data[@"message"];
if (success == 1) {
if (_currentPage == 0) {
if (self.dataArr.count > 0) {
[self.dataArr removeAllObjects];
}
}
NSArray *recodesArr = data[ @"data" ][ @"records" ];
NSArray *recodesArr = data[@"data"][@"records"];
for (NSDictionary *dictRepair in recodesArr) {
GTOLicence *licence = [GTOLicence DBObject];
[licence praseFromJsonDict:dictRepair];
[self.dataArr addObject:licence];
}
NSDictionary *pageDict = data[ @"data" ][ @"paging" ];
NSDictionary *pageDict = data[@"data"][@"paging"];
NSInteger pageCount = [pageDict[@"pageCount"] integerValue];
[self.tableView reloadData];
[self endRefreshing];
......@@ -172,19 +170,18 @@ static NSString *cellID = @"licenceListCell";
if (_currentPage == 0 && self.dataArr.count > 0) {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}else{
} else {
[IBTLoadingView showTips:message];
}
}else{
} else {
[IBTLoadingView showTips:@" 无记录 "];
}
}
- (void)createRefresh{
- (void)createRefresh
{
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
if (_isRefresh) {
return ;
return;
}
_isRefresh = YES;
_currentPage = 0;
......@@ -194,15 +191,16 @@ static NSString *cellID = @"licenceListCell";
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (_isLoadMore) {
return ;
return;
}
_isLoadMore = YES;
_currentPage ++;
_currentPage++;
[self getData];
} ];
}];
}
#pragma mark - 结束刷新
- (void)endRefreshing{
- (void)endRefreshing
{
_isLoadMore = NO;
_isRefresh = NO;
[self.tableView.header endRefreshing];
......@@ -210,50 +208,69 @@ static NSString *cellID = @"licenceListCell";
}
- (void)createTableView
{
_sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
_sureBtn = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
self.navigationItem.rightBarButtonItem = _sureBtn;
_sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil];
_sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight)
target:self
sel:@selector(sortClick:)
tag:SortTag
image:@"black_arrow_down_with_text"
title:nil
titleColor:GXF_DETAIL_COLOR
isCorner:NO
corner:0
bgColor:nil];
_sortBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_sortBtn];
_boltBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(ScreenSize.width-BtnWidth - LeftMargin,10,BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:BoltTag image:@"black_filter_with_text" title:nil titleColor:GXF_DETAIL_COLOR isCorner:NO corner:0 bgColor:nil];
_boltBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(ScreenSize.width - BtnWidth - LeftMargin, 10, BtnWidth, BtnHeight)
target:self
sel:@selector(sortClick:)
tag:BoltTag
image:@"black_filter_with_text"
title:nil
titleColor:GXF_DETAIL_COLOR
isCorner:NO
corner:0
bgColor:nil];
_boltBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_boltBtn];
self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
self.tableView = [[UITableView alloc] initWithFrame:(CGRectMake(0, TopMargin, ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellID];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.tableFooterView = [UIView new];
[self.view addSubview:self.tableView];
_maskView = [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, ScreenSize.height - 64- TopMargin)];
_maskView = [[UIView alloc] initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, ScreenSize.height - 64 - TopMargin)];
_maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
_maskView.hidden = YES;
[self.view addSubview:_maskView];
}
#pragma mark -按钮事件
- (void)sortClick:(UIButton *)btn{
- (void)sortClick:(UIButton *)btn
{
_maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
_maskView.hidden = NO;
if (btn.tag == SortTag) {
if(_boltView){
if (_boltView) {
[self hiddenBoltMaskView:NO];
}
if (currentBtn == btn) {
[btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
[self hiddenSortMaskView:YES];
currentBtn = nil;
}else{
} else {
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) {
_sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 150) withOrderDirection:self.orderDirection];
_sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序",@"按时间逆序",@"按时间顺序",nil];
_sortView = [[SortMaskView alloc] initWithFrame:CGRectMake(0, -105, ScreenSize.width, 150) withOrderDirection:self.orderDirection];
_sortView.dataArr = [[NSMutableArray alloc] initWithObjects:@"默认排序", @"按时间逆序", @"按时间顺序", nil];
_sortView.delegate = self;
[_maskView addSubview:_sortView];
[UIView animateWithDuration:0.25 animations:^{
[UIView animateWithDuration:0.25
animations:^{
CGRect sortFrame = _sortView.frame;
sortFrame.origin.y = 0;
_sortView.frame = sortFrame;
......@@ -261,7 +278,7 @@ static NSString *cellID = @"licenceListCell";
}
currentBtn = btn;
}
}else if(btn.tag == BoltTag){
} else if (btn.tag == BoltTag) {
if (_sortView) {
[self hiddenSortMaskView:NO];
}
......@@ -270,18 +287,19 @@ static NSString *cellID = @"licenceListCell";
[self hiddenBoltMaskView:YES];
currentBtn = nil;
}else{
} else {
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
if (_boltView == nil) {
CGRect rect = CGRectMake(0, -105, ScreenSize.width, 274) ;
_boltView = [[GTOLicenceCheckBoltView alloc]initWithFrame:rect billNumber:self.billNumberLike riskGrade:self.riskGrade];
CGRect rect = CGRectMake(0, -105, ScreenSize.width, 274);
_boltView = [[GTOLicenceCheckBoltView alloc] initWithFrame:rect billNumber:self.billNumberLike riskGrade:self.riskGrade];
_boltView.backgroundColor = XXFBgColor;
_boltView.delegate = self;
// //initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"全部",GTO_LICENCE_RISK_HIGHT,GTO_LICENCE__RISK_MIDDLE,nil];
// //initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
_boltView.dataArr = [[NSMutableArray alloc] initWithObjects:@"全部", GTO_LICENCE_RISK_HIGHT, GTO_LICENCE__RISK_MIDDLE, nil];
[_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{
[UIView animateWithDuration:0.25
animations:^{
CGRect sortFrame = _boltView.frame;
sortFrame.origin.y = 0;
_boltView.frame = sortFrame;
......@@ -292,38 +310,44 @@ static NSString *cellID = @"licenceListCell";
}
}
- (void)hiddenSortMaskView:(BOOL)isHide{
- (void)hiddenSortMaskView:(BOOL)isHide
{
currentBtn = nil;
[self checkSortBtnColor];
if (isHide == NO) {
[_sortView removeFromSuperview];
_sortView = nil;
}else{
[UIView animateWithDuration:0.25 animations:^{
} else {
[UIView animateWithDuration:0.25
animations:^{
CGRect sortFrame = _sortView.frame;
sortFrame.origin.y = -105;
_sortView.frame = sortFrame;
_maskView.backgroundColor = RGBA(0, 0, 0, 0);
}completion:^(BOOL finished) {
}
completion:^(BOOL finished) {
[_sortView removeFromSuperview];
_sortView = nil;
_maskView.hidden = YES;
}];
}
}
- (void)hiddenBoltMaskView:(BOOL)isHide{
- (void)hiddenBoltMaskView:(BOOL)isHide
{
currentBtn = nil;
[self checkBoltBtnColor];
if (isHide == NO) {
[_boltView removeFromSuperview];
_boltView = nil;
}else{
[UIView animateWithDuration:0.25 animations:^{
} else {
[UIView animateWithDuration:0.25
animations:^{
CGRect sortFrame = _boltView.frame;
sortFrame.origin.y = -105;
_boltView.frame = sortFrame;
_maskView.backgroundColor = RGBA(0, 0, 0, 0);
}completion:^(BOOL finished) {
}
completion:^(BOOL finished) {
[_boltView removeFromSuperview];
_boltView = nil;
_maskView.hidden = YES;
......@@ -332,25 +356,26 @@ static NSString *cellID = @"licenceListCell";
}
//检测排序的颜色
- (void)checkSortBtnColor{
- (void)checkSortBtnColor
{
if (self.orderDirection.length > 0) {
[_sortBtn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
}else{
} else {
[_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
}
}
- (void)checkBoltBtnColor{
if ( self.billNumberLike.length > 0 || self.riskGrade.length > 0) {
- (void)checkBoltBtnColor
{
if (self.billNumberLike.length > 0 || self.riskGrade.length > 0) {
[_boltBtn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
}else{
} else {
[_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
}
}
#pragma mark - 确定
- (void)sureClick{
- (void)sureClick
{
// [_boltView.repairNumberFiled resignFirstResponder];
[_boltView.billNumberFiled resignFirstResponder];
......@@ -369,15 +394,17 @@ static NSString *cellID = @"licenceListCell";
}
}
#pragma mark - sortDelegate
- (void)getSortValueSelectRow:(NSString *)state{
- (void)getSortValueSelectRow:(NSString *)state
{
if (state.length > 0) {
self.orderDirection = state;
// CLog(@"%@",state);
// CLog(@"%@",state);
}
}
#pragma mark - sortDelegate
- (void)getBoltValueSelectRow:(NSString *)riskGrade {
- (void)getBoltValueSelectRow:(NSString *)riskGrade
{
self.riskGrade = riskGrade;
}
......@@ -386,62 +413,52 @@ static NSString *cellID = @"licenceListCell";
//- (void)getRepairNumberLike:(NSString *)repairLike {
// self.repairNumberLike = repairLike;
//}
- (void)getBillNumber:(NSString *)billNumber {
- (void)getBillNumber:(NSString *)billNumber
{
self.billNumberLike = billNumber;
}
- (void)getRiskGrade:(NSString *)riskGrade {
- (void)getRiskGrade:(NSString *)riskGrade
{
self.riskGrade = riskGrade;
}
- (void)clearBoltInformation{
- (void)clearBoltInformation
{
//清空所有条件
if (self.billNumberLike.length > 0) {
self.billNumberLike = @"";
}
// if (self.repairNumberLike.length > 0) {
// self.repairNumberLike = @"";
// }
// if (self.state.length > 0) {
// self.state = @"";
// }
// if (self.repairNumberLike.length > 0) {
// self.repairNumberLike = @"";
// }
// if (self.state.length > 0) {
// self.state = @"";
// }
if (self.riskGrade.length > 0) {
self.riskGrade = @"";
}
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return self.dataArr.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
// static NSString *cellID = @"SurveyID";
// PurchaseCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
// if (cell == nil) {
// cell = [[PurchaseCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
// tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// }
// if (self.dataArr.count > 0) {
// PurchaseBill *bill = self.dataArr[indexPath.row];
// [cell setPurchaseBill:bill];
// }
[self configureCell:cell forRowAtIndexPath:indexPath];
return cell;
}
- (void)configureCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath
- (void)configureCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
//cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIView *contentView = cell.contentView;
......@@ -449,29 +466,30 @@ static NSString *cellID = @"licenceListCell";
if (!view) {
view = [[GTOLicenceListCellContentView alloc] initWithFrame:contentView.bounds];
//view.m_bHiddenNumLabel = m_bIsInHome;
// view.m_bHiddenNumLabel = m_bIsInHome;
[view autoresizingWithStrechFullSize];
[contentView addSubview:view];
}
GTOLicence *licence = _dataArr[indexPath.section];
[view updateWithLicence:licence];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return TableHeight;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return section == 0 ? 1 : 10;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
GTOLicence *licence = _dataArr[indexPath.section];
self.d_currentLicence = licence;
[self p_httpGetLicenceItems];
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
/*
UITableViewCellEditingStyleNone,
UITableViewCellEditingStyleDelete,
......@@ -485,60 +503,61 @@ static NSString *cellID = @"licenceListCell";
// return UITableViewCellEditingStyleDelete;
return UITableViewCellEditingStyleNone;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
GTOLicence *licence = _dataArr[indexPath.section];
[self p_deleteLicenceWithLicence: licence];
[self p_deleteLicenceWithLicence:licence];
[_dataArr removeObjectAtIndex:indexPath.section];
[tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade];
}
}
- (void)p_deleteLicenceWithLicence: (GTOLicence *)licence {
- (void)p_deleteLicenceWithLicence:(GTOLicence *)licence
{
//后台删除
void(^succ)(id) = ^(id data) {
void (^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
if ([data[@"success"] integerValue] == 1) {
//本地删除 许可证
ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOLicence TableName],@"uuid" ];
[db executeUpdate:strSql,licence.uuid];
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOLicence TableName], @"uuid"];
[db executeUpdate:strSql, licence.uuid];
}];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOQuestion TableName],@"licenceUuid" ];
[db executeUpdate:strSql,licence.uuid];
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOQuestion TableName], @"licenceUuid"];
[db executeUpdate:strSql, licence.uuid];
}];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOAnswer TableName],@"licenceUuid" ];
[db executeUpdate:strSql,licence.uuid];
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOAnswer TableName], @"licenceUuid"];
[db executeUpdate:strSql, licence.uuid];
}];
} else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
}
};
void(^fail)(id) = ^(id data) {
void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
[IBTLoadingView showProgressLabel:@"正在加载..."];
ICRHTTPController *httpC = [ICRHTTPController sharedController];
[httpC doLicenceRemoveWithLicenceUuid:licence.uuid version:licence.version success:succ failure:fail];
}
- (void)p_httpGetLicenceItems {
- (void)p_httpGetLicenceItems
{
__weak typeof(self) weakSelf = self;
void(^succ)(id) = ^(id data) {
void (^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf;
__strong __typeof(weakSelf) strongSelf = weakSelf;
[strongSelf p_saveLicenceItemsWithData:data];
};
void(^fail)(id) = ^(id data) {
void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data];
};
......@@ -546,17 +565,17 @@ static NSString *cellID = @"licenceListCell";
ICRHTTPController *httpC = [ICRHTTPController sharedController];
[httpC getLicenceItemsWithLicenceUuid:_d_currentLicence.uuid success:succ failure:fail];
}
- (void)p_saveLicenceItemsWithData: (id)data {
- (void)p_saveLicenceItemsWithData:(id)data
{
NSInteger intSucc = [data[@"success"] integerValue];
if (intSucc == 1) {
}
NSArray *arrItems = [data[@"data"] objectForKey:@"items"];
NSMutableArray *muArrQuestions = [NSMutableArray array];
NSMutableArray *muArrAnswers = [NSMutableArray array];
NSMutableArray *muArrCategory = [NSMutableArray array];
for(NSDictionary *dictItem in arrItems) {
for (NSDictionary *dictItem in arrItems) {
GTOPioneeringSurveyItem *item = [GTOPioneeringSurveyItem DBObject];
[item praseFromJsonDict:dictItem];
......@@ -564,10 +583,9 @@ static NSString *cellID = @"licenceListCell";
[question praseFromJsonDict:dictItem];
question.licenceUuid = _d_currentLicence.uuid;
[question saveToDBWithHandleData:NULL complete:NULL fail:NULL];
// CLog(@"%@",question.uuid);
// CLog(@"%@",question.uuid);
[muArrQuestions addObject:[question dictForCommit]];
/*
@property (assign, nonatomic) NSUInteger resultScore; //打分结果
@property (copy, nonatomic) NSString *resultContent;
......@@ -578,25 +596,23 @@ static NSString *cellID = @"licenceListCell";
*/
GTOAnswer *answer = [GTOAnswer DBObject];
[answer praseFromJsonDict:dictItem];
if (answer.resultScore ||answer.resultContent || answer.resultRemark ||( answer.resultDetails.count > 0) ) {
if (answer.resultScore || answer.resultContent || answer.resultRemark || (answer.resultDetails.count > 0)) {
answer.bIsAnswered = YES;
answer.questionUuid = item.uuid;
answer.licenceUuid = _d_currentLicence.uuid;
[answer saveToDBWithHandleData:NULL complete:NULL fail:NULL];
[muArrAnswers addObject:[answer dictForCommit]];
} else {
}
[muArrCategory addObject:item.category];
}
_d_currentLicence.questions = muArrQuestions;
//GTODisplayResult
// GTODisplayResult
NSSet *setCategory = [NSSet setWithArray:muArrCategory];
NSMutableArray *muArrDisplayRs = [NSMutableArray array];
for(NSString *category in setCategory) {
for (NSString *category in setCategory) {
NSMutableArray *muArrQuestions = [NSMutableArray array];
for(NSDictionary *dictQ in _d_currentLicence.questions) {
for (NSDictionary *dictQ in _d_currentLicence.questions) {
GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:dictQ];
if ([question.category isEqualToString:category]) {
......@@ -611,7 +627,6 @@ static NSString *cellID = @"licenceListCell";
[muArrDisplayRs addObject:[displayR dictForCommit]];
}
_d_currentLicence.arrDisplayResults = muArrDisplayRs;
[_d_currentLicence saveToDBWithHandleData:NULL
complete:^{
......@@ -628,48 +643,53 @@ static NSString *cellID = @"licenceListCell";
[IBTLoadingView hideHUDWithText:error.localizedDescription];
}];
}
- (void)createBackBtn{
- (void)createBackBtn
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
btn.frame = CGRectMake(0, 0, 12, 20);
[btn addTarget:self action:@selector(backRV) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithCustomView:btn];
UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithCustomView:btn];
self.navigationItem.leftBarButtonItem = back;
}
- (void)backRV{
- (void)backRV
{
[self PopToRootViewControllerAnimated:YES];
}
- (void)p_addAlerInfoLicenceView {
GTOAlertInfoLicenceViewController *alertInfoVC = [[GTOAlertInfoLicenceViewController alloc]initWithLicence:_d_currentLicence];
- (void)p_addAlerInfoLicenceView
{
GTOAlertInfoLicenceViewController *alertInfoVC = [[GTOAlertInfoLicenceViewController alloc] initWithLicence:_d_currentLicence];
self.alertInfoVC = alertInfoVC;
alertInfoVC.delegate = self;
[[UIApplication sharedApplication].keyWindow addSubview:_alertInfoVC.view];
}
//找到对应的答案并跳转结果页面
- (void)fetchResult { //答案的个数
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid",@"questionUuid" ];
- (void)fetchResult
{//答案的个数
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db)
{
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid", @"questionUuid"];
//答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????)
NSLog(@"%@",sql);
return [db executeQuery:sql,_d_currentLicence.uuid];
NSLog(@"%@", sql);
return [db executeQuery:sql, _d_currentLicence.uuid];
};
__weak typeof(self)weakSelf = self;
__weak typeof(self) weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
__strong __typeof(weakSelf) strongSelf = weakSelf;
NSMutableArray *muArrDisplayRs = [NSMutableArray array];
for (int count = 0; count < _d_currentLicence.arrDisplayResults.count; count ++) {
for (int count = 0; count < _d_currentLicence.arrDisplayResults.count; count++) {
// NSInteger finiseNumber = 0;
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_currentLicence.arrDisplayResults[count]];
//displayR.answerNumber = 0;
// displayR.answerNumber = 0;
NSMutableArray *muArrAnswers = [NSMutableArray array];
for (GTOAnswer *answer in fetchedObjects) {
if([answer.category isEqualToString:displayR.category])
//displayR.answerNumber++;
if ([answer.category isEqualToString:displayR.category])
// displayR.answerNumber++;
[muArrAnswers addObject:[answer dictForCommit]];
}
displayR.arrAnswers = muArrAnswers;
......@@ -677,38 +697,39 @@ static NSString *cellID = @"licenceListCell";
[muArrDisplayRs addObject:[displayR dictForCommit]];
}
_d_currentLicence.arrDisplayResults = muArrDisplayRs;
[_d_currentLicence saveToDBWithHandleData:nil complete:^{
GTOLiceneResultViewController *resultVC = [[GTOLiceneResultViewController alloc]initWithLicence:_d_currentLicence];
//resultVC.
[_d_currentLicence saveToDBWithHandleData:nil
complete:^{
GTOLiceneResultViewController *resultVC = [[GTOLiceneResultViewController alloc] initWithLicence:_d_currentLicence];
// resultVC.
[self PushViewController:resultVC animated:YES];
} fail:nil];
}
fail:nil];
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[GTOAnswer class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
[dbCtrl runFetchForClass:[GTOAnswer class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultsBlk];
}
#pragma GTOAlertInfoLicenceViewControllerDelegate
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence closeClickedWithBtton:(UIButton *)btn {
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence closeClickedWithBtton:(UIButton *)btn
{
self.d_isClosed = YES;
[_alertInfoVC.view removeFromSuperview];
}
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence seeResultClickedWithBtton:(UIButton *)btn {
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence seeResultClickedWithBtton:(UIButton *)btn
{
GTOLiceneResultViewController *resultVC = [[GTOLiceneResultViewController alloc]initWithLicence:_d_currentLicence];
GTOLiceneResultViewController *resultVC = [[GTOLiceneResultViewController alloc] initWithLicence:_d_currentLicence];
self.d_isClosed = YES;
[_alertInfoVC.view removeFromSuperview];
[self PushViewController:resultVC animated:YES];
}
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence nextClickedWithBtton:(UIButton *)btn {
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence nextClickedWithBtton:(UIButton *)btn
{
BOOL isAllFinished = YES;
for(NSDictionary *dict in _d_currentLicence.arrDisplayResults) {
for (NSDictionary *dict in _d_currentLicence.arrDisplayResults) {
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:dict];
if (displayR.arrAnswers.count < displayR.arrQuestions.count) {
......@@ -729,27 +750,23 @@ static NSString *cellID = @"licenceListCell";
mgr.d_category = displayR.category;
[mgr openQuestionVCFromViewControler:self Licence:_d_currentLicence Pioneering:nil];
[self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil];
}
}
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
GTOQuestionManager *mgr = [GTOQuestionManager sharedManager];
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_currentLicence.arrDisplayResults[indexPath.row]];
mgr.d_category = displayR.category;//alertInfoPioneering.d_arrCategorys[indexPath.row];
mgr.d_category = displayR.category;// alertInfoPioneering.d_arrCategorys[indexPath.row];
[mgr openQuestionVCFromViewControler:self Licence:_d_currentLicence Pioneering:nil];
[self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil];
}
- (void)didReceiveMemoryWarning {
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
......@@ -7,15 +7,14 @@
//
#import "GTOLiceneResultViewController.h"
#import "ICRQuestionHelperView.h"
#import "ICRAttachmentView.h"
#import "ICRQuestionHelperView.h"
#import "GTOLicence.h"
#import "GTOAnswer.h"
#import "GTODisplayResult.h"
#import "GTOQuestion.h"
#import "GTOAnswer.h"
#import "GTOPatrolPlanResultHeaderItem.h"
#import "GTOPatrolPlanResultProblemItem.h"
......@@ -25,35 +24,35 @@
//#import "GTOPioneeringListViewController.h"
#import "GTOPioneeringSurveyItem.h"
//#import "GTOPioneeringResult.h"
#import "GTOLicenceResult.h"
#import "GTOEditPioneeringViewController.h"
#import "GTOLicenceResult.h"
#import "GXFBottomView.h"
#import "GTORepair.h"
#import "GTOQuestionBaseViewController.h"
#import "GTOLicenceResultHeaderContentView.h"
#import "ICRPostAttachment.h"
#import "GTOLicenceListViewController.h"
#import "GTOLicenceCheckListViewController.h"
#import "GTOButtonHeaderContentView.h"
#import "GTORepairDetailViewController.h"
#import "GTOLicenceCheckListViewController.h"
#import "GTOLicenceListViewController.h"
#import "GTOLicenceResultHeaderContentView.h"
#import "GTOQuestionBaseViewController.h"
#import "GTOQuestionManager.h"
#import "GTORepair.h"
#import "GTORepairDetailViewController.h"
#import "ICRPostAttachment.h"
#define GXF_DETAIL_COLOR HexColor(@"888888")
#define GXF_CONTENT_COLOR HexColor(@"444444")
#define KEY_IS_DISPLAY @"isDisplay"
typedef NS_ENUM(NSUInteger, bottomViewTag) {
// kBottomViewLeftDelTag = 0,
// kBottomViewLeftSubmittedTag,
kBottomViewOneSaveTag = 0,
kBottomViewTwoSaveSubmitTag,
kBottomViewTwoRejectedApprovedTag,
kBottomViewOneBackTag
kBottomViewOneBackTag,
kBOttomViewAskForApprove
};
typedef NS_ENUM(NSUInteger, alertViewTag) {
kAlertViewSubmiteTag = 0,
kAlertViewApprovedTag,
kAlertViewRejectedTag,
kAlertViewAskForApprove
};
static NSString *cellID = @"cellID";
//只有标题
......@@ -62,19 +61,14 @@ static NSString *headerBtnItemID = @"headerBtnItem";
//可以点击(存放问题的header)
static NSString *headerProblemItemID = @"headerItem";
@interface GTOLiceneResultViewController ()
<UITextFieldDelegate,
UITableViewDataSource,
UITableViewDelegate, GTOPatrolPlanResultHeaderItemDelegate,
GXFBottomViewDelegate,UIAlertViewDelegate>
@interface GTOLiceneResultViewController () <UITextFieldDelegate, UITableViewDataSource, UITableViewDelegate, GTOPatrolPlanResultHeaderItemDelegate, GXFBottomViewDelegate, UIAlertViewDelegate>
@property(strong, nonatomic) ICRQuestionHelperView *m_helperView;
@property(nonatomic, strong) NSIndexPath *m_clickedIndexPath;
@property (strong, nonatomic) ICRQuestionHelperView *m_helperView;
@property (nonatomic, strong) NSIndexPath *m_clickedIndexPath;
/////
@property(strong, nonatomic) GTOLicence *d_licence;
@property (strong, nonatomic) GTOLicence *d_licence;
//@property (strong, nonatomic) GTORepair *d_repair;
@property(nonatomic, strong) UITableView *c_tableView;
@property (nonatomic, strong) UITableView *c_tableView;
@property (nonatomic, strong) NSMutableArray *d_arrPostAttachments;
......@@ -84,7 +78,8 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
#pragma mark - Life Cycle
- (instancetype)initWithLicence:(GTOLicence *)licence {//andRepair: (GTORepair *)repair {
- (instancetype)initWithLicence:(GTOLicence *)licence
{// andRepair: (GTORepair *)repair {
self = [super init];
if (!self) {
return nil;
......@@ -95,41 +90,44 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
// self.d_repair = repair;
}
return self;
}
- (void)viewDidLoad {
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"许可证结果";
[self initSubViews];
}
- (void)viewWillAppear:(BOOL)animated {
- (void)viewWillAppear:(BOOL)animated
{
[self updateAnswer];
}
- (void)updateAnswer {
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid",@"questionUuid" ];
- (void)updateAnswer
{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db)
{
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid", @"questionUuid"];
//答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????)
NSLog(@"%@",sql);
return [db executeQuery:sql,_d_licence.uuid];
NSLog(@"%@", sql);
return [db executeQuery:sql, _d_licence.uuid];
};
__weak typeof(self)weakSelf = self;
__weak typeof(self) weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
__strong __typeof(weakSelf) strongSelf = weakSelf;
NSMutableArray *muArrDisplayRs = [NSMutableArray array];
for (int count = 0; count < _d_licence.arrDisplayResults.count; count ++) {
for (int count = 0; count < _d_licence.arrDisplayResults.count; count++) {
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]];
NSMutableArray *muArrAnswers = [NSMutableArray array];
for (GTOAnswer *answer in fetchedObjects) {
if([answer.category isEqualToString:displayR.category])
//displayR.answerNumber++;
if ([answer.category isEqualToString:displayR.category])
// displayR.answerNumber++;
[muArrAnswers addObject:[answer dictForCommit]];
}
displayR.arrAnswers = muArrAnswers;
......@@ -137,20 +135,20 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[muArrDisplayRs addObject:[displayR dictForCommit]];
}
_d_licence.arrDisplayResults = muArrDisplayRs;
[_d_licence saveToDBWithHandleData:nil complete:^{
[_d_licence saveToDBWithHandleData:nil
complete:^{
[_c_tableView reloadData];
} fail:nil];
}
fail:nil];
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[GTOAnswer class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
[dbCtrl runFetchForClass:[GTOAnswer class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultsBlk];
}
- (void)initSubViews {
//tableView
- (void)initSubViews
{
// tableView
self.c_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height - 60 - 64) style:UITableViewStylePlain];
self.c_tableView.delegate = self;
self.c_tableView.dataSource = self;
......@@ -161,47 +159,64 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[self.c_tableView registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:headerProblemItemID];
[self.view addSubview:_c_tableView];
//bottomView
// bottomView
BOOL highApprovePermission = [GTOCommonTools hasPermissionWithPermissionId:500403]; //高级审批权
BOOL middleApprovePermission = [GTOCommonTools hasPermissionWithPermissionId:500404]; //中级审批权
BOOL middleApprovePermission = [GTOCommonTools hasPermissionWithPermissionId:500404];//中级审批权
BOOL approvePermission = NO;
if (highApprovePermission) {
approvePermission = YES;
} else if (!highApprovePermission && middleApprovePermission) {
if ([_d_licence.riskGrade isEqualToString:GTO_LICENCE_RISK_HIGHT]) {
approvePermission = NO;
}else if ([_d_licence.riskGrade isEqualToString:GTO_LICENCE__RISK_MIDDLE]) {
approvePermission = YES;
}
}
CGRect rect = CGRectMake(0, _c_tableView.bottom, self.view.width, 40);
GXFBottomView *bottomV;
//判断是否在时间区间内
BOOL bet = [GTOCommonTools nowInTimeDuringMinTime:_d_licence.beginDate maxTime:_d_licence.endDate];
BOOL condition = [_d_licence.state isEqualToString:GTO_LICENCE__STATE_SUBMITTED] && approvePermission;
if ([_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL] || [_d_licence.state isEqualToString:GTO_LICENCE_STATE_LOCAL]) {
//是已提交状态 && 有权限
BOOL isSubmitted = [_d_licence.state isEqualToString:GTO_LICENCE__STATE_SUBMITTED] && [GTOCommonTools hasPermissionWithPermissionId:500405];
BOOL isAskForApprove = [_d_licence.state isEqualToString:GTO_LICENCE__STATE_ASKFORAPPROVE] && approvePermission;
if ([_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL] || [_d_licence.state isEqualToString:GTO_LICENCE_STATE_LOCAL]) {
NSUInteger noFinishNumber = 0;
for (NSDictionary *dictDisplayR in _d_licence.arrDisplayResults) {
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:dictDisplayR];
if (displayR.arrAnswers.count != displayR.arrQuestions.count)
noFinishNumber++;
if (displayR.arrAnswers.count != displayR.arrQuestions.count) noFinishNumber++;
}
if (noFinishNumber > 0) {
bottomV = [[GXFBottomView alloc] initOneButtonWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, 40) buttonColor:GTO_RED_COLOR buttonTitle:@"返回"];
bottomV.tag = kBottomViewOneBackTag;
} else {
bottomV = [[GXFBottomView alloc] initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, 40) leftButtonColor:GTO_RED_COLOR rightButtonColor:GTO_BLUE_DEEP_COLOR LeftBtnTitle:@"保存" rightBtnTitle:@"提交"];
bottomV = [[GXFBottomView alloc] initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, 40)
leftButtonColor:GTO_RED_COLOR
rightButtonColor:GTO_BLUE_DEEP_COLOR
LeftBtnTitle:@"保存"
rightBtnTitle:@"提交"];
bottomV.tag = kBottomViewTwoSaveSubmitTag;
}
} else if (condition){
bottomV = [[GXFBottomView alloc] initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, 40) leftButtonColor:GTO_RED_COLOR rightButtonColor:GTO_BLUE_DEEP_COLOR LeftBtnTitle:@"审批拒绝" rightBtnTitle:@"审批通过"];
} else if (isSubmitted) {
bottomV = [[GXFBottomView alloc] initOneButtonWithFrame:rect buttonColor:GTO_RED_COLOR buttonTitle:@"申请审批"];
bottomV.tag = kBOttomViewAskForApprove;
}else if (isAskForApprove) {
bottomV = [[GXFBottomView alloc] initWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, 40)
leftButtonColor:GTO_RED_COLOR
rightButtonColor:GTO_BLUE_DEEP_COLOR
LeftBtnTitle:@"审批拒绝"
rightBtnTitle:@"审批通过"];
bottomV.tag = kBottomViewTwoRejectedApprovedTag;
} else {
}else {
bottomV = [[GXFBottomView alloc] initOneButtonWithFrame:rect buttonColor:GTO_RED_COLOR buttonTitle:@"返 回"];
bottomV.tag = kBottomViewOneBackTag;
}
bottomV.backgroundColor = XXFBgColor;
bottomV.delegate = self;
......@@ -209,14 +224,15 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[self.view addSubview:bottomV];
}
#pragma UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2 + _d_licence.arrDisplayResults.count;//_d_arrDisplayResults.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
CLog(@"indexpath section = %ld", section);
if (section == 0) {
return 1;
......@@ -224,14 +240,11 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
return 0;
} else {
for (int count = 0; count < _d_licence.arrDisplayResults.count; count++) { //
for (int count = 0; count < _d_licence.arrDisplayResults.count; count++) {//
if (section == count + 2) {
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]];
return displayR.isDisplay ? displayR.arrQuestions.count : 0;
// return displayR.isDisplay ? displayR.arrAnswers.count : 0;
}
}
......@@ -239,16 +252,17 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
[self configureCell:cell forRowAtIndexPath:indexPath];
//cell.selectionStyle = UITableViewCellSelectionStyleNone;
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (void)configureCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath {
- (void)configureCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
UIView *contentView = cell.contentView;
if (indexPath.section == 0) {
......@@ -275,29 +289,19 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:displayR.arrQuestions[indexPath.row]];
[self uploadePatrolPlanResultProblemItemAnswer:problemItem question:question cellForRowAtIndexPath:indexPath];
// GTOAnswer *answer = [GTOAnswer DBObject];
// [answer praseFromJsonDict:displayR.arrAnswers[indexPath.row]];
//
// for (NSDictionary *dictQues in displayR.arrQuestions) {
// GTOQuestion *question = [GTOQuestion DBObject];
// [question praseFromJsonDict:dictQues];
// if ([question.uuid isEqualToString:answer.questionUuid])
// [problemItem updateWithQuestion:question answer:answer index:indexPath.row];
// }
} else {}
} else {
}
}
- (void)uploadePatrolPlanResultProblemItemAnswer: (GTOPatrolPlanResultProblemItem *)problemItem question: (GTOQuestion *)question cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- (void)uploadePatrolPlanResultProblemItemAnswer:(GTOPatrolPlanResultProblemItem *)problemItem question:(GTOQuestion *)question cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? AND %@ = ? AND %@ = ?", [GTOAnswer TableName], @"licenceUuid",@"questionUuid",@"category" ];
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db)
{
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? AND %@ = ? AND %@ = ?", [GTOAnswer TableName], @"licenceUuid", @"questionUuid", @"category"];
//答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????)
NSLog(@"%@",sql);
return [db executeQuery:sql,_d_licence.uuid,question.uuid,question.category];
NSLog(@"%@", sql);
return [db executeQuery:sql, _d_licence.uuid, question.uuid, question.category];
};
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
......@@ -309,19 +313,15 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[GTOAnswer class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
[dbCtrl runFetchForClass:[GTOAnswer class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultsBlk];
}
#pragma UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section < 2)
{
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section < 2) {
return;
}
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[indexPath.section - 2]];
GTOQuestion *question = [GTOQuestion DBObject];
......@@ -330,40 +330,16 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
mgr.d_category = question.category;
BOOL notEdit = NO;
if ([_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL]
|| [_d_licence.state isEqualToString:GTO_LICENCE_STATE_LOCAL]) {
if ([_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL] || [_d_licence.state isEqualToString:GTO_LICENCE_STATE_LOCAL]) {
notEdit = NO;
} else {
notEdit = YES;
}
[mgr openQuestionVCFromViewControler:self Licence:_d_licence Pioneering:nil IsNotEdit:notEdit ProblemIndex:indexPath.row + 1];
// GTOAnswer *answer = [GTOAnswer DBObject];
// [answer praseFromJsonDict:displayR.arrAnswers[indexPath.row]];
//
//
// for (NSDictionary *dictQues in displayR.arrQuestions) {
// GTOQuestion *question = [GTOQuestion DBObject];
// [question praseFromJsonDict:dictQues];
// if ([question.uuid isEqualToString:answer.questionUuid]) {
// GTOQuestionBaseViewController *questionBVC = [[GTOQuestionBaseViewController alloc] initWithQuestion:question answer:answer];
// questionBVC.d_licence = _d_licence;
// if (![_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL]) {
// questionBVC.d_notEdit = YES;
// }
//
// questionBVC.d_questionIndex = indexPath.row;
// [self PushViewController:questionBVC animated:YES];
// break;
// }
//
// }
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
return 176;
} else {
......@@ -371,15 +347,17 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return HEADER_HEIGHT;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UITableViewHeaderFooterView *headerView = nil;
if (section == 0) {
headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerBtnItemID];
} else if(section == 1){
} else if (section == 1) {
headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerTitleItemID];
} else {
headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerProblemItemID];
......@@ -387,31 +365,29 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
CGRect rect = CGRectMake(0, 0, tableView.width, 50);
[self configureHeaderView:headerView frameWithRect:rect viewForSection:section];
return headerView;
}
- (UITableViewHeaderFooterView *)tableHeaderFooterViewWithTableView: (UITableView *)tableView andHeaderID: (NSString *)headerId {
- (UITableViewHeaderFooterView *)tableHeaderFooterViewWithTableView:(UITableView *)tableView andHeaderID:(NSString *)headerId
{
UITableViewHeaderFooterView *headerView = nil;
headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerId];
if (!headerView) {
headerView = [[UITableViewHeaderFooterView alloc]initWithReuseIdentifier:headerId];
headerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:headerId];
}
return headerView;
}
- (void)configureHeaderView:(UITableViewHeaderFooterView *)headerView frameWithRect:(CGRect)rect viewForSection:(NSInteger)section {
- (void)configureHeaderView:(UITableViewHeaderFooterView *)headerView frameWithRect:(CGRect)rect viewForSection:(NSInteger)section
{
UIView *contentView = headerView.contentView;
CGFloat padding = 10;
if (section == 0) {
GTOButtonHeaderContentView *btnView = [contentView viewWithClass:[GTOButtonHeaderContentView class]];
if (!btnView) {
btnView = [[GTOButtonHeaderContentView alloc]initWithFrame:rect];
btnView = [[GTOButtonHeaderContentView alloc] initWithFrame:rect];
[btnView.m_btn addTarget:self action:@selector(seeRepairClicked) forControlEvents:UIControlEventTouchUpInside];
[contentView addSubview:btnView];
}
[btnView updateWithTitleLabelText:@"许可证" andButtonLabelText:@"查看报修单"];
} else if (section == 1) {
GTOLicenceResultHeaderContentView *view = [contentView viewWithClass:[GTOLicenceResultHeaderContentView class]];
......@@ -430,7 +406,7 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[section - 2]];
resultHeader.isDisplay = displayR.isDisplay;//isDisplay;
resultHeader.isDisplay = displayR.isDisplay;// isDisplay;
resultHeader.delegate = self;
resultHeader.backgroundColor = [UIColor whiteColor];
//刷新数据
......@@ -439,7 +415,8 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
}
- (GTOLicenceResult *)p_licenceResult {
- (GTOLicenceResult *)p_licenceResult
{
//_d_arrDisplayResults
NSMutableArray *muArrItems = [NSMutableArray array];
......@@ -447,12 +424,12 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:dictDisplayR];
for (NSDictionary *dictQuestion in displayR.arrQuestions) { //一条数据
for (NSDictionary *dictQuestion in displayR.arrQuestions) {//一条数据
GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:dictQuestion];
GTOPioneeringSurveyItem *surveyItem = [[GTOPioneeringSurveyItem alloc] init];
NSMutableDictionary *muDictItem = [NSMutableDictionary dictionary];
GTOAnswer *ans; //找到问题对应的answer
GTOAnswer *ans;//找到问题对应的answer
for (NSDictionary *dictAnswer in displayR.arrAnswers) {
GTOAnswer *answer = [GTOAnswer DBObject];
[answer praseFromJsonDict:dictAnswer];
......@@ -466,7 +443,6 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
surveyItem.details = question.details;
surveyItem.resultDetails = ans.resultDetails;
surveyItem.category = question.category;
surveyItem.type = question.type;
surveyItem.lineNo = question.lineNo;
......@@ -508,17 +484,16 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
result.store_code = _d_licence.store_code;
result.store_name = _d_licence.store_name;
result.validHours = _d_licence.validHours;
// result.beginDate = _d_licence.beginDate;
// result.endDate = _d_licence.endDate;
// result.beginDate = _d_licence.beginDate;
// result.endDate = _d_licence.endDate;
result.items = muArrItems;
return result;
}
//保存
- (void)httpSaveLicenceResult {
- (void)httpSaveLicenceResult
{
self.d_licence.beginDate = [[NSDate date] httpParameterString];
self.d_licence.endDate = [[[NSDate date] dateAddHourse:3] httpParameterString];
......@@ -538,8 +513,8 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
// [self PopViewControllerAnimated:YES];
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
} else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
}
......@@ -547,18 +522,16 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
};
void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data);
// CLog(@"%@", data);
};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doSaveLicenceResultWithData:[licenceR dictForCommit] success:success failure:failure];
}
//提交
- (void)httpSubmitLicenceResult {
- (void)httpSubmitLicenceResult
{
self.d_licence.beginDate = [[NSDate date] httpParameterString];
self.d_licence.endDate = [[[NSDate date] dateAddHourse:0] httpParameterString];
GTOLicenceResult *licenceR = [self p_licenceResult];
......@@ -576,146 +549,131 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} else {
[self PopViewControllerAnimated:YES];
}
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
} else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
}
};
void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data);
// CLog(@"%@", data);
};
[httpCtrl doSubmitLicenceResultWithData:[licenceR dictForCommit] success:success failure:failure];
}
//审批拒绝
- (void)httpRejectedLicenceResultWithRejectCause: (NSString *)cause {
// NSDate *date = [NSDate date];
// GTOLicenceResult *licenceR = [self p_licenceResult];
- (void)httpRejectedLicenceResultWithRejectCause:(NSString *)cause
{
[IBTLoadingView showProgressLabel:@"审批拒绝中"];
// [IBTLoadingView hideHUDWithText:nil];
void (^success)(id data) = ^(id data) {
// CLog(@"%@", data);
if ([data[@"success"] integerValue] == 1) {
[IBTLoadingView hideHUDWithText:nil];
[self localDelete];
[self PopViewControllerAnimated:YES];
// if (self.d_isCheckList) {
// GTOLicenceCheckListViewController *listVC = [[GTOLicenceCheckListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
// } else {
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
// }
} else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
}
};
void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data);
};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doLicenceRejectWithLicenceUuid:_d_licence.uuid version:_d_licence.version rejectCausen:cause success:success failure:failure];
}
//审批通过
- (void)httpApprovedLicenceResult {
// NSDate *date = [NSDate date];
// GTOLicenceResult *licenceR = [self p_licenceResult];
- (void)httpApprovedLicenceResult
{
[IBTLoadingView showProgressLabel:@"审批通过中"];
// [IBTLoadingView hideHUDWithText:nil];
void (^success)(id data) = ^(id data) {
// CLog(@"%@", data);
if ([data[@"success"] integerValue] == 1) {
[IBTLoadingView hideHUDWithText:nil];
[self localDelete];
[self PopViewControllerAnimated:YES];
// if (self.d_isCheckList) {
// GTOLicenceCheckListViewController *listVC = [[GTOLicenceCheckListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
// } else {
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES];
// }
} else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
}
};
void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doLicenceApproveWithLicenceUuid:_d_licence.uuid version:_d_licence.version success:success failure:failure];
}
- (void)httpAskForApproveLicense {
[IBTLoadingView showProgressLabel:@"申请审批中"];
void (^success)(id data) = ^(id data) {
if ([data[@"success"] integerValue] == 1) {
[IBTLoadingView hideHUDWithText:nil];
[self localDelete];
[self PopViewControllerAnimated:YES];
} else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
}
};
void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data);
};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doLicenceApproveWithLicenceUuid:_d_licence.uuid version:_d_licence.version success:success failure:failure];
}
[httpCtrl doLicenceAskForApproveWithLicenceUuid:_d_licence.uuid version:_d_licence.version success:success failure:failure];
}
//上传附件
- (void)upLoadFlieWithAction: (NSString *)action {
- (void)upLoadFlieWithAction:(NSString *)action
{
NSInteger counts = 0;
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
hud.labelText = [NSString stringWithFormat:@"已上传%lu%%",counts * 100 / _d_licence.arrDisplayResults.count];
hud.labelText = [NSString stringWithFormat:@"已上传%lu%%", counts * 100 / _d_licence.arrDisplayResults.count];
for (int count = 0; count < _d_licence.arrDisplayResults.count; count ++) {
for (int count = 0; count < _d_licence.arrDisplayResults.count; count++) {
GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]];
for (int ansCount = 0; ansCount < displayR.arrAnswers.count; ansCount ++) {
// if(count ==0 && ansCount==0){
// [IBTLoadingView showProgressLabel:@"正在上传图片"];
// }
for (int ansCount = 0; ansCount < displayR.arrAnswers.count; ansCount++) {
// if(count ==0 && ansCount==0){
// [IBTLoadingView showProgressLabel:@"正在上传图片"];
// }
GTOAnswer *answer = [GTOAnswer DBObject];
[answer praseFromJsonDict:displayR.arrAnswers[ansCount]];
BOOL isFinish = NO;
if ((ansCount == displayR.arrAnswers.count - 1)
&& (count == _d_licence.arrDisplayResults.count - 1)) {
if ((ansCount == displayR.arrAnswers.count - 1) && (count == _d_licence.arrDisplayResults.count - 1)) {
isFinish = YES;
}
[self everyProblemUpLoadPhotoWithAnswer:answer isFinishedUpload:isFinish action:action index:count count:counts allCounts:_d_licence.arrDisplayResults.count hud:hud];
}
}
}
- (void)everyProblemUpLoadPhotoWithAnswer: (GTOAnswer *)answer
isFinishedUpload: (BOOL)isFinish
action: (NSString *)action
index: (NSInteger)index
count: (NSInteger)counts
allCounts: (NSInteger)allcount
hud: (MBProgressHUD *)hud{
- (void)everyProblemUpLoadPhotoWithAnswer:(GTOAnswer *)answer
isFinishedUpload:(BOOL)isFinish
action:(NSString *)action
index:(NSInteger)index
count:(NSInteger)counts
allCounts:(NSInteger)allcount
hud:(MBProgressHUD *)hud
{
//找到数据表中的附件
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@=? AND %@=? ORDER BY %@",[ICRPostAttachment TableName],@"questionUuid",@"licenceUuid",@"addTime"];
return [db executeQuery:sql,answer.questionUuid,answer.licenceUuid];
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db)
{
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@=? AND %@=? ORDER BY %@", [ICRPostAttachment TableName], @"questionUuid", @"licenceUuid", @"addTime"];
return [db executeQuery:sql, answer.questionUuid, answer.licenceUuid];
};
__weak typeof(self)weakSelf = self;
__weak typeof(self) weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultBlk = ^(NSArray *fetchObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (!fetchObjects) {
if (!isFinish) {
return ;
return;
} else {
if ([action isEqualToString:@"save"]) {
[self httpSaveLicenceResult];
......@@ -728,14 +686,14 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
if (fetchObjects.count > 0) {
if (!_d_arrPostAttachments) {
strongSelf.d_arrPostAttachments = [@[]mutableCopy];
strongSelf.d_arrPostAttachments = [@[] mutableCopy];
} else {
[strongSelf.d_arrPostAttachments removeAllObjects];
}
NSMutableArray *delArr = [@[]mutableCopy];
NSMutableArray *delArrPostAttachments = [@[]mutableCopy];
NSMutableArray *addArrPostAttachments = [@[]mutableCopy];
for(ICRPostAttachment *postAttachment in fetchObjects) {
NSMutableArray *delArr = [@[] mutableCopy];
NSMutableArray *delArrPostAttachments = [@[] mutableCopy];
NSMutableArray *addArrPostAttachments = [@[] mutableCopy];
for (ICRPostAttachment *postAttachment in fetchObjects) {
if (postAttachment.is_delete) {
[delArr addObject:postAttachment.uuid];
}
......@@ -745,26 +703,22 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} else if (!postAttachment.is_localPhoto && postAttachment.is_delete) {
[delArrPostAttachments addObject:postAttachment];
[strongSelf.d_arrPostAttachments addObject:postAttachment];
} else{
} else {
}
}
NSString *delStr = [delArr componentsJoinedByString:@";"];
if (delStr.length <= 0) {
delStr = @"";
}
if(addArrPostAttachments.count > 0 || delArrPostAttachments.count > 0) {
if (addArrPostAttachments.count > 0 || delArrPostAttachments.count > 0) {
ICRPostAttachment *postAttachment = _d_arrPostAttachments[0];
void(^succAdd)(id) = ^(id data) {
void (^succAdd)(id) = ^(id data) {
if ([data[@"success"] integerValue] == 1) {
if (!isFinish) {
[strongSelf localDeleteOneAnswerPhotos:answer];
hud.labelText = [NSString stringWithFormat:@"已上传%lu%%",(counts + 1) * 100 / allcount];
return ;
hud.labelText = [NSString stringWithFormat:@"已上传%lu%%", (counts + 1) * 100 / allcount];
return;
} else {
[IBTLoadingView hideHUDWithText:nil];
if ([action isEqualToString:@"save"]) {
......@@ -775,22 +729,21 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
}
} else {
[IBTLoadingView hideHUDWithText:data[@"message"]];
}
};
void(^failAdd)(id) = ^(id data) {
void (^failAdd)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:@"上传图片出错啦! 请重新上传。"];
};
void(^succDel)(id) = ^(id data) {
void (^succDel)(id) = ^(id data) {
if ([data[@"success"] integerValue] == 1) {
[strongSelf localDeleteOneAnswerPhotos:answer];
if (!isFinish) {
return ;
return;
} else {
[IBTLoadingView hideHUDWithText:nil];
if ([action isEqualToString:@"save"]) {
......@@ -805,23 +758,26 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}
};
void(^failDel)(id) = ^(id data) {
void (^failDel)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:@"上传删除的图片出错啦! 请重新上传。"];
};
ICRHTTPController *httpC = [ICRHTTPController sharedController];
if (delArrPostAttachments.count >0) {
if (delArrPostAttachments.count > 0) {
[httpC deleteAttachments:delStr success:succDel failure:failDel];
}
if (addArrPostAttachments.count >0) {
[httpC multiPartUploadWithEntityType:postAttachment.entityType entityUuid:postAttachment.entityUuid arrayPostAttachments:addArrPostAttachments success:succAdd failure:failAdd];
if (addArrPostAttachments.count > 0) {
[httpC multiPartUploadWithEntityType:postAttachment.entityType
entityUuid:postAttachment.entityUuid
arrayPostAttachments:addArrPostAttachments
success:succAdd
failure:failAdd];
}
}else {
} else {
if (!isFinish) {
return ;
return;
} else {
if ([action isEqualToString:@"save"]) {
[self httpSaveLicenceResult];
......@@ -834,141 +790,121 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
};
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[ICRPostAttachment class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultBlk];
[dbCtrl runFetchForClass:[ICRPostAttachment class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultBlk];
}
//本地删除
- (void)localDelete {
- (void)localDelete
{
//本地删除 许可证
ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOLicence TableName],@"uuid" ];
[db executeUpdate:strSql,_d_licence.uuid];
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOLicence TableName], @"uuid"];
[db executeUpdate:strSql, _d_licence.uuid];
}];
//删除问题
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOQuestion TableName],@"licenceUuid" ];
[db executeUpdate:strSql,_d_licence.uuid];
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOQuestion TableName], @"licenceUuid"];
[db executeUpdate:strSql, _d_licence.uuid];
}];
//删除本地图片
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOAnswer TableName],@"licenceUuid" ];
[db executeUpdate:strSql,_d_licence.uuid];
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOAnswer TableName], @"licenceUuid"];
[db executeUpdate:strSql, _d_licence.uuid];
}];
//删除本地图片
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[ICRPostAttachment TableName],@"licenceUuid" ];
[db executeUpdate:strSql,_d_licence.uuid];
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [ICRPostAttachment TableName], @"licenceUuid"];
[db executeUpdate:strSql, _d_licence.uuid];
}];
}
//本地删除 一个问题对应的答案的图片
- (void)localDeleteOneAnswerPhotos: (GTOAnswer *)answer {
- (void)localDeleteOneAnswerPhotos:(GTOAnswer *)answer
{
ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=? AND %@=? ORDER BY %@",[ICRPostAttachment TableName],@"questionUuid",@"licenceUuid",@"addTime" ];
[db executeUpdate:strSql,answer.questionUuid,answer.licenceUuid];
NSString *strSql =
[NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=? AND %@=? ORDER BY %@", [ICRPostAttachment TableName], @"questionUuid", @"licenceUuid", @"addTime"];
[db executeUpdate:strSql, answer.questionUuid, answer.licenceUuid];
}];
}
#pragma bottomViewDelegate
- (void)bottomView:(GXFBottomView *)bottomView oneButtonClicked:(UIButton *)oneBtn {
- (void)bottomView:(GXFBottomView *)bottomView oneButtonClicked:(UIButton *)oneBtn
{
switch (bottomView.tag) {
case kBottomViewOneSaveTag: {
[self httpSaveLicenceResult];
}
break;
} break;
case kBottomViewOneBackTag: {
[self PopViewControllerAnimated:YES];
} break;
case kBOttomViewAskForApprove:{
//提交
UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:@"确定申请审批?" message:@"" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alertV.tag = kAlertViewAskForApprove;
[alertV show];
}
break;
default:
break;
default: break;
}
}
- (void)bottomView:(GXFBottomView *)bottomView leftButtonClicked:(UIButton *)leftBtn {
- (void)bottomView:(GXFBottomView *)bottomView leftButtonClicked:(UIButton *)leftBtn
{
switch (bottomView.tag) {
case kBottomViewTwoSaveSubmitTag: {
//保存
//[self httpSubmitLicenceResult];
[self upLoadFlieWithAction: @"save"];
}
break;
[self upLoadFlieWithAction:@"save"];
} break;
case kBottomViewTwoRejectedApprovedTag: {
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"填写拒绝理由" message:@"" delegate: self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:@"填写拒绝理由" message:@"" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alertV.alertViewStyle = UIAlertViewStylePlainTextInput;
alertV.tag = kAlertViewRejectedTag;
[alertV show];
// [self httpRejectedLicenceResult];
}
break;
default:
break;
} break;
default: break;
}
}
- (void)bottomView:(GXFBottomView *)bottomView RightButtonClicked:(UIButton *)rightBtn {
- (void)bottomView:(GXFBottomView *)bottomView RightButtonClicked:(UIButton *)rightBtn
{
switch (bottomView.tag) {
case kBottomViewTwoSaveSubmitTag: {
//提交
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"确定提交" message:@"" delegate: self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:@"确定提交" message:@"" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alertV.tag = kAlertViewSubmiteTag;
[alertV show];
// [self upLoadFlieWithAction: @"submit"];
}
break;
// [self upLoadFlieWithAction: @"submit"];
} break;
case kBottomViewTwoRejectedApprovedTag: {
UIAlertView *alertV = [[UIAlertView alloc]initWithTitle:@"确定审批通过" message:@"" delegate: self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:@"确定审批通过" message:@"" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alertV.tag = kAlertViewApprovedTag;
[alertV show];
// [self httpApprovedLicenceResult];
} break;
default: break;
}
break;
default:
break;
}
}
//#pragma Button Action
//- (void)sumbitResultClicked {
//
//
//}
//- (void)backClicked {
//// GTOEditPioneeringViewController *editPVC = [[GTOEditPioneeringViewController alloc]initWithPioneering:_d_licence];
//// // [self presentViewController:editPVC animated:YES completion:nil];
//// [self PushViewController:editPVC animated:NO];
//
//
// [self PopViewControllerAnimated:YES];
// // [super disMissSelf];///great!!!
//
//}
- (void)modifyClicked:(UIButton *)btn {
- (void)modifyClicked:(UIButton *)btn
{
}
#pragma GTOPatrolPlanResultHeaderItemDelegate
// 巡检结果中:不同区的headerView
- (void)patrolPlanResultHeaderItem:(GTOPatrolPlanResultHeaderItem *)resultHeaderItem
andIsDisplay:(BOOL)isDisplay {
- (void)patrolPlanResultHeaderItem:(GTOPatrolPlanResultHeaderItem *)resultHeaderItem andIsDisplay:(BOOL)isDisplay
{
NSInteger aIndex = resultHeaderItem.tag - 2;
NSMutableArray *muArrDisplayRs = [NSMutableArray array];
[muArrDisplayRs addObjectsFromArray:_d_licence.arrDisplayResults];
GTODisplayResult *displayR = [GTODisplayResult DBObject];
......@@ -979,48 +915,42 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[muArrDisplayRs replaceObjectAtIndex:aIndex withObject:[displayR dictForCommit]];
break;
}
}
_d_licence.arrDisplayResults = muArrDisplayRs;
[_d_licence saveToDBWithHandleData:NULL complete:^{
[_d_licence saveToDBWithHandleData:NULL
complete:^{
[_c_tableView reloadData];
} fail:nil];
}
fail:nil];
}
#pragma UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1 ) {
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
switch (alertView.tag) {
case kAlertViewSubmiteTag:
{
[self upLoadFlieWithAction: @"submit"];
}
break;
case kAlertViewApprovedTag:
{
case kAlertViewSubmiteTag: {
[self upLoadFlieWithAction:@"submit"];
} break;
case kAlertViewApprovedTag: {
[self httpApprovedLicenceResult];
}
break;
} break;
case kAlertViewRejectedTag:
{
case kAlertViewRejectedTag: {
UITextField *texfF = [alertView textFieldAtIndex:0];
[self httpRejectedLicenceResultWithRejectCause:texfF.text];
} break;
case kAlertViewAskForApprove: {
[self httpAskForApproveLicense];
} break;
default: break;
}
break;
default:
break;
}
}
}
#pragma button Action
- (void)seeRepairClicked {
GTORepairDetailViewController *repairDeVC = [[GTORepairDetailViewController alloc]initWithRepairUuid:_d_licence.repairUuid];
- (void)seeRepairClicked
{
GTORepairDetailViewController *repairDeVC = [[GTORepairDetailViewController alloc] initWithRepairUuid:_d_licence.repairUuid];
[self PushViewController:repairDeVC animated:YES];
}
@end
......@@ -6,48 +6,45 @@
// Copyright (c) 2015 Xummer. All rights reserved.
//
#import "ICRLoginViewController.h"
#import "ICRLoginContentView.h"
#import "APService.h"
#import "ICRLoginContentView.h"
#import "ICRLoginViewController.h"
#import <BaiduMapAPI/BMapKit.h>
#define LOGIN_CONTAINER_LEFT_MARGIN (20)
#define LOGIN_CONTAINER_HEIGHT (450)
@interface ICRLoginViewController ()<BMKMapViewDelegate,
BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
>
{
@interface ICRLoginViewController () <BMKMapViewDelegate, BMKLocationServiceDelegate, BMKGeoCodeSearchDelegate> {
CGFloat m_fDefaultContainerY;
}
@property (strong, nonatomic) ICRLoginContentView *m_containerView;
@property (strong, nonatomic) BMKLocationService *locService;
@property (strong, nonatomic) BMKMapView* mapView;
@property (strong, nonatomic) BMKGeoCodeSearch* geocodesearch;
@property (strong, nonatomic) BMKMapView *mapView;
@property (strong, nonatomic) BMKGeoCodeSearch *geocodesearch;
@property (assign, nonatomic) CGFloat coordinateX;
@property (assign, nonatomic) CGFloat coordinateY;
@property (copy, nonatomic) NSString *city;
@end
@implementation ICRLoginViewController
#pragma mark - Life Cycle
- (void)viewDidLoad {
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setupSubviews];
}
- (void)didReceiveMemoryWarning {
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewWillLayoutSubviews {
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
if (m_fDefaultContainerY == 0) {
......@@ -55,17 +52,16 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
}
}
- (void)viewDidAppear:(BOOL)animated {
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
NSNotificationCenter *notiCenter = [NSNotificationCenter defaultCenter];
[notiCenter addObserver:self
selector:@selector(inputTextEditChanged:)
name:UITextFieldTextDidChangeNotification
object:nil];
[notiCenter addObserver:self selector:@selector(inputTextEditChanged:) name:UITextFieldTextDidChangeNotification object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
NSNotificationCenter *notiCenter = [NSNotificationCenter defaultCenter];
......@@ -73,124 +69,107 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
}
#pragma mark - Private Method
- (void)setupSubviews {
// self.mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0,self.view.width , 50)];
//
// _mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放
// self.geocodesearch = [[BMKGeoCodeSearch alloc]init];
// self.geocodesearch.delegate = self;
//
// self.locService = [[BMKLocationService alloc]init];
// [_locService startUserLocationService];
// _locService.delegate = self;
//
- (void)setupSubviews
{
// self.mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0,self.view.width , 50)];
//
// _mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放
// self.geocodesearch = [[BMKGeoCodeSearch alloc]init];
// self.geocodesearch.delegate = self;
//
// self.locService = [[BMKLocationService alloc]init];
// [_locService startUserLocationService];
// _locService.delegate = self;
//
UIImageView *bg = [[UIImageView alloc] initWithFrame:self.view.bounds];
bg.image = [UIImage imageNamed:@"login_bg"];
[bg autoresizingWithStrechFullSize];
UITapGestureRecognizer *tapGesture =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(onBGTapped:)];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onBGTapped:)];
bg.userInteractionEnabled = YES;
[bg addGestureRecognizer:tapGesture];
[self.view addSubview:bg];
self.m_containerView =
[[ICRLoginContentView alloc] initWithFrame:(CGRect){
.origin.x = LOGIN_CONTAINER_LEFT_MARGIN,
.origin.y = (self.view.height - LOGIN_CONTAINER_HEIGHT) * .5f,
.size.width = self.view.width - 2 * LOGIN_CONTAINER_LEFT_MARGIN,
.size.height = LOGIN_CONTAINER_HEIGHT
self.m_containerView = [[ICRLoginContentView alloc] initWithFrame:(CGRect) {
.origin.x = LOGIN_CONTAINER_LEFT_MARGIN, .origin.y = (self.view.height - LOGIN_CONTAINER_HEIGHT) * .5f, .size.width = self.view.width - 2 * LOGIN_CONTAINER_LEFT_MARGIN, .size.height = LOGIN_CONTAINER_HEIGHT
}
showCCode:YES];
[_m_containerView autoresizingWithVerticalCenter];
[_m_containerView.m_loginBtn addTarget:self
action:@selector(onLoginTapped:)
forControlEvents:UIControlEventTouchUpInside];
[_m_containerView.m_loginBtn addTarget:self action:@selector(onLoginTapped:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_m_containerView];
//ICRDataBaseController *dataBC = [ICRDataBaseController sharedController];
// ICRDataBaseController *dataBC = [ICRDataBaseController sharedController];
NSString *dbPath = [ICRDataBaseController GetDataBasePath];
CLog(@"dbpath = %@",dbPath);
CLog(@"dbpath = %@", dbPath);
_m_containerView.m_cCodeTextF.placeholder = @"请输入企业验证码";
_m_containerView.m_userNameTextF.placeholder = @"请输入用户名";
_m_containerView.m_passwordTextF.placeholder = @"请输入密码";
_m_containerView.m_cCodeTextF.text = @"211534962";
//
//#if DEBUG
// self.m_containerView.m_cCodeTextF.text = @"923";//
// self.m_containerView.m_userNameTextF.text = @"admin";//@"admin2";//
// self.m_containerView.m_passwordTextF.text = @"thoradmin";//@"admin2";//
// [self.m_containerView checkLoginEnable];
//#else
//
//#endif
//
//#if DEBUG
// self.m_containerView.m_cCodeTextF.text = @"923";//
// self.m_containerView.m_userNameTextF.text = @"admin";//@"admin2";//
// self.m_containerView.m_passwordTextF.text = @"thoradmin";//@"admin2";//
// [self.m_containerView checkLoginEnable];
//#else
//
//#endif
ICRUserUtil *userU = [ICRUserUtil sharedInstance];
if (userU.f_isLogout) {
self.m_containerView.m_cCodeTextF.text = userU.f_authenticode;
self.m_containerView.m_userNameTextF.text =userU.f_user_loginName;
self.m_containerView.m_userNameTextF.text = userU.f_user_loginName;
self.m_containerView.m_passwordTextF.text = userU.f_user_password;
}
[self.m_containerView checkLoginEnable];
}
#pragma mark - Logic
#pragma mark - Actions
- (void)onBGTapped:(__unused id)sender {
- (void)onBGTapped:(__unused id)sender
{
[self.view endEditing:YES];
}
- (void)onLoginTapped:(__unused id)sender {
- (void)onLoginTapped:(__unused id)sender
{
NSString *nsRegisterCode = self.m_containerView.m_cCodeTextF.text;
NSString *nsUserName = self.m_containerView.m_userNameTextF.text;
NSString *nsPassword = self.m_containerView.m_passwordTextF.text ;
NSString *nsPassword = self.m_containerView.m_passwordTextF.text;
void(^succ)(id) = ^(id data) {
void (^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
userUtil.bAutoLogin = @( [_m_containerView isAutoLogin] );
userUtil.bAutoLogin = @([_m_containerView isAutoLogin]);
[userUtil saveArchive];
ICRAppViewControllerManager *mgr =
[ICRAppViewControllerManager getAppViewControllerManager];
ICRAppViewControllerManager *mgr = [ICRAppViewControllerManager getAppViewControllerManager];
[mgr openMainFrame];
//极光别名
NSSet *setTags = [NSSet setWithArray:@[@""]];
[APService setTags:setTags
alias:userUtil.f_user_uuid
callbackSelector:nil object:nil];
NSSet *setTags = [NSSet setWithArray:@[ @"" ]];
[APService setTags:setTags alias:userUtil.f_user_uuid callbackSelector:nil object:nil];
};
void(^fail)(id) = ^(id data) {
void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:@"登录失败"];
//[IBTLoadingView showTextOnly: data inView:self.view];
};
[IBTLoadingView showProgressLabel:@"正在登录"];
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doLoginWithUserName:nsUserName
password:nsPassword
registerCode:nsRegisterCode
success:succ
failure:fail];
[httpCtrl doLoginWithUserName:nsUserName password:nsPassword registerCode:nsRegisterCode success:succ failure:fail];
}
///**
// *在地图View将要启动定位时,会调用此函数
// *@param mapView 地图View
......@@ -228,15 +207,17 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
// }
//}
#pragma mark - TextObserver
- (void)inputTextEditChanged:(NSNotification *)obj {
- (void)inputTextEditChanged:(NSNotification *)obj
{
[self.m_containerView checkLoginEnable];
}
#pragma mark - Keyboard
- (void)keyboardWillShow:(NSNotification *)note {
- (void)keyboardWillShow:(NSNotification *)note
{
// get keyboard size and loctaion
CGRect keyboardBounds;
[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardBounds];
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
......@@ -250,13 +231,14 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
[UIView setAnimationCurve:[curve intValue]];
// set views with new info
self.m_containerView.y = - 50.0f;
self.m_containerView.y = -50.0f;
// commit animations
[UIView commitAnimations];
}
- (void)keyboardWillHide:(NSNotification *)note {
- (void)keyboardWillHide:(NSNotification *)note
{
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
......
......@@ -111,6 +111,8 @@
if ([englishState isEqualToString:@"initial"]) {
return @"未提交";
} else if ([englishState isEqualToString:@"submitted"]) {
return @"申请审批";
}else if ([englishState isEqualToString:GTO_LICENCE__STATE_ASKFORAPPROVE]) {
return @"待审批";
}else if ([englishState isEqualToString:@"approved"]) {
return @"审批通过";
......
......@@ -79,8 +79,8 @@
//#define HTTP_LOCAL_BASE_URL @"http://218.244.151.129:7580"
////正式环境
#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:7080/total-server/rest"
#define HTTP_LOCAL_BASE_URL @"http://139.196.39.77:7080"
//#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:7080/total-server/rest"
//#define HTTP_LOCAL_BASE_URL @"http://139.196.39.77:7080"
//
//测试环境
//#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:8180/total-server/rest"
......@@ -91,8 +91,8 @@
//#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:8080/total-server/rest"
//开发环境
//#define HTTP_LOCAL_BASE_URL @"http://139.196.195.30:8093"
//#define HTTP_REST_API_BASE_URL @"http://139.196.195.30:8093/total-server/rest"
#define HTTP_LOCAL_BASE_URL @"http://139.196.195.30:8093"
#define HTTP_REST_API_BASE_URL @"http://139.196.195.30:8093/total-server/rest"
//豪杰/
......@@ -168,6 +168,7 @@ typedef NS_ENUM(NSUInteger, ICRQestionType) {
#define GTO_LICENCE_STATE_LOCAL @"local"
#define GTO_LICENCE_STATE_INITIAL @"initial"
#define GTO_LICENCE__STATE_SUBMITTED @"submitted"
#define GTO_LICENCE__STATE_ASKFORAPPROVE @"askforapprove"
#define GTO_LICENCE__STATE_APPROVED @"approved"
#define GTO_LICENCE__STATE_REJECTED @"rejected"
#define GTO_LICENCE__STATE_EXPIRED @"expired"
......
......@@ -132,6 +132,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
version: (NSInteger)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
// 申请审批许可证(写)
- (void)doLicenceAskForApproveWithLicenceUuid:(NSString *)licenceUuid
version: (NSInteger)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//5.8许可证操作日志列表(读)
- (void)getLicenceGet_logsWithLicenceUuid:(NSString *)licenceUuid
success:(void (^)(id))succ
......
......@@ -82,6 +82,7 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
kGTOHTTP_LicenceRemove,
kGTOHTTP_LicenceReject,
kGTOHTTP_LicenceApprove,
kGTOHTTP_LicenceAskForApprove,
kGTOHTTP_LicenceGetLogs,
//6.1 保存拓店(写)
kGTOHTTP_PioneeringSaveResult,
......@@ -171,6 +172,7 @@ static NSString * const ICRHTTPInterface[] = {
[kGTOHTTP_LicenceRemove] = @"licence/remove",
[kGTOHTTP_LicenceReject] = @"licence/reject",
[kGTOHTTP_LicenceApprove] = @"licence/approve",
[kGTOHTTP_LicenceAskForApprove] = @"licence/askforapprove",
[kGTOHTTP_LicenceGetLogs] = @"licence/get_logs",
//6.1 保存拓店(写)
......@@ -1026,6 +1028,17 @@ acceptTypeJson:YES
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self p_doPostActionWithEncodeURL:encodeUrlStr data:nil success:succ failure:fail];
}
// 申请审批许可证(写)
- (void)doLicenceAskForApproveWithLicenceUuid:(NSString *)licenceUuid
version: (NSInteger)version
success:(void (^)(id))succ
failure:(void (^)(id))fail {
ICRUserUtil *userU = [ICRUserUtil sharedInstance];
NSString *urlStr = [[[self class] UrlForPluginHTTPAction:kGTOHTTP_LicenceAskForApprove] stringByAppendingFormat:@"/%@?version=%ld&time=%@&operId=%@&operName=%@",licenceUuid,version,[[NSDate date] httpParameterString],userU.f_user_code,userU.f_user_name];
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self p_doPostActionWithEncodeURL:encodeUrlStr data:nil success:succ failure:fail];
}
//5.8许可证操作日志列表(读)
- (void)getLicenceGet_logsWithLicenceUuid:(NSString *)licenceUuid
success:(void (^)(id))succ
......
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