Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
total
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
total
Commits
9b6a90b1
Commit
9b6a90b1
authored
Dec 13, 2016
by
Sandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
07989fcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
549 additions
and
482 deletions
+549
-482
GTONewAddPioneeringViewController.m
...p/Business/Pioneering/GTONewAddPioneeringViewController.m
+549
-482
No files found.
total/GTOApp/Business/Pioneering/GTONewAddPioneeringViewController.m
View file @
9b6a90b1
...
@@ -6,556 +6,626 @@
...
@@ -6,556 +6,626 @@
// Copyright (c) 2015年 free. All rights reserved.
// Copyright (c) 2015年 free. All rights reserved.
//
//
#import "GTOAlertInfoPioneeringViewController.h"
#import "GTONewAddPioneeringViewController.h"
#import "GTONewAddPioneeringViewController.h"
#import "GXFTableViewCell.h"
#import "GXFBottomView.h"
#import "GTOPioneeringTemplateViewController.h"
#import "GTOPatrolTemplate.h"
#import "GTOPatrolTemplate.h"
#import "GTOPioneering.h"
#import "GTOPioneering.h"
#import "GTOSignViewController.h"
#import "GTOPioneeringTemplateViewController.h"
#import "GTOAlertInfoPioneeringViewController.h"
#import "GTOQuestionManager.h"
#import "GTOQuestionManager.h"
#import "GTOSignViewController.h"
#import "GXFBottomView.h"
#import "GXFTableViewCell.h"
#import "GTOQuestion.h"
#import "GTOAnswer.h"
#import "GTOAnswer.h"
#import "GTOQResultViewController.h"
#import "GTOQResultViewController.h"
#import "
RETableViewManager
.h"
#import "
GTOQuestion
.h"
#import "ICRPostAttachment.h"
#import "ICRPostAttachment.h"
#import "RETableViewManager.h"
#import <BaiduMapAPI/BMapKit.h>
#import <BaiduMapAPI/BMapKit.h>
@interface
GTONewAddPioneeringViewController
()
@interface
GTONewAddPioneeringViewController
()
<
<
UITableViewDataSource
,
UITableViewDelegate
,
GXFBottomViewDelegate
,
UITableViewDataSource
,
UITableViewDelegate
,
GXFBottomViewDelegate
,
UITextFieldDelegate
,
GTOAlertInfoPioneeringViewControllerDelegate
>
UITextFieldDelegate
,
GTOAlertInfoPioneeringViewControllerDelegate
>
typedef
NS_ENUM
(
NSUInteger
,
bottomTag
)
{
typedef
NS_ENUM
(
NSUInteger
,
bottomTag
)
{
kbottomDelBtnsTag
=
0
,
kbottomDelBtnsTag
=
0
,
kbottomBackBtnsTag
kbottomBackBtnsTag
};
};
#define BOTTOM_TEXT_DELETE
@"删除拓站"
#define BOTTOM_TEXT_DELETE @"删除拓站"
#define BOTTOM_TEXT_BACK
@"返回列表"
#define BOTTOM_TEXT_BACK @"返回列表"
@property
(
nonatomic
,
strong
)
UITableView
*
c_tableView
;
@property
(
nonatomic
,
strong
)
UITableView
*
c_tableView
;
@property
(
nonatomic
,
strong
)
GTOPioneering
*
d_pioneering
;
@property
(
nonatomic
,
strong
)
GTOPioneering
*
d_pioneering
;
@property
(
nonatomic
,
strong
)
GTOPatrolTemplate
*
d_patrolTemplate
;
@property
(
nonatomic
,
strong
)
GTOPatrolTemplate
*
d_patrolTemplate
;
@property
(
nonatomic
,
strong
)
GTOSignViewController
*
c_signVC
;
@property
(
nonatomic
,
strong
)
GTOSignViewController
*
c_signVC
;
@property
(
nonatomic
,
assign
)
BOOL
isStartPioneering
;
//
@property
(
nonatomic
,
assign
)
BOOL
isStartPioneering
;
//
@property
(
nonatomic
,
strong
)
GTOAlertInfoPioneeringViewController
*
alertInfoVC
;
@property
(
nonatomic
,
strong
)
GTOAlertInfoPioneeringViewController
*
alertInfoVC
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETableViewManager
*
manager
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETableViewManager
*
manager
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETextItem
*
titleItem
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETextItem
*
titleItem
;
@property
(
strong
,
readwrite
,
nonatomic
)
RERadioItem
*
templeteSelectItem
;
@property
(
strong
,
readwrite
,
nonatomic
)
RERadioItem
*
templeteSelectItem
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETextItem
*
locationItem
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETextItem
*
locationItem
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETextItem
*
remarkItem
;
@property
(
strong
,
readwrite
,
nonatomic
)
RETextItem
*
remarkItem
;
@property
(
nonatomic
,
strong
)
BMKMapView
*
c_mapView
;
@property
(
nonatomic
,
strong
)
BMKMapView
*
c_mapView
;
@property
(
nonatomic
,
strong
)
GXFBottomView
*
bottomV
;
@property
(
nonatomic
,
strong
)
GXFBottomView
*
bottomV
;
//重构
//重构
@property
(
nonatomic
,
strong
)
NSArray
*
d_arrCategorys
;
//问题按区域分
@property
(
nonatomic
,
strong
)
NSArray
*
d_arrCategorys
;
//问题按区域分
@end
@end
@implementation
GTONewAddPioneeringViewController
@implementation
GTONewAddPioneeringViewController
-
(
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
p_initData
];
[
self
p_initData
];
[
self
p_initWithSubViews
];
[
self
p_initWithSubViews
];
}
}
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
-
(
void
)
viewWillAppear
:
(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
super
viewWillAppear
:
animated
];
[
self
appearMap
];
[
self
appearMap
];
[
self
fetchLocalNoSubmittedPioneering
];
[
self
fetchLocalNoSubmittedPioneering
];
}
}
-
(
void
)
fetchLocalNoSubmittedPioneering
{
-
(
void
)
fetchLocalNoSubmittedPioneering
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE %@=?"
,
[
GTOPioneering
TableName
],
@"state"
];
NSString
*
sql
=
NSLog
(
@"%@"
,
sql
);
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE %@=?"
,
[
GTOPioneering
TableName
],
@"state"
];
return
[
db
executeQuery
:
sql
,
GTO_PIONEERING_STATE_LOCAL
];
NSLog
(
@"%@"
,
sql
);
};
return
[
db
executeQuery
:
sql
,
GTO_PIONEERING_STATE_LOCAL
];
__weak
typeof
(
self
)
weakSelf
=
self
;
};
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
__weak
typeof
(
self
)
weakSelf
=
self
;
if
(
!
fetchedObjects
)
{
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
if
(
_bottomV
.
tag
==
kbottomDelBtnsTag
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_BACK
forState
:
UIControlStateNormal
];
if
(
!
fetchedObjects
)
{
self
.
bottomV
.
tag
=
kbottomBackBtnsTag
;
if
(
_bottomV
.
tag
==
kbottomDelBtnsTag
)
{
}
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_BACK
forState
:
UIControlStateNormal
];
return
;
self
.
bottomV
.
tag
=
kbottomBackBtnsTag
;
}
}
if
(
!
_d_pioneering
)
{
self
.
d_pioneering
=
[[
GTOPioneering
alloc
]
init
];
return
;
}
}
_d_pioneering
=
fetchedObjects
[
0
];
if
(
!
_d_pioneering
)
{
// [strongSelf appearMap];
self
.
d_pioneering
=
[[
GTOPioneering
alloc
]
init
];
}
//tableview
_d_pioneering
=
fetchedObjects
[
0
];
_titleItem
.
value
=
_d_pioneering
.
title
;
// [strongSelf appearMap];
_templeteSelectItem
.
value
=
_d_pioneering
.
templateName
;
_remarkItem
.
value
=
_d_pioneering
.
remark
;
// tableview
_titleItem
.
value
=
_d_pioneering
.
title
;
[
_titleItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
_templeteSelectItem
.
value
=
_d_pioneering
.
templateName
;
[
_templeteSelectItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
_remarkItem
.
value
=
_d_pioneering
.
remark
;
[
_remarkItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
_c_tableView
.
userInteractionEnabled
=
NO
;
[
_titleItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
//bottomView
[
_templeteSelectItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
if
(
_bottomV
.
tag
==
kbottomBackBtnsTag
)
{
[
_remarkItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_DELETE
forState
:
UIControlStateNormal
];
_c_tableView
.
userInteractionEnabled
=
NO
;
self
.
bottomV
.
tag
=
kbottomDelBtnsTag
;
// bottomView
}
if
(
_bottomV
.
tag
==
kbottomBackBtnsTag
)
{
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_DELETE
forState
:
UIControlStateNormal
];
[
strongSelf
p_addAlerInfoPioneeringView
];
self
.
bottomV
.
tag
=
kbottomDelBtnsTag
;
};
}
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
strongSelf
p_addAlerInfoPioneeringView
];
[
dbCtrl
runFetchForClass
:[
GTOPioneering
class
]
};
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
runFetchForClass
:[
GTOPioneering
class
]
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
}
}
-
(
void
)
appearMap
{
-
(
void
)
appearMap
{
BOOL
condition
=
_c_signVC
.
latitudeX
||
_c_signVC
.
longitudeY
BOOL
condition
=
_c_signVC
.
latitudeX
||
_c_signVC
.
longitudeY
||
||
_d_pioneering
.
longitude
||
_d_pioneering
.
latitude
;
_d_pioneering
.
longitude
||
_d_pioneering
.
latitude
;
if
(
condition
)
{
if
(
condition
)
{
_c_mapView
.
hidden
=
NO
;
_c_mapView
.
hidden
=
NO
;
BMKPointAnnotation
*
pointAnnotation
=
[[
BMKPointAnnotation
alloc
]
init
];
BMKPointAnnotation
*
pointAnnotation
=
[[
BMKPointAnnotation
alloc
]
init
];
CLLocationCoordinate2D
coor
;
CLLocationCoordinate2D
coor
;
coor
.
latitude
=
[
_c_signVC
.
latitudeX
floatValue
];
//31.2357360000;//
coor
.
latitude
=
[
_c_signVC
.
latitudeX
floatValue
];
// 31.2357360000;//
coor
.
longitude
=
[
_c_signVC
.
longitudeY
floatValue
];
//121.5292150000;//
coor
.
longitude
=
[
_c_signVC
.
longitudeY
floatValue
];
// 121.5292150000;//
pointAnnotation
.
coordinate
=
coor
;
pointAnnotation
.
coordinate
=
coor
;
[
_c_mapView
addAnnotation
:
pointAnnotation
];
_c_mapView
.
showsUserLocation
=
YES
;
_c_mapView
.
centerCoordinate
=
CLLocationCoordinate2DMake
(
coor
.
latitude
,
coor
.
longitude
);
_c_mapView
.
zoomLevel
=
17
;
}
[
_c_mapView
addAnnotation
:
pointAnnotation
];
_c_mapView
.
showsUserLocation
=
YES
;
_c_mapView
.
centerCoordinate
=
CLLocationCoordinate2DMake
(
coor
.
latitude
,
coor
.
longitude
);
_c_mapView
.
zoomLevel
=
17
;
}
}
}
-
(
void
)
p_initData
{
-
(
void
)
p_initData
{
if
(
!
_d_pioneering
)
{
if
(
!
_d_pioneering
)
{
self
.
d_pioneering
=
[[
GTOPioneering
alloc
]
init
];
self
.
d_pioneering
=
[[
GTOPioneering
alloc
]
init
];
}
}
}
}
-
(
void
)
p_initWithSubViews
{
-
(
void
)
p_initWithSubViews
{
CGFloat
signBtnW
=
120
;
CGFloat
signBtnW
=
120
;
UIButton
*
signBtn
=
[[
UIButton
alloc
]
initWithFrame
:
CGRectMake
(
self
.
view
.
width
-
signBtnW
,
0
,
signBtnW
,
44
)];
UIButton
*
signBtn
=
[[
UIButton
alloc
]
signBtn
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
20
];
initWithFrame
:
CGRectMake
(
self
.
view
.
width
-
signBtnW
,
0
,
signBtnW
,
44
)];
[
signBtn
.
titleLabel
setTextAlignment
:
NSTextAlignmentRight
];
signBtn
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
20
];
[
signBtn
setTitle
:
@"记录位置"
forState
:
UIControlStateNormal
];
[
signBtn
.
titleLabel
setTextAlignment
:
NSTextAlignmentRight
];
[
signBtn
setTitleColor
:
GTO_BLUE_TINT_COLOR
forState
:
UIControlStateNormal
];
[
signBtn
setTitle
:
@"记录位置"
forState
:
UIControlStateNormal
];
// [signBtn setImage:[UIImage imageNamed:@"icon_nav_start"] forState:UIControlStateNormal];
[
signBtn
setTitleColor
:
GTO_BLUE_TINT_COLOR
forState
:
UIControlStateNormal
];
[
signBtn
addTarget
:
self
action
:
@selector
(
signClicked
)
forControlEvents
:
UIControlEventTouchUpInside
];
// [signBtn setImage:[UIImage imageNamed:@"icon_nav_start"]
[
self
.
view
addSubview
:
signBtn
];
// forState:UIControlStateNormal];
UIImageView
*
imgV
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
self
.
view
.
width
-
signBtn
.
left
-
44
,
signBtn
.
y
,
44
,
signBtn
.
height
)];
[
signBtn
addTarget
:
self
imgV
.
image
=
[
UIImage
imageNamed
:
@"icon_nav_start"
];
action
:
@selector
(
signClicked
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
view
addSubview
:
signBtn
];
//table
UIImageView
*
imgV
=
[[
UIImageView
alloc
]
self
.
c_tableView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
signBtn
.
bottom
,
ScreenSize
.
width
,
44
*
3
)
style
:(
UITableViewStylePlain
)];
initWithFrame
:
CGRectMake
(
self
.
view
.
width
-
signBtn
.
left
-
44
,
signBtn
.
y
,
44
,
signBtn
.
height
)];
[
self
.
view
addSubview
:
self
.
c_tableView
];
imgV
.
image
=
[
UIImage
imageNamed
:
@"icon_nav_start"
];
self
.
manager
=
[[
RETableViewManager
alloc
]
initWithTableView
:
self
.
c_tableView
];
RETableViewSection
*
section
=
[
RETableViewSection
section
];
// table
[
self
.
manager
addSection
:
section
];
self
.
c_tableView
=
[[
UITableView
alloc
]
self
.
titleItem
=
[
RETextItem
itemWithTitle
:
@"标题:"
value
:
nil
placeholder
:
@"请输入标题"
];
initWithFrame
:
CGRectMake
(
0
,
signBtn
.
bottom
,
ScreenSize
.
width
,
44
*
3
)
self
.
templeteSelectItem
=
[
RERadioItem
itemWithTitle
:
@"拓站模板:"
value
:
nil
selectionHandler
:^
(
RERadioItem
*
item
)
{
style
:(
UITableViewStylePlain
)];
GTOPioneeringTemplateViewController
*
VC
=
[[
GTOPioneeringTemplateViewController
alloc
]
init
];
VC
.
purpose
=
@"explorer"
;
[
self
.
view
addSubview
:
self
.
c_tableView
];
// if (VC.choseBaseInfo) {
self
.
manager
=
VC
.
choseBaseInfo
=
^
(
NSArray
*
templateNames
)
{
[[
RETableViewManager
alloc
]
initWithTableView
:
self
.
c_tableView
];
GTOPatrolTemplate
*
patroTemplate
=
templateNames
[
0
];
RETableViewSection
*
section
=
[
RETableViewSection
section
];
self
.
templeteSelectItem
.
value
=
patroTemplate
.
name
;
[
self
.
manager
addSection
:
section
];
self
.
d_patrolTemplate
=
patroTemplate
;
self
.
titleItem
=
[
item
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
[
RETextItem
itemWithTitle
:
@"标题:"
value
:
nil
};
placeholder
:
@"请输入标题"
];
[
self
PushViewController
:
VC
animated
:
YES
];
self
.
templeteSelectItem
=
[
RERadioItem
itemWithTitle
:
@"拓站模板:"
}];
value
:
nil
self
.
remarkItem
=
[
RETextItem
itemWithTitle
:
@"备注"
value
:
nil
placeholder
:
@"输入备注内容"
];
selectionHandler
:^
(
RERadioItem
*
item
)
{
[
section
addItem
:
_titleItem
];
GTOPioneeringTemplateViewController
*
VC
=
[
section
addItem
:
_templeteSelectItem
];
[[
GTOPioneeringTemplateViewController
alloc
]
init
];
[
section
addItem
:
_remarkItem
];
VC
.
purpose
=
@"explorer"
;
// if (VC.choseBaseInfo) {
VC
.
choseBaseInfo
=
^
(
NSArray
*
templateNames
)
{
IBTUILabel
*
attentionLbl
=
[[
IBTUILabel
alloc
]
initWithFrame
:
CGRectMake
(
10
,
_c_tableView
.
bottom
+
10
,
self
.
view
.
width
,
20
)
text
:
@"注:开始拓站店前请先签到"
font
:
[
UIFont
systemFontOfSize
:
16
]
tintColor
:
[
UIColor
blackColor
]
backgroundColor
:
nil
textAlignment
:
NSTextAlignmentLeft
];
GTOPatrolTemplate
*
patroTemplate
=
templateNames
[
0
];
[
self
.
view
addSubview
:
attentionLbl
];
self
.
templeteSelectItem
.
value
=
patroTemplate
.
name
;
self
.
d_patrolTemplate
=
patroTemplate
;
[
item
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
CGRect
rect
=
CGRectMake
(
0
,
attentionLbl
.
bottom
+
20
,
self
.
view
.
width
,
self
.
view
.
height
-
(
attentionLbl
.
bottom
+
20
)
-
BottomViewHeight
-
20
-
64
);
};
self
.
c_mapView
=
[[
BMKMapView
alloc
]
initWithFrame
:
rect
];
[
self
PushViewController
:
VC
animated
:
YES
];
[
self
.
view
addSubview
:
_c_mapView
];
_c_mapView
.
hidden
=
YES
;
}];
self
.
remarkItem
=
GXFBottomView
*
bottomV
=
[[
GXFBottomView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
_c_mapView
.
bottom
+
20
,
self
.
view
.
width
,
BottomViewHeight
)
leftButtonColor
:
GTO_RED_COLOR
rightButtonColor
:
GTO_BLUE_DEEP_COLOR
LeftBtnTitle
:
@"返回列表"
rightBtnTitle
:
@"开始拓站"
];
[
RETextItem
itemWithTitle
:
@"备注"
value
:
nil
bottomV
.
delegate
=
self
;
placeholder
:
@"输入备注内容"
];
bottomV
.
tag
=
kbottomBackBtnsTag
;
[
section
addItem
:
_titleItem
];
self
.
bottomV
=
bottomV
;
[
section
addItem
:
_templeteSelectItem
];
[
self
.
view
addSubview
:
_bottomV
];
[
section
addItem
:
_remarkItem
];
IBTUILabel
*
attentionLbl
=
[[
IBTUILabel
alloc
]
initWithFrame
:
CGRectMake
(
10
,
_c_tableView
.
bottom
+
10
,
self
.
view
.
width
,
20
)
text
:
@"注:开始拓站店前请先签到"
font
:
[
UIFont
systemFontOfSize
:
16
]
tintColor
:
[
UIColor
blackColor
]
backgroundColor
:
nil
textAlignment
:
NSTextAlignmentLeft
];
[
self
.
view
addSubview
:
attentionLbl
];
CGRect
rect
=
CGRectMake
(
0
,
attentionLbl
.
bottom
+
20
,
self
.
view
.
width
,
self
.
view
.
height
-
(
attentionLbl
.
bottom
+
20
)
-
BottomViewHeight
-
20
-
64
);
self
.
c_mapView
=
[[
BMKMapView
alloc
]
initWithFrame
:
rect
];
[
self
.
view
addSubview
:
_c_mapView
];
_c_mapView
.
hidden
=
YES
;
GXFBottomView
*
bottomV
=
[[
GXFBottomView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
_c_mapView
.
bottom
+
20
,
self
.
view
.
width
,
BottomViewHeight
)
leftButtonColor
:
GTO_RED_COLOR
rightButtonColor
:
GTO_BLUE_DEEP_COLOR
LeftBtnTitle
:
@"返回列表"
rightBtnTitle
:
@"开始拓站"
];
bottomV
.
delegate
=
self
;
bottomV
.
tag
=
kbottomBackBtnsTag
;
self
.
bottomV
=
bottomV
;
[
self
.
view
addSubview
:
_bottomV
];
}
}
-
(
void
)
p_pioneeringWithatrolTemplate
:
(
GTOPatrolTemplate
*
)
patrolTemple
-
(
void
)
p_pioneeringWithatrolTemplate
:
(
GTOPatrolTemplate
*
)
patrolTemple
{
{
[
self
p_initData
];
[
self
p_initData
];
ICRUserUtil
*
userU
=
[
ICRUserUtil
sharedInstance
];
ICRUserUtil
*
userU
=
[
ICRUserUtil
sharedInstance
];
self
.
d_pioneering
.
title
=
_titleItem
.
value
;
self
.
d_pioneering
.
title
=
_titleItem
.
value
;
self
.
d_pioneering
.
remark
=
_remarkItem
.
value
;
self
.
d_pioneering
.
remark
=
_remarkItem
.
value
;
self
.
d_pioneering
.
uuid
=
[
userU
mobileID
];
// patrolTemple.uuid;
self
.
d_pioneering
.
uuid
=
[
userU
mobileID
];
//patrolTemple.uuid;
self
.
d_pioneering
.
version
=
0
;
//新建时为0
self
.
d_pioneering
.
version
=
0
;
//新建时为0
self
.
d_pioneering
.
state
=
GTO_PIONEERING_STATE_LOCAL
;
self
.
d_pioneering
.
state
=
GTO_PIONEERING_STATE_LOCAL
;
self
.
d_pioneering
.
pioneer_uuid
=
userU
.
f_user_uuid
;
self
.
d_pioneering
.
pioneer_uuid
=
userU
.
f_user_uuid
;
self
.
d_pioneering
.
pioneer_name
=
userU
.
f_user_name
;
self
.
d_pioneering
.
pioneer_name
=
userU
.
f_user_name
;
self
.
d_pioneering
.
pioneer_code
=
userU
.
f_user_code
;
self
.
d_pioneering
.
pioneer_code
=
userU
.
f_user_code
;
self
.
d_pioneering
.
templateName
=
patrolTemple
.
name
;
self
.
d_pioneering
.
templateName
=
patrolTemple
.
name
;
self
.
d_pioneering
.
beginDate
=
[[
NSDate
date
]
httpParameterString
];
self
.
d_pioneering
.
beginDate
=
[[
NSDate
date
]
httpParameterString
];
self
.
d_pioneering
.
enterprise
=
userU
.
f_enterprise_uuid
;
self
.
d_pioneering
.
enterprise
=
userU
.
f_enterprise_uuid
;
self
.
d_pioneering
.
create_time
=
patrolTemple
.
create_time
;
//
self
.
d_pioneering
.
create_time
=
patrolTemple
.
create_time
;
//
self
.
d_pioneering
.
create_id
=
patrolTemple
.
create_id
;
self
.
d_pioneering
.
create_id
=
patrolTemple
.
create_id
;
self
.
d_pioneering
.
create_operName
=
patrolTemple
.
create_operName
;
self
.
d_pioneering
.
create_operName
=
patrolTemple
.
create_operName
;
self
.
d_pioneering
.
lastModify_time
=
patrolTemple
.
lastModify_time
;
self
.
d_pioneering
.
lastModify_time
=
patrolTemple
.
lastModify_time
;
self
.
d_pioneering
.
lastModify_id
=
patrolTemple
.
lastModify_id
;
self
.
d_pioneering
.
lastModify_id
=
patrolTemple
.
lastModify_id
;
self
.
d_pioneering
.
latitude
=
_c_signVC
.
latitudeX
;
//@"38.12"; //
self
.
d_pioneering
.
latitude
=
_c_signVC
.
latitudeX
;
//@"38.12"; //
self
.
d_pioneering
.
longitude
=
_c_signVC
.
longitudeY
;
//@"89.77"; //
self
.
d_pioneering
.
longitude
=
_c_signVC
.
longitudeY
;
//@"89.77"; //
self
.
d_pioneering
.
purpose
=
patrolTemple
.
purpose
;
self
.
d_pioneering
.
purpose
=
patrolTemple
.
purpose
;
NSMutableArray
*
muArrQuestions
=
[
NSMutableArray
array
];
NSMutableArray
*
muArrQuestions
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
dictQuestion
in
patrolTemple
.
questions
)
{
for
(
NSDictionary
*
dictQuestion
in
patrolTemple
.
questions
)
{
GTOQuestion
*
question
=
[
GTOQuestion
DBObject
];
GTOQuestion
*
question
=
[
GTOQuestion
DBObject
];
[
question
praseFromJsonDict
:
dictQuestion
];
[
question
praseFromJsonDict
:
dictQuestion
];
question
.
uuid
=
[[
ICRUserUtil
sharedInstance
]
mobileID
];
question
.
uuid
=
[[
ICRUserUtil
sharedInstance
]
mobileID
];
question
.
pioneeringUuid
=
self
.
d_pioneering
.
uuid
;
question
.
pioneeringUuid
=
self
.
d_pioneering
.
uuid
;
[
question
saveToDBWithHandleData
:
NULL
complete
:
NULL
fail
:
NULL
];
[
question
saveToDBWithHandleData
:
NULL
complete
:
NULL
fail
:
NULL
];
[
muArrQuestions
addObject
:[
question
dictForCommit
]];
[
muArrQuestions
addObject
:[
question
dictForCommit
]];
}
}
self
.
d_pioneering
.
questions
=
muArrQuestions
;
// patrolTemple.questions;//
self
.
d_pioneering
.
questions
=
muArrQuestions
;
//patrolTemple.questions;//
[
self
p_pioneeringDisplayResults
];
[
self
p_pioneeringDisplayResults
];
}
}
-
(
void
)
p_savePioneering
{
-
(
void
)
p_savePioneering
{
__weak
typeof
(
self
)
weakSelf
=
self
;
__weak
typeof
(
self
)
weakSelf
=
self
;
[
_d_pioneering
saveToDBWithHandleData
:
NULL
[
_d_pioneering
saveToDBWithHandleData
:
NULL
complete
:
^
{
complete
:
^
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
[
IBTLoadingView
hideHUDWithText
:
nil
];
[
IBTLoadingView
hideHUDWithText
:
nil
];
self
.
isStartPioneering
=
YES
;
self
.
isStartPioneering
=
YES
;
GTOAlertInfoPioneeringViewController
*
alertInfoVC
=
[[
GTOAlertInfoPioneeringViewController
alloc
]
initWithPioneering
:
_d_pioneering
];
self
.
alertInfoVC
=
alertInfoVC
;
alertInfoVC
.
delegate
=
self
;
[[
UIApplication
sharedApplication
].
keyWindow
addSubview
:
_alertInfoVC
.
view
];
}
fail
:^
(
NSError
*
error
)
{
[
IBTLoadingView
hideHUDWithText
:
error
.
localizedDescription
];
}];
GTOAlertInfoPioneeringViewController
*
alertInfoVC
=
[[
GTOAlertInfoPioneeringViewController
alloc
]
initWithPioneering
:
_d_pioneering
];
self
.
alertInfoVC
=
alertInfoVC
;
alertInfoVC
.
delegate
=
self
;
[[
UIApplication
sharedApplication
]
.
keyWindow
addSubview
:
_alertInfoVC
.
view
];
}
fail
:^
(
NSError
*
error
)
{
[
IBTLoadingView
hideHUDWithText
:
error
.
localizedDescription
];
}];
}
}
-
(
void
)
p_pioneeringDisplayResults
{
-
(
void
)
p_pioneeringDisplayResults
{
//问题的分类
//问题的分类
if
(
!
_d_arrCategorys
)
{
if
(
!
_d_arrCategorys
)
{
NSUInteger
uiQuestionsCount
=
[
_d_pioneering
.
questions
count
];
NSUInteger
uiQuestionsCount
=
[
_d_pioneering
.
questions
count
];
NSArray
*
arrQuestIDs
=
[
_d_pioneering
.
questions
valueForKeyPath
:
@"uuid"
];
NSArray
*
arrQuestIDs
=
[
_d_pioneering
.
questions
valueForKeyPath
:
@"uuid"
];
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT DISTINCT category FROM %@ WHERE %@ IN %@ ORDER BY %@ ASC"
,
[
GTOQuestion
TableName
],
@"uuid"
,
[
IBTModel
ValuePlaceholdersWithCount
:
uiQuestionsCount
],
@"uuid"
];
NSLog
(
@"%@"
,
sql
);
//lineno没有,因为现在后台没有给问题排序
return
[
db
executeQuery
:
sql
withArgumentsInArray
:
arrQuestIDs
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
NSMutableArray
*
muArr
=
[
NSMutableArray
array
];
for
(
GTOQuestion
*
question
in
fetchedObjects
){
[
muArr
addObject
:
question
.
category
];
}
strongSelf
.
d_arrCategorys
=
[
NSArray
arrayWithArray
:
muArr
];
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
runFetchForClass
:[
GTOQuestion
class
]
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
}
//答案 (新建任务答案肯定是没有的,所以这个可以不写)
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE %@ = ?"
,
[
GTOAnswer
TableName
],
@"pioneeringUuid"
];
NSString
*
sql
=
[
NSString
NSLog
(
@"%@"
,
sql
);
//lineno没有,因为现在后台没有给问题排序
stringWithFormat
:
@"SELECT DISTINCT category FROM %@ WHERE %@ IN %@ "
@"ORDER BY %@ ASC"
,
return
[
db
executeQuery
:
sql
,
_d_pioneering
.
uuid
];
[
GTOQuestion
TableName
],
@"uuid"
,
[
IBTModel
ValuePlaceholdersWithCount
:
uiQuestionsCount
],
@"uuid"
];
NSLog
(
@"%@"
,
sql
);
// lineno没有,因为现在后台没有给问题排序
return
[
db
executeQuery
:
sql
withArgumentsInArray
:
arrQuestIDs
];
};
};
__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
*
muArr
=
[
NSMutableArray
array
];
for
(
GTOQuestion
*
question
in
fetchedObjects
)
{
for
(
NSString
*
category
in
_d_arrCategorys
){
[
muArr
addObject
:
question
.
category
];
}
//答案
strongSelf
.
d_arrCategorys
=
[
NSArray
arrayWithArray
:
muArr
];
GTODisplayResult
*
displayR
=
[[
GTODisplayResult
alloc
]
init
];
NSMutableArray
*
muArrAnswers
=
[
NSMutableArray
array
];
for
(
GTOAnswer
*
answer
in
fetchedObjects
){
if
([
answer
.
category
isEqualToString
:
category
])
//[muArrAnswers addObject:answer];
[
muArrAnswers
addObject
:[
answer
dictForCommit
]];
}
//问题
NSMutableArray
*
muArrQuestions
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
dict
in
_d_pioneering
.
questions
){
if
([
dict
[
@"category"
]
isEqualToString
:
category
])
{
GTOQuestion
*
question
=
[
GTOQuestion
DBObject
];
[
question
praseFromJsonDict
:
dict
];
// question.uuid = [[ICRUserUtil sharedInstance] mobileID];//给所有问题分配唯一标识
[
muArrQuestions
addObject
:[
question
dictForCommit
]];
}
}
displayR
.
arrAnswers
=
muArrAnswers
;
displayR
.
category
=
category
;
displayR
.
isDisplay
=
NO
;
displayR
.
arrQuestions
=
muArrQuestions
;
// displayR.answerNumber = muArrAnswers.count;
// displayR.questionNumber = muArrQuestions.count;
[
muArrDisplayRs
addObject
:[
displayR
dictForCommit
]];
}
// strongSelf.d_arrDisplayResults = muArrDisplayRs;
strongSelf
.
d_pioneering
.
arrCategorys
=
_d_arrCategorys
;
strongSelf
.
d_pioneering
.
arrDisplayResults
=
muArrDisplayRs
;
strongSelf
.
d_pioneering
.
state
=
GTO_PIONEERING_STATE_LOCAL
;
[
strongSelf
p_savePioneering
];
[
_c_tableView
reloadData
];
};
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
runFetchForClass
:[
GTO
Answer
class
]
[
dbCtrl
runFetchForClass
:[
GTO
Question
class
]
fetchBlock
:
fetchBlk
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
fetchResultsBlock
:
fetchResultsBlk
];
}
//答案 (新建任务答案肯定是没有的,所以这个可以不写)
ICRDatabaseFetchBlock
fetchBlk
=
^
FMResultSet
*
(
FMDatabase
*
db
)
{
NSString
*
sql
=
[
NSString
stringWithFormat
:
@"SELECT * FROM %@ WHERE %@ = ?"
,
[
GTOAnswer
TableName
],
@"pioneeringUuid"
];
NSLog
(
@"%@"
,
sql
);
// lineno没有,因为现在后台没有给问题排序
return
[
db
executeQuery
:
sql
,
_d_pioneering
.
uuid
];
};
__weak
typeof
(
self
)
weakSelf
=
self
;
ICRDatabaseFetchResultsBlock
fetchResultsBlk
=
^
(
NSArray
*
fetchedObjects
)
{
__strong
__typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
NSMutableArray
*
muArrDisplayRs
=
[
NSMutableArray
array
];
for
(
NSString
*
category
in
_d_arrCategorys
)
{
//答案
GTODisplayResult
*
displayR
=
[[
GTODisplayResult
alloc
]
init
];
NSMutableArray
*
muArrAnswers
=
[
NSMutableArray
array
];
for
(
GTOAnswer
*
answer
in
fetchedObjects
)
{
if
([
answer
.
category
isEqualToString
:
category
])
//[muArrAnswers addObject:answer];
[
muArrAnswers
addObject
:[
answer
dictForCommit
]];
}
//问题
NSMutableArray
*
muArrQuestions
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
dict
in
_d_pioneering
.
questions
)
{
if
([
dict
[
@"category"
]
isEqualToString
:
category
])
{
GTOQuestion
*
question
=
[
GTOQuestion
DBObject
];
[
question
praseFromJsonDict
:
dict
];
// question.uuid = [[ICRUserUtil sharedInstance]
// mobileID];//给所有问题分配唯一标识
[
muArrQuestions
addObject
:[
question
dictForCommit
]];
}
}
displayR
.
arrAnswers
=
muArrAnswers
;
displayR
.
category
=
category
;
displayR
.
isDisplay
=
NO
;
displayR
.
arrQuestions
=
muArrQuestions
;
// displayR.answerNumber = muArrAnswers.count;
// displayR.questionNumber = muArrQuestions.count;
[
muArrDisplayRs
addObject
:[
displayR
dictForCommit
]];
}
// strongSelf.d_arrDisplayResults = muArrDisplayRs;
strongSelf
.
d_pioneering
.
arrCategorys
=
_d_arrCategorys
;
strongSelf
.
d_pioneering
.
arrDisplayResults
=
muArrDisplayRs
;
strongSelf
.
d_pioneering
.
state
=
GTO_PIONEERING_STATE_LOCAL
;
[
strongSelf
p_savePioneering
];
[
_c_tableView
reloadData
];
};
ICRDataBaseController
*
dbCtrl
=
[
ICRDataBaseController
sharedController
];
[
dbCtrl
runFetchForClass
:[
GTOAnswer
class
]
fetchBlock
:
fetchBlk
fetchResultsBlock
:
fetchResultsBlk
];
}
}
-
(
void
)
p_addAlerInfoPioneeringView
{
-
(
void
)
p_addAlerInfoPioneeringView
{
GTOAlertInfoPioneeringViewController
*
alertInfoVC
=
[[
GTOAlertInfoPioneeringViewController
alloc
]
initWithPioneering
:
_d_pioneering
];
GTOAlertInfoPioneeringViewController
*
alertInfoVC
=
self
.
alertInfoVC
=
alertInfoVC
;
[[
GTOAlertInfoPioneeringViewController
alloc
]
alertInfoVC
.
delegate
=
self
;
initWithPioneering
:
_d_pioneering
];
[[
UIApplication
sharedApplication
].
keyWindow
addSubview
:
_alertInfoVC
.
view
];
self
.
alertInfoVC
=
alertInfoVC
;
alertInfoVC
.
delegate
=
self
;
[[
UIApplication
sharedApplication
].
keyWindow
addSubview
:
_alertInfoVC
.
view
];
}
}
#pragma GXFBottomViewDelegate
#pragma GXFBottomViewDelegate
-
(
void
)
bottomView
:
(
GXFBottomView
*
)
bottomView
oneButtonClicked
:
(
UIButton
*
)
oneBtn
{
-
(
void
)
bottomView
:
(
GXFBottomView
*
)
bottomView
oneButtonClicked
:
(
UIButton
*
)
oneBtn
{
// if (!self.c_signVC || !self.c_signVC.latitudeX || !self.c_signVC.longitudeY) {
// if (!self.c_signVC || !self.c_signVC.latitudeX ||
// [IBTLoadingView showTextOnly:@"开始拓站前,请先签到" inView:self.view];
// !self.c_signVC.longitudeY) {
// return;
// [IBTLoadingView showTextOnly:@"开始拓站前,请先签到"
// }
// inView:self.view];
// return;
if
(
!
_titleItem
.
value
||
_titleItem
.
value
.
length
<=
0
)
{
// }
[
IBTLoadingView
showTextOnly
:
@"请填写标题"
inView
:
self
.
view
];
return
;
if
(
!
_titleItem
.
value
||
_titleItem
.
value
.
length
<=
0
)
{
}
[
IBTLoadingView
showTextOnly
:
@"请填写标题"
inView
:
self
.
view
];
if
(
!
_templeteSelectItem
.
value
||
_templeteSelectItem
.
value
.
length
<=
0
)
{
return
;
[
IBTLoadingView
showTextOnly
:
@"请选择拓站模板"
inView
:
self
.
view
];
}
return
;
if
(
!
_templeteSelectItem
.
value
||
_templeteSelectItem
.
value
.
length
<=
0
)
{
}
[
IBTLoadingView
showTextOnly
:
@"请选择拓站模板"
inView
:
self
.
view
];
return
;
// if (!_isStartPioneering) {//同一个界面点击创建拓站任务,只能创建一次
}
if
(
!
_d_pioneering
.
uuid
)
{
[
self
p_pioneeringWithatrolTemplate
:
_d_patrolTemplate
];
}
else
{
// self.d_isNext = YES;
[
self
p_addAlerInfoPioneeringView
];
}
_c_tableView
.
userInteractionEnabled
=
NO
;
if
(
_bottomV
.
tag
==
kbottomBackBtnsTag
)
{
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_DELETE
forState
:
UIControlStateNormal
];
self
.
bottomV
.
tag
=
kbottomDelBtnsTag
;
}
// if (!_isStartPioneering) {//同一个界面点击创建拓站任务,只能创建一次
if
(
!
_d_pioneering
.
uuid
)
{
[
self
p_pioneeringWithatrolTemplate
:
_d_patrolTemplate
];
}
else
{
// self.d_isNext = YES;
[
self
p_addAlerInfoPioneeringView
];
}
_c_tableView
.
userInteractionEnabled
=
NO
;
if
(
_bottomV
.
tag
==
kbottomBackBtnsTag
)
{
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_DELETE
forState
:
UIControlStateNormal
];
self
.
bottomV
.
tag
=
kbottomDelBtnsTag
;
}
}
}
-
(
void
)
bottomView
:
(
GXFBottomView
*
)
bottomView
leftButtonClicked
:
(
UIButton
*
)
leftBtn
{
-
(
void
)
bottomView
:
(
GXFBottomView
*
)
bottomView
if
(
bottomView
.
tag
==
kbottomBackBtnsTag
)
{
leftButtonClicked
:
(
UIButton
*
)
leftBtn
{
[
self
PopViewControllerAnimated
:
YES
];
if
(
bottomView
.
tag
==
kbottomBackBtnsTag
)
{
return
;
[
self
PopViewControllerAnimated
:
YES
];
return
;
}
ICRDataBaseController
*
dataBaseC
=
[
ICRDataBaseController
sharedController
];
[
dataBaseC
.
m_dbQueue
inDatabase
:
^
(
FMDatabase
*
db
)
{
NSString
*
strSql
=
[
NSString
stringWithFormat
:
@"DELETE FROM %@ WHERE %@=?"
,
[
GTOPioneering
TableName
],
@"state"
];
BOOL
del
=
[
db
executeUpdate
:
strSql
,
GTO_PIONEERING_STATE_LOCAL
];
if
(
!
del
)
{
[
IBTLoadingView
showTextOnly
:
@"删除失败"
];
return
;
}
}
ICRDataBaseController
*
dataBaseC
=
[
ICRDataBaseController
sharedController
];
_d_pioneering
=
nil
;
[
dataBaseC
.
m_dbQueue
inDatabase
:
^
(
FMDatabase
*
db
)
{
_titleItem
.
value
=
nil
;
NSString
*
strSql
=
[
NSString
stringWithFormat
:
@"DELETE FROM %@ WHERE %@=?"
,[
GTOPioneering
TableName
],
@"state"
];
_templeteSelectItem
.
value
=
nil
;
BOOL
del
=
[
db
executeUpdate
:
strSql
,
GTO_PIONEERING_STATE_LOCAL
];
_remarkItem
.
value
=
nil
;
if
(
!
del
)
{
_d_arrCategorys
=
nil
;
[
IBTLoadingView
showTextOnly
:
@"删除失败"
];
self
.
d_pioneering
=
nil
;
return
;
}
[
_titleItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
_d_pioneering
=
nil
;
[
_templeteSelectItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
_titleItem
.
value
=
nil
;
[
_remarkItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
_templeteSelectItem
.
value
=
nil
;
_c_tableView
.
userInteractionEnabled
=
YES
;
_remarkItem
.
value
=
nil
;
_d_arrCategorys
=
nil
;
self
.
d_pioneering
=
nil
;
[
_titleItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
[
_templeteSelectItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
[
_remarkItem
reloadRowWithAnimation
:
UITableViewRowAnimationNone
];
_c_tableView
.
userInteractionEnabled
=
YES
;
if
(
_bottomV
.
tag
==
kbottomDelBtnsTag
)
{
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_BACK
forState
:
UIControlStateNormal
];
self
.
bottomV
.
tag
=
kbottomBackBtnsTag
;
}
}];
[
self
localDelete
];
if
(
_bottomV
.
tag
==
kbottomDelBtnsTag
)
{
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_BACK
forState
:
UIControlStateNormal
];
self
.
bottomV
.
tag
=
kbottomBackBtnsTag
;
}
}];
[
self
localDelete
];
}
}
//本地删除
//本地删除
-
(
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 %@=?"
,[
GTOAnswer
TableName
],
@"pioneeringUuid"
];
NSString
*
strSql
=
[
db
executeUpdate
:
strSql
,
_d_pioneering
.
uuid
];
[
NSString
stringWithFormat
:
@"DELETE FROM %@ WHERE %@=?"
,
}];
[
GTOAnswer
TableName
],
@"pioneeringUuid"
];
//删除本地问题
[
db
executeUpdate
:
strSql
,
_d_pioneering
.
uuid
];
[
dataBaseC
.
m_dbQueue
inDatabase
:
^
(
FMDatabase
*
db
)
{
}];
NSString
*
strSql
=
[
NSString
stringWithFormat
:
@"DELETE FROM %@ WHERE %@=?"
,[
GTOQuestion
TableName
],
@"pioneeringUuid"
];
//删除本地问题
[
db
executeUpdate
:
strSql
,
_d_pioneering
.
uuid
];
[
dataBaseC
.
m_dbQueue
inDatabase
:
^
(
FMDatabase
*
db
)
{
}];
NSString
*
strSql
=
//删除本地图片
[
NSString
stringWithFormat
:
@"DELETE FROM %@ WHERE %@=?"
,
[
dataBaseC
.
m_dbQueue
inDatabase
:
^
(
FMDatabase
*
db
)
{
[
GTOQuestion
TableName
],
@"pioneeringUuid"
];
NSString
*
strSql
=
[
NSString
stringWithFormat
:
@"DELETE FROM %@ WHERE %@=?"
,[
ICRPostAttachment
TableName
],
@"pioneeringUuid"
];
[
db
executeUpdate
:
strSql
,
_d_pioneering
.
uuid
];
[
db
executeUpdate
:
strSql
,
_d_pioneering
.
uuid
];
}];
}];
//删除本地图片
[
dataBaseC
.
m_dbQueue
inDatabase
:
^
(
FMDatabase
*
db
)
{
NSString
*
strSql
=
[
NSString
stringWithFormat
:
@"DELETE FROM %@ WHERE %@=?"
,
[
ICRPostAttachment
TableName
],
@"pioneeringUuid"
];
[
db
executeUpdate
:
strSql
,
_d_pioneering
.
uuid
];
}];
}
}
-
(
void
)
bottomView
:
(
GXFBottomView
*
)
bottomView
RightButtonClicked
:
(
UIButton
*
)
rightBtn
{
-
(
void
)
bottomView
:
(
GXFBottomView
*
)
bottomView
if
(
!
_titleItem
.
value
||
_titleItem
.
value
.
length
<=
0
)
{
RightButtonClicked
:
(
UIButton
*
)
rightBtn
{
[
IBTLoadingView
showTextOnly
:
@"请填写标题"
inView
:
self
.
view
];
if
(
!
_titleItem
.
value
||
_titleItem
.
value
.
length
<=
0
)
{
return
;
[
IBTLoadingView
showTextOnly
:
@"请填写标题"
inView
:
self
.
view
];
}
return
;
if
(
!
_templeteSelectItem
.
value
||
_templeteSelectItem
.
value
.
length
<=
0
)
{
}
[
IBTLoadingView
showTextOnly
:
@"请选择拓站模板"
inView
:
self
.
view
];
if
(
!
_templeteSelectItem
.
value
||
_templeteSelectItem
.
value
.
length
<=
0
)
{
return
;
[
IBTLoadingView
showTextOnly
:
@"请选择拓站模板"
inView
:
self
.
view
];
}
return
;
}
if
(
bottomView
.
tag
==
kbottomBackBtnsTag
)
{
if
(
bottomView
.
tag
==
kbottomBackBtnsTag
)
{
if
(
!
_d_pioneering
.
uuid
)
{
if
(
!
_d_pioneering
.
uuid
)
{
[
self
p_pioneeringWithatrolTemplate
:
_d_patrolTemplate
];
[
self
p_pioneeringWithatrolTemplate
:
_d_patrolTemplate
];
}
else
{
}
else
{
// self.d_isNext = YES;
// self.d_isNext = YES;
[
self
p_addAlerInfoPioneeringView
];
[
self
p_addAlerInfoPioneeringView
];
}
self
.
bottomV
.
tag
=
kbottomDelBtnsTag
;
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_DELETE
forState
:
UIControlStateNormal
];
return
;
}
if
(
bottomView
.
tag
==
kbottomDelBtnsTag
)
{
[
self
p_addAlerInfoPioneeringView
];
}
}
self
.
bottomV
.
tag
=
kbottomDelBtnsTag
;
[
self
.
bottomV
.
f_leftBtn
setTitle
:
BOTTOM_TEXT_DELETE
forState
:
UIControlStateNormal
];
return
;
}
if
(
bottomView
.
tag
==
kbottomDelBtnsTag
)
{
[
self
p_addAlerInfoPioneeringView
];
}
}
}
#pragma GTOAlertInfoPioneeringViewControllerDelegate
#pragma GTOAlertInfoPioneeringViewControllerDelegate
-
(
void
)
alertInfoPioneeringViewController
:
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
closeClickedWithBtton
:
(
UIButton
*
)
btn
{
-
(
void
)
alertInfoPioneeringViewController
:
// self.d_isClosed = YES;
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
[
_alertInfoVC
.
view
removeFromSuperview
];
closeClickedWithBtton
:
(
UIButton
*
)
btn
{
// self.d_isClosed = YES;
[
_alertInfoVC
.
view
removeFromSuperview
];
}
}
-
(
void
)
alertInfoPioneeringViewController
:
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
seeResultClickedWithBtton
:
(
UIButton
*
)
btn
{
-
(
void
)
alertInfoPioneeringViewController
:
GTOQResultViewController
*
resultVC
=
[[
GTOQResultViewController
alloc
]
initWithPioneering
:
_d_pioneering
];
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
seeResultClickedWithBtton
:
(
UIButton
*
)
btn
{
//self.d_isClosed = YES;
GTOQResultViewController
*
resultVC
=
[
_alertInfoVC
.
view
removeFromSuperview
];
[[
GTOQResultViewController
alloc
]
initWithPioneering
:
_d_pioneering
];
[
self
PushViewController
:
resultVC
animated
:
YES
];
// self.d_isClosed = YES;
[
_alertInfoVC
.
view
removeFromSuperview
];
[
self
PushViewController
:
resultVC
animated
:
YES
];
}
}
-
(
void
)
alertInfoPioneeringViewController
:
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
nextClickedWithBtton
:
(
UIButton
*
)
btn
{
-
(
void
)
alertInfoPioneeringViewController
:
BOOL
isAllFinished
=
YES
;
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
for
(
NSDictionary
*
dict
in
_d_pioneering
.
arrDisplayResults
)
{
nextClickedWithBtton
:
(
UIButton
*
)
btn
{
GTODisplayResult
*
displayR
=
[
GTODisplayResult
DBObject
];
BOOL
isAllFinished
=
YES
;
[
displayR
praseFromJsonDict
:
dict
];
for
(
NSDictionary
*
dict
in
_d_pioneering
.
arrDisplayResults
)
{
if
(
displayR
.
arrAnswers
.
count
<
displayR
.
arrQuestions
.
count
)
{
GTODisplayResult
*
displayR
=
[
GTODisplayResult
DBObject
];
GTOQuestionManager
*
mgr
=
[
GTOQuestionManager
sharedManager
];
[
displayR
praseFromJsonDict
:
dict
];
mgr
.
d_category
=
displayR
.
category
;
if
(
displayR
.
arrAnswers
.
count
<
displayR
.
arrQuestions
.
count
)
{
// [mgr openQuestionVCFromViewControler:self withPioneering:_d_pioneering];
GTOQuestionManager
*
mgr
=
[
GTOQuestionManager
sharedManager
];
BOOL
notEdit
=
NO
;
mgr
.
d_category
=
displayR
.
category
;
if
([
_d_pioneering
.
state
isEqualToString
:
GTO_PIONEERING_STATE_SUBMITTED
])
{
// [mgr openQuestionVCFromViewControler:self
notEdit
=
YES
;
// withPioneering:_d_pioneering];
}
else
{
BOOL
notEdit
=
NO
;
notEdit
=
NO
;
if
([
_d_pioneering
.
state
}
isEqualToString
:
GTO_PIONEERING_STATE_SUBMITTED
])
{
[
mgr
openQuestionVCFromViewControler
:
self
Licence
:
nil
Pioneering
:
_d_pioneering
IsNotEdit
:
notEdit
ProblemIndex
:
0
];
notEdit
=
YES
;
[
self
alertInfoPioneeringViewController
:
alertInfoPioneering
closeClickedWithBtton
:
nil
];
}
else
{
isAllFinished
=
NO
;
notEdit
=
NO
;
break
;
}
}
[
mgr
openQuestionVCFromViewControler
:
self
}
Licence
:
nil
Pioneering
:
_d_pioneering
if
(
isAllFinished
)
{
IsNotEdit
:
notEdit
NSDictionary
*
dictR
=
[
_d_pioneering
.
arrDisplayResults
lastObject
];
ProblemIndex
:
0
];
GTODisplayResult
*
displayR
=
[
GTODisplayResult
DBObject
];
[
self
alertInfoPioneeringViewController
:
alertInfoPioneering
[
displayR
praseFromJsonDict
:
dictR
];
closeClickedWithBtton
:
nil
];
GTOQuestionManager
*
mgr
=
[
GTOQuestionManager
sharedManager
];
isAllFinished
=
NO
;
mgr
.
d_category
=
displayR
.
category
;
break
;
// [mgr openQuestionVCFromViewControler:self withPioneering:_d_pioneering];
BOOL
notEdit
=
NO
;
if
([
_d_pioneering
.
state
isEqualToString
:
GTO_PIONEERING_STATE_SUBMITTED
])
{
notEdit
=
YES
;
}
else
{
notEdit
=
NO
;
}
[
mgr
openQuestionVCFromViewControler
:
self
Licence
:
nil
Pioneering
:
_d_pioneering
IsNotEdit
:
notEdit
ProblemIndex
:
0
];
[
self
alertInfoPioneeringViewController
:
alertInfoPioneering
closeClickedWithBtton
:
nil
];
}
}
}
}
-
(
void
)
alertInfoPioneeringViewController
:
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
GTOQuestionManager
*
mgr
=
[
GTOQuestionManager
sharedManager
];
if
(
isAllFinished
)
{
NSDictionary
*
dictR
=
[
_d_pioneering
.
arrDisplayResults
lastObject
];
GTODisplayResult
*
displayR
=
[
GTODisplayResult
DBObject
];
GTODisplayResult
*
displayR
=
[
GTODisplayResult
DBObject
];
[
displayR
praseFromJsonDict
:
_d_pioneering
.
arrDisplayResults
[
indexPath
.
row
]];
[
displayR
praseFromJsonDict
:
dictR
];
mgr
.
d_category
=
displayR
.
category
;
//alertInfoPioneering.d_arrCategorys[indexPath.row];
GTOQuestionManager
*
mgr
=
[
GTOQuestionManager
sharedManager
];
// [mgr openQuestionVCFromViewControler:self withPioneering:_d_pioneering];
mgr
.
d_category
=
displayR
.
category
;
// [self alertInfoPioneeringViewController:alertInfoPioneering closeClickedWithBtton:nil];
// [mgr openQuestionVCFromViewControler:self
// withPioneering:_d_pioneering];
BOOL
notEdit
=
NO
;
BOOL
notEdit
=
NO
;
if
([
_d_pioneering
.
state
isEqualToString
:
GTO_PIONEERING_STATE_SUBMITTED
])
{
if
([
_d_pioneering
.
state
isEqualToString
:
GTO_PIONEERING_STATE_SUBMITTED
])
{
notEdit
=
YES
;
notEdit
=
YES
;
}
else
{
}
else
{
notEdit
=
NO
;
notEdit
=
NO
;
}
}
[
mgr
openQuestionVCFromViewControler
:
self
Licence
:
nil
Pioneering
:
_d_pioneering
IsNotEdit
:
notEdit
ProblemIndex
:
0
];
[
mgr
openQuestionVCFromViewControler
:
self
Licence
:
nil
[
self
alertInfoPioneeringViewController
:
alertInfoPioneering
closeClickedWithBtton
:
nil
];
Pioneering
:
_d_pioneering
IsNotEdit
:
notEdit
ProblemIndex
:
0
];
[
self
alertInfoPioneeringViewController
:
alertInfoPioneering
closeClickedWithBtton
:
nil
];
}
}
-
(
void
)
alertInfoPioneeringViewController
:
(
GTOAlertInfoPioneeringViewController
*
)
alertInfoPioneering
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
GTOQuestionManager
*
mgr
=
[
GTOQuestionManager
sharedManager
];
GTODisplayResult
*
displayR
=
[
GTODisplayResult
DBObject
];
[
displayR
praseFromJsonDict
:
_d_pioneering
.
arrDisplayResults
[
indexPath
.
row
]];
mgr
.
d_category
=
displayR
.
category
;
// alertInfoPioneering.d_arrCategorys[indexPath.row];
// [mgr openQuestionVCFromViewControler:self withPioneering:_d_pioneering];
// [self alertInfoPioneeringViewController:alertInfoPioneering
// closeClickedWithBtton:nil];
BOOL
notEdit
=
NO
;
if
([
_d_pioneering
.
state
isEqualToString
:
GTO_PIONEERING_STATE_SUBMITTED
])
{
notEdit
=
YES
;
}
else
{
notEdit
=
NO
;
}
[
mgr
openQuestionVCFromViewControler
:
self
Licence
:
nil
Pioneering
:
_d_pioneering
IsNotEdit
:
notEdit
ProblemIndex
:
0
];
[
self
alertInfoPioneeringViewController
:
alertInfoPioneering
closeClickedWithBtton
:
nil
];
}
}
//签到
//签到
-
(
void
)
signClicked
{
-
(
void
)
signClicked
{
GTOSignViewController
*
signVC
=
[[
GTOSignViewController
alloc
]
init
];
GTOSignViewController
*
signVC
=
[[
GTOSignViewController
alloc
]
init
];
self
.
c_signVC
=
signVC
;
self
.
c_signVC
=
signVC
;
[
self
PushViewController
:
signVC
animated
:
NO
];
[
self
PushViewController
:
signVC
animated
:
NO
];
}
}
//- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell
//
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell
*)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
//*)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// if (indexPath.row == 2) {
// if (indexPath.row == 2) {
// cell.backgroundColor = [UIColor redColor];
// cell.backgroundColor = [UIColor redColor];
// cell.userInteractionEnabled = NO;
// cell.userInteractionEnabled = NO;
...
@@ -584,12 +654,9 @@ typedef NS_ENUM(NSUInteger, bottomTag) {
...
@@ -584,12 +654,9 @@ typedef NS_ENUM(NSUInteger, bottomTag) {
// return YES;
// return YES;
//}
//}
-
(
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment