Commit 2370cb39 authored by Sandy's avatar Sandy

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

2.中级审批权可以审批对应级别的许可证。
3.增加申请审批权限控制
parent 58bceca3
[ [
{ {
"id": "10", "id": "10",
"name": "系统管理", "name": "系统管理",
"children": [ "children": [
{ {
"id": "1001", "id": "1001",
"name": "员工管理", "name": "员工管理",
"url": "user/user.thor", "url": "user/user.thor",
"permissions": [ "permissions": [
{ {
"id": "100101", "id": "100101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "100102", "id": "100102",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
}, },
{ {
"id": "1002", "id": "1002",
"name": "角色管理", "name": "角色管理",
"url": "role/role.thor", "url": "role/role.thor",
"permissions": [ "permissions": [
{ {
"id": "100201", "id": "100201",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "100202", "id": "100202",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
}, },
{ {
"id": "1003", "id": "1003",
"name": "组织管理", "name": "组织管理",
"url": "organization/organization.thor", "url": "organization/organization.thor",
"permissions": [ "permissions": [
{ {
"id": "100301", "id": "100301",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "100302", "id": "100302",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
} }
] ]
}, },
{ {
"id": "20", "id": "20",
"name": "资料管理", "name": "资料管理",
"children": [ "children": [
{ {
"id": "2001", "id": "2001",
"name": "门店管理", "name": "门店管理",
"url": "mdata/store/store.thor", "url": "mdata/store/store.thor",
"permissions": [ "permissions": [
{ {
"id": "200101", "id": "200101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "200102", "id": "200102",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
}, },
{ {
"id": "2002", "id": "2002",
"name": "商品管理", "name": "商品管理",
"url": "mdata/product/product.thor", "url": "mdata/product/product.thor",
"permissions": [ "permissions": [
{ {
"id": "200201", "id": "200201",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "200202", "id": "200202",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
} }
] ]
}, },
{ {
"id": "30", "id": "30",
"name": "模板管理", "name": "模板管理",
"children": [ "children": [
{ {
"id" : "3001", "id" : "3001",
"name": "问卷模板管理", "name": "问卷模板管理",
"url": "inspect/template/template.thor", "url": "inspect/template/template.thor",
"permissions": [ "permissions": [
{ {
"id" : "300101", "id" : "300101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id" : "300102", "id" : "300102",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
} }
] ]
}, },
{ {
"id": "40", "id": "40",
"name": "公告管理", "name": "公告管理",
"children": [ "children": [
{ {
"id": "4001", "id": "4001",
"name": "公告管理", "name": "公告管理",
"url": "affiche/affiche.thor", "url": "affiche/affiche.thor",
"permissions": [ "permissions": [
{ {
"id": "400101", "id": "400101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "400102", "id": "400102",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
} }
] ]
}, },
{ {
"id": "60", "id": "60",
"name": "巡检管理", "name": "巡检管理",
"children": [ "children": [
{ {
"id": "6001", "id": "6001",
"name": "工程巡检", "name": "工程巡检",
"url": "patrol/plan/patrolplan.thor?category=project", "url": "patrol/plan/patrolplan.thor?category=project",
"permissions": [ "permissions": [
{ {
"id": "600101", "id": "600101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "600102", "id": "600102",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
}, },
{ {
"id": "6002", "id": "6002",
"name": "HSE巡检", "name": "HSE巡检",
"url": "patrol/plan/patrolplan.thor?category=HSE", "url": "patrol/plan/patrolplan.thor?category=HSE",
"permissions": [ "permissions": [
{ {
"id": "600201", "id": "600201",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id": "600202", "id": "600202",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
} }
] ]
}, },
{ {
"id": "70", "id": "70",
"name": "报修管理", "name": "报修管理",
"children": [ "children": [
{ {
"id" : "7001", "id" : "7001",
"name": "报修单", "name": "报修单",
"url": "repair/repair.thor", "url": "repair/repair.thor",
"permissions": [ "permissions": [
{ {
"id" : "700101", "id" : "700101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id" : "700102", "id" : "700102",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
}, },
{ {
"id" : "700103", "id" : "700103",
"name": "submit", "name": "submit",
"caption": "提交权" "caption": "提交权"
} }
] ]
}, },
{ {
"id" : "7002", "id" : "7002",
"name": "许可证", "name": "许可证",
"url": "licence/licence.thor", "url": "licence/licence.thor",
"permissions": [ "permissions": [
{ {
"id" : "700201", "id" : "700201",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
}, },
{ {
"id" : "700202", "id" : "700202",
"name": "middleapprove", "name": "middleapprove",
"caption": "中级审批权" "caption": "中级审批权"
}, },
{ {
"id" : "700203", "id" : "700203",
"name": "highapprove", "name": "highapprove",
"caption": "高级审批权" "caption": "高级审批权"
} }
] ]
} }
] ]
}, },
{ {
"id": "80", "id": "80",
"name": "拓站管理", "name": "拓站管理",
"children": [ "children": [
{ {
"id" : "8001", "id" : "8001",
"name": "拓站", "name": "拓站",
"url": "pioneer/pioneer.thor", "url": "pioneer/pioneer.thor",
"permissions": [ "permissions": [
{ {
"id" : "800101", "id" : "800101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
} }
] ]
} }
] ]
}, },
{ {
"id": "90", "id": "90",
"name": "签到管理", "name": "签到管理",
"children": [ "children": [
{ {
"id": "9001", "id": "9001",
"name": "查看签到", "name": "查看签到",
"url": "signin/signin.thor", "url": "signin/signin.thor",
"permissions": [ "permissions": [
{ {
"id": "900101", "id": "900101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
} }
] ]
}, },
{ {
"id": "9002", "id": "9002",
"name": "签到地图", "name": "签到地图",
"url": "signin/map.thor", "url": "signin/map.thor",
"permissions": [ "permissions": [
{ {
"id": "900201", "id": "900201",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
} }
] ]
} }
] ]
}, },
{ {
"id" : "95", "id" : "95",
"name": "报表", "name": "报表",
"children": [ "children": [
{ {
"id" : "9501", "id" : "9501",
"name": "员工报表", "name": "员工报表",
"url": "runqianReportJsp/showReport.jsp?raq=\\user.raq", "url": "runqianReportJsp/showReport.jsp?raq=\\user.raq",
"permissions": [ "permissions": [
{ {
"id" : "950101", "id" : "950101",
"name": "view", "name": "view",
"caption": "查看权" "caption": "查看权"
} }
] ]
} }
] ]
}, },
{ {
"id" : "50", "id" : "50",
"name": "前台", "name": "前台",
"type" : "mobileModule", "type" : "mobileModule",
"children": [ "children": [
{ {
"id" : "5001", "id" : "5001",
"name": "工程巡检", "name": "工程巡检",
"type" : "mobileModule", "type" : "mobileModule",
"permissions": [ "permissions": [
{ {
"id" : "500101", "id" : "500101",
"name": "viewall", "name": "viewall",
"caption": "全部查看权" "caption": "全部查看权"
}, },
{ {
"id" : "500102", "id" : "500102",
"name": "viewself", "name": "viewself",
"caption": "本人查看权" "caption": "本人查看权"
}, },
{ {
"id" : "500103", "id" : "500103",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
}, },
{ {
"id" : "5002", "id" : "5002",
"name": "HSE巡检", "name": "HSE巡检",
"type" : "mobileModule", "type" : "mobileModule",
"permissions": [ "permissions": [
{ {
"id" : "500201", "id" : "500201",
"name": "viewall", "name": "viewall",
"caption": "全部查看权" "caption": "全部查看权"
}, },
{ {
"id" : "500202", "id" : "500202",
"name": "viewself", "name": "viewself",
"caption": "本人查看权" "caption": "本人查看权"
}, },
{ {
"id" : "500203", "id" : "500203",
"name": "edit", "name": "edit",
"caption": "编辑权" "caption": "编辑权"
} }
] ]
}, },
{ {
"id" : "5003", "id" : "5003",
"name": "报修单", "name": "报修单",
"type" : "mobileModule", "type" : "mobileModule",
"permissions": [ "permissions": [
{ {
"id" : "500301", "id" : "500301",
"name": "viewall", "name": "viewall",
"caption": "全部查看权" "caption": "全部查看权"
}, },
{ {
"id" : "500302", "id" : "500302",
"name": "viewself", "name": "viewself",
"caption": "本人查看权" "caption": "本人查看权"
}, },
{ {
"id" : "500303", "id" : "500303",
"name": "create", "name": "create",
"caption": "新建许可证权" "caption": "新建许可证权"
}, },
{ {
"id" : "500304", "id" : "500304",
"name": "finish", "name": "finish",
"caption": "结束报修权" "caption": "结束报修权"
} }
] ]
}, },
{ {
"id" : "5004", "id" : "5004",
"name": "许可证", "name": "许可证",
"type" : "mobileModule", "type" : "mobileModule",
"permissions": [ "permissions": [
{ {
"id" : "500401", "id" : "500401",
"name": "viewall", "name": "viewall",
"caption": "全部查看权" "caption": "全部查看权"
}, },
{ {
"id" : "500402", "id" : "500402",
"name": "viewself", "name": "viewself",
"caption": "本人查看权" "caption": "本人查看权"
}, },
{ {
"id" : "500403", "id" : "500403",
"name": "highapprove", "name": "highapprove",
"caption": "高级审批权" "caption": "高级审批权"
}, },
{ {
"id" : "500404", "id" : "500404",
"name": "middleapprove", "name": "middleapprove",
"caption": "中级审批权" "caption": "中级审批权"
} }
] ]
}, },
{ {
"id" : "5005", "id" : "5005",
"name": "拓站", "name": "拓站",
"type" : "mobileModule", "type" : "mobileModule",
"permissions": [ "permissions": [
{ {
"id" : "500501", "id" : "500501",
"name": "viewall", "name": "viewall",
"caption": "全部查看权" "caption": "全部查看权"
}, },
{ {
"id" : "500502", "id" : "500502",
"name": "viewself", "name": "viewself",
"caption": "本人查看权" "caption": "本人查看权"
}, },
{ {
"id" : "500503", "id" : "500503",
"name": "create", "name": "create",
"caption": "新建权" "caption": "新建权"
} }
] ]
}, },
{ {
"id" : "5006", "id" : "5006",
"name": "公告", "name": "公告",
"type" : "mobileModule", "type" : "mobileModule",
"permissions": [ "permissions": [
{ {
"id" : "500601", "id" : "500601",
"name": "viewall", "name": "viewall",
"caption": "全部查看权" "caption": "全部查看权"
}, },
{ {
"id" : "500602", "id" : "500602",
"name": "viewself", "name": "viewself",
"caption": "本人查看权" "caption": "本人查看权"
} }
] ]
}, },
{ {
"id" : "5007", "id" : "5007",
"name": "签到", "name": "签到",
"type" : "mobileModule", "type" : "mobileModule",
"permissions": [ "permissions": [
{ {
"id" : "500701", "id" : "500701",
"name": "signin", "name": "signin",
"caption": "签到权" "caption": "签到权"
}, },
{ {
"id" : "500702", "id" : "500702",
"name": "position", "name": "position",
"caption": "自动定位权" "caption": "自动定位权"
} }
] ]
} }
] ]
} }
] ]
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--Business View Controller--> <!--Business View Controller-->
......
...@@ -6,18 +6,18 @@ ...@@ -6,18 +6,18 @@
// Copyright © 2015年 free. All rights reserved. // Copyright © 2015年 free. All rights reserved.
// //
#import "GTOLicenceCheckListViewController.h" #import "GTOAlertInfoLicenceViewController.h"
#import "GTOLicenceListCellContentView.h" #import "GTODisplayResult.h"
#import "GTOLicence.h" #import "GTOLicence.h"
#import "SortMaskView.h"
#import "MJRefresh.h"
#import "GTOLicenceCheckBoltView.h" #import "GTOLicenceCheckBoltView.h"
#import "QueryOrderNew.h" #import "GTOLicenceCheckListViewController.h"
#import "GTOAlertInfoLicenceViewController.h" #import "GTOLicenceListCellContentView.h"
#import "GTOLiceneResultViewController.h" #import "GTOLiceneResultViewController.h"
#import "GTODisplayResult.h"
#import "GTOQuestionManager.h"
#import "GTOPioneeringSurveyItem.h" #import "GTOPioneeringSurveyItem.h"
#import "GTOQuestionManager.h"
#import "MJRefresh.h"
#import "QueryOrderNew.h"
#import "SortMaskView.h"
#import "GTOAnswer.h" #import "GTOAnswer.h"
#import "GTOQuestion.h" #import "GTOQuestion.h"
...@@ -31,16 +31,15 @@ ...@@ -31,16 +31,15 @@
typedef enum : NSUInteger { typedef enum : NSUInteger {
SortTag = 3000, SortTag = 3000,
BoltTag BoltTag
} BtnTag; } BtnTag;
static NSString *cellID = @"licenceListCell"; static NSString *cellID = @"licenceListCell";
@interface GTOLicenceCheckListViewController ()<UITableViewDataSource,UITableViewDelegate,SortMaskViewDelegate,GTOLicenceCheckBoltViewDelegate,GTOAlertInfoLicenceViewControllerDelegate> @interface GTOLicenceCheckListViewController () <UITableViewDataSource, UITableViewDelegate, SortMaskViewDelegate, GTOLicenceCheckBoltViewDelegate, GTOAlertInfoLicenceViewControllerDelegate> {
{
UIView *_maskView; UIView *_maskView;
UIButton *currentBtn; UIButton *currentBtn;
SortMaskView *_sortView; SortMaskView *_sortView;
GTOLicenceCheckBoltView *_boltView; GTOLicenceCheckBoltView *_boltView;
UIBarButtonItem *_sureBtn; UIBarButtonItem *_sureBtn;
UIButton *_sortBtn; UIButton *_sortBtn;
UIButton *_boltBtn; UIButton *_boltBtn;
BOOL _isRefresh; BOOL _isRefresh;
...@@ -48,57 +47,57 @@ static NSString *cellID = @"licenceListCell"; ...@@ -48,57 +47,57 @@ static NSString *cellID = @"licenceListCell";
NSInteger _currentPage; NSInteger _currentPage;
} }
@property (nonatomic,strong)NSMutableArray *dataArr; @property (nonatomic, strong) NSMutableArray *dataArr;
@property (nonatomic,strong)UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic,strong)NSString *billNumberLike; @property (nonatomic, strong) NSString *billNumberLike;
@property (nonatomic,strong)NSString *riskGrade; @property (nonatomic, strong) NSString *riskGrade;
@property (nonatomic,strong)NSString *orderDirection;//asc(升序),desc(降序) @property (nonatomic, strong) NSString *orderDirection;// asc(升序),desc(降序)
@property (nonatomic, strong) GTOAlertInfoLicenceViewController *alertInfoVC; @property (nonatomic, strong) GTOAlertInfoLicenceViewController *alertInfoVC;
@property (nonatomic, assign) BOOL d_isClosed; //点击弹框的“关闭”按钮 @property (nonatomic, assign) BOOL d_isClosed; //点击弹框的“关闭”按钮
@property (nonatomic, strong) GTOLicence *d_currentLicence;//当前点击的列表的cell @property (nonatomic, strong) GTOLicence *d_currentLicence;//当前点击的列表的cell
@end @end
@implementation GTOLicenceCheckListViewController @implementation GTOLicenceCheckListViewController
- (void)viewDidLoad { - (void)viewDidLoad
{
[super viewDidLoad]; [super viewDidLoad];
self.title = @"许可证审批列表"; self.title = @"许可证审批列表";
self.view.backgroundColor = XXFBgColor; self.view.backgroundColor = XXFBgColor;
[self initData]; [self initData];
[self createBackBtn]; [self createBackBtn];
[self createTableView]; [self createTableView];
[self createRefresh]; [self createRefresh];
[self getData]; [self getData];
} }
- (void)viewWillAppear:(BOOL)animated{ - (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated]; [super viewWillAppear:animated];
[self getData];
} }
- (void)initData{ - (void)initData
{
self.dataArr = [NSMutableArray array]; self.dataArr = [NSMutableArray array];
// if (self.assessorVendor.length > 0) {
// self.vendorLike = self.assessorVendor;
// }
} }
- (void)getData{ - (void)getData
{
// [ICRUserUtil sharedInstance].needFresh = NO; // [ICRUserUtil sharedInstance].needFresh = NO;
__weak typeof(self)weakSelf = self; __weak typeof(self) weakSelf = self;
void(^succ)(id) = ^(id data) { void (^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf) strongSelf = weakSelf;
[strongSelf fetchtPuchaseList:data]; [strongSelf fetchtPuchaseList:data];
}; };
void(^fail)(id) = ^(id data) { void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
}; };
[IBTLoadingView showProgressLabel:@"正在加载..."]; [IBTLoadingView showProgressLabel:@"正在加载..."];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
//排序条件 //排序条件
NSMutableArray *orderArr =[NSMutableArray array]; NSMutableArray *orderArr = [NSMutableArray array];
if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) { if (self.orderDirection.length > 0 && ![self.orderDirection isEqualToString:@"none"]) {
QueryOrderNew *order = [QueryOrderNew new]; QueryOrderNew *order = [QueryOrderNew new];
order.field = @"billnumber"; order.field = @"billnumber";
...@@ -110,59 +109,58 @@ static NSString *cellID = @"licenceListCell"; ...@@ -110,59 +109,58 @@ static NSString *cellID = @"licenceListCell";
order.field = @"lastModify_time"; order.field = @"lastModify_time";
order.direction = @"desc"; order.direction = @"desc";
[orderArr addObject:[order dictForCommit]]; [orderArr addObject:[order dictForCommit]];
} }
// //筛选条件 // //筛选条件
// id stateObject = [NSNull null]; // id stateObject = [NSNull null];
// if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) { // if (self.state.length > 0 && ![self.state isEqualToString:@"none"]) {
// stateObject = self.state; // stateObject = self.state;
// } // }
id billNumberObject = [NSNull null]; id billNumberObject = [NSNull null];
if (self.billNumberLike.length > 0) { if (self.billNumberLike.length > 0) {
billNumberObject = self.billNumberLike; billNumberObject = self.billNumberLike;
} }
// id repairNumberObject = [NSNull null]; // id repairNumberObject = [NSNull null];
// if (self.repairNumberLike.length > 0) { // if (self.repairNumberLike.length > 0) {
// repairNumberObject = self.repairNumberLike; // repairNumberObject = self.repairNumberLike;
// } // }
id riskGradeObject = [NSNull null]; id riskGradeObject = [NSNull null];
if (self.riskGrade.length > 0 && ![self.riskGrade isEqualToString:@"none"]) { if (self.riskGrade.length > 0 && ![self.riskGrade isEqualToString:@"none"]) {
riskGradeObject = self.riskGrade; riskGradeObject = self.riskGrade;
} }
NSDictionary *dict = @{ NSDictionary *dict = @{
@"userUuid":userUtil.f_user_uuid, @"userUuid" : userUtil.f_user_uuid,
@"billNumberLike":billNumberObject, @"billNumberLike" : billNumberObject,
@"state":GTO_LICENCE__STATE_SUBMITTED, @"state" : [NSNull null],
@"repairUuid":@"", @"repairUuid" : @"",
@"repairNumberLike":[NSNull null],//repairNumberObject, @"repairNumberLike" : [NSNull null],// repairNumberObject,
@"riskGrade":riskGradeObject, @"riskGrade" : riskGradeObject,
@"queryOrders":orderArr, @"queryOrders" : orderArr,
@"pageNumber":@(_currentPage), @"pageNumber" : @(_currentPage),
@"pageSize":@(20)}; @"pageSize" : @(20)
};
ICRHTTPController *httpC = [ICRHTTPController sharedController]; ICRHTTPController *httpC = [ICRHTTPController sharedController];
[httpC getLicenceListWithData:dict success:succ failure:fail]; [httpC getLicenceListWithData:dict success:succ failure:fail];
} }
- (void)fetchtPuchaseList:(id)data{ - (void)fetchtPuchaseList:(id)data
{
if (data) { if (data) {
NSInteger success = [data[@"success"] integerValue]; NSInteger success = [data[@"success"] integerValue];
NSString *message = data[@"message"] ; NSString *message = data[@"message"];
if (success == 1) { if (success == 1) {
if (_currentPage == 0) { if (_currentPage == 0) {
if (self.dataArr.count > 0) { if (self.dataArr.count > 0) {
[self.dataArr removeAllObjects]; [self.dataArr removeAllObjects];
} }
} }
NSArray *recodesArr = data[ @"data" ][ @"records" ]; NSArray *recodesArr = data[@"data"][@"records"];
for (NSDictionary *dictRepair in recodesArr) { for (NSDictionary *dictRepair in recodesArr) {
GTOLicence *licence = [GTOLicence DBObject]; GTOLicence *licence = [GTOLicence DBObject];
[licence praseFromJsonDict:dictRepair]; [licence praseFromJsonDict:dictRepair];
[self.dataArr addObject:licence]; [self.dataArr addObject:licence];
} }
NSDictionary *pageDict = data[ @"data" ][ @"paging" ]; NSDictionary *pageDict = data[@"data"][@"paging"];
NSInteger pageCount = [pageDict[@"pageCount"] integerValue]; NSInteger pageCount = [pageDict[@"pageCount"] integerValue];
[self.tableView reloadData]; [self.tableView reloadData];
[self endRefreshing]; [self endRefreshing];
...@@ -172,37 +170,37 @@ static NSString *cellID = @"licenceListCell"; ...@@ -172,37 +170,37 @@ static NSString *cellID = @"licenceListCell";
if (_currentPage == 0 && self.dataArr.count > 0) { if (_currentPage == 0 && self.dataArr.count > 0) {
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES]; [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
} }
}else{ } else {
[IBTLoadingView showTips:message]; [IBTLoadingView showTips:message];
} }
}else{ } else {
[IBTLoadingView showTips:@" 无记录 "]; [IBTLoadingView showTips:@" 无记录 "];
} }
} }
- (void)createRefresh{ - (void)createRefresh
{
self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ self.tableView.header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
if (_isRefresh) { if (_isRefresh) {
return ; return;
} }
_isRefresh = YES; _isRefresh = YES;
_currentPage = 0; _currentPage = 0;
[self getData]; [self getData];
}]; }];
self.tableView.header.lastUpdatedTimeKey = GTO_REPAIR_UPDATEDATE; self.tableView.header.lastUpdatedTimeKey = GTO_REPAIR_UPDATEDATE;
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{ self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
if (_isLoadMore) { if (_isLoadMore) {
return ; return;
} }
_isLoadMore = YES; _isLoadMore = YES;
_currentPage ++; _currentPage++;
[self getData]; [self getData];
} ]; }];
} }
#pragma mark - 结束刷新 #pragma mark - 结束刷新
- (void)endRefreshing{ - (void)endRefreshing
{
_isLoadMore = NO; _isLoadMore = NO;
_isRefresh = NO; _isRefresh = NO;
[self.tableView.header endRefreshing]; [self.tableView.header endRefreshing];
...@@ -210,58 +208,77 @@ static NSString *cellID = @"licenceListCell"; ...@@ -210,58 +208,77 @@ static NSString *cellID = @"licenceListCell";
} }
- (void)createTableView - (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; 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); _sortBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_sortBtn]; [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); _boltBtn.titleLabel.font = FontSize(BtnSize);
[self.view addSubview:_boltBtn]; [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 registerClass:[UITableViewCell class] forCellReuseIdentifier:cellID];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
self.tableView.tableFooterView = [UIView new]; self.tableView.tableFooterView = [UIView new];
[self.view addSubview:self.tableView]; [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.backgroundColor = RGBA(0, 0, 0, 0.5);
_maskView.hidden = YES; _maskView.hidden = YES;
[self.view addSubview:_maskView]; [self.view addSubview:_maskView];
} }
#pragma mark -按钮事件 #pragma mark -按钮事件
- (void)sortClick:(UIButton *)btn{ - (void)sortClick:(UIButton *)btn
{
_maskView.backgroundColor = RGBA(0, 0, 0, 0.5); _maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
_maskView.hidden = NO; _maskView.hidden = NO;
if (btn.tag == SortTag) { if (btn.tag == SortTag) {
if(_boltView){ if (_boltView) {
[self hiddenBoltMaskView:NO]; [self hiddenBoltMaskView:NO];
} }
if (currentBtn == btn) { if (currentBtn == btn) {
[btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
[self hiddenSortMaskView:YES]; [self hiddenSortMaskView:YES];
currentBtn = nil; currentBtn = nil;
}else{ } else {
[btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
if (_sortView == nil) { if (_sortView == nil) {
_sortView = [[SortMaskView alloc]initWithFrame:CGRectMake(0, -105, ScreenSize.width, 150) withOrderDirection:self.orderDirection]; _sortView = [[SortMaskView alloc] initWithFrame:CGRectMake(0, -105, ScreenSize.width, 150) withOrderDirection:self.orderDirection];
_sortView.dataArr = [[NSMutableArray alloc]initWithObjects:@"默认排序",@"按时间逆序",@"按时间顺序",nil]; _sortView.dataArr = [[NSMutableArray alloc] initWithObjects:@"默认排序", @"按时间逆序", @"按时间顺序", nil];
_sortView.delegate = self; _sortView.delegate = self;
[_maskView addSubview:_sortView]; [_maskView addSubview:_sortView];
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25
CGRect sortFrame = _sortView.frame; animations:^{
sortFrame.origin.y = 0; CGRect sortFrame = _sortView.frame;
_sortView.frame = sortFrame; sortFrame.origin.y = 0;
}]; _sortView.frame = sortFrame;
}];
} }
currentBtn = btn; currentBtn = btn;
} }
}else if(btn.tag == BoltTag){ } else if (btn.tag == BoltTag) {
if (_sortView) { if (_sortView) {
[self hiddenSortMaskView:NO]; [self hiddenSortMaskView:NO];
} }
...@@ -269,97 +286,105 @@ static NSString *cellID = @"licenceListCell"; ...@@ -269,97 +286,105 @@ static NSString *cellID = @"licenceListCell";
[btn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
[self hiddenBoltMaskView:YES]; [self hiddenBoltMaskView:YES];
currentBtn = nil; currentBtn = nil;
}else{ } else {
[btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
if (_boltView == nil) { if (_boltView == nil) {
CGRect rect = CGRectMake(0, -105, ScreenSize.width, 274) ; CGRect rect = CGRectMake(0, -105, ScreenSize.width, 274);
_boltView = [[GTOLicenceCheckBoltView alloc]initWithFrame:rect billNumber:self.billNumberLike riskGrade:self.riskGrade]; _boltView = [[GTOLicenceCheckBoltView alloc] initWithFrame:rect billNumber:self.billNumberLike riskGrade:self.riskGrade];
_boltView.backgroundColor = XXFBgColor; _boltView.backgroundColor = XXFBgColor;
_boltView.delegate = self; _boltView.delegate = self;
// //initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成) // //initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
_boltView.dataArr = [[NSMutableArray alloc]initWithObjects:@"全部",GTO_LICENCE_RISK_HIGHT,GTO_LICENCE__RISK_MIDDLE,nil]; _boltView.dataArr = [[NSMutableArray alloc] initWithObjects:@"全部", GTO_LICENCE_RISK_HIGHT, GTO_LICENCE__RISK_MIDDLE, nil];
[_maskView addSubview:_boltView]; [_maskView addSubview:_boltView];
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25
CGRect sortFrame = _boltView.frame; animations:^{
sortFrame.origin.y = 0; CGRect sortFrame = _boltView.frame;
_boltView.frame = sortFrame; sortFrame.origin.y = 0;
}]; _boltView.frame = sortFrame;
}];
currentBtn = btn; currentBtn = btn;
} }
} }
} }
} }
- (void)hiddenSortMaskView:(BOOL)isHide{ - (void)hiddenSortMaskView:(BOOL)isHide
{
currentBtn = nil; currentBtn = nil;
[self checkSortBtnColor]; [self checkSortBtnColor];
if (isHide == NO) { if (isHide == NO) {
[_sortView removeFromSuperview]; [_sortView removeFromSuperview];
_sortView = nil; _sortView = nil;
}else{ } else {
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25
CGRect sortFrame = _sortView.frame; animations:^{
sortFrame.origin.y = -105; CGRect sortFrame = _sortView.frame;
_sortView.frame = sortFrame; sortFrame.origin.y = -105;
_maskView.backgroundColor = RGBA(0, 0, 0, 0); _sortView.frame = sortFrame;
}completion:^(BOOL finished) { _maskView.backgroundColor = RGBA(0, 0, 0, 0);
[_sortView removeFromSuperview]; }
_sortView = nil; completion:^(BOOL finished) {
_maskView.hidden = YES; [_sortView removeFromSuperview];
}]; _sortView = nil;
_maskView.hidden = YES;
}];
} }
} }
- (void)hiddenBoltMaskView:(BOOL)isHide{ - (void)hiddenBoltMaskView:(BOOL)isHide
{
currentBtn = nil; currentBtn = nil;
[self checkBoltBtnColor]; [self checkBoltBtnColor];
if (isHide == NO) { if (isHide == NO) {
[_boltView removeFromSuperview]; [_boltView removeFromSuperview];
_boltView = nil; _boltView = nil;
}else{ } else {
[UIView animateWithDuration:0.25 animations:^{ [UIView animateWithDuration:0.25
CGRect sortFrame = _boltView.frame; animations:^{
sortFrame.origin.y = -105; CGRect sortFrame = _boltView.frame;
_boltView.frame = sortFrame; sortFrame.origin.y = -105;
_maskView.backgroundColor = RGBA(0, 0, 0, 0); _boltView.frame = sortFrame;
}completion:^(BOOL finished) { _maskView.backgroundColor = RGBA(0, 0, 0, 0);
[_boltView removeFromSuperview]; }
_boltView = nil; completion:^(BOOL finished) {
_maskView.hidden = YES; [_boltView removeFromSuperview];
}]; _boltView = nil;
_maskView.hidden = YES;
}];
} }
} }
//检测排序的颜色 //检测排序的颜色
- (void)checkSortBtnColor{ - (void)checkSortBtnColor
{
if (self.orderDirection.length > 0) { if (self.orderDirection.length > 0) {
[_sortBtn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal]; [_sortBtn setImage:[UIImage imageNamed:@"select_arrow_up_text"] forState:UIControlStateNormal];
}else{ } else {
[_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal]; [_sortBtn setImage:[UIImage imageNamed:@"black_arrow_down_with_text"] forState:UIControlStateNormal];
} }
} }
- (void)checkBoltBtnColor{ - (void)checkBoltBtnColor
if ( self.billNumberLike.length > 0 || self.riskGrade.length > 0) { {
if (self.billNumberLike.length > 0 || self.riskGrade.length > 0) {
[_boltBtn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal]; [_boltBtn setImage:[UIImage imageNamed:@"selected-filter_with_text"] forState:UIControlStateNormal];
}else{ } else {
[_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal]; [_boltBtn setImage:[UIImage imageNamed:@"black_filter_with_text"] forState:UIControlStateNormal];
} }
} }
#pragma mark - 确定 #pragma mark - 确定
- (void)sureClick{ - (void)sureClick
{
// [_boltView.repairNumberFiled resignFirstResponder];
// [_boltView.repairNumberFiled resignFirstResponder];
[_boltView.billNumberFiled resignFirstResponder]; [_boltView.billNumberFiled resignFirstResponder];
_currentPage = 0; _currentPage = 0;
//请求 //请求
[self getData]; [self getData];
//还原数据 //还原数据
if (_sortView) { if (_sortView) {
[self hiddenSortMaskView:YES]; [self hiddenSortMaskView:YES];
...@@ -369,15 +394,17 @@ static NSString *cellID = @"licenceListCell"; ...@@ -369,15 +394,17 @@ static NSString *cellID = @"licenceListCell";
} }
} }
#pragma mark - sortDelegate #pragma mark - sortDelegate
- (void)getSortValueSelectRow:(NSString *)state{ - (void)getSortValueSelectRow:(NSString *)state
{
if (state.length > 0) { if (state.length > 0) {
self.orderDirection = state; self.orderDirection = state;
// CLog(@"%@",state); // CLog(@"%@",state);
} }
} }
#pragma mark - sortDelegate #pragma mark - sortDelegate
- (void)getBoltValueSelectRow:(NSString *)riskGrade { - (void)getBoltValueSelectRow:(NSString *)riskGrade
{
self.riskGrade = riskGrade; self.riskGrade = riskGrade;
} }
...@@ -386,92 +413,83 @@ static NSString *cellID = @"licenceListCell"; ...@@ -386,92 +413,83 @@ static NSString *cellID = @"licenceListCell";
//- (void)getRepairNumberLike:(NSString *)repairLike { //- (void)getRepairNumberLike:(NSString *)repairLike {
// self.repairNumberLike = repairLike; // self.repairNumberLike = repairLike;
//} //}
- (void)getBillNumber:(NSString *)billNumber { - (void)getBillNumber:(NSString *)billNumber
{
self.billNumberLike = billNumber; self.billNumberLike = billNumber;
} }
- (void)getRiskGrade:(NSString *)riskGrade { - (void)getRiskGrade:(NSString *)riskGrade
{
self.riskGrade = riskGrade; self.riskGrade = riskGrade;
} }
- (void)clearBoltInformation{ - (void)clearBoltInformation
{
//清空所有条件 //清空所有条件
if (self.billNumberLike.length > 0) { if (self.billNumberLike.length > 0) {
self.billNumberLike = @""; self.billNumberLike = @"";
} }
// if (self.repairNumberLike.length > 0) { // if (self.repairNumberLike.length > 0) {
// self.repairNumberLike = @""; // self.repairNumberLike = @"";
// } // }
// if (self.state.length > 0) { // if (self.state.length > 0) {
// self.state = @""; // self.state = @"";
// } // }
if (self.riskGrade.length > 0) { if (self.riskGrade.length > 0) {
self.riskGrade = @""; self.riskGrade = @"";
} }
} }
#pragma mark - 协议方法 #pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return self.dataArr.count; return self.dataArr.count;
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1; return 1;
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO]; [tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath]; 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]; [self configureCell:cell forRowAtIndexPath:indexPath];
return cell; return cell;
} }
- (void)configureCell:(UITableViewCell *)cell - (void)configureCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
forRowAtIndexPath:(NSIndexPath *)indexPath
{ {
//cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIView *contentView = cell.contentView; UIView *contentView = cell.contentView;
GTOLicenceListCellContentView *view = [contentView viewWithClass:[GTOLicenceListCellContentView class]]; GTOLicenceListCellContentView *view = [contentView viewWithClass:[GTOLicenceListCellContentView class]];
if (!view) { if (!view) {
view = [[GTOLicenceListCellContentView alloc] initWithFrame:contentView.bounds]; view = [[GTOLicenceListCellContentView alloc] initWithFrame:contentView.bounds];
//view.m_bHiddenNumLabel = m_bIsInHome; // view.m_bHiddenNumLabel = m_bIsInHome;
[view autoresizingWithStrechFullSize]; [view autoresizingWithStrechFullSize];
[contentView addSubview:view]; [contentView addSubview:view];
} }
GTOLicence *licence = _dataArr[indexPath.section]; GTOLicence *licence = _dataArr[indexPath.section];
[view updateWithLicence:licence]; [view updateWithLicence:licence];
} }
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return TableHeight; return TableHeight;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return section == 0 ? 1 : 10; return section == 0 ? 1 : 10;
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
GTOLicence *licence = _dataArr[indexPath.section]; GTOLicence *licence = _dataArr[indexPath.section];
self.d_currentLicence = licence; self.d_currentLicence = licence;
[self p_httpGetLicenceItems]; [self p_httpGetLicenceItems];
} }
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
/* /*
UITableViewCellEditingStyleNone, UITableViewCellEditingStyleNone,
UITableViewCellEditingStyleDelete, UITableViewCellEditingStyleDelete,
...@@ -481,64 +499,65 @@ static NSString *cellID = @"licenceListCell"; ...@@ -481,64 +499,65 @@ static NSString *cellID = @"licenceListCell";
if ([licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL]) { if ([licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL]) {
return UITableViewCellEditingStyleDelete; return UITableViewCellEditingStyleDelete;
} }
// return UITableViewCellEditingStyleDelete; // return UITableViewCellEditingStyleDelete;
return UITableViewCellEditingStyleNone; 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) { if (editingStyle == UITableViewCellEditingStyleDelete) {
GTOLicence *licence = _dataArr[indexPath.section]; GTOLicence *licence = _dataArr[indexPath.section];
[self p_deleteLicenceWithLicence: licence]; [self p_deleteLicenceWithLicence:licence];
[_dataArr removeObjectAtIndex:indexPath.section]; [_dataArr removeObjectAtIndex:indexPath.section];
[tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade]; [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]; [IBTLoadingView hideHUDWithText:nil];
if ([data[@"success"] integerValue] == 1) { if ([data[@"success"] integerValue] == 1) {
//本地删除 许可证 //本地删除 许可证
ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController]; ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOLicence TableName],@"uuid" ]; NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOLicence TableName], @"uuid"];
[db executeUpdate:strSql,licence.uuid]; [db executeUpdate:strSql, licence.uuid];
}]; }];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOQuestion TableName],@"licenceUuid" ]; NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOQuestion TableName], @"licenceUuid"];
[db executeUpdate:strSql,licence.uuid]; [db executeUpdate:strSql, licence.uuid];
}]; }];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOAnswer TableName],@"licenceUuid" ]; NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOAnswer TableName], @"licenceUuid"];
[db executeUpdate:strSql,licence.uuid]; [db executeUpdate:strSql, licence.uuid];
}]; }];
} else { } else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view]; [IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
} }
}; };
void(^fail)(id) = ^(id data) { void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
}; };
[IBTLoadingView showProgressLabel:@"正在加载..."]; [IBTLoadingView showProgressLabel:@"正在加载..."];
ICRHTTPController *httpC = [ICRHTTPController sharedController]; ICRHTTPController *httpC = [ICRHTTPController sharedController];
[httpC doLicenceRemoveWithLicenceUuid:licence.uuid version:licence.version success:succ failure:fail]; [httpC doLicenceRemoveWithLicenceUuid:licence.uuid version:licence.version success:succ failure:fail];
} }
- (void)p_httpGetLicenceItems { - (void)p_httpGetLicenceItems
{
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
void(^succ)(id) = ^(id data) { void (^succ)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf) strongSelf = weakSelf;
[strongSelf p_saveLicenceItemsWithData:data]; [strongSelf p_saveLicenceItemsWithData:data];
}; };
void(^fail)(id) = ^(id data) { void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showTips:data]; [IBTLoadingView showTips:data];
}; };
...@@ -546,57 +565,54 @@ static NSString *cellID = @"licenceListCell"; ...@@ -546,57 +565,54 @@ static NSString *cellID = @"licenceListCell";
ICRHTTPController *httpC = [ICRHTTPController sharedController]; ICRHTTPController *httpC = [ICRHTTPController sharedController];
[httpC getLicenceItemsWithLicenceUuid:_d_currentLicence.uuid success:succ failure:fail]; [httpC getLicenceItemsWithLicenceUuid:_d_currentLicence.uuid success:succ failure:fail];
} }
- (void)p_saveLicenceItemsWithData: (id)data { - (void)p_saveLicenceItemsWithData:(id)data
{
NSInteger intSucc = [data[@"success"] integerValue]; NSInteger intSucc = [data[@"success"] integerValue];
if (intSucc == 1) { if (intSucc == 1) {
} }
NSArray *arrItems = [data[@"data"] objectForKey:@"items"]; NSArray *arrItems = [data[@"data"] objectForKey:@"items"];
NSMutableArray *muArrQuestions = [NSMutableArray array]; NSMutableArray *muArrQuestions = [NSMutableArray array];
NSMutableArray *muArrAnswers = [NSMutableArray array]; NSMutableArray *muArrAnswers = [NSMutableArray array];
NSMutableArray *muArrCategory = [NSMutableArray array]; NSMutableArray *muArrCategory = [NSMutableArray array];
for(NSDictionary *dictItem in arrItems) { for (NSDictionary *dictItem in arrItems) {
GTOPioneeringSurveyItem *item = [GTOPioneeringSurveyItem DBObject]; GTOPioneeringSurveyItem *item = [GTOPioneeringSurveyItem DBObject];
[item praseFromJsonDict:dictItem]; [item praseFromJsonDict:dictItem];
GTOQuestion *question = [GTOQuestion DBObject]; GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:dictItem]; [question praseFromJsonDict:dictItem];
question.licenceUuid = _d_currentLicence.uuid; question.licenceUuid = _d_currentLicence.uuid;
[question saveToDBWithHandleData:NULL complete:NULL fail:NULL]; [question saveToDBWithHandleData:NULL complete:NULL fail:NULL];
// CLog(@"%@",question.uuid); // CLog(@"%@",question.uuid);
[muArrQuestions addObject:[question dictForCommit]]; [muArrQuestions addObject:[question dictForCommit]];
/* /*
@property (assign, nonatomic) NSUInteger resultScore; //打分结果 @property (assign, nonatomic) NSUInteger resultScore; //打分结果
@property (copy, nonatomic) NSString *resultContent; @property (copy, nonatomic) NSString *resultContent;
@property (copy, nonatomic) NSString *resultRemark; @property (copy, nonatomic) NSString *resultRemark;
@property (copy, nonatomic) NSArray *resultDetails; @property (copy, nonatomic) NSArray *resultDetails;
@property (copy, nonatomic) NSString *resultAttachmentId; //结果附件id 没做 @property (copy, nonatomic) NSString *resultAttachmentId; //结果附件id 没做
*/ */
GTOAnswer *answer = [GTOAnswer DBObject]; GTOAnswer *answer = [GTOAnswer DBObject];
[answer praseFromJsonDict:dictItem]; [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.bIsAnswered = YES;
answer.questionUuid = item.uuid; answer.questionUuid = item.uuid;
answer.licenceUuid = _d_currentLicence.uuid; answer.licenceUuid = _d_currentLicence.uuid;
[answer saveToDBWithHandleData:NULL complete:NULL fail:NULL]; [answer saveToDBWithHandleData:NULL complete:NULL fail:NULL];
[muArrAnswers addObject:[answer dictForCommit]]; [muArrAnswers addObject:[answer dictForCommit]];
} else { } else {
} }
[muArrCategory addObject:item.category]; [muArrCategory addObject:item.category];
} }
_d_currentLicence.questions = muArrQuestions; _d_currentLicence.questions = muArrQuestions;
//GTODisplayResult // GTODisplayResult
NSSet *setCategory = [NSSet setWithArray:muArrCategory]; NSSet *setCategory = [NSSet setWithArray:muArrCategory];
NSMutableArray *muArrDisplayRs = [NSMutableArray array]; NSMutableArray *muArrDisplayRs = [NSMutableArray array];
for(NSString *category in setCategory) { for (NSString *category in setCategory) {
NSMutableArray *muArrQuestions = [NSMutableArray array]; NSMutableArray *muArrQuestions = [NSMutableArray array];
for(NSDictionary *dictQ in _d_currentLicence.questions) { for (NSDictionary *dictQ in _d_currentLicence.questions) {
GTOQuestion *question = [GTOQuestion DBObject]; GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:dictQ]; [question praseFromJsonDict:dictQ];
if ([question.category isEqualToString:category]) { if ([question.category isEqualToString:category]) {
...@@ -610,105 +626,110 @@ static NSString *cellID = @"licenceListCell"; ...@@ -610,105 +626,110 @@ static NSString *cellID = @"licenceListCell";
displayR.isDisplay = NO; displayR.isDisplay = NO;
[muArrDisplayRs addObject:[displayR dictForCommit]]; [muArrDisplayRs addObject:[displayR dictForCommit]];
} }
_d_currentLicence.arrDisplayResults = muArrDisplayRs; _d_currentLicence.arrDisplayResults = muArrDisplayRs;
[_d_currentLicence saveToDBWithHandleData:NULL [_d_currentLicence saveToDBWithHandleData:NULL
complete:^{ complete:^{
//[self p_addAlerInfoLicenceView]; //[self p_addAlerInfoLicenceView];
if ([_d_currentLicence.state isEqualToString:GTO_LICENCE_STATE_INITIAL]) { if ([_d_currentLicence.state isEqualToString:GTO_LICENCE_STATE_INITIAL]) {
[self p_addAlerInfoLicenceView]; [self p_addAlerInfoLicenceView];
} else { } else {
[self fetchResult]; [self fetchResult];
} }
} }
fail:^(NSError *error) { fail:^(NSError *error) {
[IBTLoadingView hideHUDWithText:error.localizedDescription]; [IBTLoadingView hideHUDWithText:error.localizedDescription];
}]; }];
} }
- (void)createBackBtn{ - (void)createBackBtn
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
btn.frame = CGRectMake(0, 0, 12, 20); btn.frame = CGRectMake(0, 0, 12, 20);
[btn addTarget:self action:@selector(backRV) forControlEvents:UIControlEventTouchUpInside]; [btn addTarget:self action:@selector(backRV) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithCustomView:btn]; UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithCustomView:btn];
self.navigationItem.leftBarButtonItem = back; self.navigationItem.leftBarButtonItem = back;
} }
- (void)backRV{ - (void)backRV
{
[self PopToRootViewControllerAnimated:YES]; [self PopToRootViewControllerAnimated:YES];
} }
- (void)p_addAlerInfoLicenceView { - (void)p_addAlerInfoLicenceView
GTOAlertInfoLicenceViewController *alertInfoVC = [[GTOAlertInfoLicenceViewController alloc]initWithLicence:_d_currentLicence]; {
GTOAlertInfoLicenceViewController *alertInfoVC = [[GTOAlertInfoLicenceViewController alloc] initWithLicence:_d_currentLicence];
self.alertInfoVC = alertInfoVC; self.alertInfoVC = alertInfoVC;
alertInfoVC.delegate = self; alertInfoVC.delegate = self;
[[UIApplication sharedApplication].keyWindow addSubview:_alertInfoVC.view]; [[UIApplication sharedApplication].keyWindow addSubview:_alertInfoVC.view];
} }
//找到对应的答案并跳转结果页面 //找到对应的答案并跳转结果页面
- (void)fetchResult { //答案的个数 - (void)fetchResult
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) { {//答案的个数
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid",@"questionUuid" ]; ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db)
{
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid", @"questionUuid"];
//答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????) //答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????)
NSLog(@"%@",sql); NSLog(@"%@", sql);
return [db executeQuery:sql,_d_currentLicence.uuid]; return [db executeQuery:sql, _d_currentLicence.uuid];
}; };
__weak typeof(self)weakSelf = self; __weak typeof(self) weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) { ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf) strongSelf = weakSelf;
NSMutableArray *muArrDisplayRs = [NSMutableArray array]; 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; // NSInteger finiseNumber = 0;
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_currentLicence.arrDisplayResults[count]]; [displayR praseFromJsonDict:_d_currentLicence.arrDisplayResults[count]];
//displayR.answerNumber = 0; // displayR.answerNumber = 0;
NSMutableArray *muArrAnswers = [NSMutableArray array]; NSMutableArray *muArrAnswers = [NSMutableArray array];
for (GTOAnswer *answer in fetchedObjects) { for (GTOAnswer *answer in fetchedObjects) {
if([answer.category isEqualToString:displayR.category]) if ([answer.category isEqualToString:displayR.category])
//displayR.answerNumber++; // displayR.answerNumber++;
[muArrAnswers addObject:[answer dictForCommit]]; [muArrAnswers addObject:[answer dictForCommit]];
} }
displayR.arrAnswers = muArrAnswers; displayR.arrAnswers = muArrAnswers;
[muArrDisplayRs addObject:[displayR dictForCommit]]; [muArrDisplayRs addObject:[displayR dictForCommit]];
} }
_d_currentLicence.arrDisplayResults = muArrDisplayRs; _d_currentLicence.arrDisplayResults = muArrDisplayRs;
[_d_currentLicence saveToDBWithHandleData:nil complete:^{ [_d_currentLicence saveToDBWithHandleData:nil
GTOLiceneResultViewController *resultVC = [[GTOLiceneResultViewController alloc]initWithLicence:_d_currentLicence]; complete:^{
//resultVC. GTOLiceneResultViewController *resultVC = [[GTOLiceneResultViewController alloc] initWithLicence:_d_currentLicence];
[self PushViewController:resultVC animated:YES]; // resultVC.
} fail:nil]; [self PushViewController:resultVC animated:YES];
}
fail:nil];
}; };
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController]; ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[GTOAnswer class] [dbCtrl runFetchForClass:[GTOAnswer class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultsBlk];
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
} }
#pragma GTOAlertInfoLicenceViewControllerDelegate #pragma GTOAlertInfoLicenceViewControllerDelegate
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence closeClickedWithBtton:(UIButton *)btn { - (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence closeClickedWithBtton:(UIButton *)btn
{
self.d_isClosed = YES; self.d_isClosed = YES;
[_alertInfoVC.view removeFromSuperview]; [_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; self.d_isClosed = YES;
[_alertInfoVC.view removeFromSuperview]; [_alertInfoVC.view removeFromSuperview];
[self PushViewController:resultVC animated:YES]; [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) { BOOL isAllFinished = YES;
for (NSDictionary *dict in _d_currentLicence.arrDisplayResults) {
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:dict]; [displayR praseFromJsonDict:dict];
if (displayR.arrAnswers.count < displayR.arrQuestions.count) { if (displayR.arrAnswers.count < displayR.arrQuestions.count) {
...@@ -716,11 +737,11 @@ static NSString *cellID = @"licenceListCell"; ...@@ -716,11 +737,11 @@ static NSString *cellID = @"licenceListCell";
mgr.d_category = displayR.category; mgr.d_category = displayR.category;
[mgr openQuestionVCFromViewControler:self Licence:_d_currentLicence Pioneering:nil]; [mgr openQuestionVCFromViewControler:self Licence:_d_currentLicence Pioneering:nil];
[self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil]; [self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil];
isAllFinished = NO; isAllFinished = NO;
break; break;
} }
} }
if (isAllFinished) { if (isAllFinished) {
NSDictionary *dictR = [_d_currentLicence.arrDisplayResults lastObject]; NSDictionary *dictR = [_d_currentLicence.arrDisplayResults lastObject];
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
...@@ -729,27 +750,23 @@ static NSString *cellID = @"licenceListCell"; ...@@ -729,27 +750,23 @@ static NSString *cellID = @"licenceListCell";
mgr.d_category = displayR.category; mgr.d_category = displayR.category;
[mgr openQuestionVCFromViewControler:self Licence:_d_currentLicence Pioneering:nil]; [mgr openQuestionVCFromViewControler:self Licence:_d_currentLicence Pioneering:nil];
[self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil]; [self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil];
} }
} }
- (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)alertInfoLicenceViewController:(GTOAlertInfoLicenceViewController *)alertInfoLicence didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
GTOQuestionManager *mgr = [GTOQuestionManager sharedManager]; GTOQuestionManager *mgr = [GTOQuestionManager sharedManager];
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_currentLicence.arrDisplayResults[indexPath.row]]; [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]; [mgr openQuestionVCFromViewControler:self Licence:_d_currentLicence Pioneering:nil];
[self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil]; [self alertInfoLicenceViewController:alertInfoLicence closeClickedWithBtton:nil];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
@end @end
...@@ -7,15 +7,14 @@ ...@@ -7,15 +7,14 @@
// //
#import "GTOLiceneResultViewController.h" #import "GTOLiceneResultViewController.h"
#import "ICRQuestionHelperView.h"
#import "ICRAttachmentView.h" #import "ICRAttachmentView.h"
#import "ICRQuestionHelperView.h"
#import "GTOLicence.h" #import "GTOLicence.h"
#import "GTOAnswer.h"
#import "GTODisplayResult.h" #import "GTODisplayResult.h"
#import "GTOQuestion.h" #import "GTOQuestion.h"
#import "GTOAnswer.h"
#import "GTOPatrolPlanResultHeaderItem.h" #import "GTOPatrolPlanResultHeaderItem.h"
#import "GTOPatrolPlanResultProblemItem.h" #import "GTOPatrolPlanResultProblemItem.h"
...@@ -25,35 +24,35 @@ ...@@ -25,35 +24,35 @@
//#import "GTOPioneeringListViewController.h" //#import "GTOPioneeringListViewController.h"
#import "GTOPioneeringSurveyItem.h" #import "GTOPioneeringSurveyItem.h"
//#import "GTOPioneeringResult.h" //#import "GTOPioneeringResult.h"
#import "GTOLicenceResult.h"
#import "GTOEditPioneeringViewController.h" #import "GTOEditPioneeringViewController.h"
#import "GTOLicenceResult.h"
#import "GXFBottomView.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 "GTOButtonHeaderContentView.h"
#import "GTORepairDetailViewController.h" #import "GTOLicenceCheckListViewController.h"
#import "GTOLicenceListViewController.h"
#import "GTOLicenceResultHeaderContentView.h"
#import "GTOQuestionBaseViewController.h"
#import "GTOQuestionManager.h" #import "GTOQuestionManager.h"
#define GXF_DETAIL_COLOR HexColor(@"888888") #import "GTORepair.h"
#define GXF_CONTENT_COLOR HexColor(@"444444") #import "GTORepairDetailViewController.h"
#import "ICRPostAttachment.h"
#define GXF_DETAIL_COLOR HexColor(@"888888")
#define GXF_CONTENT_COLOR HexColor(@"444444")
#define KEY_IS_DISPLAY @"isDisplay" #define KEY_IS_DISPLAY @"isDisplay"
typedef NS_ENUM(NSUInteger, bottomViewTag) { typedef NS_ENUM(NSUInteger, bottomViewTag) {
// kBottomViewLeftDelTag = 0,
// kBottomViewLeftSubmittedTag,
kBottomViewOneSaveTag = 0, kBottomViewOneSaveTag = 0,
kBottomViewTwoSaveSubmitTag, kBottomViewTwoSaveSubmitTag,
kBottomViewTwoRejectedApprovedTag, kBottomViewTwoRejectedApprovedTag,
kBottomViewOneBackTag kBottomViewOneBackTag,
kBOttomViewAskForApprove
}; };
typedef NS_ENUM(NSUInteger, alertViewTag) { typedef NS_ENUM(NSUInteger, alertViewTag) {
kAlertViewSubmiteTag = 0, kAlertViewSubmiteTag = 0,
kAlertViewApprovedTag, kAlertViewApprovedTag,
kAlertViewRejectedTag, kAlertViewRejectedTag,
kAlertViewAskForApprove
}; };
static NSString *cellID = @"cellID"; static NSString *cellID = @"cellID";
//只有标题 //只有标题
...@@ -62,19 +61,14 @@ static NSString *headerBtnItemID = @"headerBtnItem"; ...@@ -62,19 +61,14 @@ static NSString *headerBtnItemID = @"headerBtnItem";
//可以点击(存放问题的header) //可以点击(存放问题的header)
static NSString *headerProblemItemID = @"headerItem"; static NSString *headerProblemItemID = @"headerItem";
@interface GTOLiceneResultViewController () @interface GTOLiceneResultViewController () <UITextFieldDelegate, UITableViewDataSource, UITableViewDelegate, GTOPatrolPlanResultHeaderItemDelegate, GXFBottomViewDelegate, UIAlertViewDelegate>
<UITextFieldDelegate,
UITableViewDataSource,
UITableViewDelegate, GTOPatrolPlanResultHeaderItemDelegate,
GXFBottomViewDelegate,UIAlertViewDelegate>
@property(strong, nonatomic) ICRQuestionHelperView *m_helperView; @property (strong, nonatomic) ICRQuestionHelperView *m_helperView;
@property(nonatomic, strong) NSIndexPath *m_clickedIndexPath; @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 (strong, nonatomic) GTORepair *d_repair;
@property(nonatomic, strong) UITableView *c_tableView; @property (nonatomic, strong) UITableView *c_tableView;
@property (nonatomic, strong) NSMutableArray *d_arrPostAttachments; @property (nonatomic, strong) NSMutableArray *d_arrPostAttachments;
...@@ -84,73 +78,77 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -84,73 +78,77 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
#pragma mark - Life Cycle #pragma mark - Life Cycle
- (instancetype)initWithLicence:(GTOLicence *)licence {//andRepair: (GTORepair *)repair { - (instancetype)initWithLicence:(GTOLicence *)licence
{// andRepair: (GTORepair *)repair {
self = [super init]; self = [super init];
if (!self) { if (!self) {
return nil; return nil;
} }
if ([licence isKindOfClass:[GTOLicence class]]) { if ([licence isKindOfClass:[GTOLicence class]]) {
self.d_licence = licence; self.d_licence = licence;
// self.d_repair = repair; // self.d_repair = repair;
} }
return self; return self;
} }
- (void)viewDidLoad { - (void)viewDidLoad
{
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.title = @"许可证结果"; self.title = @"许可证结果";
[self initSubViews]; [self initSubViews];
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated
{
[self updateAnswer]; [self updateAnswer];
} }
- (void)updateAnswer { - (void)updateAnswer
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) { {
NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid",@"questionUuid" ]; ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db)
{
NSString *sql = [NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@ = ? ORDER BY %@", [GTOAnswer TableName], @"licenceUuid", @"questionUuid"];
//答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????) //答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????)
NSLog(@"%@",sql); NSLog(@"%@", sql);
return [db executeQuery:sql,_d_licence.uuid]; return [db executeQuery:sql, _d_licence.uuid];
}; };
__weak typeof(self)weakSelf = self; __weak typeof(self) weakSelf = self;
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) { ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf) strongSelf = weakSelf;
NSMutableArray *muArrDisplayRs = [NSMutableArray array]; 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]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]]; [displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]];
NSMutableArray *muArrAnswers = [NSMutableArray array]; NSMutableArray *muArrAnswers = [NSMutableArray array];
for (GTOAnswer *answer in fetchedObjects) { for (GTOAnswer *answer in fetchedObjects) {
if([answer.category isEqualToString:displayR.category]) if ([answer.category isEqualToString:displayR.category])
//displayR.answerNumber++; // displayR.answerNumber++;
[muArrAnswers addObject:[answer dictForCommit]]; [muArrAnswers addObject:[answer dictForCommit]];
} }
displayR.arrAnswers = muArrAnswers; displayR.arrAnswers = muArrAnswers;
[muArrDisplayRs addObject:[displayR dictForCommit]]; [muArrDisplayRs addObject:[displayR dictForCommit]];
} }
_d_licence.arrDisplayResults = muArrDisplayRs; _d_licence.arrDisplayResults = muArrDisplayRs;
[_d_licence saveToDBWithHandleData:nil complete:^{ [_d_licence saveToDBWithHandleData:nil
[_c_tableView reloadData]; complete:^{
} fail:nil]; [_c_tableView reloadData];
}
fail:nil];
}; };
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[GTOAnswer class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[GTOAnswer class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultsBlk];
} }
- (void)initSubViews { - (void)initSubViews
//tableView {
// tableView
self.c_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height - 60 - 64) style:UITableViewStylePlain]; 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.delegate = self;
self.c_tableView.dataSource = self; self.c_tableView.dataSource = self;
...@@ -160,96 +158,112 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -160,96 +158,112 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[self.c_tableView registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:headerTitleItemID]; [self.c_tableView registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:headerTitleItemID];
[self.c_tableView registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:headerProblemItemID]; [self.c_tableView registerClass:[UITableViewHeaderFooterView class] forHeaderFooterViewReuseIdentifier:headerProblemItemID];
[self.view addSubview:_c_tableView]; [self.view addSubview:_c_tableView];
//bottomView // bottomView
BOOL highApprovePermission = [GTOCommonTools hasPermissionWithPermissionId:500403]; //高级审批权 BOOL highApprovePermission = [GTOCommonTools hasPermissionWithPermissionId:500403]; //高级审批权
BOOL middleApprovePermission = [GTOCommonTools hasPermissionWithPermissionId:500404]; //中级审批权 BOOL middleApprovePermission = [GTOCommonTools hasPermissionWithPermissionId:500404];//中级审批权
BOOL approvePermission = NO; BOOL approvePermission = NO;
if (highApprovePermission) { if (highApprovePermission) {
approvePermission = YES; approvePermission = YES;
} else if (!highApprovePermission && middleApprovePermission) { } else if (!highApprovePermission && middleApprovePermission) {
if ([_d_licence.riskGrade isEqualToString:GTO_LICENCE_RISK_HIGHT]) { if ([_d_licence.riskGrade isEqualToString:GTO_LICENCE_RISK_HIGHT]) {
approvePermission = NO; 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); CGRect rect = CGRectMake(0, _c_tableView.bottom, self.view.width, 40);
GXFBottomView *bottomV; GXFBottomView *bottomV;
//判断是否在时间区间内
BOOL bet = [GTOCommonTools nowInTimeDuringMinTime:_d_licence.beginDate maxTime:_d_licence.endDate]; BOOL bet = [GTOCommonTools nowInTimeDuringMinTime:_d_licence.beginDate maxTime:_d_licence.endDate];
BOOL condition = [_d_licence.state isEqualToString:GTO_LICENCE__STATE_SUBMITTED] && approvePermission;
//是已提交状态 && 有权限
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]) { if ([_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL] || [_d_licence.state isEqualToString:GTO_LICENCE_STATE_LOCAL]) {
NSUInteger noFinishNumber = 0; NSUInteger noFinishNumber = 0;
for (NSDictionary *dictDisplayR in _d_licence.arrDisplayResults) { for (NSDictionary *dictDisplayR in _d_licence.arrDisplayResults) {
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:dictDisplayR]; [displayR praseFromJsonDict:dictDisplayR];
if (displayR.arrAnswers.count != displayR.arrQuestions.count) if (displayR.arrAnswers.count != displayR.arrQuestions.count) noFinishNumber++;
noFinishNumber++;
} }
if (noFinishNumber > 0) { if (noFinishNumber > 0) {
bottomV = [[GXFBottomView alloc] initOneButtonWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, 40) buttonColor:GTO_RED_COLOR buttonTitle:@"返回"]; bottomV = [[GXFBottomView alloc] initOneButtonWithFrame:CGRectMake(0, _c_tableView.bottom, self.view.width, 40) buttonColor:GTO_RED_COLOR buttonTitle:@"返回"];
bottomV.tag = kBottomViewOneBackTag; bottomV.tag = kBottomViewOneBackTag;
} else { } 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; bottomV.tag = kBottomViewTwoSaveSubmitTag;
} }
} else if (condition){ } else if (isSubmitted) {
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] 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; bottomV.tag = kBottomViewTwoRejectedApprovedTag;
} else {
}else {
bottomV = [[GXFBottomView alloc] initOneButtonWithFrame:rect buttonColor:GTO_RED_COLOR buttonTitle:@"返 回"]; bottomV = [[GXFBottomView alloc] initOneButtonWithFrame:rect buttonColor:GTO_RED_COLOR buttonTitle:@"返 回"];
bottomV.tag = kBottomViewOneBackTag; bottomV.tag = kBottomViewOneBackTag;
} }
bottomV.backgroundColor = XXFBgColor; bottomV.backgroundColor = XXFBgColor;
bottomV.delegate = self; bottomV.delegate = self;
[self.view addSubview:bottomV]; [self.view addSubview:bottomV];
} }
#pragma UITableViewDataSource #pragma UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2 + _d_licence.arrDisplayResults.count;//_d_arrDisplayResults.count; 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); CLog(@"indexpath section = %ld", section);
if (section == 0) { if (section == 0) {
return 1; return 1;
} else if (section == 1) { } else if (section == 1) {
return 0; return 0;
} else { } 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) { if (section == count + 2) {
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]]; [displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]];
return displayR.isDisplay ? displayR.arrQuestions.count : 0; return displayR.isDisplay ? displayR.arrQuestions.count : 0;
// return displayR.isDisplay ? displayR.arrAnswers.count : 0;
} }
} }
return 0; return 0;
} }
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES]; [tableView deselectRowAtIndexPath:indexPath animated:YES];
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
[self configureCell:cell forRowAtIndexPath:indexPath]; [self configureCell:cell forRowAtIndexPath:indexPath];
//cell.selectionStyle = UITableViewCellSelectionStyleNone; // cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; return cell;
} }
- (void)configureCell:(UITableViewCell *)cell - (void)configureCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
forRowAtIndexPath:(NSIndexPath *)indexPath { {
UIView *contentView = cell.contentView; UIView *contentView = cell.contentView;
if (indexPath.section == 0) { if (indexPath.section == 0) {
GTOLicenceResultTopCellContentView *topItem = [contentView viewWithClass:[GTOLicenceResultTopCellContentView class]]; GTOLicenceResultTopCellContentView *topItem = [contentView viewWithClass:[GTOLicenceResultTopCellContentView class]];
...@@ -259,9 +273,9 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -259,9 +273,9 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[contentView addSubview:topItem]; [contentView addSubview:topItem];
} }
[topItem updateWithLicence:_d_licence arrayDictDisplayResults:_d_licence.arrDisplayResults]; [topItem updateWithLicence:_d_licence arrayDictDisplayResults:_d_licence.arrDisplayResults];
} else if (indexPath.section > 1) { } else if (indexPath.section > 1) {
GTOPatrolPlanResultProblemItem *problemItem = [contentView viewWithClass:[GTOPatrolPlanResultProblemItem class]]; GTOPatrolPlanResultProblemItem *problemItem = [contentView viewWithClass:[GTOPatrolPlanResultProblemItem class]];
if (!problemItem) { if (!problemItem) {
problemItem = [[GTOPatrolPlanResultProblemItem alloc] initWithFrame:contentView.bounds]; problemItem = [[GTOPatrolPlanResultProblemItem alloc] initWithFrame:contentView.bounds];
...@@ -275,29 +289,19 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -275,29 +289,19 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
GTOQuestion *question = [GTOQuestion DBObject]; GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:displayR.arrQuestions[indexPath.row]]; [question praseFromJsonDict:displayR.arrQuestions[indexPath.row]];
[self uploadePatrolPlanResultProblemItemAnswer:problemItem question:question cellForRowAtIndexPath:indexPath]; [self uploadePatrolPlanResultProblemItemAnswer:problemItem question:question cellForRowAtIndexPath:indexPath];
} else {
// 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 {}
} }
- (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来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????) //答案的排序按照问题的uuid来,(此事的排序关系到结果页中答案的显示,按道理应该是根据答题的顺序,是不是后台给的问题应该排序?????)
NSLog(@"%@",sql); NSLog(@"%@", sql);
return [db executeQuery:sql,_d_licence.uuid,question.uuid,question.category]; return [db executeQuery:sql, _d_licence.uuid, question.uuid, question.category];
}; };
ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) { ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
...@@ -309,61 +313,33 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -309,61 +313,33 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} }
}; };
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController]; ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[GTOAnswer class] [dbCtrl runFetchForClass:[GTOAnswer class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultsBlk];
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultsBlk];
} }
#pragma UITableViewDelegate #pragma UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
if (indexPath.section < 2) {
{ if (indexPath.section < 2) {
return; return;
} }
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[indexPath.section - 2]]; [displayR praseFromJsonDict:_d_licence.arrDisplayResults[indexPath.section - 2]];
GTOQuestion *question = [GTOQuestion DBObject]; GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:displayR.arrQuestions[indexPath.row]]; [question praseFromJsonDict:displayR.arrQuestions[indexPath.row]];
GTOQuestionManager *mgr = [GTOQuestionManager sharedManager]; GTOQuestionManager *mgr = [GTOQuestionManager sharedManager];
mgr.d_category = question.category; mgr.d_category = question.category;
BOOL notEdit = NO; BOOL notEdit = NO;
if ([_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL] if ([_d_licence.state isEqualToString:GTO_LICENCE_STATE_INITIAL] || [_d_licence.state isEqualToString:GTO_LICENCE_STATE_LOCAL]) {
|| [_d_licence.state isEqualToString:GTO_LICENCE_STATE_LOCAL]) {
notEdit = NO; notEdit = NO;
} else { } else {
notEdit = YES; notEdit = YES;
} }
[mgr openQuestionVCFromViewControler:self Licence:_d_licence Pioneering:nil IsNotEdit:notEdit ProblemIndex:indexPath.row + 1]; [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) { if (indexPath.section == 0) {
return 176; return 176;
} else { } else {
...@@ -371,58 +347,58 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -371,58 +347,58 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} }
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return HEADER_HEIGHT; return HEADER_HEIGHT;
} }
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UITableViewHeaderFooterView *headerView = nil; UITableViewHeaderFooterView *headerView = nil;
if (section == 0) { if (section == 0) {
headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerBtnItemID]; headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerBtnItemID];
} else if(section == 1){ } else if (section == 1) {
headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerTitleItemID]; headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerTitleItemID];
} else { } else {
headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerProblemItemID]; headerView = [self tableHeaderFooterViewWithTableView:tableView andHeaderID:headerProblemItemID];
} }
CGRect rect = CGRectMake(0, 0, tableView.width, 50); CGRect rect = CGRectMake(0, 0, tableView.width, 50);
[self configureHeaderView:headerView frameWithRect:rect viewForSection:section]; [self configureHeaderView:headerView frameWithRect:rect viewForSection:section];
return headerView; return headerView;
} }
- (UITableViewHeaderFooterView *)tableHeaderFooterViewWithTableView: (UITableView *)tableView andHeaderID: (NSString *)headerId { - (UITableViewHeaderFooterView *)tableHeaderFooterViewWithTableView:(UITableView *)tableView andHeaderID:(NSString *)headerId
{
UITableViewHeaderFooterView *headerView = nil; UITableViewHeaderFooterView *headerView = nil;
headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerId]; headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerId];
if (!headerView) { if (!headerView) {
headerView = [[UITableViewHeaderFooterView alloc]initWithReuseIdentifier:headerId]; headerView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:headerId];
} }
return headerView; 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; UIView *contentView = headerView.contentView;
CGFloat padding = 10; CGFloat padding = 10;
if (section == 0) { if (section == 0) {
GTOButtonHeaderContentView *btnView = [contentView viewWithClass:[GTOButtonHeaderContentView class]]; GTOButtonHeaderContentView *btnView = [contentView viewWithClass:[GTOButtonHeaderContentView class]];
if (!btnView) { if (!btnView) {
btnView = [[GTOButtonHeaderContentView alloc]initWithFrame:rect]; btnView = [[GTOButtonHeaderContentView alloc] initWithFrame:rect];
[btnView.m_btn addTarget:self action:@selector(seeRepairClicked) forControlEvents:UIControlEventTouchUpInside]; [btnView.m_btn addTarget:self action:@selector(seeRepairClicked) forControlEvents:UIControlEventTouchUpInside];
[contentView addSubview:btnView]; [contentView addSubview:btnView];
} }
[btnView updateWithTitleLabelText:@"许可证" andButtonLabelText:@"查看报修单"]; [btnView updateWithTitleLabelText:@"许可证" andButtonLabelText:@"查看报修单"];
} else if (section == 1) { } else if (section == 1) {
GTOLicenceResultHeaderContentView *view = [contentView viewWithClass:[GTOLicenceResultHeaderContentView class]]; GTOLicenceResultHeaderContentView *view = [contentView viewWithClass:[GTOLicenceResultHeaderContentView class]];
if (!view) { if (!view) {
view = [[GTOLicenceResultHeaderContentView alloc] initWithFrame:rect]; view = [[GTOLicenceResultHeaderContentView alloc] initWithFrame:rect];
[contentView addSubview:view]; [contentView addSubview:view];
} }
[view updateWithString:@"许可证问题结果"]; [view updateWithString:@"许可证问题结果"];
} else { } else {
GTOPatrolPlanResultHeaderItem *resultHeader = [contentView viewWithClass:[GTOPatrolPlanResultHeaderItem class]]; GTOPatrolPlanResultHeaderItem *resultHeader = [contentView viewWithClass:[GTOPatrolPlanResultHeaderItem class]];
if (!resultHeader) { if (!resultHeader) {
resultHeader = [[GTOPatrolPlanResultHeaderItem alloc] initWithFrame:rect];// resultHeader = [[GTOPatrolPlanResultHeaderItem alloc] initWithFrame:rect];//
...@@ -430,7 +406,7 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -430,7 +406,7 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} }
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[section - 2]]; [displayR praseFromJsonDict:_d_licence.arrDisplayResults[section - 2]];
resultHeader.isDisplay = displayR.isDisplay;//isDisplay; resultHeader.isDisplay = displayR.isDisplay;// isDisplay;
resultHeader.delegate = self; resultHeader.delegate = self;
resultHeader.backgroundColor = [UIColor whiteColor]; resultHeader.backgroundColor = [UIColor whiteColor];
//刷新数据 //刷新数据
...@@ -439,20 +415,21 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -439,20 +415,21 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} }
} }
- (GTOLicenceResult *)p_licenceResult { - (GTOLicenceResult *)p_licenceResult
{
//_d_arrDisplayResults //_d_arrDisplayResults
NSMutableArray *muArrItems = [NSMutableArray array]; NSMutableArray *muArrItems = [NSMutableArray array];
for (NSDictionary *dictDisplayR in _d_licence.arrDisplayResults) { for (NSDictionary *dictDisplayR in _d_licence.arrDisplayResults) {
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:dictDisplayR]; [displayR praseFromJsonDict:dictDisplayR];
for (NSDictionary *dictQuestion in displayR.arrQuestions) { //一条数据 for (NSDictionary *dictQuestion in displayR.arrQuestions) {//一条数据
GTOQuestion *question = [GTOQuestion DBObject]; GTOQuestion *question = [GTOQuestion DBObject];
[question praseFromJsonDict:dictQuestion]; [question praseFromJsonDict:dictQuestion];
GTOPioneeringSurveyItem *surveyItem = [[GTOPioneeringSurveyItem alloc] init]; GTOPioneeringSurveyItem *surveyItem = [[GTOPioneeringSurveyItem alloc] init];
NSMutableDictionary *muDictItem = [NSMutableDictionary dictionary]; NSMutableDictionary *muDictItem = [NSMutableDictionary dictionary];
GTOAnswer *ans; //找到问题对应的answer GTOAnswer *ans;//找到问题对应的answer
for (NSDictionary *dictAnswer in displayR.arrAnswers) { for (NSDictionary *dictAnswer in displayR.arrAnswers) {
GTOAnswer *answer = [GTOAnswer DBObject]; GTOAnswer *answer = [GTOAnswer DBObject];
[answer praseFromJsonDict:dictAnswer]; [answer praseFromJsonDict:dictAnswer];
...@@ -462,11 +439,10 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -462,11 +439,10 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} }
} }
surveyItem.uuid = question.uuid;//用答案的uuid去标识每个问题的uuid surveyItem.uuid = question.uuid;//用答案的uuid去标识每个问题的uuid
surveyItem.details = question.details; surveyItem.details = question.details;
surveyItem.resultDetails = ans.resultDetails; surveyItem.resultDetails = ans.resultDetails;
surveyItem.category = question.category; surveyItem.category = question.category;
surveyItem.type = question.type; surveyItem.type = question.type;
surveyItem.lineNo = question.lineNo; surveyItem.lineNo = question.lineNo;
...@@ -480,18 +456,18 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -480,18 +456,18 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
surveyItem.writingReply = question.writingReply; surveyItem.writingReply = question.writingReply;
surveyItem.pictureReply = question.pictureReply; surveyItem.pictureReply = question.pictureReply;
surveyItem.recordReply = question.recordReply; surveyItem.recordReply = question.recordReply;
if (ans) { if (ans) {
surveyItem.resultScore = ans.resultScore; surveyItem.resultScore = ans.resultScore;
surveyItem.resultContent = ans.resultContent; surveyItem.resultContent = ans.resultContent;
surveyItem.resultRemark = ans.resultRemark; surveyItem.resultRemark = ans.resultRemark;
surveyItem.resultAttachmentId = ans.resultAttachmentId; surveyItem.resultAttachmentId = ans.resultAttachmentId;
} }
[muArrItems addObject:[surveyItem dictForCommit]]; [muArrItems addObject:[surveyItem dictForCommit]];
} }
} }
GTOLicenceResult *result = [[GTOLicenceResult alloc] init]; GTOLicenceResult *result = [[GTOLicenceResult alloc] init];
result.uuid = _d_licence.uuid; result.uuid = _d_licence.uuid;
result.version = _d_licence.version; result.version = _d_licence.version;
...@@ -508,38 +484,37 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -508,38 +484,37 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
result.store_code = _d_licence.store_code; result.store_code = _d_licence.store_code;
result.store_name = _d_licence.store_name; result.store_name = _d_licence.store_name;
result.validHours = _d_licence.validHours; result.validHours = _d_licence.validHours;
// result.beginDate = _d_licence.beginDate; // result.beginDate = _d_licence.beginDate;
// result.endDate = _d_licence.endDate; // result.endDate = _d_licence.endDate;
result.items = muArrItems; result.items = muArrItems;
return result; return result;
} }
//保存 //保存
- (void)httpSaveLicenceResult { - (void)httpSaveLicenceResult
{
self.d_licence.beginDate = [[NSDate date] httpParameterString]; self.d_licence.beginDate = [[NSDate date] httpParameterString];
self.d_licence.endDate = [[[NSDate date] dateAddHourse:3] httpParameterString]; self.d_licence.endDate = [[[NSDate date] dateAddHourse:3] httpParameterString];
GTOLicenceResult *licenceR = [self p_licenceResult]; GTOLicenceResult *licenceR = [self p_licenceResult];
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showProgressLabel:@"正在保存"]; [IBTLoadingView showProgressLabel:@"正在保存"];
void (^success)(id data) = ^(id data) { void (^success)(id data) = ^(id data) {
if ([data[@"success"] integerValue] == 1) { if ([data[@"success"] integerValue] == 1) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[self localDelete]; [self localDelete];
if (_d_isNew) { if (_d_isNew) {
[self PopToViewControllerAtIndex:2 animated:YES]; [self PopToViewControllerAtIndex:2 animated:YES];
} else { } else {
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} }
// [self PopViewControllerAnimated:YES]; // [self PopViewControllerAnimated:YES];
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init]; // GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES]; // [self PushViewController:listVC animated:YES];
} else { } else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view]; [IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
} }
...@@ -547,26 +522,24 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -547,26 +522,24 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
}; };
void (^failure)(id) = ^(id data) { void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data); // CLog(@"%@", data);
}; };
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController]; ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doSaveLicenceResultWithData:[licenceR dictForCommit] success:success failure:failure]; [httpCtrl doSaveLicenceResultWithData:[licenceR dictForCommit] success:success failure:failure];
} }
//提交 //提交
- (void)httpSubmitLicenceResult { - (void)httpSubmitLicenceResult
{
self.d_licence.beginDate = [[NSDate date] httpParameterString]; self.d_licence.beginDate = [[NSDate date] httpParameterString];
self.d_licence.endDate = [[[NSDate date] dateAddHourse:0] httpParameterString]; self.d_licence.endDate = [[[NSDate date] dateAddHourse:0] httpParameterString];
GTOLicenceResult *licenceR = [self p_licenceResult]; GTOLicenceResult *licenceR = [self p_licenceResult];
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController]; ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[IBTLoadingView showProgressLabel:@"正在提交"]; [IBTLoadingView showProgressLabel:@"正在提交"];
void (^success)(id data) = ^(id data) { void (^success)(id data) = ^(id data) {
if ([data[@"success"] integerValue] == 1) { if ([data[@"success"] integerValue] == 1) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
...@@ -576,146 +549,131 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -576,146 +549,131 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} else { } else {
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} }
// GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init]; // GTOLicenceListViewController *listVC = [[GTOLicenceListViewController alloc]init];
// [self PushViewController:listVC animated:YES]; // [self PushViewController:listVC animated:YES];
} else { } else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view]; [IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
} }
}; };
void (^failure)(id) = ^(id data) { void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data); // CLog(@"%@", data);
}; };
[httpCtrl doSubmitLicenceResultWithData:[licenceR dictForCommit] success:success failure:failure]; [httpCtrl doSubmitLicenceResultWithData:[licenceR dictForCommit] success:success failure:failure];
} }
//审批拒绝 //审批拒绝
- (void)httpRejectedLicenceResultWithRejectCause: (NSString *)cause { - (void)httpRejectedLicenceResultWithRejectCause:(NSString *)cause
// NSDate *date = [NSDate date]; {
// GTOLicenceResult *licenceR = [self p_licenceResult];
[IBTLoadingView showProgressLabel:@"审批拒绝中"]; [IBTLoadingView showProgressLabel:@"审批拒绝中"];
// [IBTLoadingView hideHUDWithText:nil];
void (^success)(id data) = ^(id data) { void (^success)(id data) = ^(id data) {
// CLog(@"%@", data);
if ([data[@"success"] integerValue] == 1) { if ([data[@"success"] integerValue] == 1) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[self localDelete]; [self localDelete];
[self PopViewControllerAnimated:YES]; [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 { } else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view]; [IBTLoadingView showTextOnly:data[@"message"] inView:self.view];
} }
}; };
void (^failure)(id) = ^(id data) { void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data);
}; };
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController]; ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doLicenceRejectWithLicenceUuid:_d_licence.uuid version:_d_licence.version rejectCausen:cause success:success failure:failure]; [httpCtrl doLicenceRejectWithLicenceUuid:_d_licence.uuid version:_d_licence.version rejectCausen:cause success:success failure:failure];
} }
//审批通过 //审批通过
- (void)httpApprovedLicenceResult { - (void)httpApprovedLicenceResult
// NSDate *date = [NSDate date]; {
// GTOLicenceResult *licenceR = [self p_licenceResult];
[IBTLoadingView showProgressLabel:@"审批通过中"]; [IBTLoadingView showProgressLabel:@"审批通过中"];
// [IBTLoadingView hideHUDWithText:nil];
void (^success)(id data) = ^(id data) { void (^success)(id data) = ^(id data) {
// CLog(@"%@", data);
if ([data[@"success"] integerValue] == 1) { if ([data[@"success"] integerValue] == 1) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
[self localDelete]; [self localDelete];
[self PopViewControllerAnimated:YES]; [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 { } else {
[IBTLoadingView showTextOnly:data[@"message"] inView:self.view]; [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) { void (^failure)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
// CLog(@"%@", data);
}; };
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController]; 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; NSInteger counts = 0;
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES]; 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]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
[displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]]; [displayR praseFromJsonDict:_d_licence.arrDisplayResults[count]];
for (int ansCount = 0; ansCount < displayR.arrAnswers.count; ansCount ++) { for (int ansCount = 0; ansCount < displayR.arrAnswers.count; ansCount++) {
// if(count ==0 && ansCount==0){ // if(count ==0 && ansCount==0){
// [IBTLoadingView showProgressLabel:@"正在上传图片"]; // [IBTLoadingView showProgressLabel:@"正在上传图片"];
// } // }
GTOAnswer *answer = [GTOAnswer DBObject]; GTOAnswer *answer = [GTOAnswer DBObject];
[answer praseFromJsonDict:displayR.arrAnswers[ansCount]]; [answer praseFromJsonDict:displayR.arrAnswers[ansCount]];
BOOL isFinish = NO; BOOL isFinish = NO;
if ((ansCount == displayR.arrAnswers.count - 1) if ((ansCount == displayR.arrAnswers.count - 1) && (count == _d_licence.arrDisplayResults.count - 1)) {
&& (count == _d_licence.arrDisplayResults.count - 1)) {
isFinish = YES; isFinish = YES;
} }
[self everyProblemUpLoadPhotoWithAnswer:answer isFinishedUpload:isFinish action:action index:count count:counts allCounts:_d_licence.arrDisplayResults.count hud:hud]; [self everyProblemUpLoadPhotoWithAnswer:answer isFinishedUpload:isFinish action:action index:count count:counts allCounts:_d_licence.arrDisplayResults.count hud:hud];
} }
} }
} }
- (void)everyProblemUpLoadPhotoWithAnswer: (GTOAnswer *)answer - (void)everyProblemUpLoadPhotoWithAnswer:(GTOAnswer *)answer
isFinishedUpload: (BOOL)isFinish isFinishedUpload:(BOOL)isFinish
action: (NSString *)action action:(NSString *)action
index: (NSInteger)index index:(NSInteger)index
count: (NSInteger)counts count:(NSInteger)counts
allCounts: (NSInteger)allcount allCounts:(NSInteger)allcount
hud: (MBProgressHUD *)hud{ hud:(MBProgressHUD *)hud
{
//找到数据表中的附件 //找到数据表中的附件
ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) { 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]; 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) { ICRDatabaseFetchResultsBlock fetchResultBlk = ^(NSArray *fetchObjects) {
__strong __typeof(weakSelf)strongSelf = weakSelf; __strong __typeof(weakSelf) strongSelf = weakSelf;
if (!fetchObjects) { if (!fetchObjects) {
if (!isFinish) { if (!isFinish) {
return ; return;
} else { } else {
if ([action isEqualToString:@"save"]) { if ([action isEqualToString:@"save"]) {
[self httpSaveLicenceResult]; [self httpSaveLicenceResult];
...@@ -726,16 +684,16 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -726,16 +684,16 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} }
} }
if (fetchObjects.count > 0) { if (fetchObjects.count > 0) {
if (!_d_arrPostAttachments) { if (!_d_arrPostAttachments) {
strongSelf.d_arrPostAttachments = [@[]mutableCopy]; strongSelf.d_arrPostAttachments = [@[] mutableCopy];
} else { } else {
[strongSelf.d_arrPostAttachments removeAllObjects]; [strongSelf.d_arrPostAttachments removeAllObjects];
} }
NSMutableArray *delArr = [@[]mutableCopy]; NSMutableArray *delArr = [@[] mutableCopy];
NSMutableArray *delArrPostAttachments = [@[]mutableCopy]; NSMutableArray *delArrPostAttachments = [@[] mutableCopy];
NSMutableArray *addArrPostAttachments = [@[]mutableCopy]; NSMutableArray *addArrPostAttachments = [@[] mutableCopy];
for(ICRPostAttachment *postAttachment in fetchObjects) { for (ICRPostAttachment *postAttachment in fetchObjects) {
if (postAttachment.is_delete) { if (postAttachment.is_delete) {
[delArr addObject:postAttachment.uuid]; [delArr addObject:postAttachment.uuid];
} }
...@@ -745,26 +703,22 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -745,26 +703,22 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} else if (!postAttachment.is_localPhoto && postAttachment.is_delete) { } else if (!postAttachment.is_localPhoto && postAttachment.is_delete) {
[delArrPostAttachments addObject:postAttachment]; [delArrPostAttachments addObject:postAttachment];
[strongSelf.d_arrPostAttachments addObject:postAttachment]; [strongSelf.d_arrPostAttachments addObject:postAttachment];
} else{ } else {
} }
} }
NSString *delStr = [delArr componentsJoinedByString:@";"]; NSString *delStr = [delArr componentsJoinedByString:@";"];
if (delStr.length <= 0) { if (delStr.length <= 0) {
delStr = @""; delStr = @"";
} }
if(addArrPostAttachments.count > 0 || delArrPostAttachments.count > 0) { if (addArrPostAttachments.count > 0 || delArrPostAttachments.count > 0) {
ICRPostAttachment *postAttachment = _d_arrPostAttachments[0]; ICRPostAttachment *postAttachment = _d_arrPostAttachments[0];
void(^succAdd)(id) = ^(id data) { void (^succAdd)(id) = ^(id data) {
if ([data[@"success"] integerValue] == 1) { if ([data[@"success"] integerValue] == 1) {
if (!isFinish) { if (!isFinish) {
[strongSelf localDeleteOneAnswerPhotos:answer]; [strongSelf localDeleteOneAnswerPhotos:answer];
hud.labelText = [NSString stringWithFormat:@"已上传%lu%%",(counts + 1) * 100 / allcount]; hud.labelText = [NSString stringWithFormat:@"已上传%lu%%", (counts + 1) * 100 / allcount];
return ; return;
} else { } else {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
if ([action isEqualToString:@"save"]) { if ([action isEqualToString:@"save"]) {
...@@ -774,23 +728,22 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -774,23 +728,22 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[self httpSubmitLicenceResult]; [self httpSubmitLicenceResult];
} }
} }
} else { } else {
[IBTLoadingView hideHUDWithText:data[@"message"]]; [IBTLoadingView hideHUDWithText:data[@"message"]];
} }
}; };
void(^failAdd)(id) = ^(id data) { void (^failAdd)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:@"上传图片出错啦! 请重新上传。"]; [IBTLoadingView hideHUDWithText:@"上传图片出错啦! 请重新上传。"];
}; };
void(^succDel)(id) = ^(id data) { void (^succDel)(id) = ^(id data) {
if ([data[@"success"] integerValue] == 1) { if ([data[@"success"] integerValue] == 1) {
[strongSelf localDeleteOneAnswerPhotos:answer]; [strongSelf localDeleteOneAnswerPhotos:answer];
if (!isFinish) { if (!isFinish) {
return ; return;
} else { } else {
[IBTLoadingView hideHUDWithText:nil]; [IBTLoadingView hideHUDWithText:nil];
if ([action isEqualToString:@"save"]) { if ([action isEqualToString:@"save"]) {
...@@ -799,29 +752,32 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -799,29 +752,32 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[self httpSubmitLicenceResult]; [self httpSubmitLicenceResult];
} }
} }
} else { } else {
[IBTLoadingView hideHUDWithText:data[@"message"]]; [IBTLoadingView hideHUDWithText:data[@"message"]];
} }
}; };
void(^failDel)(id) = ^(id data) { void (^failDel)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:@"上传删除的图片出错啦! 请重新上传。"]; [IBTLoadingView hideHUDWithText:@"上传删除的图片出错啦! 请重新上传。"];
}; };
ICRHTTPController *httpC = [ICRHTTPController sharedController]; ICRHTTPController *httpC = [ICRHTTPController sharedController];
if (delArrPostAttachments.count >0) { if (delArrPostAttachments.count > 0) {
[httpC deleteAttachments:delStr success:succDel failure:failDel]; [httpC deleteAttachments:delStr success:succDel failure:failDel];
} }
if (addArrPostAttachments.count >0) { if (addArrPostAttachments.count > 0) {
[httpC multiPartUploadWithEntityType:postAttachment.entityType entityUuid:postAttachment.entityUuid arrayPostAttachments:addArrPostAttachments success:succAdd failure:failAdd]; [httpC multiPartUploadWithEntityType:postAttachment.entityType
entityUuid:postAttachment.entityUuid
arrayPostAttachments:addArrPostAttachments
success:succAdd
failure:failAdd];
} }
}else { } else {
if (!isFinish) { if (!isFinish) {
return ; return;
} else { } else {
if ([action isEqualToString:@"save"]) { if ([action isEqualToString:@"save"]) {
[self httpSaveLicenceResult]; [self httpSaveLicenceResult];
...@@ -832,143 +788,123 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -832,143 +788,123 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
} }
} }
}; };
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[ICRPostAttachment class]
fetchBlock:fetchBlk
fetchResultsBlock:fetchResultBlk];
ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
[dbCtrl runFetchForClass:[ICRPostAttachment class] fetchBlock:fetchBlk fetchResultsBlock:fetchResultBlk];
} }
//本地删除 //本地删除
- (void)localDelete { - (void)localDelete
{
//本地删除 许可证 //本地删除 许可证
ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController]; ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOLicence TableName],@"uuid" ]; NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOLicence TableName], @"uuid"];
[db executeUpdate:strSql,_d_licence.uuid]; [db executeUpdate:strSql, _d_licence.uuid];
}]; }];
//删除问题 //删除问题
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOQuestion TableName],@"licenceUuid" ]; NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOQuestion TableName], @"licenceUuid"];
[db executeUpdate:strSql,_d_licence.uuid]; [db executeUpdate:strSql, _d_licence.uuid];
}]; }];
//删除本地图片 //删除本地图片
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[GTOAnswer TableName],@"licenceUuid" ]; NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [GTOAnswer TableName], @"licenceUuid"];
[db executeUpdate:strSql,_d_licence.uuid]; [db executeUpdate:strSql, _d_licence.uuid];
}]; }];
//删除本地图片 //删除本地图片
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?",[ICRPostAttachment TableName],@"licenceUuid" ]; NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=?", [ICRPostAttachment TableName], @"licenceUuid"];
[db executeUpdate:strSql,_d_licence.uuid]; [db executeUpdate:strSql, _d_licence.uuid];
}]; }];
} }
//本地删除 一个问题对应的答案的图片 //本地删除 一个问题对应的答案的图片
- (void)localDeleteOneAnswerPhotos: (GTOAnswer *)answer { - (void)localDeleteOneAnswerPhotos:(GTOAnswer *)answer
{
ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController]; ICRDataBaseController *dataBaseC = [ICRDataBaseController sharedController];
[dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) { [dataBaseC.m_dbQueue inDatabase:^(FMDatabase *db) {
NSString *strSql = [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=? AND %@=? ORDER BY %@",[ICRPostAttachment TableName],@"questionUuid",@"licenceUuid",@"addTime" ]; NSString *strSql =
[db executeUpdate:strSql,answer.questionUuid,answer.licenceUuid]; [NSString stringWithFormat:@"DELETE FROM %@ WHERE %@=? AND %@=? ORDER BY %@", [ICRPostAttachment TableName], @"questionUuid", @"licenceUuid", @"addTime"];
[db executeUpdate:strSql, answer.questionUuid, answer.licenceUuid];
}]; }];
} }
#pragma bottomViewDelegate #pragma bottomViewDelegate
- (void)bottomView:(GXFBottomView *)bottomView oneButtonClicked:(UIButton *)oneBtn
{
- (void)bottomView:(GXFBottomView *)bottomView oneButtonClicked:(UIButton *)oneBtn {
switch (bottomView.tag) { switch (bottomView.tag) {
case kBottomViewOneSaveTag: { case kBottomViewOneSaveTag: {
[self httpSaveLicenceResult]; [self httpSaveLicenceResult];
} } break;
break;
case kBottomViewOneBackTag: { case kBottomViewOneBackTag: {
[self PopViewControllerAnimated:YES]; [self PopViewControllerAnimated:YES];
} break;
case kBOttomViewAskForApprove:{
//提交
UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:@"确定申请审批?" message:@"" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alertV.tag = kAlertViewAskForApprove;
[alertV show];
} }
break; break;
default: default: break;
break;
} }
} }
- (void)bottomView:(GXFBottomView *)bottomView leftButtonClicked:(UIButton *)leftBtn { - (void)bottomView:(GXFBottomView *)bottomView leftButtonClicked:(UIButton *)leftBtn
{
switch (bottomView.tag) { switch (bottomView.tag) {
case kBottomViewTwoSaveSubmitTag: { case kBottomViewTwoSaveSubmitTag: {
//保存 //保存
//[self httpSubmitLicenceResult]; //[self httpSubmitLicenceResult];
[self upLoadFlieWithAction: @"save"]; [self upLoadFlieWithAction:@"save"];
} } break;
break;
case kBottomViewTwoRejectedApprovedTag: { 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.alertViewStyle = UIAlertViewStylePlainTextInput;
alertV.tag = kAlertViewRejectedTag; alertV.tag = kAlertViewRejectedTag;
[alertV show]; [alertV show];
// [self httpRejectedLicenceResult]; // [self httpRejectedLicenceResult];
} } break;
break; default: break;
default:
break;
} }
} }
- (void)bottomView:(GXFBottomView *)bottomView RightButtonClicked:(UIButton *)rightBtn { - (void)bottomView:(GXFBottomView *)bottomView RightButtonClicked:(UIButton *)rightBtn
{
switch (bottomView.tag) { switch (bottomView.tag) {
case kBottomViewTwoSaveSubmitTag: { 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.tag = kAlertViewSubmiteTag;
[alertV show]; [alertV show];
// [self upLoadFlieWithAction: @"submit"]; // [self upLoadFlieWithAction: @"submit"];
} } break;
break;
case kBottomViewTwoRejectedApprovedTag: { 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.tag = kAlertViewApprovedTag;
[alertV show]; [alertV show];
// [self httpApprovedLicenceResult];
} break;
} default: break;
break;
default:
break;
} }
} }
//#pragma Button Action - (void)modifyClicked:(UIButton *)btn
//- (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 {
} }
#pragma GTOPatrolPlanResultHeaderItemDelegate #pragma GTOPatrolPlanResultHeaderItemDelegate
// 巡检结果中:不同区的headerView // 巡检结果中:不同区的headerView
- (void)patrolPlanResultHeaderItem:(GTOPatrolPlanResultHeaderItem *)resultHeaderItem - (void)patrolPlanResultHeaderItem:(GTOPatrolPlanResultHeaderItem *)resultHeaderItem andIsDisplay:(BOOL)isDisplay
andIsDisplay:(BOOL)isDisplay { {
NSInteger aIndex = resultHeaderItem.tag - 2; NSInteger aIndex = resultHeaderItem.tag - 2;
NSMutableArray *muArrDisplayRs = [NSMutableArray array]; NSMutableArray *muArrDisplayRs = [NSMutableArray array];
[muArrDisplayRs addObjectsFromArray:_d_licence.arrDisplayResults]; [muArrDisplayRs addObjectsFromArray:_d_licence.arrDisplayResults];
GTODisplayResult *displayR = [GTODisplayResult DBObject]; GTODisplayResult *displayR = [GTODisplayResult DBObject];
...@@ -979,48 +915,42 @@ GXFBottomViewDelegate,UIAlertViewDelegate> ...@@ -979,48 +915,42 @@ GXFBottomViewDelegate,UIAlertViewDelegate>
[muArrDisplayRs replaceObjectAtIndex:aIndex withObject:[displayR dictForCommit]]; [muArrDisplayRs replaceObjectAtIndex:aIndex withObject:[displayR dictForCommit]];
break; break;
} }
} }
_d_licence.arrDisplayResults = muArrDisplayRs; _d_licence.arrDisplayResults = muArrDisplayRs;
[_d_licence saveToDBWithHandleData:NULL complete:^{ [_d_licence saveToDBWithHandleData:NULL
[_c_tableView reloadData]; complete:^{
} fail:nil]; [_c_tableView reloadData];
}
fail:nil];
} }
#pragma UIAlertViewDelegate #pragma UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
if (buttonIndex == 1 ) { {
switch (alertView.tag) { if (buttonIndex == 1) {
case kAlertViewSubmiteTag: switch (alertView.tag) {
{ case kAlertViewSubmiteTag: {
[self upLoadFlieWithAction: @"submit"]; [self upLoadFlieWithAction:@"submit"];
} break;
case kAlertViewApprovedTag: {
[self httpApprovedLicenceResult];
} break;
case kAlertViewRejectedTag: {
UITextField *texfF = [alertView textFieldAtIndex:0];
[self httpRejectedLicenceResultWithRejectCause:texfF.text];
} break;
case kAlertViewAskForApprove: {
[self httpAskForApproveLicense];
} break;
default: break;
} }
break;
case kAlertViewApprovedTag:
{
[self httpApprovedLicenceResult];
}
break;
case kAlertViewRejectedTag:
{
UITextField *texfF = [alertView textFieldAtIndex:0];
[self httpRejectedLicenceResultWithRejectCause:texfF.text];
}
break;
default:
break;
}
} }
} }
#pragma button Action #pragma button Action
- (void)seeRepairClicked { - (void)seeRepairClicked
GTORepairDetailViewController *repairDeVC = [[GTORepairDetailViewController alloc]initWithRepairUuid:_d_licence.repairUuid]; {
GTORepairDetailViewController *repairDeVC = [[GTORepairDetailViewController alloc] initWithRepairUuid:_d_licence.repairUuid];
[self PushViewController:repairDeVC animated:YES]; [self PushViewController:repairDeVC animated:YES];
} }
@end @end
...@@ -6,191 +6,170 @@ ...@@ -6,191 +6,170 @@
// Copyright (c) 2015 Xummer. All rights reserved. // Copyright (c) 2015 Xummer. All rights reserved.
// //
#import "ICRLoginViewController.h"
#import "ICRLoginContentView.h"
#import "APService.h" #import "APService.h"
#import "ICRLoginContentView.h"
#import "ICRLoginViewController.h"
#import <BaiduMapAPI/BMapKit.h> #import <BaiduMapAPI/BMapKit.h>
#define LOGIN_CONTAINER_LEFT_MARGIN (20) #define LOGIN_CONTAINER_LEFT_MARGIN (20)
#define LOGIN_CONTAINER_HEIGHT (450) #define LOGIN_CONTAINER_HEIGHT (450)
@interface ICRLoginViewController ()<BMKMapViewDelegate, @interface ICRLoginViewController () <BMKMapViewDelegate, BMKLocationServiceDelegate, BMKGeoCodeSearchDelegate> {
BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
>
{
CGFloat m_fDefaultContainerY; CGFloat m_fDefaultContainerY;
} }
@property (strong, nonatomic) ICRLoginContentView *m_containerView; @property (strong, nonatomic) ICRLoginContentView *m_containerView;
@property (strong, nonatomic) BMKLocationService *locService; @property (strong, nonatomic) BMKLocationService *locService;
@property (strong, nonatomic) BMKMapView* mapView; @property (strong, nonatomic) BMKMapView *mapView;
@property (strong, nonatomic) BMKGeoCodeSearch* geocodesearch; @property (strong, nonatomic) BMKGeoCodeSearch *geocodesearch;
@property (assign, nonatomic) CGFloat coordinateX; @property (assign, nonatomic) CGFloat coordinateX;
@property (assign, nonatomic) CGFloat coordinateY; @property (assign, nonatomic) CGFloat coordinateY;
@property (copy, nonatomic) NSString *city; @property (copy, nonatomic) NSString *city;
@end @end
@implementation ICRLoginViewController @implementation ICRLoginViewController
#pragma mark - Life Cycle #pragma mark - Life Cycle
- (void)viewDidLoad { - (void)viewDidLoad
{
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
[self setupSubviews]; [self setupSubviews];
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
- (void)viewWillLayoutSubviews { - (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews]; [super viewWillLayoutSubviews];
if (m_fDefaultContainerY == 0) { if (m_fDefaultContainerY == 0) {
m_fDefaultContainerY = _m_containerView.y; m_fDefaultContainerY = _m_containerView.y;
} }
} }
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated]; [super viewDidAppear:animated];
NSNotificationCenter *notiCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter *notiCenter = [NSNotificationCenter defaultCenter];
[notiCenter addObserver:self [notiCenter addObserver:self selector:@selector(inputTextEditChanged:) name:UITextFieldTextDidChangeNotification object:nil];
selector:@selector(inputTextEditChanged:)
name:UITextFieldTextDidChangeNotification
object:nil];
} }
- (void)viewWillDisappear:(BOOL)animated { - (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated]; [super viewWillDisappear:animated];
NSNotificationCenter *notiCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter *notiCenter = [NSNotificationCenter defaultCenter];
[notiCenter removeObserver:self]; [notiCenter removeObserver:self];
} }
#pragma mark - Private Method #pragma mark - Private Method
- (void)setupSubviews { - (void)setupSubviews
// self.mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0,self.view.width , 50)]; {
// // self.mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0,self.view.width , 50)];
// _mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放 //
// self.geocodesearch = [[BMKGeoCodeSearch alloc]init]; // _mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放
// self.geocodesearch.delegate = self; // self.geocodesearch = [[BMKGeoCodeSearch alloc]init];
// // self.geocodesearch.delegate = self;
// self.locService = [[BMKLocationService alloc]init]; //
// [_locService startUserLocationService]; // self.locService = [[BMKLocationService alloc]init];
// _locService.delegate = self; // [_locService startUserLocationService];
// // _locService.delegate = self;
//
UIImageView *bg = [[UIImageView alloc] initWithFrame:self.view.bounds]; UIImageView *bg = [[UIImageView alloc] initWithFrame:self.view.bounds];
bg.image = [UIImage imageNamed:@"login_bg"]; bg.image = [UIImage imageNamed:@"login_bg"];
[bg autoresizingWithStrechFullSize]; [bg autoresizingWithStrechFullSize];
UITapGestureRecognizer *tapGesture = UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onBGTapped:)];
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(onBGTapped:)];
bg.userInteractionEnabled = YES; bg.userInteractionEnabled = YES;
[bg addGestureRecognizer:tapGesture]; [bg addGestureRecognizer:tapGesture];
[self.view addSubview:bg]; [self.view addSubview:bg];
self.m_containerView = self.m_containerView = [[ICRLoginContentView alloc] initWithFrame:(CGRect) {
[[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
.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]; showCCode:YES];
[_m_containerView autoresizingWithVerticalCenter]; [_m_containerView autoresizingWithVerticalCenter];
[_m_containerView.m_loginBtn addTarget:self [_m_containerView.m_loginBtn addTarget:self action:@selector(onLoginTapped:) forControlEvents:UIControlEventTouchUpInside];
action:@selector(onLoginTapped:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_m_containerView]; [self.view addSubview:_m_containerView];
//ICRDataBaseController *dataBC = [ICRDataBaseController sharedController]; // ICRDataBaseController *dataBC = [ICRDataBaseController sharedController];
NSString *dbPath = [ICRDataBaseController GetDataBasePath]; NSString *dbPath = [ICRDataBaseController GetDataBasePath];
CLog(@"dbpath = %@",dbPath); CLog(@"dbpath = %@", dbPath);
_m_containerView.m_cCodeTextF.placeholder = @"请输入企业验证码"; _m_containerView.m_cCodeTextF.placeholder = @"请输入企业验证码";
_m_containerView.m_userNameTextF.placeholder = @"请输入用户名"; _m_containerView.m_userNameTextF.placeholder = @"请输入用户名";
_m_containerView.m_passwordTextF.placeholder = @"请输入密码"; _m_containerView.m_passwordTextF.placeholder = @"请输入密码";
_m_containerView.m_cCodeTextF.text = @"211534962"; _m_containerView.m_cCodeTextF.text = @"211534962";
// //
//#if DEBUG //#if DEBUG
// self.m_containerView.m_cCodeTextF.text = @"923";// // self.m_containerView.m_cCodeTextF.text = @"923";//
// self.m_containerView.m_userNameTextF.text = @"admin";//@"admin2";// // self.m_containerView.m_userNameTextF.text = @"admin";//@"admin2";//
// self.m_containerView.m_passwordTextF.text = @"thoradmin";//@"admin2";// // self.m_containerView.m_passwordTextF.text = @"thoradmin";//@"admin2";//
// [self.m_containerView checkLoginEnable]; // [self.m_containerView checkLoginEnable];
//#else //#else
// //
//#endif //#endif
ICRUserUtil *userU = [ICRUserUtil sharedInstance]; ICRUserUtil *userU = [ICRUserUtil sharedInstance];
if (userU.f_isLogout) { if (userU.f_isLogout) {
self.m_containerView.m_cCodeTextF.text = userU.f_authenticode; 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.m_passwordTextF.text = userU.f_user_password;
} }
[self.m_containerView checkLoginEnable]; [self.m_containerView checkLoginEnable];
} }
#pragma mark - Logic #pragma mark - Logic
#pragma mark - Actions #pragma mark - Actions
- (void)onBGTapped:(__unused id)sender { - (void)onBGTapped:(__unused id)sender
{
[self.view endEditing:YES]; [self.view endEditing:YES];
} }
- (void)onLoginTapped:(__unused id)sender { - (void)onLoginTapped:(__unused id)sender
{
NSString *nsRegisterCode = self.m_containerView.m_cCodeTextF.text; NSString *nsRegisterCode = self.m_containerView.m_cCodeTextF.text;
NSString *nsUserName = self.m_containerView.m_userNameTextF.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]; [IBTLoadingView hideHUDWithText:nil];
ICRUserUtil *userUtil = [ICRUserUtil sharedInstance]; ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
userUtil.bAutoLogin = @( [_m_containerView isAutoLogin] ); userUtil.bAutoLogin = @([_m_containerView isAutoLogin]);
[userUtil saveArchive]; [userUtil saveArchive];
ICRAppViewControllerManager *mgr = ICRAppViewControllerManager *mgr = [ICRAppViewControllerManager getAppViewControllerManager];
[ICRAppViewControllerManager getAppViewControllerManager];
[mgr openMainFrame]; [mgr openMainFrame];
//极光别名 //极光别名
NSSet *setTags = [NSSet setWithArray:@[@""]]; NSSet *setTags = [NSSet setWithArray:@[ @"" ]];
[APService setTags:setTags [APService setTags:setTags alias:userUtil.f_user_uuid callbackSelector:nil object:nil];
alias:userUtil.f_user_uuid
callbackSelector:nil object:nil];
}; };
void(^fail)(id) = ^(id data) { void (^fail)(id) = ^(id data) {
[IBTLoadingView hideHUDWithText:@"登录失败"]; [IBTLoadingView hideHUDWithText:@"登录失败"];
//[IBTLoadingView showTextOnly: data inView:self.view]; //[IBTLoadingView showTextOnly: data inView:self.view];
}; };
[IBTLoadingView showProgressLabel:@"正在登录"]; [IBTLoadingView showProgressLabel:@"正在登录"];
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController]; ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl doLoginWithUserName:nsUserName [httpCtrl doLoginWithUserName:nsUserName password:nsPassword registerCode:nsRegisterCode success:succ failure:fail];
password:nsPassword
registerCode:nsRegisterCode
success:succ
failure:fail];
} }
///** ///**
// *在地图View将要启动定位时,会调用此函数 // *在地图View将要启动定位时,会调用此函数
// *@param mapView 地图View // *@param mapView 地图View
...@@ -198,7 +177,7 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate ...@@ -198,7 +177,7 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
//- (void)willStartLocatingUser //- (void)willStartLocatingUser
//{ //{
// NSLog(@"start locate"); // NSLog(@"start locate");
// //
//} //}
//- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation //- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
//{ //{
...@@ -211,14 +190,14 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate ...@@ -211,14 +190,14 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
// BOOL flag = [_geocodesearch reverseGeoCode:reverseGeocodeSearchOption]; // BOOL flag = [_geocodesearch reverseGeoCode:reverseGeocodeSearchOption];
// if(flag) // if(flag)
// { // {
// //
// NSLog(@"反geo检索发送成功"); // NSLog(@"反geo检索发送成功");
// } // }
// else // else
// { // {
// NSLog(@"反geo检索发送失败"); // NSLog(@"反geo检索发送失败");
// } // }
// //
// [self.locService stopUserLocationService]; // [self.locService stopUserLocationService];
//} //}
//-(void) onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error //-(void) onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error
...@@ -228,47 +207,50 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate ...@@ -228,47 +207,50 @@ BMKLocationServiceDelegate,BMKGeoCodeSearchDelegate
// } // }
//} //}
#pragma mark - TextObserver #pragma mark - TextObserver
- (void)inputTextEditChanged:(NSNotification *)obj { - (void)inputTextEditChanged:(NSNotification *)obj
{
[self.m_containerView checkLoginEnable]; [self.m_containerView checkLoginEnable];
} }
#pragma mark - Keyboard #pragma mark - Keyboard
- (void)keyboardWillShow:(NSNotification *)note { - (void)keyboardWillShow:(NSNotification *)note
{
// get keyboard size and loctaion // get keyboard size and loctaion
CGRect keyboardBounds; CGRect keyboardBounds;
[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds]; [[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardBounds];
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey]; NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey]; NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// Need to translate the bounds to account for rotation. // Need to translate the bounds to account for rotation.
keyboardBounds = [self.view convertRect:keyboardBounds toView:nil]; keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];
// animations settings // animations settings
[UIView beginAnimations:nil context:NULL]; [UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]]; [UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]]; [UIView setAnimationCurve:[curve intValue]];
// set views with new info // set views with new info
self.m_containerView.y = - 50.0f; self.m_containerView.y = -50.0f;
// commit animations // commit animations
[UIView commitAnimations]; [UIView commitAnimations];
} }
- (void)keyboardWillHide:(NSNotification *)note { - (void)keyboardWillHide:(NSNotification *)note
{
NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey]; NSNumber *duration = [note.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey]; NSNumber *curve = [note.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey];
// animations settings // animations settings
[UIView beginAnimations:nil context:NULL]; [UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:[duration doubleValue]]; [UIView setAnimationDuration:[duration doubleValue]];
[UIView setAnimationCurve:[curve intValue]]; [UIView setAnimationCurve:[curve intValue]];
// set views with new info // set views with new info
self.m_containerView.y = m_fDefaultContainerY; self.m_containerView.y = m_fDefaultContainerY;
// commit animations // commit animations
[UIView commitAnimations]; [UIView commitAnimations];
} }
......
...@@ -111,6 +111,8 @@ ...@@ -111,6 +111,8 @@
if ([englishState isEqualToString:@"initial"]) { if ([englishState isEqualToString:@"initial"]) {
return @"未提交"; return @"未提交";
} else if ([englishState isEqualToString:@"submitted"]) { } else if ([englishState isEqualToString:@"submitted"]) {
return @"申请审批";
}else if ([englishState isEqualToString:GTO_LICENCE__STATE_ASKFORAPPROVE]) {
return @"待审批"; return @"待审批";
}else if ([englishState isEqualToString:@"approved"]) { }else if ([englishState isEqualToString:@"approved"]) {
return @"审批通过"; return @"审批通过";
......
...@@ -79,8 +79,8 @@ ...@@ -79,8 +79,8 @@
//#define HTTP_LOCAL_BASE_URL @"http://218.244.151.129:7580" //#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_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_LOCAL_BASE_URL @"http://139.196.39.77:7080"
// //
//测试环境 //测试环境
//#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:8180/total-server/rest" //#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:8180/total-server/rest"
...@@ -91,8 +91,8 @@ ...@@ -91,8 +91,8 @@
//#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:8080/total-server/rest" //#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_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_REST_API_BASE_URL @"http://139.196.195.30:8093/total-server/rest"
//豪杰/ //豪杰/
...@@ -168,6 +168,7 @@ typedef NS_ENUM(NSUInteger, ICRQestionType) { ...@@ -168,6 +168,7 @@ typedef NS_ENUM(NSUInteger, ICRQestionType) {
#define GTO_LICENCE_STATE_LOCAL @"local" #define GTO_LICENCE_STATE_LOCAL @"local"
#define GTO_LICENCE_STATE_INITIAL @"initial" #define GTO_LICENCE_STATE_INITIAL @"initial"
#define GTO_LICENCE__STATE_SUBMITTED @"submitted" #define GTO_LICENCE__STATE_SUBMITTED @"submitted"
#define GTO_LICENCE__STATE_ASKFORAPPROVE @"askforapprove"
#define GTO_LICENCE__STATE_APPROVED @"approved" #define GTO_LICENCE__STATE_APPROVED @"approved"
#define GTO_LICENCE__STATE_REJECTED @"rejected" #define GTO_LICENCE__STATE_REJECTED @"rejected"
#define GTO_LICENCE__STATE_EXPIRED @"expired" #define GTO_LICENCE__STATE_EXPIRED @"expired"
......
...@@ -132,6 +132,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) { ...@@ -132,6 +132,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
version: (NSInteger)version version: (NSInteger)version
success:(void (^)(id))succ success:(void (^)(id))succ
failure:(void (^)(id))fail; failure:(void (^)(id))fail;
// 申请审批许可证(写)
- (void)doLicenceAskForApproveWithLicenceUuid:(NSString *)licenceUuid
version: (NSInteger)version
success:(void (^)(id))succ
failure:(void (^)(id))fail;
//5.8许可证操作日志列表(读) //5.8许可证操作日志列表(读)
- (void)getLicenceGet_logsWithLicenceUuid:(NSString *)licenceUuid - (void)getLicenceGet_logsWithLicenceUuid:(NSString *)licenceUuid
success:(void (^)(id))succ success:(void (^)(id))succ
......
...@@ -82,6 +82,7 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) { ...@@ -82,6 +82,7 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
kGTOHTTP_LicenceRemove, kGTOHTTP_LicenceRemove,
kGTOHTTP_LicenceReject, kGTOHTTP_LicenceReject,
kGTOHTTP_LicenceApprove, kGTOHTTP_LicenceApprove,
kGTOHTTP_LicenceAskForApprove,
kGTOHTTP_LicenceGetLogs, kGTOHTTP_LicenceGetLogs,
//6.1 保存拓店(写) //6.1 保存拓店(写)
kGTOHTTP_PioneeringSaveResult, kGTOHTTP_PioneeringSaveResult,
...@@ -171,6 +172,7 @@ static NSString * const ICRHTTPInterface[] = { ...@@ -171,6 +172,7 @@ static NSString * const ICRHTTPInterface[] = {
[kGTOHTTP_LicenceRemove] = @"licence/remove", [kGTOHTTP_LicenceRemove] = @"licence/remove",
[kGTOHTTP_LicenceReject] = @"licence/reject", [kGTOHTTP_LicenceReject] = @"licence/reject",
[kGTOHTTP_LicenceApprove] = @"licence/approve", [kGTOHTTP_LicenceApprove] = @"licence/approve",
[kGTOHTTP_LicenceAskForApprove] = @"licence/askforapprove",
[kGTOHTTP_LicenceGetLogs] = @"licence/get_logs", [kGTOHTTP_LicenceGetLogs] = @"licence/get_logs",
//6.1 保存拓店(写) //6.1 保存拓店(写)
...@@ -1026,6 +1028,17 @@ acceptTypeJson:YES ...@@ -1026,6 +1028,17 @@ acceptTypeJson:YES
NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self p_doPostActionWithEncodeURL:encodeUrlStr data:nil success:succ failure:fail]; [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许可证操作日志列表(读) //5.8许可证操作日志列表(读)
- (void)getLicenceGet_logsWithLicenceUuid:(NSString *)licenceUuid - (void)getLicenceGet_logsWithLicenceUuid:(NSString *)licenceUuid
success:(void (^)(id))succ 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