Commit abf8a10d authored by 曹云霄's avatar 曹云霄

VI检查添加字段控制是否拍照和是否从相册选取

parent 4ba86e22
This diff is collapsed.
......@@ -126,7 +126,7 @@
,@"function_vicheck"
,@"function_vicheckresult",nil];
NSArray *titleArray = [NSArray arrayWithObjects:
@"临时VI检查"
@"VI抽查"
,@"VI检查任务"
,@"VI检查结果",nil];
NSDictionary *dict = @{@"image":[imageArray objectAtIndex:i],@"title":[titleArray objectAtIndex:i]};
......
......@@ -157,7 +157,22 @@
[self noAnswersCondition];return;
}
NewDetails *detail = [self.answerModel.details firstObject];
self.contentLabel.text = [NSString stringWithFormat:@"%@",(detail.index == ONE)?@"是":@"否"];
NSString *string;
switch (detail.index) {
case 1:
string = @"是";
break;
case 2:
string = @"否";
break;
case 3:
string = @"无此项";
break;
default:
break;
}
self.contentLabel.text = string;
[self addImageAttachment];
}
......
......@@ -58,7 +58,7 @@
[self.btnAtt setTitleColor:RGBA(227, 12, 53, 1) forState:UIControlStateNormal];
}
}else {
if (cellModel.question.needPhoto) {
if (photoType(cellModel.question.photoType) != PHOTO_TYPE_NO) {
[self.btnAtt setBackgroundImage:TCImage(@"patrol_exam_btn_bg_red") forState:UIControlStateNormal];
[self.btnAtt setImage:TCImage(@"patrol_exam_camera_red") forState:UIControlStateNormal];
if (self.cellModel.answer.resultAttachments.count > 0) {
......
......@@ -174,17 +174,17 @@
@property (nonatomic, strong) NSNumber <Optional> * lineNo;
@property (nonatomic, strong) NSNumber <Optional> * scoreTo;
/**
是否必须拍照
拍照类型
*/
@property (nonatomic, assign) BOOL needPhoto;
@property (nonatomic, copy) NSString *photoType;
@property (nonatomic, strong) NSNumber <Optional> * scoreFrom;
@property (nonatomic, strong) NSString <Optional> * reference;
@property (nonatomic, strong) NSNumber <Optional> * star;
@end
......
......@@ -92,7 +92,8 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
ZJPictureTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ZJPictureTableViewCell" forIndexPath:indexPath];
NSString *memarkString = [NSString stringWithFormat:@"%@ %@\n%@ %@",kUser.f_user_name,self.cellModel.question.title,[[NSDate date] httpParameterString],self.cellModel.viewModel.inspector.store_name];
[cell configCellWithViewModel:self.viewModel indexPath:indexPath target:self remarkString:memarkString];
PHOTO_TYPE type = photoType(self.cellModel.question.photoType);
[cell configCellWithViewModel:self.viewModel indexPath:indexPath target:self remarkString:memarkString photoType:type];
@weakify(self);
cell.blockReloadData = ^{
@strongify(self);
......
......@@ -326,7 +326,7 @@
}
for (NSInteger i = 0; i < self.viewModel.arrCellData.count; i++) {
PatrolExamCellViewModel *vm = self.viewModel.arrCellData[i];
if (vm.question.needPhoto) {
if (1) {
if ([questionArray containsObject:vm.question.uuid]) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:(UITableViewScrollPositionMiddle) animated:YES];
......
......@@ -43,7 +43,7 @@
[self addStoreChildVc];
[self addHistoryButtonItem];
self.title = @"临时VI检查";
self.title = @"VI抽查";
}
#pragma mark -布局完成
......@@ -97,7 +97,7 @@
[RequestManager request_CreatePatrolTempCheck:weakSelf.selectedStoreModel.uuid success:^(id returnValue) {
[IBTLoadingView hideHUDWithText:nil];
if ([ BaseViewModel verifyData:returnValue]) {
[IBTLoadingView showTextOnly:@"生成VI临时VI检查任务成功"];
[IBTLoadingView showTextOnly:@"生成VIVI抽查任务成功"];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
ZJPatrolDetail *detail = [ZJPatrolDetail modelWithDic:[BaseViewModel formatData:returnValue]];
PatrolTaskCustomModel *customModel = [PatrolTaskCustomModel new];
......
//
// GTORepairNewViewController.h
// total
//
// Created by freecui on 15/10/31.
// Copyright © 2015年 free. All rights reserved.
//
#import <UIKit/UIKit.h>
@class GTORepair;
@interface GTOLicenceNewViewController : UIViewController
@property (nonatomic, strong) GTORepair *d_repair;
//- (instancetype)initWithRepairUuid: (NSString *)repairUuid;
@end
......@@ -152,7 +152,7 @@
+ (void)request_UploadInspectResult:(NSString *)taskUuid parmeter:(NSDictionary *)parmeter success:(SuccessBlock)success failure:(ErrorBlock)failure;
/**
生成VI临时VI检
生成VIVI抽
@param store_Uuid 油站ID
@param success 成功回调
......
......@@ -611,7 +611,7 @@
/**
生成VI临时VI检
生成VIVI抽
@param store_Uuid 油站ID
@param success 成功回调
......
......@@ -28,7 +28,7 @@ UIKIT_EXTERN NSString *const PRAISEANDINSPECTOR_PROGRESS;
UIKIT_EXTERN NSString *const SUPERVISOR_SERVICE;
//当日自检任务进度(首页)
UIKIT_EXTERN NSString *const QUERYPRAISESBYDAY;
//生成VI临时VI检
//生成VIVI抽
UIKIT_EXTERN NSString *const CREATEVITEMPCHECK;
//当日自检任务列表、时间轴(首页)
UIKIT_EXTERN NSString *const QUERYPRAISESBYDAY2;
......
......@@ -76,7 +76,7 @@ NSString *const QUERYPATROLINSPECTPLAN = @"vipatrol/plan/query/%@?start_date=%@&
NSString *const QUERYPATROLINSPECTDETAIL = @"vipatrol/plan/get_rstore_result/%@?store_uuid=%@";
//查询VI检查任务附件
NSString *const QUERYPATROLATTACHMENT = @"attachment/get_urls?entity_type=repairingBill&entity_uuid=%@";
//生成VI临时VI检
//生成VIVI抽
NSString *const CREATEVITEMPCHECK = @"vipatrol/plan/create_by_temporary/%@?store_uuid=%@";
//修改密码
NSString *const CHANGEPASSWORD = @"user/change_password/%@?time=%@&operId=%@&operName=%@";
......
......@@ -13,12 +13,17 @@
typedef void (^repairBlock)(void);
@interface ZJPictureTableViewCell : UITableViewCell<UICollectionViewDelegate,
UICollectionViewDataSource,DBCameraViewControllerDelegate>
UICollectionViewDataSource,DBCameraViewControllerDelegate,DBCameraContainerDelegate>
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
@property (weak, nonatomic) IBOutlet UICollectionViewFlowLayout *layOut;
@property (weak, nonatomic) UIViewController *vc;
@property (strong, nonatomic) PicViewModel *viewModel;
/**
附件选取类型
*/
@property (nonatomic, assign) PHOTO_TYPE type;
/**
水印文字
*/
......@@ -26,6 +31,8 @@ UICollectionViewDataSource,DBCameraViewControllerDelegate>
/** 是否显示添加按钮 */
@property (nonatomic, copy) repairBlock blockReloadData;
- (void)configCellWithViewModel:(PicViewModel *)viewModel indexPath:(NSIndexPath *)indexPath target:(UIViewController *)target remarkString:(NSString *)remarkString;
- (void)configCellWithViewModel:(PicViewModel *)viewModel indexPath:(NSIndexPath *)indexPath target:(UIViewController *)target remarkString:(NSString *)remarkString photoType:(PHOTO_TYPE)photoType;
- (void)pushImagePickerController;
@end
......@@ -8,6 +8,9 @@
#import "ZJPictureTableViewCell.h"
#import "ZJAddPictureCollectionCell.h"
#import "DBCameraLibraryViewController.h"
#import "DBCameraContainerViewController.h"
@interface ZJPictureTableViewCell ()
......@@ -22,13 +25,13 @@
self.layOut.minimumInteritemSpacing = 10;
self.layOut.minimumLineSpacing = 10;
self.layOut.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
// Initialization code
}
- (void)configCellWithViewModel:(PicViewModel *)viewModel indexPath:(NSIndexPath *)indexPath target:(UIViewController *)target remarkString:(NSString *)remarkString {
- (void)configCellWithViewModel:(PicViewModel *)viewModel indexPath:(NSIndexPath *)indexPath target:(UIViewController *)target remarkString:(NSString *)remarkString photoType:(PHOTO_TYPE)photoType {
self.vc = target;
self.viewModel = viewModel;
self.remarkString = remarkString;
self.type = photoType;
//如果是只读的,则直接刷新。
if (self.viewModel.type == kPicCellTypeRead) {
[self.collectionView reloadData];
......@@ -98,15 +101,44 @@
}
#pragma mark - TZImagePickerController
- (void)pushImagePickerController {
DBCameraViewController *cameraVc = [DBCameraViewController initWithDelegate:self];
[cameraVc setUseCameraSegue:NO];
[self.vc presentViewController:cameraVc animated:YES completion:nil];
switch (self.type) {
case PHOTO_TYPE_NO:
ShowDefaultErrorView(@"此分类不用拍照", nil);
break;
case PHOTO_TYPE_ONLYPHOTO:
{
DBCameraViewController *cameraVc = [DBCameraViewController initWithDelegate:self];
[cameraVc setUseCameraSegue:NO];
[self.vc presentViewController:cameraVc animated:YES completion:nil];
}
break;
case PHOTO_TYPE_ONLYLBUM:
{
DBCameraLibraryViewController *vc = [[DBCameraLibraryViewController alloc] init];
[vc setDelegate:self];
[IBTLoadingView showProgressLabel:@"加载中"];
[self.vc presentViewController:vc animated:YES completion:^{
[IBTLoadingView hideHUDWithText:nil];
}];
}
break;
case PHOTO_TYPE_ALL:
{
DBCameraViewController *cameraController = [DBCameraViewController initWithDelegate:self];
[cameraController setForceQuadCrop:YES];
DBCameraContainerViewController *container = [[DBCameraContainerViewController alloc] initWithDelegate:self];
[container setCameraViewController:cameraController];
[container setFullScreenMode];
[self.vc presentViewController:container animated:YES completion:nil];
}
break;
default:
break;
}
}
#pragma mark - DBCameraViewControllerDelegate
- (void) dismissCamera:(id)cameraViewController{
[self.vc dismissViewControllerAnimated:YES completion:nil];
[cameraViewController restoreFullScreenMode];
......@@ -121,7 +153,6 @@
return;
}
UIImage *newImage = [image rescaleImageToSize:CGSizeMake(ScreenSize.width, ScreenSize.width * 4 / 3)];
// NSString *string = [NSString stringWithFormat:@"%@ %@",kUser.f_user_name,[[NSDate date] httpParameterString]];
NSDictionary *fontDict = @{NSForegroundColorAttributeName:[UIColor yellowColor],NSFontAttributeName:[UIFont systemFontOfSize:17]};
UIImage *waterImage = [newImage imageWaterMarkWithString:self.remarkString point:CGPointMake(20, newImage.size.height - 20) attribute:fontDict];
NSString *imageName = [self saveImageToLocal:waterImage];
......@@ -129,6 +160,18 @@
self.blockReloadData();
}
#pragma mark - DBCameraContainerDelegate
- (void) backFromController:(id)fromController
{
[self.vc dismissViewControllerAnimated:YES completion:nil];
[fromController restoreFullScreenMode];
}
- (void) switchFromController:(id)fromController toController:(id)controller
{
}
#pragma mark -保存到本地
- (NSString *)saveImageToLocal:(UIImage *)image
{
......
......@@ -242,7 +242,6 @@ void PerformCustomHUDMethod(MBProgressHUD *hud,NSString *message,NSString *image
}
}
/**
进度条
默认窗口
......
......@@ -158,10 +158,39 @@ typedef NS_ENUM(NSInteger,ATTACHMENT_TYPE){
ATTACHMENT_VIDEO
};
/**
VI检查拍照类型
- PHOTO_TYPE_NO: 不允许拍照
- PHOTO_TYPE_ONLYPHOTO: 只允许拍照
- PHOTO_TYPE_ONLYLBUM: 只允许从相册选取
- PHOTO_TYPE_ALL: 可以拍照,可以从相册获取
*/
typedef NS_ENUM(NSInteger,PHOTO_TYPE) {
PHOTO_TYPE_NO = 0,
PHOTO_TYPE_ONLYPHOTO,
PHOTO_TYPE_ONLYLBUM,
PHOTO_TYPE_ALL
};
static PHOTO_TYPE photoType(NSString *type) {
if ([type isEqualToString:@"no"]) {
return PHOTO_TYPE_NO;
}
if ([type isEqualToString:@"onlyphoto"]) {
return PHOTO_TYPE_ONLYPHOTO;
}
if ([type isEqualToString:@"onlyalbum"]) {
return PHOTO_TYPE_ONLYLBUM;
}
if ([type isEqualToString:@"all"]) {
return PHOTO_TYPE_ALL;
}
return PHOTO_TYPE_ONLYPHOTO;
};
/**
附件位置
- ATTACHMENT_HTTP: 网络
- ATTACHMENT_LOCAL: 本地
*/
......@@ -179,12 +208,16 @@ typedef NS_ENUM(NSInteger,ATTACHMENT_LOCATION){
//#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_LOCAL_BASE_URL @"http://139.196.39.77:8180"
//#define HTTP_REST_API_BASE_URL @"http://139.196.39.77:8180/total-server/rest"
//#define HTTP_LOCAL_BASE_URL @"http://139.196.39.77:8180"
//开发环境
//#define HTTP_LOCAL_BASE_URL @"http://192.168.1.176:8083"
//#define HTTP_REST_API_BASE_URL @"http://192.168.1.176:8083/total-server/rest"
#define HTTP_LOCAL_BASE_URL @"http://192.168.1.176:8083"
#define HTTP_REST_API_BASE_URL @"http://192.168.1.176:8083/total-server/rest"
//外网映射开发环境
//#define HTTP_LOCAL_BASE_URL @"http://dev.gomoretech.com"
//#define HTTP_REST_API_BASE_URL @"http://dev.gomoretech.com/total-server/rest/"
#define HTTP_WEATHER_URL @"http://apis.baidu.com/heweather/weather/free"
//refreshUpdateDate
......
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