Commit 22ef2cab authored by admin's avatar admin

修复bug

parent c8c656fe
......@@ -61,6 +61,7 @@
8490C4D31BF9DEF0006B6569 /* PictureTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8490C4CE1BF9DEF0006B6569 /* PictureTableCell.m */; };
8490C4D41BF9DEF0006B6569 /* PictureViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8490C4D21BF9DEF0006B6569 /* PictureViewController.m */; };
8490C4D71BF9DF1D006B6569 /* PictureStoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8490C4D61BF9DF1D006B6569 /* PictureStoryViewController.m */; };
8491F6C61C2BCD8D00A00395 /* SpotCheckTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8491F6C51C2BCD8D00A00395 /* SpotCheckTableViewCell.m */; };
84945F1B1C2A6A6300C1793C /* AboutMeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84945F1A1C2A6A6300C1793C /* AboutMeViewController.m */; };
84970DEF1BD8DD8A00C1728A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 84970DEE1BD8DD8A00C1728A /* main.m */; };
84970DFA1BD8DD8A00C1728A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84970DF91BD8DD8A00C1728A /* Assets.xcassets */; };
......@@ -285,6 +286,8 @@
8490C4D21BF9DEF0006B6569 /* PictureViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureViewController.m; sourceTree = "<group>"; };
8490C4D51BF9DF1D006B6569 /* PictureStoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PictureStoryViewController.h; sourceTree = "<group>"; };
8490C4D61BF9DF1D006B6569 /* PictureStoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PictureStoryViewController.m; sourceTree = "<group>"; };
8491F6C41C2BCD8D00A00395 /* SpotCheckTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpotCheckTableViewCell.h; sourceTree = "<group>"; };
8491F6C51C2BCD8D00A00395 /* SpotCheckTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpotCheckTableViewCell.m; sourceTree = "<group>"; };
84945F191C2A6A6300C1793C /* AboutMeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutMeViewController.h; sourceTree = "<group>"; };
84945F1A1C2A6A6300C1793C /* AboutMeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AboutMeViewController.m; sourceTree = "<group>"; };
84970DEA1BD8DD8A00C1728A /* redstar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = redstar.app; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -755,6 +758,7 @@
843D1B991C0B3F6200E30002 /* SpotCheckOnLine */ = {
isa = PBXGroup;
children = (
8491F6C31C2BCD7300A00395 /* Cell */,
84CEB1641C28E7E40072ED0A /* Model */,
843D1B9A1C0B3F6200E30002 /* View */,
843D1B9B1C0B3F6200E30002 /* ViewController */,
......@@ -1174,6 +1178,15 @@
path = ViewController;
sourceTree = "<group>";
};
8491F6C31C2BCD7300A00395 /* Cell */ = {
isa = PBXGroup;
children = (
8491F6C41C2BCD8D00A00395 /* SpotCheckTableViewCell.h */,
8491F6C51C2BCD8D00A00395 /* SpotCheckTableViewCell.m */,
);
path = Cell;
sourceTree = "<group>";
};
84945F181C2A6A4A00C1793C /* About */ = {
isa = PBXGroup;
children = (
......@@ -2263,6 +2276,7 @@
84CF0F1E1BE9B40400C855CE /* InspectDetailFooterView.m in Sources */,
84F30DA41BFC19F200CBAD13 /* RankListModel.m in Sources */,
8409BDFC1C281ACD00354460 /* SelectStoreHeadView.m in Sources */,
8491F6C61C2BCD8D00A00395 /* SpotCheckTableViewCell.m in Sources */,
84CC34EF1C09AEC0002F10E2 /* LookOnLineDetailViewController.m in Sources */,
8487D8091BF20FAD00E63E90 /* TaxisView.m in Sources */,
84A673C71C0C7E0C000F828E /* AnnounceDetailHeadView.m in Sources */,
......
......@@ -9,10 +9,11 @@
#ifndef Url_h
#define Url_h
// url
// url 测试环境
// #define kRedStarURL @"http://218.244.151.129:7580/"
#define kRedStarURL @"http://219.235.234.225:7580/"
// 正式环境
#define kRedStarURL @"http://219.235.234.225:7580/"
// 检查更新
......
......@@ -33,7 +33,7 @@
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
} else if ([lookOnLine.state isEqualToString:@"finished"]) {
NSString *str = [NSString stringWithFormat:@"临检进度:已评分"];
NSString *str = [NSString stringWithFormat:@"临检进度:已完成"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
......
......@@ -430,7 +430,15 @@
[http getStoreSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"获取 商场 抽查列表 response= %@", response);
NSLog(@"获取 商场 抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
LookOnLineModel *lookOnline = [[LookOnLineModel alloc] init];
[lookOnline setValuesForKeysWithDictionary:dict];
[tempArray addObject:lookOnline];
}
_allLookOnLineList = tempArray;
if (_allLookOnLineList.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
......@@ -451,7 +459,7 @@
}];
[self.tableView reloadData];
}
[self closeGreenView];
[MBProgressHUD hideHUDForView:self.view animated:YES];
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
}];
......@@ -531,7 +539,6 @@
@"direction":@"asc"}];
}
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"userUuid":user_uuid,
......@@ -543,7 +550,15 @@
[http getStoreSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"获取 商场 抽查列表 response= %@", response);
NSLog(@"获取 商场 抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
LookOnLineModel *lookOnline = [[LookOnLineModel alloc] init];
[lookOnline setValuesForKeysWithDictionary:dict];
[tempArray addObject:lookOnline];
}
_allLookOnLineList = tempArray;
if (_allLookOnLineList.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
......
//
// SpotCheckTableViewCell.h
// redstar
//
// Created by admin on 15/12/24.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@class SpotCheckModel;
@interface SpotCheckTableViewCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel; // 标题
@property (nonatomic, strong) UILabel *startDate; // 起始日期
@property (nonatomic, strong) UILabel *overDate; // 截止日期
@property (nonatomic, strong) UILabel *progressLabel;
@property (nonatomic, strong) UILabel *alreadyLabel;
@property (nonatomic, strong) UILabel *allLabel;
@property (nonatomic, assign) CGFloat multiplier; // 乘数
@property (nonatomic, strong) UIImageView *alreadyView;
@property (nonatomic, strong) UIView *allView;
@property (nonatomic, strong) SpotCheckModel *spotCheck;
@end
//
// SpotCheckTableViewCell.m
// redstar
//
// Created by admin on 15/12/24.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "SpotCheckTableViewCell.h"
#import "SpotCheckModel.h"
@implementation SpotCheckTableViewCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
self.titleLabel.font = [UIFont systemFontOfSize:19.0];
self.startDate.textColor = kCellDetailColor;
self.overDate.textColor = kCellDetailColor;
self.progressLabel.font = [UIFont systemFontOfSize:14.0];
self.alreadyLabel.font = [UIFont systemFontOfSize:15.0];
self.allLabel.font = [UIFont systemFontOfSize:15.0];
}
- (void)setSpotCheck:(SpotCheckModel *)spotCheck
{
_spotCheck = spotCheck;
self.titleLabel.text = [NSString stringWithFormat:@"%@", spotCheck.title];
self.startDate.text = [NSString stringWithFormat:@"起始时间:%@", spotCheck.create_time];
self.overDate.text = [NSString stringWithFormat:@"截止时间:%@", spotCheck.endDate];
self.alreadyLabel.text = [NSString stringWithFormat:@"%d", spotCheck.reportCount];
self.allLabel.text = [NSString stringWithFormat:@"/%d", spotCheck.storeCount];
self.allView.backgroundColor = kProgressViewAllBackColor;
if (spotCheck.reportCount == 0) {
self.multiplier = 0;
} else {
self.multiplier = (CGFloat)spotCheck.reportCount / spotCheck.storeCount;
}
if (self.multiplier > 1) {
self.multiplier = 1.0;
}
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image;
if ([_spotCheck.state isEqualToString:@"initial"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:未处理"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressUnSettledColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressUnSettledColor;
self.allLabel.textColor = kProgressUnSettledColor;
} else if ([_spotCheck.state isEqualToString:@"reported"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:已上报"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor;
} else if ([_spotCheck.state isEqualToString:@"finished"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:已评分"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor;
} else {
}
}
#pragma mark - lazy Loading
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = kCellTitleColor;
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_titleLabel];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self.contentView addConstraint:titleLabelTop];
NSLayoutConstraint *titleLabelLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLabelLeft];
NSLayoutConstraint *titleLabelRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:titleLabelRight];
NSLayoutConstraint *titleLabelHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:titleLabelHeight];
}
return _titleLabel;
}
- (UILabel *)startDate
{
if (!_startDate) {
_startDate = [[UILabel alloc] init];
_startDate.translatesAutoresizingMaskIntoConstraints = NO;
_startDate.font = [UIFont systemFontOfSize:14.0];
[self.contentView addSubview:_startDate];
NSLayoutConstraint *startDateTop = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:startDateTop];
NSLayoutConstraint *startDateLeft = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:startDateLeft];
NSLayoutConstraint *startDateRight = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:startDateRight];
NSLayoutConstraint *startDateHeight = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:startDateHeight];
}
return _startDate;
}
- (UILabel *)overDate
{
if (!_overDate) {
_overDate = [[UILabel alloc] init];
_overDate.font = [UIFont systemFontOfSize:14.0];
_overDate.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_overDate];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_overDate attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.startDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_overDate attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_overDate attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_overDate attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
return _overDate;
}
- (UILabel *)progressLabel
{
if (!_progressLabel) {
_progressLabel = [[UILabel alloc] init];
_progressLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_progressLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.alreadyLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
return _progressLabel;
}
- (UILabel *)alreadyLabel
{
if (!_alreadyLabel) {
_alreadyLabel = [[UILabel alloc] init];
_alreadyLabel.textAlignment = NSTextAlignmentRight;
_alreadyLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_alreadyLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateWidth = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateWidth];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.allLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
return _alreadyLabel;
}
- (UILabel *)allLabel
{
if (!_allLabel) {
_allLabel = [[UILabel alloc] init];
_allLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_allLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateWidth = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:32];
[self.contentView addConstraint:overDateWidth];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-18];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
return _allLabel;
}
- (UIView *)allView
{
if (!_allView) {
_allView = [[UIView alloc] init];
_allView.translatesAutoresizingMaskIntoConstraints = NO;
_allView.layer.cornerRadius = 3;
_allView.layer.borderWidth = 1;
_allView.layer.masksToBounds = YES;
_allView.layer.borderColor = kUsernameBorderColor;
[self.contentView addSubview:_allView];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.allLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:overDateBottom];
}
return _allView;
}
- (UIImageView *)alreadyView
{
if (!_alreadyView) {
_alreadyView = [[UIImageView alloc] init];
_alreadyView.layer.cornerRadius = 3;
_alreadyView.layer.masksToBounds = YES;
_alreadyView.translatesAutoresizingMaskIntoConstraints = NO;
_alreadyView.tag = 9760001;
[self.allView addSubview:_alreadyView];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
[self.allView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:1];
[self.allView addConstraint:overDateLeft];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1];
[self.allView addConstraint:overDateBottom];
NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:_multiplier constant:-1];
[self.allView addConstraint:overDatewidth];
}
return _alreadyView;
}
@end
......@@ -18,7 +18,7 @@
#import <MJRefresh.h>
#import "NoDataView.h"
#import "InspectListCell.h"
#import "SpotCheckTableViewCell.h"
#import "SpotCheckModel.h"
#define kInspectListTableViewcellIndeterfor @"inspectListTableViewcellIndeterfor"
@interface SpotCheckOnLineViewController ()<UITableViewDelegate, UITableViewDataSource,ScreenTableDelegate, TaxisViewDelegate, InspectTableViewDelegate>
......@@ -442,7 +442,16 @@
[httpCilent getManageSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"管理层的抽查列表 response= %@", response);
NSLog(@"管理层的抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
SpotCheckModel *spot = [[SpotCheckModel alloc] init];
[spot setValuesForKeysWithDictionary:dict];
[tempArray addObject:spot];
}
_allSpotCheckList = tempArray;
if (_allSpotCheckList.count == 0) {
......@@ -468,6 +477,7 @@
[MBProgressHUD hideHUDForView:self.view animated:YES];
self.menuView.backgroundColor = kInspectSectionBackGroundColor;
[self closeGreenView];
}];
}
......@@ -577,9 +587,9 @@
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kInspectListTableViewcellIndeterfor];
SpotCheckTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kInspectListTableViewcellIndeterfor];
if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kInspectListTableViewcellIndeterfor];
cell = [[SpotCheckTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kInspectListTableViewcellIndeterfor];
}
cell.spotCheck = _allSpotCheckList[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
......@@ -617,7 +627,7 @@
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.tableFooterView = [[UIView alloc] init];
[_tableView registerClass:[InspectListCell class] forCellReuseIdentifier:kInspectListTableViewcellIndeterfor];
[_tableView registerClass:[SpotCheckTableViewCell class] forCellReuseIdentifier:kInspectListTableViewcellIndeterfor];
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 200.0;
[self.view addSubview:_tableView];
......
......@@ -8,7 +8,6 @@
#import <UIKit/UIKit.h>
@class TaskListModel;
@class SpotCheckModel;
@interface InspectListCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel; // 标题
......@@ -26,6 +25,5 @@
@property (nonatomic, strong) UIView *allView;
@property (nonatomic, strong) TaskListModel *taskList;
@property (nonatomic, strong) SpotCheckModel *spotCheck;
@end
......@@ -39,59 +39,6 @@
}
- (void)setSpotCheck:(SpotCheckModel *)spotCheck
{
_spotCheck = spotCheck;
self.titleLabel.text = [NSString stringWithFormat:@"%@", spotCheck.title];
self.startDate.text = [NSString stringWithFormat:@"起始时间:%@", spotCheck.create_time];
self.overDate.text = [NSString stringWithFormat:@"截止时间:%@", spotCheck.endDate];
self.address.text = [NSString stringWithFormat:@"巡检商场:%@", @"上海真北店"];
self.alreadyLabel.text = [NSString stringWithFormat:@"%d", spotCheck.reportCount];
self.allLabel.text = [NSString stringWithFormat:@"/%d", spotCheck.storeCount];
self.allView.backgroundColor = kProgressViewAllBackColor;
if (spotCheck.reportCount == 0) {
self.multiplier = 0;
} else {
self.multiplier = (CGFloat)spotCheck.reportCount / spotCheck.storeCount;
}
if (self.multiplier > 1) {
self.multiplier = 1.0;
}
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image;
if ([_spotCheck.state isEqualToString:@"initial"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:未处理"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressUnSettledColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressUnSettledColor;
self.allLabel.textColor = kProgressUnSettledColor;
} else if ([_spotCheck.state isEqualToString:@"reported"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:已上报"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor;
} else if ([_spotCheck.state isEqualToString:@"finished"]) {
NSString *str = [NSString stringWithFormat:@"巡检进度:已评分"];
NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)];
[strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressDealWithColor;
self.allLabel.textColor = kProgressDealWithColor;
} else {
}
}
- (void)setTaskList:(TaskListModel *)taskList
{
......
......@@ -15,7 +15,7 @@
@property (nonatomic, assign) int attachmentNumber;
@property (nonatomic, copy) NSString *category;
@property (nonatomic, copy) NSString *lineNo;
@property (nonatomic, copy) NSString *readonly;
@property (nonatomic) BOOL readonly;
@property (nonatomic, copy) NSString *reference;
@property (nonatomic, strong) NSArray *referenceAttachments;
@property (nonatomic, copy) NSString *remark;
......
......@@ -253,7 +253,7 @@
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
if ([permissions containsObject:@"500103"]) {
if ([task.readonly isEqualToString:@"1"]) {
if (task.readonly) {
InspectUploadedViewController *inspectVC = [[InspectUploadedViewController alloc] init];
inspectVC.questionCount = taskGroup.questionCount;
inspectVC.taskModel = task;
......
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