Commit 80095dde authored by 曹云霄's avatar 曹云霄

密码修改完成,修复工单模块部分字段为空,优化刷新机制,优化悬浮框

parent 18f8fd9c
......@@ -11,6 +11,15 @@
295064B7200C9E50008DC8DD /* AttachmentReponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295064B6200C9E4F008DC8DD /* AttachmentReponseModel.swift */; };
295064B9200CAA6B008DC8DD /* AttachmentResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295064B8200CAA6B008DC8DD /* AttachmentResultModel.swift */; };
295064BB200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 295064BA200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift */; };
29516A86200D8EE400C3A17E /* ChildBillDetailResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29516A85200D8EE400C3A17E /* ChildBillDetailResultModel.swift */; };
29516A89200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29516A87200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.swift */; };
29516A8A200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29516A88200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.xib */; };
29516A8D200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29516A8B200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.swift */; };
29516A8E200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29516A8C200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.xib */; };
29516A91200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29516A8F200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.swift */; };
29516A92200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29516A90200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.xib */; };
29516A94200E3A9900C3A17E /* UpdateVersionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29516A93200E3A9900C3A17E /* UpdateVersionModel.swift */; };
29516A97200EE05900C3A17E /* NSString+Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = 29516A96200EE05900C3A17E /* NSString+Helper.m */; };
296968062007142B0049B5CC /* PublicFilterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 296968052007142B0049B5CC /* PublicFilterModel.swift */; };
29696808200728F50049B5CC /* EmptyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29696807200728F50049B5CC /* EmptyModel.swift */; };
296AAC5A1FFCB2A4008BE04C /* BaseTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 296AAC591FFCB2A4008BE04C /* BaseTableViewController.swift */; };
......@@ -128,6 +137,16 @@
295064B6200C9E4F008DC8DD /* AttachmentReponseModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentReponseModel.swift; sourceTree = "<group>"; };
295064B8200CAA6B008DC8DD /* AttachmentResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentResultModel.swift; sourceTree = "<group>"; };
295064BA200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChildBillSaveOrUpdateModel.swift; sourceTree = "<group>"; };
29516A85200D8EE400C3A17E /* ChildBillDetailResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChildBillDetailResultModel.swift; sourceTree = "<group>"; };
29516A87200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaintainBeforAttachmentTableViewCell.swift; sourceTree = "<group>"; };
29516A88200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MaintainBeforAttachmentTableViewCell.xib; sourceTree = "<group>"; };
29516A8B200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MaintainAfterAttachmentTableViewCell.swift; sourceTree = "<group>"; };
29516A8C200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MaintainAfterAttachmentTableViewCell.xib; sourceTree = "<group>"; };
29516A8F200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepairOrderAttachmentTableViewCell.swift; sourceTree = "<group>"; };
29516A90200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RepairOrderAttachmentTableViewCell.xib; sourceTree = "<group>"; };
29516A93200E3A9900C3A17E /* UpdateVersionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateVersionModel.swift; sourceTree = "<group>"; };
29516A95200EE05900C3A17E /* NSString+Helper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSString+Helper.h"; sourceTree = "<group>"; };
29516A96200EE05900C3A17E /* NSString+Helper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSString+Helper.m"; sourceTree = "<group>"; };
296968052007142B0049B5CC /* PublicFilterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublicFilterModel.swift; sourceTree = "<group>"; };
29696807200728F50049B5CC /* EmptyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyModel.swift; sourceTree = "<group>"; };
296AAC591FFCB2A4008BE04C /* BaseTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewController.swift; sourceTree = "<group>"; };
......@@ -432,6 +451,7 @@
29D530731FFF626500851F00 /* Model */ = {
isa = PBXGroup;
children = (
29516A85200D8EE400C3A17E /* ChildBillDetailResultModel.swift */,
295064BA200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift */,
295064B8200CAA6B008DC8DD /* AttachmentResultModel.swift */,
295064B6200C9E4F008DC8DD /* AttachmentReponseModel.swift */,
......@@ -466,6 +486,12 @@
29DA417520035B3C002762A2 /* RepairBeforAttachmentTableViewCell.swift */,
29DA4179200367EF002762A2 /* RepairOrderEditSonOrderCompleteView.swift */,
29DA417B200367F5002762A2 /* RepairOrderEditSonOrderCompleteView.xib */,
29516A87200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.swift */,
29516A88200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.xib */,
29516A8B200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.swift */,
29516A8C200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.xib */,
29516A8F200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.swift */,
29516A90200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.xib */,
);
path = View;
sourceTree = "<group>";
......@@ -643,6 +669,7 @@
isa = PBXGroup;
children = (
29DA418120045AC2002762A2 /* QueryTodoModel.swift */,
29516A93200E3A9900C3A17E /* UpdateVersionModel.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -805,6 +832,8 @@
29EA0BDC1FEA3156005A6170 /* UIImage+Category.m */,
29DA4187200472A1002762A2 /* UIDevice+Helper.h */,
29DA4188200472A1002762A2 /* UIDevice+Helper.m */,
29516A95200EE05900C3A17E /* NSString+Helper.h */,
29516A96200EE05900C3A17E /* NSString+Helper.m */,
);
path = Category;
sourceTree = "<group>";
......@@ -959,7 +988,10 @@
296FE4401FFB2D3400810820 /* Function.storyboard in Resources */,
29B0C66C1FEA3A7000FF37ED /* LaunchScreen.storyboard in Resources */,
296FE4581FFB7CED00810820 /* function.plist in Resources */,
29516A92200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.xib in Resources */,
29516A8A200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.xib in Resources */,
29DA41642003137E002762A2 /* RepairOrderDetailBottomView.xib in Resources */,
29516A8E200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.xib in Resources */,
29DA416A200334BC002762A2 /* RepairOrderSubOrderTableViewCell.xib in Resources */,
296FE43E1FFB2D2700810820 /* Home.storyboard in Resources */,
29EA0C191FEA3156005A6170 /* EmptyTableViewCell.xib in Resources */,
......@@ -992,6 +1024,8 @@
"${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework",
"${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework",
"${BUILT_PRODUCTS_DIR}/Moya/Moya.framework",
"${BUILT_PRODUCTS_DIR}/ObservableArray-RxSwift/ObservableArray_RxSwift.framework",
"${BUILT_PRODUCTS_DIR}/PPBadgeViewSwift/PPBadgeViewSwift.framework",
"${BUILT_PRODUCTS_DIR}/Result/Result.framework",
"${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework",
"${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework",
......@@ -1016,6 +1050,8 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MBProgressHUD.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Moya.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObservableArray_RxSwift.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PPBadgeViewSwift.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework",
......@@ -1071,6 +1107,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
29516A86200D8EE400C3A17E /* ChildBillDetailResultModel.swift in Sources */,
295064BB200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift in Sources */,
29DA417420035B28002762A2 /* RepairAfterAttachmentTableViewCell.swift in Sources */,
29EA0C031FEA3156005A6170 /* BaseNavigationController.swift in Sources */,
......@@ -1096,6 +1133,7 @@
29B0C66A1FEA382F00FF37ED /* MBProgressView.swift in Sources */,
296DAD7E2006FBEB00615A2D /* RepairOrderAddViewModel.swift in Sources */,
29EA0C0B1FEA3156005A6170 /* Public.swift in Sources */,
29516A91200DEE9500C3A17E /* RepairOrderAttachmentTableViewCell.swift in Sources */,
296AAC9F1FFDF54A008BE04C /* FilterTableViewCell.swift in Sources */,
29DA416C2003419A002762A2 /* RepairOrderDetailSuspendView.swift in Sources */,
29F6B8EE2007498A00EE4630 /* DeviceQueryModel.swift in Sources */,
......@@ -1112,6 +1150,7 @@
29DA4169200334BC002762A2 /* RepairOrderSubOrderTableViewCell.swift in Sources */,
29F6B8F62007747900EE4630 /* RepairOrderResultModel.swift in Sources */,
29F6B90A200C54CD00EE4630 /* RepairOrderCompletedViewController.swift in Sources */,
29516A89200DEC4400C3A17E /* MaintainBeforAttachmentTableViewCell.swift in Sources */,
29DA418B200475AC002762A2 /* AccountViewModel.swift in Sources */,
296DAD82200711CA00615A2D /* InitiatorModel.swift in Sources */,
29EA0C011FEA3156005A6170 /* BaseColletionViewPullController.swift in Sources */,
......@@ -1145,10 +1184,12 @@
29EA0C131FEA3156005A6170 /* UIView+Extension.swift in Sources */,
29D5308A1FFF635C00851F00 /* TodoViewModel.swift in Sources */,
296AAC5A1FFCB2A4008BE04C /* BaseTableViewController.swift in Sources */,
29516A94200E3A9900C3A17E /* UpdateVersionModel.swift in Sources */,
29EA0C001FEA3156005A6170 /* UserModel.swift in Sources */,
29EA0C0A1FEA3156005A6170 /* Notification.swift in Sources */,
29D5307C1FFF626500851F00 /* FunctionCollectionReusableView.swift in Sources */,
29F6B8F8200879DC00EE4630 /* UIButton+Extension.swift in Sources */,
29516A8D200DEC5A00C3A17E /* MaintainAfterAttachmentTableViewCell.swift in Sources */,
296FE4441FFB393C00810820 /* AccountTableViewController.swift in Sources */,
29DA418220045AC3002762A2 /* QueryTodoModel.swift in Sources */,
296AAC9D1FFDF533008BE04C /* FilterViewController.swift in Sources */,
......@@ -1159,6 +1200,7 @@
29F6B8EC2007488C00EE4630 /* DeviceModel.swift in Sources */,
29EA0C161FEA3156005A6170 /* Network.swift in Sources */,
29EA0C041FEA3156005A6170 /* BaseTableViewPullController.swift in Sources */,
29516A97200EE05900C3A17E /* NSString+Helper.m in Sources */,
296FE43C1FFB2D1D00810820 /* HomeViewController.swift in Sources */,
29F6B8FA200884F900EE4630 /* PublicModel.swift in Sources */,
29F6B9022008A85200EE4630 /* DepartmentQueryModel.swift in Sources */,
......
......@@ -17,4 +17,29 @@ class BaseTableViewController: UITableViewController {
}
automaticallyAdjustsScrollViewInsets = false
}
// MARK: - 生成随机字符串
open func randomMD5() -> String {
let identifier = CFUUIDCreate(nil)
let identifierString = CFUUIDCreateString(nil, identifier) as String
let cStr = identifierString.cString(using: .utf8)
var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
CC_MD5(cStr, CC_LONG(strlen(cStr)), &digest)
var output = String()
for i in digest {
output = output.appendingFormat("%02X", i)
}
return output;
}
// MARK: - 保存图片附件至沙盒
open func saveImage(currentImage: UIImage, persent: CGFloat, imageName: String) ->String {
if let imageData = UIImageJPEGRepresentation(currentImage, persent) as NSData? {
let fullPath = NSHomeDirectory().appending("/Documents/Files").appending(imageName)
imageData.write(toFile: fullPath, atomically: true)
return fullPath
}
return ""
}
}
......@@ -7,7 +7,37 @@
//
import UIKit
import RxCocoa
import RxSwift
class BaseViewModel: NSObject {
class BaseViewModel: NSObject {
// MARK: - 检查版本更新
func updateVersion() ->Observable<(Bool,String,String)> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .UpdateVersion(), success: { (json) in
let resultModel = UpdateVersionModel.deserialize(from: json.dictionaryObject)
guard resultModel?.data != nil else {
ShowMessage("数据异常")
return
}
if resultModel!.success {
let index = NSString.compareVersion(UIDevice.appVersion(), string: resultModel?.data.version)
if index == -1 {
if resultModel?.data.forceUpdate == 1 {
observer.onNext((true, resultModel!.data.url,resultModel!.data.version))
}else {
observer.onNext((false, resultModel!.data.url,resultModel!.data.version))
}
}
}else {
ShowMessage(resultModel!.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
}
//
// NSString+Helper.h
// IFS
//
// Created by 曹云霄 on 2018/1/17.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NSString (Helper)
/**
* 比较版本号
*
* @param string1 第一个版本号
* @param string2 第二个版本号
*
* @return 如果版本号相等,返回 0,
* 如果第一个版本号低于第二个,返回 -1,否则返回 1.
*/
+ (NSInteger)compareVersion:(NSString *)string1 string:(NSString *)string2;
@end
//
// NSString+Helper.m
// IFS
//
// Created by 曹云霄 on 2018/1/17.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
#import "NSString+Helper.h"
@implementation NSString (Helper)
/**
* 比较版本号
*
* @param string1 第一个版本号
* @param string2 第二个版本号
*
* @return 如果版本号相等,返回 0,
* 如果第一个版本号低于第二个,返回 -1,否则返回 1.
*/
+ (NSInteger)compareVersion:(NSString *)string1 string:(NSString *)string2
{
int result = compareVersion([string1 UTF8String], [string2 UTF8String]);
switch (result) {
case 0:
return 0;
case -1:
return -1;
case 1:
return 1;
default:
break;
}
return NO;
}
/**
* 比较版本号
*
* @param v1 第一个版本号
* @param v2 第二个版本号
*
* @return 如果版本号相等,返回 0,
* 如果第一个版本号低于第二个,返回 -1,否则返回 1.
*/
int compareVersion(const char *v1, const char *v2)
{
assert(v1);
assert(v2);
const char *p_v1 = v1;
const char *p_v2 = v2;
while (*p_v1 && *p_v2) {
char buf_v1[32] = {0};
char buf_v2[32] = {0};
char *i_v1 = strchr(p_v1, '.');
char *i_v2 = strchr(p_v2, '.');
if (!i_v1 || !i_v2) break;
if (i_v1 != p_v1) {
strncpy(buf_v1, p_v1, i_v1 - p_v1);
p_v1 = i_v1;
}
else
p_v1++;
if (i_v2 != p_v2) {
strncpy(buf_v2, p_v2, i_v2 - p_v2);
p_v2 = i_v2;
}
else
p_v2++;
int order = atoi(buf_v1) - atoi(buf_v2);
if (order != 0)
return order < 0 ? -1 : 1;
}
double res = atof(p_v1) - atof(p_v2);
if (res < 0) return -1;
if (res > 0) return 1;
return 0;
}
@end
......@@ -55,6 +55,19 @@ public enum REPAIR_ORDER_SECTION: Int {
}
/// 子工单详情界面分区
///
/// - STATE: 工单状态
/// - SOURCE: 工单来源
/// - COST: 费用
/// - DESCRIBE: 描述
public enum CHILD_BILL_DETAIL_SECTION: Int {
case STATE = 0
case SOURCE
case COST
case DESCRIBE
}
/// 工单详情界面分区
///
/// - STATE: 工单状态
......@@ -200,6 +213,16 @@ public enum FILTER_TYPE: Int {
case MULTIPLE
}
/// 工单详情悬浮框按钮
///
/// - GET: 领取
/// - COMPLETED: 完成
public enum SUSPEND_BUTTON_TYPE: String {
case GET = "领单"
case COMPLETED = "完成"
}
......
......@@ -7,3 +7,9 @@
//
import Foundation
/// 更新工单列表数据
public let UPDATE_BILL_LIST: String = "UPDATE_BILL_LIST"
/// 更新工单列表数据
public let UPDATE_BILL_DETAIL_LIST: String = "UPDATE_BILL_DETAIL_LIST"
......@@ -16,10 +16,9 @@ public let kMainColor: UIColor = UIColor.RGB(67, g: 132, b: 196)
public let kBlueColor: UIColor = UIColor.RGB(77, g: 131, b: 242)
public let kGaryColor: UIColor = UIColor.RGB(240, g: 240, b: 240)
public let kLightGaryColor: UIColor = UIColor.RGB(170, g: 170, b: 170)
public let kYellowColor: UIColor = UIColor.RGB(253, g: 156, b: 79)
public let kBlackColor: UIColor = UIColor.black
// MARK: - 全局常用属性
public let kNavHeight: CGFloat = 64
public let kCellHeight: CGFloat = 44
......@@ -31,17 +30,24 @@ public let kPageSize: Int = 15
public let kSectionZero: CGFloat = 0.01
public let kSectionTen: CGFloat = 10
public let kEmptyHeight: CGFloat = 108
public let kAnimationTime: TimeInterval = 0.3
public let kWidth: CGFloat = UIScreen.main.bounds.size.width
public let kHeight: CGFloat = UIScreen.main.bounds.size.height
public let kWindow: UIWindow = ((UIApplication.shared.delegate?.window)!)!
/// 用户信息
public func kUser() -> UserModel {
return AppManager.shareInstance.userModel!
}
/// 工单状态回调
public typealias BillStateBlock = (String) ->Void
/// 悬浮框透明度回调
public typealias SuspendViewAlphaBlock = (CGFloat) ->Void
/// 悬浮框状态回调
public typealias SuspendViewStateBlock = (BillDetailExecute,IndexPath,String) ->Void
/// 图片加载占位图
public let loadingImage: UIImage = UIImage(named: "loading")!
......
......@@ -10,15 +10,23 @@ import Foundation
/// BaseUrl
//public let BaseUrl: String = "http://192.168.1.176:9030/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://192.168.1.176:9030"
public let BaseUrl: String = "http://192.168.1.176:9030/ifs-server/rest"
public let BaseAttachmentUrl: String = "http://192.168.1.176:9030"
public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
public let BaseAttachmentUrl: String = "http://dev.gomoretech.com"
//测试环境
//public let BaseUrl: String = "http://222.180.250.18:7080/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://222.180.250.18:7080"
//外网开发环境
//public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://dev.gomoretech.com"
/// 登录
public let loginUrl: String = "/user/login/%@"
/// 更新版本
public let updateUrl = "/ipapk?type=ipa";
/// 修改密码
public let changePassword = "/user/change_password/%@?time=%@&operId=%@&operName=%@";
/// 待办事项
public let todoUrl: String = "/todo/workExecute/query"
/// 新建工单来源
......@@ -39,6 +47,8 @@ public let saveRepairOrderUrl: String = "/work/saveOrUpdate"
public let repairOrderUrl: String = "/work/query"
/// 工单详情get
public let getBillDetailUrl: String = "/work/get/%@"
/// 子单详情get
public let getChildBillDetailUrl: String = "/work/getWorkExecute/%@"
/// 工单详情转交部门
public let organizationUrl : String = "/organization/query"
/// 工单详情转交
......@@ -62,7 +72,9 @@ public let attachmentUrl: String = "\(BaseAttachmentUrl)/ifs-web/attachment/down
/// 子工单领单
public let drawExecute: String = "/work/drawExecute/%@"
/// 子工单保存及提交
public let saveExecute: String = "/work/saveExecute/%@"
public let saveExecute: String = "/work/saveExecute"
/// 子工单完成
public let finishExecute: String = "/work/finishExecute"
......
......@@ -8,33 +8,10 @@
import UIKit
extension NSString {
/*
#pragma mark - 获取当前时间之前或者之后的时间(之前传入负数)
+ (NSString *)getTimeby:(NSInteger)day
{
NSDate *nowDate = [NSDate date];
NSDate *theDate;
if(day!=0){
NSTimeInterval oneDay = 24*60*60*1; //1天的长度
theDate = [nowDate initWithTimeIntervalSinceNow: oneDay*day];
}else{
theDate = nowDate;
}
NSDateFormatter *date_formatter = [[NSDateFormatter alloc] init];
[date_formatter setDateFormat:@"yyyy-MM-dd"];
NSString *the_date_str = [date_formatter stringFromDate:theDate];
return the_date_str;
}
*/
extension String {
// 计算字符串的宽度,高度
open func calculateStringSize(_ size: CGSize,font: UIFont) ->CGSize {
public func calculateStringSize(_ size: CGSize,font: UIFont) ->CGSize {
let attributes = [NSAttributedStringKey.font:font]
let option = NSStringDrawingOptions.usesLineFragmentOrigin
let rect:CGRect = self.boundingRect(with:CGSize(width: kWidth, height: kHeight) , options: option, attributes: attributes, context: nil)
......@@ -42,62 +19,10 @@ extension NSString {
}
// 去掉字符串前后空格
open func formatString() -> String {
public func formatString() -> String {
let set = NSCharacterSet.whitespacesAndNewlines
return self.trimmingCharacters(in: set)
}
// MARK: - 富文本设置颜色
open func attributeString(_ colorString: String,_ color: UIColor) ->NSMutableAttributedString {
let range = self.range(of: colorString)
//富文本设置
let attributeString = NSMutableAttributedString(string:self as String)
//设置字体颜色
attributeString.addAttribute(NSAttributedStringKey.foregroundColor, value: color,range: range)
return attributeString
}
// MARK: - 带¥符号字符串
open func priceString() -> String {
return String(format: "¥%.2f", self.floatValue)
}
// MARK: - 获取路径文件大小
open func getFileSize() -> UInt64 {
var size: UInt64 = 0
let fileManager = FileManager.default
var isDir: ObjCBool = false
let isExists = fileManager.fileExists(atPath: self as String, isDirectory: &isDir)
// 判断文件存在
if isExists {
// 是否为文件夹
if isDir.boolValue {
// 迭代器 存放文件夹下的所有文件名
let enumerator = fileManager.enumerator(atPath: self as String)
for subPath in enumerator! {
// 获得全路径
let fullPath = self.appending("/\(subPath)")
do {
let attr = try fileManager.attributesOfItem(atPath: fullPath)
size += attr[FileAttributeKey.size] as! UInt64
} catch {
print("error :\(error)")
}
}
} else { // 单文件
do {
let attr = try fileManager.attributesOfItem(atPath: self as String)
size += attr[FileAttributeKey.size] as! UInt64
} catch {
print("error :\(error)")
}
}
}
return size
}
}
......
......@@ -76,6 +76,7 @@ struct Network {
do {
guard response.statusCode == 200 else {
print(response)
failure(MoyaError.statusCode(response))
return
}
......
......@@ -34,6 +34,8 @@ public enum Service {
case QueryRepairOrder(RepairOrderQueryModel)
// MARK: - 查询工单详情
case GetRepairOrderDetail(String)
// MARK: - 查询子单详情
case GetChildBillDetail(String)
// MARK: - 查询工单详情转交部门
case GetRepairOrderDepartment()
// MARK: - 工单详情转交
......@@ -57,7 +59,13 @@ public enum Service {
// MARK: - 子工单工单uuid
case GetChildBill(String)
// MARK: - 保存及更新子工单
case SaveChildBill(ChildBillSaveOrUpdateModel)
case SaveChildBill(ChildBillDetailData)
// MARK: - 完成子工单
case FinishChildBill(ChildBillDetailData)
// MARK: - 检查版本更新
case UpdateVersion()
// MARK: - 修改密码
case ChangePassword(String)
}
extension Service: TargetType {
......@@ -102,6 +110,9 @@ extension Service: TargetType {
case .SaveChildBill(_):
let path = saveExecute + "?operator.operId=\(kUser().userCode!)&operator.operName=\(kUser().userName!)&time=\(NSDate().httpParameterString()!)"
return path.urlEncoded()
case .FinishChildBill(_):
let path = finishExecute + "?operator.operId=\(kUser().userCode!)&operator.operName=\(kUser().userName!)&time=\(NSDate().httpParameterString()!)"
return path.urlEncoded()
case .QueryToolOption:
return toolOptionUrl
case .QueryProtectOption:
......@@ -116,6 +127,13 @@ extension Service: TargetType {
return String(format: uploadAttachmentUrl, model.entityType,model.entityUuid)
case .DownloadAttachment(let entity_type, let entity_uuid):
return String(format: downloadAttachmentUrl, entity_type,entity_uuid)
case .GetChildBillDetail(let uuid):
return String(format: getChildBillDetailUrl, uuid)
case .UpdateVersion():
return updateUrl
case .ChangePassword(_):
let path = String(format: changePassword, kUser().userUuid,NSDate().httpParameterString(),kUser().userCode,kUser().userName)
return path.urlEncoded()
}
}
......@@ -131,6 +149,9 @@ extension Service: TargetType {
.TransferOrder(_),
.CompleteOrder(_),
.UploadAttachment(_),
.SaveChildBill(_),
.ChangePassword(_),
.FinishChildBill(_),
.QueryInitiator(_):
return .post
case .QuerySource(),
......@@ -141,8 +162,9 @@ extension Service: TargetType {
.QuerybrokenOption(),
.QueryprocessMethods(),
.DownloadAttachment(_, _),
.SaveChildBill(_),
.GetChildBill(_),
.GetChildBillDetail(_),
.UpdateVersion(),
.QueryPrority():
return .get
}
......@@ -158,6 +180,12 @@ extension Service: TargetType {
return .requestParameters(parameters: ["password": password,
"authenticode": "211534962"],
encoding: JSONEncoding.default)
case .ChangePassword(let password):
let oldPassword = NSString(string: kUser().password)
let newPassword = NSString(string: password)
return .requestParameters(parameters: ["newPassword": newPassword.md5(),
"oldPassword": oldPassword.md5()],
encoding: JSONEncoding.default)
case .QueryTodo(let model):
return .requestParameters(parameters: model.toDictionary(),
encoding: JSONEncoding.default)
......@@ -168,7 +196,9 @@ extension Service: TargetType {
.QueryProtectOption(),
.QuerybrokenOption(),
.QueryprocessMethods(),
.GetChildBillDetail(_),
.DownloadAttachment(_,_),
.UpdateVersion(),
.GetChildBill(_),
.QueryPrority():
return .requestPlain
......@@ -197,8 +227,9 @@ extension Service: TargetType {
let data = MultipartFormData(provider: .file(URL(fileURLWithPath: attachmentModel.fileUrl)), name: "file", fileName: attachmentModel.fileName, mimeType: "image/jpeg")
return .uploadMultipart([data])
case .SaveChildBill(let model):
return .requestParameters(parameters: model.toDictionary(),
encoding: JSONEncoding.default)
return .requestParameters(parameters: model.toDictionary(), encoding: JSONEncoding.default)
case .FinishChildBill(let model):
return .requestParameters(parameters: model.toDictionary(), encoding: JSONEncoding.default)
}
}
......
......@@ -9,7 +9,9 @@
import UIKit
import ImagePicker
import SKPhotoBrowser
import RxCocoa
import RxSwift
import SnapKit
/// 更新高度后回调
......@@ -19,6 +21,9 @@ protocol PhotoAttachmentDelegate {
class PhotoAttachmentViewController: BaseViewController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 更新图片附件
var delegate: PhotoAttachmentDelegate?
......@@ -28,6 +33,8 @@ class PhotoAttachmentViewController: BaseViewController {
return attachmentViewModel
}()
/// item 尺寸
var size: CGSize?
/// key
var key: String?
/// 间隔
......@@ -56,9 +63,13 @@ class PhotoAttachmentViewController: BaseViewController {
/// 设置item Size
open func setItemSize(_ size: CGSize, _ count: Int) {
self.collectionViewFlowLayout.itemSize = size
self.size = size
self.imageHeight = size.height
self.COUNT = count
if let collectionViewFlowLayout = collectionViewFlowLayout {
collectionViewFlowLayout.itemSize = size
photoAttachmentCollectionView.reloadData()
}
}
// MARK: - 设置图片附件
......@@ -66,7 +77,11 @@ class PhotoAttachmentViewController: BaseViewController {
collectionViewFlowLayout.minimumLineSpacing = CGFloat(SPACE)
collectionViewFlowLayout.minimumInteritemSpacing = CGFloat(SPACE)
collectionViewFlowLayout.sectionInset = UIEdgeInsetsMake(CGFloat(SPACE), CGFloat(SPACE), CGFloat(SPACE), CGFloat(SPACE))
collectionViewFlowLayout.itemSize = CGSize(width: imageHeight * 4 / 3, height: imageHeight)
if let size = size {
collectionViewFlowLayout.itemSize = size
}else {
collectionViewFlowLayout.itemSize = CGSize(width: imageHeight * 4 / 3, height: imageHeight)
}
}
// MARK: - 计算图片附件所需高度
......
......@@ -44,7 +44,7 @@ class PhotoAttachmentCollectionViewCell: UICollectionViewCell {
deleteBtn.isHidden = true
break
case .ATTACHMENT_HTTP:
attachmentImg.kf.setImage(with: URL(string: model.attachment as! String))
attachmentImg.kf.setImage(with: URL(string: model.attachment as! String), placeholder: loadingImage)
attachmentImg.contentMode = .scaleAspectFill
deleteBtn.isHidden = true
break
......
......@@ -31,7 +31,7 @@ class AboutUsTableViewController: BaseTableViewController {
view.layoutIfNeeded()
appIconBgView.seth(h: kWidth * 9 / 16)
appVersionLab.text = UIDevice.version()
// appIconImg.image = UIDevice.appIcon()
appIconImg.image = UIDevice.appIcon()
appMobileLab.text = "15121161964"
}
}
......
......@@ -8,15 +8,25 @@
import UIKit
import Kingfisher
import RxSwift
import PPBadgeViewSwift
class AccountTableViewController: BaseTableViewController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 用户头像
@IBOutlet weak var userHeaderImg: UIImageView!
/// 用户名
@IBOutlet weak var userNameLab: UILabel!
/// 检查版本更新
@IBOutlet weak var checkVersionLabel: UILabel!
/// 账户背景
@IBOutlet weak var accountBgView: UIView!
/// 版本更新
var updateVerison: String?
/// 账户VieWModel
lazy final var accountViewModel: AccountViewModel = {
var accountViewModel = AccountViewModel()
......@@ -27,6 +37,7 @@ class AccountTableViewController: BaseTableViewController {
super.viewDidLoad()
uiConfigAction()
dataAction()
updateVersion()
}
// MARK: - 状态栏风格
......@@ -44,8 +55,23 @@ class AccountTableViewController: BaseTableViewController {
// MARK: - 填充数据
fileprivate func dataAction() {
userNameLab.text = "曹云霄"
userHeaderImg.kf.setImage(with: URL(string: "https://upload.jianshu.io/users/upload_avatars/1603648/59f165f01901.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240"))
userNameLab.text = kUser().userName
userHeaderImg.image = UIDevice.appIcon()
}
// MARK: - 检查版本更新
fileprivate func updateVersion() {
let viewModel = BaseViewModel()
viewModel.updateVersion().subscribe(onNext: {[weak self] (result) in
self?.updateVerison = result.1
if result.0 {
ShowAlertView(hint, String(format: "检测到有新版本<%@>需要更新", result.2), ["我知道了"], UIAlertControllerStyle.alert, { (index) in
UIApplication.shared.openURL(URL(string: result.1)!)
})
}else {
self?.checkVersionLabel.pp.addBadge(text: "新版本")
}
}).disposed(by: disposeBag)
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
......@@ -58,9 +84,22 @@ class AccountTableViewController: BaseTableViewController {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.section == kONE && indexPath.row == kZERO {
switch indexPath {
case IndexPath(row: 2, section: 0):
guard updateVerison != nil else {
ShowMessage("暂无更新")
return
}
UIApplication.shared.openURL(URL(string: updateVerison!)!)
break
case IndexPath(row: 0, section: 1):
accountViewModel.loginOutAction()
break
default:
break
}
}
}
......
......@@ -12,7 +12,6 @@ import RxSwift
class ChangePasswordTableViewController: BaseTableViewController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 旧密码
......@@ -23,7 +22,11 @@ class ChangePasswordTableViewController: BaseTableViewController {
@IBOutlet weak var new2PasswordText: UITextField!
/// 确认新密码
@IBOutlet weak var affirmButton: UIButton!
/// 账户VieWModel
lazy final var accountViewModel: AccountViewModel = {
var accountViewModel = AccountViewModel()
return accountViewModel;
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -67,7 +70,14 @@ class ChangePasswordTableViewController: BaseTableViewController {
// MARK: - 确认新密码
@IBAction func affirmButtonClickAction(_ sender: UIButton) {
if new2PasswordText.text != newPasswordText.text {
ShowMessage("请确认两次密码是否相同")
return
}
accountViewModel.changePasswordAction(new2PasswordText.text!).subscribe(onNext: {[weak self] () in
ShowMessage("密码修改成功")
self?.popVC()
}).disposed(by: disposeBag)
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
......
......@@ -7,20 +7,61 @@
//
import UIKit
import RxSwift
import RxCocoa
class AccountViewModel: BaseViewModel {
}
extension AccountViewModel {
// MARK: - 退出登录
func loginOutAction() {
// ShowAlertView("提示", "请确认是否退出登录?", ["取消","确认"], .alert) { (index) in
// if index == kZERO { return }
// do {
// try FileManager.default.removeItem(atPath: accountPath)
// }catch {
// ShowMessage("删除用户信息失败")
// }
// AppManager.shareInstance.openLoginVc()
// }
ShowAlertView("提示", "请确认是否退出登录?", ["取消","确认"], .alert) { (index) in
if index == kZERO { return }
do {
try FileManager.default.removeItem(atPath: accountPath)
}catch {
ShowMessage("删除用户信息失败")
}
AppManager.shareInstance.openLoginVc()
}
}
// MARK: - 修改密码
func changePasswordAction(_ newPassword: String) ->Observable<Void> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .ChangePassword(newPassword), success: { (json) in
let resultModel = PublicResultModel(fromJson: json)
if resultModel.success {
kUser().password = newPassword
observer.onNext(())
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
}
......@@ -74,21 +74,11 @@ class RepairOrderAddTableViewController: BaseTableViewController {
// MARK: - UI
fileprivate func uiConfigAction() {
describeTextView.placeholder = "工单描述"
tableView.register(UINib(nibName: RepairAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairAttachmentTableViewCell.name())
describeTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0)
tableView.register(UINib(nibName: RepairAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairAttachmentTableViewCell.name())
navigationItem.rightBarButtonItem = createButtonItem("提交", nil, self, #selector(RepairOrderAddTableViewController.submitButtonClickAction))
}
// MARK: - 保存图片附件至沙盒
fileprivate func saveImage(currentImage: UIImage, persent: CGFloat, imageName: String) ->String {
if let imageData = UIImageJPEGRepresentation(currentImage, persent) as NSData? {
let fullPath = NSHomeDirectory().appending("/Documents/Files").appending(imageName)
imageData.write(toFile: fullPath, atomically: true)
return fullPath
}
return ""
}
// MARK: - 提交工单
@objc fileprivate func submitButtonClickAction() {
var fileUrlArray = Array<String>()
......@@ -110,6 +100,7 @@ class RepairOrderAddTableViewController: BaseTableViewController {
self?.repairOrderAddViewModel.saveOrderModel.attachmentId = entityUuid
self?.repairOrderAddViewModel.submitRepairOrder().subscribe(onNext: {[weak self] (result) in
ShowMessage("提交成功")
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_LIST)))
self?.popVC()
}).disposed(by: self!.disposeBag)
}
......@@ -123,20 +114,6 @@ class RepairOrderAddTableViewController: BaseTableViewController {
}
}
// MARK: - 生成随机字符串
fileprivate func randomMD5() -> String {
let identifier = CFUUIDCreate(nil)
let identifierString = CFUUIDCreateString(nil, identifier) as String
let cStr = identifierString.cString(using: .utf8)
var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
CC_MD5(cStr, CC_LONG(strlen(cStr)), &digest)
var output = String()
for i in digest {
output = output.appendingFormat("%02X", i)
}
return output;
}
// MARK: - 设置附件VC
fileprivate func setupPhotoAttachmentVc(){
addChildViewController(attachmentVc)
......@@ -153,6 +130,10 @@ class RepairOrderAddTableViewController: BaseTableViewController {
describeTextView.rx.text.subscribe(onNext: {[weak self] (string) in
self?.repairOrderAddViewModel.saveOrderModel.descriptionField = string
}).disposed(by: disposeBag)
phoneNumberText.rx.text.subscribe(onNext: {[weak self] (string) in
self?.repairOrderAddViewModel.saveOrderModel.reporterPhone = string
}).disposed(by: disposeBag)
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......
......@@ -7,15 +7,196 @@
//
import UIKit
import RxSwift
import RxCocoa
class RepairOrderChildBillDetailViewController: BaseTableViewController {
/// 已发出状态
@IBOutlet weak var createdStateImg: UIImageView!
@IBOutlet weak var createStateLab: UILabel!
/// 处理中状态
@IBOutlet weak var processedStateImg: UIImageView!
@IBOutlet weak var processedStateLab: UILabel!
/// 已完成状态
@IBOutlet weak var completedStateImg: UIImageView!
@IBOutlet weak var completedStateLab: UILabel!
/// 领单人
@IBOutlet weak var operatorNameLabel: UILabel!
/// 单号
@IBOutlet weak var billNumberLab: UILabel!
/// 领单时间
@IBOutlet weak var billNumberTimeLabel: UILabel!
/// 备份工具
@IBOutlet weak var backupsToolLabel: UILabel!
/// 安全防护
@IBOutlet weak var safetyProtectionLabel: UILabel!
/// 出工人
@IBOutlet weak var workPersonLabel: UILabel!
/// 到位时间
@IBOutlet weak var placeTimeLabel: UILabel!
/// 离开时间
@IBOutlet weak var leaveTimeLabel: UILabel!
/// 故障原因
@IBOutlet weak var failureCauseLabel: UILabel!
/// 处理方式
@IBOutlet weak var processModeLabel: UILabel!
/// 人工费
@IBOutlet weak var costLaborLabel: UILabel!
/// 物料费用
@IBOutlet weak var materialCostLabel: UILabel!
/// 描述
@IBOutlet weak var describeLabel: UILabel!
/// 设备名称
@IBOutlet weak var deviceNameLabel: UILabel!
/// 附件宽度
let imageWidth = ((kWidth - 90) - CGFloat((3 + kONE) * 5)) / 3
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 默认section高度
let sectionHeight: CGFloat! = 30
/// 维修前图片附件高度
var beforAttachmentHeight: CGFloat! = 10
/// 维修后图片附件高度
var afterAttachmentHeight: CGFloat! = 10
/// 工单数据
open var billModel: BillDetailExecute!
/// 维修前图片附件
lazy final var beforAttachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
return attachmentVc
}()
/// 维修后图片附件
lazy final var afterAttachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
return attachmentVc
}()
/// 子工单详情ViewModel
lazy final var childBillViewModel: ReparirChildBillViewModel = {
var childBillViewModel = ReparirChildBillViewModel()
return childBillViewModel
}()
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
getBillDetailAction()
}
// MARK: - UI
fileprivate func uiConfigAction() {
title = billModel.dept.name
tableView.register(UINib(nibName: RepairOrderDetailSectionView.name(), bundle: nil), forHeaderFooterViewReuseIdentifier: RepairOrderDetailSectionView.name())
tableView.register(UINib(nibName: MaintainBeforAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: MaintainBeforAttachmentTableViewCell.name())
tableView.register(UINib(nibName: MaintainAfterAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: MaintainAfterAttachmentTableViewCell.name())
addChildViewController(afterAttachmentVc)
addChildViewController(beforAttachmentVc)
}
// MARK: - 获取子工单详情
fileprivate func getBillDetailAction() {
childBillViewModel.queryChildBillDetailAction(billModel.uuid).subscribe {[weak self] (event) in
self?.childBillViewModel.childBillDetailAssignment(self!)
self?.childBillViewModel.billDetailStataDispose(self!)
self?.disposeAttachment()
}.disposed(by: disposeBag)
}
// MARK: - 获取图片附件通过entity uuid
fileprivate func disposeAttachment() {
if !childBillViewModel.childBillDetailData.beginAttachmentId.isEmpty {
childBillViewModel.downloadBeforAttachmentAction(childBillViewModel.childBillDetailData.beginAttachmentId)
.subscribe(onNext: {[weak self] (result) in
for model in result {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName)
self?.beforAttachmentVc.attachmentViewModel.photoAttachments.insert(PhotoAttachmentModel(url, ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP), at: kZERO)
}
if result.count > kZERO {
self?.beforAttachmentVc.setItemSize(CGSize(width: self!.imageWidth, height: self!.imageWidth),3)
self?.beforAttachmentHeight = self?.beforAttachmentVc.attachmentHeight(result.count,befor)
self?.tableView.reloadData()
}
}).disposed(by: disposeBag)
}
if !childBillViewModel.childBillDetailData.endAttachmentId.isEmpty {
childBillViewModel.downloadAafterAttachmentAction(childBillViewModel.childBillDetailData.endAttachmentId)
.subscribe(onNext: {[weak self] (result) in
for model in result {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName)
self?.afterAttachmentVc.attachmentViewModel.photoAttachments.insert(PhotoAttachmentModel(url, ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP), at: kZERO)
}
if result.count > kZERO {
self?.afterAttachmentVc.setItemSize(CGSize(width: self!.imageWidth, height: self!.imageWidth),3)
self?.afterAttachmentHeight = self?.afterAttachmentVc.attachmentHeight(result.count,after)
self?.tableView.reloadData()
}
}).disposed(by: disposeBag)
}
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue {
if indexPath.row == kONE {
let beforCell = tableView.dequeueReusableCell(withIdentifier: MaintainBeforAttachmentTableViewCell.name(), for: indexPath)
beforAttachmentVc.view.frame = CGRect(x: 80, y: 0, width: kWidth - 80, height: beforAttachmentHeight)
beforCell.contentView.addSubview(beforAttachmentVc.view)
beforAttachmentVc.photoAttachmentCollectionView.reloadData()
return beforCell
}
if indexPath.row == kONE * 2 {
let afterCell = tableView.dequeueReusableCell(withIdentifier: MaintainAfterAttachmentTableViewCell.name(), for: indexPath)
afterAttachmentVc.view.frame = CGRect(x: 80, y: 0, width: kWidth - 80, height: afterAttachmentHeight)
afterCell.contentView.addSubview(afterAttachmentVc.view)
afterAttachmentVc.photoAttachmentCollectionView.reloadData()
return afterCell
}
}
return super.tableView(tableView, cellForRowAt: indexPath)
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return kSectionZero
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section == CHILD_BILL_DETAIL_SECTION.STATE.rawValue {
return kSectionZero
}
return 35
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue {
return 3
}
return super.tableView(tableView, numberOfRowsInSection: section)
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == CHILD_BILL_DETAIL_SECTION.STATE.rawValue {
return UIView()
}
return childBillViewModel.dequeueReusableHeaderFooterView(RepairOrderDetailSectionView.name(),tableView,section)
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue {
if indexPath.row == kZERO {
return childBillViewModel.childBillDetailData.noteHeight + 15
}
if indexPath.row == kONE {
return beforAttachmentHeight + 15
}
if indexPath.row == kONE * 2 {
return afterAttachmentHeight + 15
}
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
}
......@@ -10,6 +10,7 @@ import UIKit
import RxSwift
import SwiftyJSON
class RepairOrderCompletedViewController: BaseTableViewController {
/// RxSwift自动释放
......@@ -26,12 +27,21 @@ class RepairOrderCompletedViewController: BaseTableViewController {
return billCompleteViewModel
}()
/// 工单状态回调
var stateBlock: BillStateBlock!
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
}
// MARK: - 工单状态回调
func setStateBlock(_ block: @escaping BillStateBlock) {
self.stateBlock = block
}
// MARK: - UI
fileprivate func uiConfigAction() {
remarkTextView.placeholder = "详细完成情况"
......@@ -49,6 +59,8 @@ class RepairOrderCompletedViewController: BaseTableViewController {
billCompleteViewModel.billCompltedModel.finishUser = finishModel
billCompleteViewModel.complteRepairOrderAction(billCompleteViewModel.billCompltedModel).subscribe(onNext: {[weak self] () in
ShowMessage("完成成功")
self?.stateBlock(SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue)
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_DETAIL_LIST)))
self?.popVC()
}).disposed(by: disposeBag)
}
......
......@@ -9,6 +9,7 @@
import UIKit
import SnapKit
import SwiftyJSON
import RxSwift
class RepairOrderDetailBgController: BaseViewController {
......@@ -28,6 +29,16 @@ class RepairOrderDetailBgController: BaseViewController {
var detailVc = RepairOrderDetailViewController.instantiateViewController(.Function) as! RepairOrderDetailViewController
return detailVc
}()
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 悬浮View
var suspendView: RepairOrderDetailSuspendView?
/// 工单详情ViewModel
lazy final var orderDetailViewModel: RepairOrderDetailViewModel = {
var orderDetailViewModel = RepairOrderDetailViewModel()
return orderDetailViewModel
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -44,20 +55,19 @@ class RepairOrderDetailBgController: BaseViewController {
}
addChildViewController(detailVc)
detailVc.setStateBlock {[weak self] (state) in
/*
/// - FINISHED: 已完成
/// - DELETED: 已删除
/// - CANCLED
*/
if state == SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.DELETED.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.CANCLED.rawValue {
self?.bottomLayoutHeight.constant = 0
UIView.animate(withDuration: 0.5, animations: {
self?.view.layoutIfNeeded()
})
self?.rapairBillBottomViewAction(state)
}
detailVc.setSuspendViewAlphaBlock {[weak self] (alpha) in
self?.suspendView?.alpha = alpha
}
detailVc.setSuspendViewStateBlock {[weak self] (model, indexPath,state) in
if state == SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue {
self?.setupSuspendViewAction(model,indexPath)
}else {
self?.bottomLayoutHeight.constant = 50
UIView.animate(withDuration: 0.5, animations: {
self?.view.layoutIfNeeded()
UIView.animate(withDuration: kAnimationTime, animations: {
self?.suspendView?.seth(h: kHeight)
}, completion: { (bool) in
self?.suspendView?.removeFromSuperview()
})
}
}
......@@ -72,17 +82,45 @@ class RepairOrderDetailBgController: BaseViewController {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == RepairOrderCompletedViewController.name() {
let completeVc = segue.destination as! RepairOrderCompletedViewController
let model = BillCompletedRequestModel.init(fromJson: JSON(detailVc.orderDetailViewModel.billDetailModel.toDictionary()))
let model = BillCompletedRequestModel(fromJson: JSON(detailVc.orderDetailViewModel.billDetailModel.toDictionary()))
completeVc.setStateBlock({[weak self] (state) in
self?.rapairBillBottomViewAction(state)
})
completeVc.billCompleteViewModel.billCompltedModel = model
}
}
// MARK: - 工单底部view
fileprivate func rapairBillBottomViewAction(_ state: String) {
if state == SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.DELETED.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.CANCLED.rawValue {
bottomLayoutHeight.constant = 0
UIView.animate(withDuration: kAnimationTime, animations: {
self.view.layoutIfNeeded()
})
}else {
bottomLayoutHeight.constant = 50
UIView.animate(withDuration: kAnimationTime, animations: {
self.view.layoutIfNeeded()
})
}
}
// MARK: - 设置悬浮框
fileprivate func setupSuspendViewAction(_ model: BillDetailExecute, _ indexPath: IndexPath) {
let suspendView = RepairOrderDetailSuspendView.instantiateFromNib() as! RepairOrderDetailSuspendView
suspendView.updateSuspendView(model, indexPath)
suspendView.frame = CGRect(x: 15, y: kHeight, width: kWidth - 30, height: 60)
self.suspendView = suspendView
self.view.addSubview(suspendView)
self.view.bringSubview(toFront: suspendView)
UIView.animate(withDuration: kAnimationTime, animations: {
suspendView.sety(y: self.view.height - kNavHeight - kTabBarHeight)
})
suspendView.operationOrderBtn.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.detailVc.suspendViewButtonClickAction(suspendView.operationOrderBtn.currentTitle!,model,indexPath)
}).disposed(by: disposeBag)
}
}
......@@ -9,10 +9,7 @@
import UIKit
import RxCocoa
import RxSwift
/// 工单状态
typealias BillStateBlock = (String) ->Void
import SwiftyJSON
class RepairOrderDetailViewController: BaseTableViewController {
......@@ -49,35 +46,31 @@ class RepairOrderDetailViewController: BaseTableViewController {
@IBOutlet weak var brokenTimeLab: UILabel!
/// 描述
@IBOutlet weak var descriptionLab: UILabel!
/// 附件宽度
let imageWidth = ((kWidth - 90) - CGFloat((3 + kONE) * 5)) / 3
/// 工单状态回调
var stateBlock: BillStateBlock!
/// 悬浮框透明度回调
var suspendViewAlphaBlock: SuspendViewAlphaBlock!
/// 悬浮框状态回调
var suspendViewStateBlock: SuspendViewStateBlock!
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 工单详情ViewModel
lazy final var orderDetailViewModel: RepairOrderDetailViewModel = {
var orderDetailViewModel = RepairOrderDetailViewModel()
return orderDetailViewModel
}()
/// 子工单详情ViewModel
lazy final var childBillViewModel: ReparirChildBillViewModel = {
var childBillViewModel = ReparirChildBillViewModel()
return childBillViewModel
}()
/// 工单数据
open var billModel: RepairOrderRecord!
/// 悬浮View
lazy final var suspendView: RepairOrderDetailSuspendView = {
var suspendView = RepairOrderDetailSuspendView.instantiateFromNib() as! RepairOrderDetailSuspendView
suspendView.frame = CGRect(x: 15, y: kHeight - kNavHeight - 80 - 49, width: kWidth - 30, height: 60)
suspendView.operationOrderBtn.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.gotoEditingSonOrderVc(IndexPath(row: kZERO, section: kZERO))
}).disposed(by: disposeBag)
return suspendView;
}()
/// 图片附件高度
var attachmentHeight: CGFloat! = 0
/// 图片附件
lazy final var attachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
......@@ -89,13 +82,16 @@ class RepairOrderDetailViewController: BaseTableViewController {
setupTableView()
getBillDetailAction()
noticeRefreshDataAction()
}
// MARK: - 设置TableView
fileprivate func setupTableView() {
tableView.register(UINib(nibName: RepairOrderDetailSectionView.name(), bundle: nil), forHeaderFooterViewReuseIdentifier: RepairOrderDetailSectionView.name())
tableView.register(UINib(nibName: RepairOrderAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairOrderAttachmentTableViewCell.name())
tableView.register(UINib(nibName: RepairOrderSubOrderTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairOrderSubOrderTableViewCell.name())
view.addSubview(suspendView)
addChildViewController(attachmentVc)
orderDetailViewModel.billDetailModel = BillDetailData(billModel.state)
}
// MARK: - 获取tableView显示内容高度
......@@ -115,25 +111,58 @@ class RepairOrderDetailViewController: BaseTableViewController {
let indexPath = sender as! IndexPath
childBillVc.billModel = orderDetailViewModel.billDetailModel.executes[indexPath.row]
}else if segue.identifier == RepairOrderChildBillDetailViewController.name() {
// let childBillDetailVc = segue.destination as! RepairOrderChildBillDetailViewController
// let indexPath = sender as! IndexPath
// childBillVc.billModel = orderDetailViewModel.billDetailModel.executes[indexPath.row]
let childBillDetailVc = segue.destination as! RepairOrderChildBillDetailViewController
let indexPath = sender as! IndexPath
childBillDetailVc.billModel = orderDetailViewModel.billDetailModel.executes[indexPath.row]
}
}
// MARK: - 获取工单详情
fileprivate func getBillDetailAction() {
orderDetailViewModel.billDetailModel = BillDetailData(billModel.state)
orderDetailViewModel.queryRepairOrderDetailAction(billModel.uuid).subscribe {[weak self] (event) in
self?.orderDetailViewModel.billDetailAssignment(self!)
self?.orderDetailViewModel.billDetailStataDispose(self!)
self?.suspendView.isHidden = true
self?.stateBlock((self?.orderDetailViewModel.billDetailModel.state)!)
self?.disposeAttachment()
self?.suspendViewStateAction()
self?.tableView.reloadData()
}.disposed(by: disposeBag)
}
// MARK: - 悬浮框状态判断
fileprivate func suspendViewStateAction() {
for i in 0..<orderDetailViewModel.billDetailModel.executes.count {
let model = orderDetailViewModel.billDetailModel.executes[i]
if model.dept.uuid == kUser().orgUuid && model.state == SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue {
self.suspendViewStateBlock(model,IndexPath(row: i, section: REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue),model.state)
break
}
if i == orderDetailViewModel.billDetailModel.executes.count - kONE {
self.suspendViewStateBlock(model,IndexPath(row: i, section: REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue),SUBMIT_REPAIR_ORDER_STATE.DONE.rawValue)
}
}
}
// MARK: - 悬浮框按钮点击
func suspendViewButtonClickAction(_ title: String, _ model: BillDetailExecute, _ indexPath: IndexPath) {
if title == SUSPEND_BUTTON_TYPE.GET.rawValue {
ShowAlertView(hint, "请确认是否领单?", [cancel,sure], .alert, {[weak self] (index) in
if index == kZERO { return }
self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in
ShowMessage("领取成功")
self?.getBillDetailAction()
self?.gotoEditingSonOrderVc(indexPath)
}).disposed(by: self!.disposeBag)
})
}else {
childBillViewModel.childBillDetailData = ChildBillDetailData(fromJson: JSON(model.toDictionary()))
childBillViewModel.finishChildBillAction().subscribe(onNext: {[weak self] () in
ShowMessage("子工单完成")
self?.getBillDetailAction()
}).disposed(by:disposeBag)
}
}
// MARK: - 获取图片附件通过entity uuid
fileprivate func disposeAttachment() {
orderDetailViewModel.downloadAttachmentAction(ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue).subscribe(onNext: {[weak self] (attachments) in
......@@ -142,9 +171,7 @@ class RepairOrderDetailViewController: BaseTableViewController {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName)
self?.attachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel(url, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP))
}
let imageHeight = ((kWidth - 90 - 20) - CGFloat((3 + kONE) * 5)) / 3
self?.attachmentVc.setItemSize(CGSize(width: imageHeight, height: imageHeight),3)
self?.attachmentVc.photoAttachmentCollectionView.reloadData()
self?.attachmentVc.setItemSize(CGSize(width: self!.imageWidth, height: self!.imageWidth),3)
self?.attachmentHeight = self?.attachmentVc.attachmentHeight(attachments.count,nil)
self?.tableView.reloadData()
}).disposed(by: disposeBag)
......@@ -155,6 +182,16 @@ class RepairOrderDetailViewController: BaseTableViewController {
self.stateBlock = block
}
// MARK: - 悬浮框透明度回调
func setSuspendViewAlphaBlock(_ block: @escaping SuspendViewAlphaBlock) {
self.suspendViewAlphaBlock = block
}
// MARK: - 悬浮框状态回调
func setSuspendViewStateBlock(_ block: @escaping SuspendViewStateBlock) {
self.suspendViewStateBlock = block
}
// MARK: - 转交工单...查询、选择部门
func transferRepairOrder() {
orderDetailViewModel.queryRepairOrderDepartmentAction().subscribe(onNext: {[weak self] (resuleModel) in
......@@ -174,7 +211,14 @@ class RepairOrderDetailViewController: BaseTableViewController {
orderDetailViewModel.transferRepairOrderAction(model).subscribe(onNext: {[weak self] () in
ShowMessage("转交成功")
self?.getBillDetailAction()
self?.gotoEditingSonOrderVc(IndexPath(row: kZERO, section: kZERO))
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_LIST)))
}).disposed(by: disposeBag)
}
// MARK: - 通知刷新数据
func noticeRefreshDataAction() {
NotificationCenter.default.rx.notification(Notification.Name(rawValue: UPDATE_BILL_DETAIL_LIST)).subscribe(onNext: {[weak self] (notice) in
self?.getBillDetailAction()
}).disposed(by: disposeBag)
}
}
......@@ -187,9 +231,10 @@ extension RepairOrderDetailViewController {
return orderDetailViewModel.dequeueChildBillReusableCell(RepairOrderSubOrderTableViewCell.name(), indexPath, tableView)
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 11 {
let attachmentCell = super.tableView(tableView, cellForRowAt: indexPath)
attachmentVc.view.frame = CGRect(x: 90, y: 7, width: kWidth - 90 - 20, height: attachmentHeight)
let attachmentCell = tableView.dequeueReusableCell(withIdentifier: RepairOrderAttachmentTableViewCell.name(), for: indexPath)
attachmentVc.view.frame = CGRect(x: 80, y: 5, width: kWidth - 80, height: attachmentHeight)
attachmentCell.contentView.addSubview(attachmentVc.view)
return attachmentCell
}
return super.tableView(tableView, cellForRowAt: indexPath)
}
......@@ -230,9 +275,11 @@ extension RepairOrderDetailViewController {
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue {
return 70
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 10 {
return orderDetailViewModel.billDetailModel.descriptionFieldHeight + 15
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 11 {
return attachmentHeight + 20
return attachmentHeight + 30
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
......@@ -247,12 +294,12 @@ extension RepairOrderDetailViewController {
self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in
ShowMessage("领取成功")
self?.getBillDetailAction()
self?.gotoEditingSonOrderVc(indexPath)
}).disposed(by: self!.disposeBag)
})
break
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
gotoEditingSonOrderVc(IndexPath(row: kZERO, section: kZERO))
gotoEditingSonOrderVc(indexPath)
break
case SUBMIT_REPAIR_ORDER_STATE.DONE.rawValue:
self.performSegue(withIdentifier: RepairOrderChildBillDetailViewController.name(), sender: indexPath)
......@@ -287,7 +334,7 @@ extension RepairOrderDetailViewController {
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue {
return 10.0
return kSectionTen
}
return kSectionZero
}
......@@ -296,7 +343,7 @@ extension RepairOrderDetailViewController {
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
let yoffset = scrollView.contentOffset.y
if yoffset >= 0 {
suspendView.alpha = 1 - abs(yoffset) * kSectionZero
suspendViewAlphaBlock(1 - abs(yoffset) * kSectionZero)
}
}
}
......
......@@ -23,7 +23,6 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
var afterAttachmentHeight: CGFloat! = 0
/// 工单数据
open var billModel: BillDetailExecute!
/// 主管指引、备件、工具
@IBOutlet weak var toolOptionLabel: UILabel!
/// 安全、防护、围封、环保
......@@ -44,7 +43,6 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
@IBOutlet weak var materialCostLabel: UILabel!
/// 描述
@IBOutlet weak var describeTextView: IQTextView!
/// 维修前图片附件
lazy final var beforAttachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
......@@ -65,26 +63,20 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
return childBillViewModel
}()
/// 主工单详情ViewModel
lazy final var orderDetailViewModel: RepairOrderDetailViewModel = {
var orderDetailViewModel = RepairOrderDetailViewModel()
return orderDetailViewModel
}()
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
setupTableView()
setupPhotoAttachmentVc()
getBillDetailAction()
bindingRxAction()
}
// MARK: - 获取子工单详情
fileprivate func getBillDetailAction() {
orderDetailViewModel.billDetailModel = BillDetailData(billModel.state)
orderDetailViewModel.queryRepairOrderDetailAction(billModel.uuid).subscribe {[weak self] (event) in
self?.tableView.reloadData()
}.disposed(by: disposeBag)
// MARK: - UI
fileprivate func uiConfigAction() {
describeTextView.placeholder = "描述"
describeTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0)
}
// MARK: - 设置附件VC
......@@ -97,26 +89,107 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
beforAttachmentHeight = beforAttachmentVc.attachmentHeight(kONE,befor)
}
// MARK: - 绑定RxSwift事件
fileprivate func bindingRxAction() {
costLaborText.rx.text.subscribe(onNext: {[weak self] (string) in
self?.childBillViewModel.childBillDetailData.labourfee = string
}).disposed(by: disposeBag)
describeTextView.rx.text.subscribe(onNext: {[weak self] (string) in
self?.childBillViewModel.childBillDetailData.note = string
}).disposed(by: disposeBag)
}
// MARK: - 获取子工单详情
fileprivate func getBillDetailAction() {
childBillViewModel.queryChildBillDetailAction(billModel.uuid).subscribe {[weak self] (event) in
self?.childBillViewModel.childBillDetailAssignment(self!)
self?.disposeAttachment()
}.disposed(by: disposeBag)
}
// MARK: - 获取图片附件通过entity uuid
fileprivate func disposeAttachment() {
if !childBillViewModel.childBillDetailData.beginAttachmentId.isEmpty {
childBillViewModel.downloadBeforAttachmentAction(childBillViewModel.childBillDetailData.beginAttachmentId)
.subscribe(onNext: {[weak self] (result) in
for model in result {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName)
self?.beforAttachmentVc.attachmentViewModel.photoAttachments.insert(PhotoAttachmentModel(url, ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP), at: kZERO)
}
self?.beforAttachmentHeight = self?.beforAttachmentVc.attachmentHeight(result.count + kONE,befor)
self?.tableView.reloadData()
}).disposed(by: disposeBag)
}
if !childBillViewModel.childBillDetailData.endAttachmentId.isEmpty {
childBillViewModel.downloadAafterAttachmentAction(childBillViewModel.childBillDetailData.endAttachmentId)
.subscribe(onNext: {[weak self] (result) in
for model in result {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName)
self?.afterAttachmentVc.attachmentViewModel.photoAttachments.insert(PhotoAttachmentModel(url, ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP), at: kZERO)
}
self?.afterAttachmentHeight = self?.afterAttachmentVc.attachmentHeight(result.count + kONE,after)
self?.tableView.reloadData()
}).disposed(by: disposeBag)
}
}
// MARK: - TableView
fileprivate func setupTableView() {
tableView.register(RepairAfterAttachmentTableViewCell.classForCoder(), forCellReuseIdentifier: RepairAfterAttachmentTableViewCell.name())
tableView.register(RepairBeforAttachmentTableViewCell.classForCoder(), forCellReuseIdentifier: RepairBeforAttachmentTableViewCell.name())
let completeView = RepairOrderEditSonOrderCompleteView.instantiateFromNib() as! RepairOrderEditSonOrderCompleteView
//完成子工单
completeView.completeBtn.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.gotoChildBillDetailVc()
self?.uploadActtachmentAction().subscribe(onNext: {[weak self] (result) in
self?.childBillViewModel.finishChildBillAction().subscribe(onNext: { () in
ShowMessage("子工单完成")
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_DETAIL_LIST)))
self?.popVC()
}).disposed(by: self!.disposeBag)
}).disposed(by: self!.disposeBag)
}).disposed(by: disposeBag)
tableView.tableFooterView = completeView
navigationItem.rightBarButtonItem = createButtonItem("保存", nil, self, #selector(RepairOrderEditSonOrderViewController.saveButtonClickAction))
}
// MARK: - 提交、保存工单
// MARK: - 提交、保存工单
@objc fileprivate func saveButtonClickAction() {
childBillViewModel.saveChildBillAction().subscribe(onNext: {[weak self] () in
ShowMessage("保存成功")
self?.popVC()
uploadActtachmentAction().subscribe(onNext: {[weak self] (result) in
self?.childBillViewModel.saveChildBillAction().subscribe(onNext: { () in
ShowMessage("保存成功")
self?.popVC()
}).disposed(by: self!.disposeBag)
}).disposed(by: disposeBag)
}
// MARK: - 上传附件
fileprivate func uploadActtachmentAction() ->Observable<(Void,Void)> {
var beforFileUrlArray = Array<UploadPhotoAttachmentModel>()
let beforEntityUuid = childBillViewModel.childBillDetailData.beginAttachmentId!
for i in 0..<beforAttachmentVc.attachmentViewModel.photoAttachments.count - kONE {
let image = beforAttachmentVc.attachmentViewModel.photoAttachments[i]
if image.attachmentType == ATTACHMENT_LOCATION.ATTACHMENT_LOCAL {
let imageName = randomMD5()
let fileUrl = saveImage(currentImage: image.attachment as! UIImage, persent: 0.8, imageName: imageName + ".jpg")
let model = UploadPhotoAttachmentModel(imageName, fileUrl, ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue, beforEntityUuid)
beforFileUrlArray.append(model)
}
}
var afterFileUrlArray = Array<UploadPhotoAttachmentModel>()
let afterEntityUuid = childBillViewModel.childBillDetailData.endAttachmentId!
for i in 0..<afterAttachmentVc.attachmentViewModel.photoAttachments.count - kONE {
let image = afterAttachmentVc.attachmentViewModel.photoAttachments[i]
if image.attachmentType == ATTACHMENT_LOCATION.ATTACHMENT_LOCAL {
let imageName = randomMD5()
let fileUrl = saveImage(currentImage: image.attachment as! UIImage, persent: 0.8, imageName: imageName + ".jpg")
let model = UploadPhotoAttachmentModel(imageName, fileUrl, ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue, afterEntityUuid)
afterFileUrlArray.append(model)
}
}
return childBillViewModel.childBillUploadAttachmentAction(beforFileUrlArray, afterFileUrlArray)
}
// MARK: - 跳转子工单详情
fileprivate func gotoChildBillDetailVc() {
self.performSegue(withIdentifier: RepairOrderChildBillDetailViewController.name(), sender: nil)
......@@ -128,12 +201,14 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
let beforCell = tableView.dequeueReusableCell(withIdentifier: RepairBeforAttachmentTableViewCell.name(), for: indexPath)
beforAttachmentVc.view.frame = CGRect(x: 15, y: 8, width: kWidth - 30, height: beforAttachmentHeight)
beforCell.contentView.addSubview(beforAttachmentVc.view)
beforAttachmentVc.photoAttachmentCollectionView.reloadData()
return beforCell
}
if indexPath.section == CHILD_BILL_EDIT_SECTION.AFTERATTACHMENT.rawValue {
let afterCell = tableView.dequeueReusableCell(withIdentifier: RepairAfterAttachmentTableViewCell.name(), for: indexPath)
afterAttachmentVc.view.frame = CGRect(x: 15, y: 8, width: kWidth - 30, height: afterAttachmentHeight)
afterCell.contentView.addSubview(afterAttachmentVc.view)
afterAttachmentVc.photoAttachmentCollectionView.reloadData()
return afterCell
}
return super.tableView(tableView, cellForRowAt: indexPath)
......
......@@ -36,6 +36,7 @@ class RepairOrderViewController: BaseTableViewPullController {
uiConfigAction()
bindingRxAction()
noticeRefreshDataAction()
}
// MARK: - UI
......@@ -45,10 +46,10 @@ class RepairOrderViewController: BaseTableViewPullController {
stateChooseButton.addBorder(1.0, kGaryColor)
sourceChooseButton.addBorder(1.0, kGaryColor)
priorityChooseButton.addBorder(1.0, kGaryColor)
dateChooseButton.horizontalCenterTitleAndImageRight(5)
stateChooseButton.horizontalCenterTitleAndImageRight(5)
sourceChooseButton.horizontalCenterTitleAndImageRight(5)
priorityChooseButton.horizontalCenterTitleAndImageRight(5)
dateChooseButton.horizontalCenterTitleAndImage(5)
stateChooseButton.horizontalCenterTitleAndImage(5)
sourceChooseButton.horizontalCenterTitleAndImage(5)
priorityChooseButton.horizontalCenterTitleAndImage(5)
}
// MARK: - 绑定RxSwift事件
......@@ -85,6 +86,15 @@ class RepairOrderViewController: BaseTableViewPullController {
}).disposed(by: (self?.disposeBag)!)
}).disposed(by: disposeBag)
}
// MARK: - 通知刷新数据
func noticeRefreshDataAction() {
NotificationCenter.default.rx.notification(Notification.Name(rawValue: UPDATE_BILL_LIST)).subscribe(onNext: {[weak self] (notice) in
self?.pullPageIndex = kZERO
self?.repairOrderViewModel.queryModel.endCreateTime = NSDate().httpParameterString()
self?.loadWebDataSource()
}).disposed(by: disposeBag)
}
// MARK: - 加载数据
override func loadWebDataSource() {
......@@ -92,7 +102,7 @@ class RepairOrderViewController: BaseTableViewPullController {
repairOrderViewModel.queryRepairOrderAction().subscribe {[weak self] (event) in
switch event {
case .next(let page):
if (self?.pullPageIndex)! >= page {
if (self?.pullPageIndex)! >= page - kONE {
self?.endRefreshNomoreData()
}else {
self?.endRefresh()
......
//
// ChildBillDetailResultModel.swift
//
// Create by 云霄 曹 on 16/1/2018
// Copyright © 2018. All rights reserved.
import Foundation
import SwiftyJSON
class ChildBillDetailResultModel : NSObject{
var data : ChildBillDetailData!
var message : String!
var success : Bool!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
let dataJson = json["data"]
if !dataJson.isEmpty{
data = ChildBillDetailData(fromJson: dataJson)
}
message = json["message"].stringValue
success = json["success"].boolValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if data != nil{
dictionary["data"] = data.toDictionary()
}
if message != nil{
dictionary["message"] = message
}
if success != nil{
dictionary["success"] = success
}
return dictionary
}
}
open class ChildBillDetailData : NSObject{
var beginAttachmentId : String!
var createId : String!
var createOperName : String!
var createTime : String!
var dept : UCN!
var endAttachmentId : String!
// var executeMateriels : [AnyObject]!
var executeNo : String!
// var executeOutsources : [AnyObject]!
var hasOut : Bool!
var hasPaid : Bool!
var labourfee : String!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var materielfee : String!
var note : String!
var noteHeight : CGFloat! = 30
var owner : UCN!
var ownerTime : String!
var processBegin : String!
var processEnd : String!
var processMode : String!
var processor : String!
var property1 : String!
var property2 : String!
var reason : String!
var state : String!
var uuid : String!
var version : Int!
var workid : String!
init(_ state: String) {
self.state = state
}
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
beginAttachmentId = json["beginAttachmentId"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
let deptJson = json["dept"]
if !deptJson.isEmpty{
dept = UCN(fromJson: deptJson)
}
endAttachmentId = json["endAttachmentId"].stringValue
executeNo = json["executeNo"].stringValue
hasOut = json["hasOut"].boolValue
hasPaid = json["hasPaid"].boolValue
labourfee = json["labourfee"].stringValue
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
materielfee = json["materielfee"].stringValue
note = json["note"].stringValue
noteHeight = note.calculateStringSize(CGSize(width: kWidth - 105, height: CGFloat.greatestFiniteMagnitude), font: UIFont.systemFont(ofSize: 13)).height
let ownerJson = json["owner"]
if !ownerJson.isEmpty{
owner = UCN(fromJson: ownerJson)
}
ownerTime = json["ownerTime"].stringValue
processBegin = json["processBegin"].stringValue
processEnd = json["processEnd"].stringValue
processMode = json["processMode"].stringValue
processor = json["processor"].stringValue
property1 = json["property1"].stringValue
property2 = json["property2"].stringValue
reason = json["reason"].stringValue
state = json["state"].stringValue
uuid = json["uuid"].stringValue
version = json["version"].intValue
workid = json["workid"].stringValue
}
/**
* Returns all the available property values in the form of [String:Any] object where the key is the approperiate json key and the value is the value of the corresponding property
*/
func toDictionary() -> [String:Any]
{
var dictionary = [String:Any]()
if beginAttachmentId != nil{
dictionary["beginAttachmentId"] = beginAttachmentId
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if dept != nil{
dictionary["dept"] = dept.toDictionary()
}
if endAttachmentId != nil{
dictionary["endAttachmentId"] = endAttachmentId
}
// if !executeMateriels.isEmpty {
// dictionary["executeMateriels"] = executeMateriels
// }
if executeNo != nil{
dictionary["executeNo"] = executeNo
}
// if !executeOutsources.isEmpty {
// dictionary["executeOutsources"] = executeOutsources
// }
if hasOut != nil{
dictionary["hasOut"] = hasOut
}
if hasPaid != nil{
dictionary["hasPaid"] = hasPaid
}
if labourfee != nil{
dictionary["labourfee"] = labourfee
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if materielfee != nil{
dictionary["materielfee"] = materielfee
}
if note != nil{
dictionary["note"] = note
}
if owner != nil{
dictionary["owner"] = owner.toDictionary()
}
if ownerTime != nil{
dictionary["ownerTime"] = ownerTime
}
if processBegin != nil{
dictionary["processBegin"] = processBegin
}
if processEnd != nil{
dictionary["processEnd"] = processEnd
}
if processMode != nil{
dictionary["processMode"] = processMode
}
if processor != nil{
dictionary["processor"] = processor
}
if property1 != nil{
dictionary["property1"] = property1
}
if property2 != nil{
dictionary["property2"] = property2
}
if reason != nil{
dictionary["reason"] = reason
}
if state != nil{
dictionary["state"] = state
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
if workid != nil{
dictionary["workid"] = workid
}
return dictionary
}
}
......@@ -18,18 +18,18 @@ open class ChildBillSaveOrUpdateModel : NSObject{
var executeOutsources : [AnyObject]!
var hasOut : Bool!
var hasPaid : Bool!
var labourfee : AnyObject!
var labourfee : String!
var materielfee : Int!
var note : AnyObject!
var owner : AnyObject!
var ownerTime : AnyObject!
var processBegin : AnyObject!
var processEnd : AnyObject!
var processMode : AnyObject!
var processor : AnyObject!
var property1 : AnyObject!
var property2 : AnyObject!
var reason : AnyObject!
var note : String!
var owner : String!
var ownerTime : String!
var processBegin : String!
var processEnd : String!
var processMode : String!
var processor : String!
var property1 : String!
var property2 : String!
var reason : String!
var state : String!
var workid : String!
......
......@@ -64,6 +64,7 @@ open class BillDetailData : NSObject{
var createOperName : String!
var createTime : String!
var descriptionField : String!
var descriptionFieldHeight: CGFloat! = 10
var device : UCN!
var deviceType : AnyObject!
var deviceadree : String!
......@@ -97,6 +98,7 @@ open class BillDetailData : NSObject{
var workNo : String!
init(_ state: String) {
self.state = state
}
......@@ -118,6 +120,7 @@ open class BillDetailData : NSObject{
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
descriptionField = json["description"].stringValue
descriptionFieldHeight = descriptionField.calculateStringSize(CGSize(width: kWidth - 105, height: CGFloat.greatestFiniteMagnitude), font: UIFont.systemFont(ofSize: 13)).height
let deviceJson = json["device"]
if !deviceJson.isEmpty{
device = UCN(fromJson: deviceJson)
......@@ -311,7 +314,7 @@ open class BillDetailData : NSObject{
}
class BillDetailExecute : NSObject{
open class BillDetailExecute : NSObject{
var beginAttachmentId : String!
var beginAttachments : AnyObject!
......
//
// MaintainAfterAttachmentTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/16.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class MaintainAfterAttachmentTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="91" id="KGk-i7-Jjw" customClass="MaintainAfterAttachmentTableViewCell" customModule="IFS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="91"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="90.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="维修后" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j4V-Po-dFb">
<rect key="frame" x="15" y="5" width="40" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="j4V-Po-dFb" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="5" id="oDg-hH-JZD"/>
<constraint firstItem="j4V-Po-dFb" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="utU-tL-C0b"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="25" y="28.5"/>
</tableViewCell>
</objects>
</document>
//
// MaintainBeforAttachmentTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/16.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class MaintainBeforAttachmentTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="90" id="KGk-i7-Jjw" customClass="MaintainBeforAttachmentTableViewCell" customModule="IFS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="89.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="维修前" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IBZ-p5-QTS">
<rect key="frame" x="15" y="5" width="40" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="IBZ-p5-QTS" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="5" id="aZY-sE-ET4"/>
<constraint firstItem="IBZ-p5-QTS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="uNv-wU-GyU"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="-102" y="-17"/>
</tableViewCell>
</objects>
</document>
//
// RepairOrderAttachmentTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/16.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class RepairOrderAttachmentTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="97" id="KGk-i7-Jjw" customClass="RepairOrderAttachmentTableViewCell" customModule="IFS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="97"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="96.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="照片描述" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BEL-rn-e0r">
<rect key="frame" x="15" y="5" width="53.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="BEL-rn-e0r" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="5" id="bAU-m8-NXD"/>
<constraint firstItem="BEL-rn-e0r" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="egr-iP-at2"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="-72" y="20"/>
</tableViewCell>
</objects>
</document>
......@@ -25,8 +25,8 @@
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2018-01-08 10:50:32" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yca-g4-cKt">
<rect key="frame" x="230" y="10" width="130" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yca-g4-cKt">
<rect key="frame" x="360" y="18" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......
......@@ -19,8 +19,13 @@ class RepairOrderDetailSuspendView: UIView {
/// 部门
@IBOutlet weak var departmentLab: UILabel!
/// 转交时间
@IBOutlet weak var operationTimeLab: UIView!
@IBOutlet weak var operationTimeLab: UILabel!
/// 数据源
var model: BillDetailExecute!
/// 悬浮框对应数据下标
var indexPath: IndexPath!
override func awakeFromNib() {
super.awakeFromNib()
......@@ -33,4 +38,33 @@ class RepairOrderDetailSuspendView: UIView {
addShadow(UIColor.black)
contentBgView.addAngle(5.0)
}
// MARK: - 更新悬浮框
func updateSuspendView(_ model: BillDetailExecute, _ indexPath: IndexPath) {
self.model = model
self.indexPath = indexPath
orderStateLab.text = repairOrderChineseState(model.state)
operationTimeLab.text = model.lastModifyTime
departmentLab.text = model.dept.name
switch model.state {
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
operationOrderBtn.setTitle(SUSPEND_BUTTON_TYPE.GET.rawValue, for: .normal)
operationOrderBtn.backgroundColor = kBlueColor
break
case SUBMIT_REPAIR_ORDER_STATE.DONE.rawValue:
operationOrderBtn.setTitle(SUSPEND_BUTTON_TYPE.COMPLETED.rawValue, for: .normal)
operationOrderBtn.backgroundColor = kYellowColor
break
default:
break
}
}
}
......@@ -84,7 +84,7 @@
<outlet property="contentBgView" destination="Mq2-FF-B2L" id="4Ue-ir-jtf"/>
<outlet property="departmentLab" destination="9hT-Fx-col" id="MzW-Dg-7Kj"/>
<outlet property="operationOrderBtn" destination="4Ae-kJ-XQN" id="vln-FL-YrN"/>
<outlet property="operationTimeLab" destination="Mq2-FF-B2L" id="Chc-GC-zj8"/>
<outlet property="operationTimeLab" destination="kFy-ui-f5T" id="SWv-v5-GAt"/>
<outlet property="orderStateLab" destination="Ozr-71-Z31" id="9SP-Yx-cRB"/>
</connections>
<point key="canvasLocation" x="33.5" y="231"/>
......
......@@ -19,7 +19,7 @@
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yB3-AZ-0Kg">
<rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
<color key="backgroundColor" red="0.99215686274509807" green="0.61568627450980395" blue="0.30980392156862746" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="完成">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
......
......@@ -55,6 +55,10 @@ extension RepairOrderAddViewModel {
ShowMessage("请选择工单指定时间")
return false
}
guard saveOrderModel.reporterPhone != nil else {
ShowMessage("请输入报事人电话")
return false
}
guard saveOrderModel.position != nil else {
ShowMessage("请选择工单指定位置")
return false
......@@ -97,6 +101,10 @@ extension RepairOrderAddViewModel {
switch indexPath {
case IndexPath(row: 0, section: 0):
filterViewModel.queryProjectSponsors().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.sourceLabel.text, commit: { (text, index) in
controller.sourceLabel.text = text
controller.sourceLabel.textColor = kBlackColor
......@@ -106,6 +114,10 @@ extension RepairOrderAddViewModel {
break
case IndexPath(row: 1, section: 0):
filterViewModel.queryServerType().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.serviceTypeLabel.text, commit: { (text, index) in
controller.serviceTypeLabel.text = text
controller.serviceTypeLabel.textColor = kBlackColor
......@@ -115,6 +127,10 @@ extension RepairOrderAddViewModel {
break
case IndexPath(row: 2, section: 0):
filterViewModel.queryProrityOption().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.priorityLabel.text, commit: { (text, index) in
controller.priorityLabel.text = text
controller.priorityLabel.textColor = kBlackColor
......@@ -124,6 +140,10 @@ extension RepairOrderAddViewModel {
break
case IndexPath(row: 3, section: 0):
filterViewModel.queryInitiator().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
let publicFilterVc = FilterViewController.instantiateViewController(.Function) as! FilterViewController
for model in result {
let filterModel = PublicFilterModel(uuid: model.uuid, title: model.name, isSelected: "\(kZERO)")
......@@ -158,6 +178,10 @@ extension RepairOrderAddViewModel {
break
case IndexPath(row: 7, section: 0):
filterViewModel.queryLocation().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
let publicFilterVc = FilterViewController.instantiateViewController(.Function) as! FilterViewController
for model in result {
let filterModel = PublicFilterModel(uuid: model.uuid, title: model.name, isSelected: "\(kZERO)")
......@@ -176,6 +200,10 @@ extension RepairOrderAddViewModel {
break
case IndexPath(row: 0, section: 1):
filterViewModel.queryDevice().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
let publicFilterVc = FilterViewController.instantiateViewController(.Function) as! FilterViewController
for model in result {
let filterModel = PublicFilterModel(uuid: model.uuid, title: model.name, isSelected: "\(kZERO)")
......
......@@ -32,9 +32,9 @@ class RepairOrderDetailViewModel: BaseViewModel {
extension RepairOrderDetailViewModel {
/// 查询工单详情
func queryRepairOrderDetailAction(_ billNumber: String) ->Observable<Void>{
func queryRepairOrderDetailAction(_ billUuid: String) ->Observable<Void>{
return Observable.create({ (observer) -> Disposable in
Network.request(target: .GetRepairOrderDetail(billNumber), success: {[weak self] (json) in
Network.request(target: .GetRepairOrderDetail(billUuid), success: {[weak self] (json) in
let resultModel = RepairOrderDetailResult(fromJson: json)
if resultModel.success {
if let model = resultModel.data {
......@@ -148,7 +148,9 @@ extension RepairOrderDetailViewModel {
controller.sourceLab.text = billDetailModel.source
controller.serverTypeLab.text = billDetailModel.serviceType
controller.priorityLab.text = billDetailModel.level
controller.userLab.text = billDetailModel.reportUser.name
if billDetailModel.reportUser != nil {
controller.userLab.text = billDetailModel.reportUser.name
}
controller.phoneLab.text = billDetailModel.reporterPhone
controller.createTimeLab.text = billDetailModel.createTime
controller.requestTimeLab.text = billDetailModel.requestTime
......@@ -157,6 +159,10 @@ extension RepairOrderDetailViewModel {
controller.deviceLab.text = billDetailModel.device.name
controller.brokenTimeLab.text = billDetailModel.brokenTime
}
if billDetailModel.position != nil {
controller.deviceLocationLab.text = billDetailModel.position.name
}
controller.descriptionLab.text = billDetailModel.descriptionField
controller.billNumberLab.text = billDetailModel.workNo
}
......
......@@ -12,6 +12,9 @@ import Moya
class RepairOrderViewModel: BaseViewModel {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 查询工单列表对象
lazy final var queryModel: RepairOrderQueryModel = {
var queryModel = RepairOrderQueryModel()
......@@ -27,6 +30,12 @@ class RepairOrderViewModel: BaseViewModel {
var repairOrderArray = Array<RepairOrderRecord>()
return repairOrderArray
}()
/// 过滤ViewModel
lazy final var filterViewModel: FilterViewModel = {
var filterViewModel = FilterViewModel()
return filterViewModel
}()
}
extension RepairOrderViewModel {
......@@ -69,30 +78,36 @@ extension RepairOrderViewModel {
// MARK: - 工单列表筛选数据
// 时间、状态、来源、优先级
func repairOrderFilterBtnAction(_ sender: UIButton) ->Observable<Void> {
return Observable.create({ (observer) -> Disposable in
return Observable.create({[weak self] (observer) -> Disposable in
switch sender.tag {
case REPAIR_ORDER_FILTER_BUTTON_TAG.TIME.rawValue:
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["最近一周","最近两周","最近一个月"], defaultString: sender.currentTitle, commit: { (text, index) in
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["最近一周","最近一个月","最近三个月","最近半年","最近一年"], defaultString: sender.currentTitle, commit: { (text, index) in
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal)
sender.horizontalCenterTitleAndImageRight(5)
sender.horizontalCenterTitleAndImage(5)
var afterDay: Int = -7
switch index {
case 0:
afterDay = -7
break
case 1:
afterDay = -14
afterDay = -30
break
case 2:
afterDay = -30
afterDay = -90
break
case 3:
afterDay = -6 * 30
break
case 2:
afterDay = -12 * 30
break
default:
break
}
self.queryModel.startCreateTime = NSDate(after: Date(), day: afterDay).httpParameterString()
self.queryModel.endCreateTime = NSDate().httpParameterString()
self?.queryModel.startCreateTime = NSDate(after: Date(), day: afterDay).httpParameterString()
self?.queryModel.endCreateTime = NSDate().httpParameterString()
observer.onNext(())
}, cancel: {
sender.isSelected = false
......@@ -104,8 +119,12 @@ extension RepairOrderViewModel {
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal)
sender.horizontalCenterTitleAndImageRight(5)
self.queryModel.state = repairOrderEnglishState(text!)
sender.horizontalCenterTitleAndImage(5)
if index == kZERO {
self?.queryModel.state = nil
}else {
self?.queryModel.state = repairOrderEnglishState(text!)
}
observer.onNext(())
}, cancel: {
sender.isSelected = false
......@@ -113,30 +132,33 @@ extension RepairOrderViewModel {
})
break
case REPAIR_ORDER_FILTER_BUTTON_TAG.SOURCE.rawValue:
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["全部来源","内部","外部"], defaultString: sender.currentTitle, commit: { (text, index) in
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal)
sender.horizontalCenterTitleAndImageRight(5)
sender.updateConstraints()
observer.onNext(())
}, cancel: {
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
})
self?.filterViewModel.queryProjectSponsors().subscribe(onNext: { (result) in
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: result, defaultString: sender.currentTitle, commit: { (text, index) in
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal)
sender.horizontalCenterTitleAndImage(5)
observer.onNext(())
}, cancel: {
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
})
}).disposed(by: self!.disposeBag)
break
case REPAIR_ORDER_FILTER_BUTTON_TAG.PRIORITY.rawValue:
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["全部优先级","高","中","低"], defaultString: sender.currentTitle, commit: { (text, index) in
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal)
sender.horizontalCenterTitleAndImageRight(5)
self.queryModel.level = text
observer.onNext(())
}, cancel: {
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
})
self?.filterViewModel.queryProrityOption().subscribe(onNext: {[weak self] (result) in
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: result, defaultString: sender.currentTitle, commit: { (text, index) in
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal)
sender.horizontalCenterTitleAndImage(5)
self?.queryModel.level = text
observer.onNext(())
}, cancel: {
sender.isSelected = false
sender.addBorder(1.0, kGaryColor)
})
}).disposed(by: self!.disposeBag)
break
default:
break
......
......@@ -9,31 +9,86 @@
import UIKit
import RxSwift
import RxCocoa
import Moya
class ReparirChildBillViewModel: BaseViewModel {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 子工单保存或者提交Model
lazy final var childBillSaveModel: ChildBillSaveOrUpdateModel = {
var childBillSaveModel = ChildBillSaveOrUpdateModel()
return childBillSaveModel
}()
/// 过滤ViewModel
lazy final var filterViewModel: FilterViewModel = {
var filterViewModel = FilterViewModel()
return filterViewModel
}()
/// 子单详情
lazy final var childBillDetailData: ChildBillDetailData = {
var childBillDetailData = ChildBillDetailData(SUBMIT_REPAIR_ORDER_STATE.PROCESSING.rawValue)
return childBillDetailData
}()
}
extension ReparirChildBillViewModel {
/// 查询子工单详情
func queryChildBillDetailAction(_ billUuid: String) ->Observable<Void>{
return Observable.create({ (observer) -> Disposable in
Network.request(target: .GetChildBillDetail(billUuid), success: {[weak self] (json) in
let resultModel = ChildBillDetailResultModel(fromJson: json)
if resultModel.success {
if let model = resultModel.data {
self?.childBillDetailData = model
observer.onNext(())
}else {
ShowMessage(resultModel.message)
observer.onError(MoyaError.requestMapping(resultModel.message))
}
}else {
ShowMessage(resultModel.message)
observer.onError(MoyaError.requestMapping(resultModel.message))
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
observer.onError(MoyaError.requestMapping(error.localizedDescription))
})
return Disposables.create()
})
}
// MARK: - 保存子工单
func saveChildBillAction() ->Observable<Void> {
childBillDetailData.createTime = nil
childBillDetailData.createId = nil
childBillDetailData.createOperName = nil
childBillDetailData.lastModifyTime = nil
childBillDetailData.lastModifyId = nil
childBillDetailData.lastModifyOperName = nil
return Observable.create({ (observer) -> Disposable in
Network.request(target: .SaveChildBill(self.childBillDetailData), success: { (json) in
let resultModel = PublicResultModel(fromJson: json)
if resultModel.success {
observer.onNext(())
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
// MARK: - 完成子工单
func finishChildBillAction() ->Observable<Void> {
childBillDetailData.createTime = nil
childBillDetailData.createId = nil
childBillDetailData.createOperName = nil
childBillDetailData.lastModifyTime = nil
childBillDetailData.lastModifyId = nil
childBillDetailData.lastModifyOperName = nil
return Observable.create({ (observer) -> Disposable in
Network.request(target: .SaveChildBill(self.childBillSaveModel), success: { (json) in
Network.request(target: .FinishChildBill(self.childBillDetailData), success: { (json) in
let resultModel = PublicResultModel(fromJson: json)
if resultModel.success {
observer.onNext(())
......@@ -46,10 +101,191 @@ extension ReparirChildBillViewModel {
return Disposables.create()
})
}
// MARK: - 子工单上传附件
func childBillUploadAttachmentAction(_ beforArray: Array<UploadPhotoAttachmentModel>?,_ afterArray: Array<UploadPhotoAttachmentModel>?) ->Observable<(Void,Void)> {
return Observable.zip(childBillAfterAttachmentUpload(afterArray!),childBillBeforAttachmentUpload(beforArray!))
}
// MARK: -维修后附件上传
func childBillAfterAttachmentUpload(_ array: Array<UploadPhotoAttachmentModel>?) ->Observable<Void> {
return Observable.create({ (observer) -> Disposable in
if !array!.isEmpty {
for i in 0..<array!.count {
let model = array![i]
Network.request(target: .UploadAttachment(model), success: { (json) in
let resultModel = PublicResultModel(fromJson: json)
if resultModel.success {
if i == array!.count - kONE {
observer.onNext(())
}
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
}
}else {
observer.onNext(())
}
return Disposables.create()
})
}
// MARK: -维修前附件上传
func childBillBeforAttachmentUpload(_ array: Array<UploadPhotoAttachmentModel>?) ->Observable<Void> {
return Observable.create({ (observer) -> Disposable in
if !array!.isEmpty {
for i in 0..<array!.count {
let model = array![i]
Network.request(target: .UploadAttachment(model), success: { (json) in
let resultModel = PublicResultModel(fromJson: json)
if resultModel.success {
if i == array!.count - kONE {
observer.onNext(())
}
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
}
}else {
observer.onNext(())
}
return Disposables.create()
})
}
// MARK: - 下载维修前图片附件
func downloadBeforAttachmentAction(_ entityUuid: String) ->Observable<[AttachmentData]> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .DownloadAttachment(ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue,entityUuid), success: { (json) in
let resultModel = AttachmentResultModel(fromJson: json)
if resultModel.success {
observer.onNext(resultModel.data)
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
})
return Disposables.create()
})
}
// MARK: - 下载维修后图片附件
func downloadAafterAttachmentAction(_ entityUuid: String) ->Observable<[AttachmentData]> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .DownloadAttachment(ATTACHMENT_TYPE.CHILD_BILL_ATTACHMENT_TYPE.rawValue,entityUuid), success: { (json) in
let resultModel = AttachmentResultModel(fromJson: json)
if resultModel.success {
observer.onNext(resultModel.data)
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
})
return Disposables.create()
})
}
}
extension ReparirChildBillViewModel {
// MARK: - 子工单赋值.编辑
func childBillDetailAssignment(_ controller: RepairOrderEditSonOrderViewController) {
controller.toolOptionLabel.text = disposeEmpty(childBillDetailData.property1)
controller.protectOptionLabel.text = disposeEmpty(childBillDetailData.property2)
controller.workPersonLabel.text = disposeEmpty(childBillDetailData.processor)
controller.placeTimeLabel.text = disposeEmpty(childBillDetailData.processBegin)
controller.leaveTimeLabel.text = disposeEmpty(childBillDetailData.processEnd)
controller.failureCauseLabel.text = disposeEmpty(childBillDetailData.reason)
controller.processModeLabel.text = disposeEmpty(childBillDetailData.processMode)
controller.costLaborText.text = childBillDetailData.labourfee.isEmpty ? nil : childBillDetailData.labourfee
controller.materialCostLabel.text = disposeEmpty(childBillDetailData.materielfee)
controller.describeTextView.text = childBillDetailData.note.isEmpty ? nil : childBillDetailData.note
}
// MARK: - 子工单赋值.查看
func childBillDetailAssignment(_ controller: RepairOrderChildBillDetailViewController) {
controller.workPersonLabel.text = disposeEmpty(childBillDetailData.processor)
controller.placeTimeLabel.text = disposeEmpty(childBillDetailData.processBegin)
controller.leaveTimeLabel.text = disposeEmpty(childBillDetailData.processBegin)
controller.failureCauseLabel.text = disposeEmpty(childBillDetailData.reason)
controller.processModeLabel.text = disposeEmpty(childBillDetailData.processMode)
controller.materialCostLabel.text = disposeEmpty(childBillDetailData.materielfee)
controller.operatorNameLabel.text = disposeEmpty(childBillDetailData.owner.name)
controller.materialCostLabel.text = disposeEmpty(childBillDetailData.materielfee)
controller.costLaborLabel.text = disposeEmpty(childBillDetailData.labourfee)
controller.describeLabel.text = disposeEmpty(childBillDetailData.note)
controller.safetyProtectionLabel.text = disposeEmpty(childBillDetailData.processMode)
controller.backupsToolLabel.text = disposeEmpty(childBillDetailData.property1)
controller.billNumberTimeLabel.text = disposeEmpty(childBillDetailData.ownerTime)
controller.billNumberLab.text = disposeEmpty(childBillDetailData.executeNo)
}
// MARK: - 处理空数据
func disposeEmpty(_ string: String) ->String? {
if string.isEmpty {
return "请选择"
}
return string
}
// MARK: - 工单详情状态处理
func billDetailStataDispose(_ controller: RepairOrderChildBillDetailViewController) {
switch childBillDetailData.state {
case SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue:
controller.createdStateImg.image = UIImage(named: "state_selected")
controller.createStateLab.text = repairOrderChineseState(childBillDetailData.state)
controller.createStateLab.textColor = kBlueColor
controller.processedStateImg.image = UIImage(named: "state_default")
controller.processedStateLab.textColor = kLightGaryColor
controller.completedStateImg.image = UIImage(named: "state_default")
controller.completedStateLab.textColor = kLightGaryColor
break
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
controller.createdStateImg.image = UIImage(named: "state_selected")
controller.createStateLab.textColor = kBlueColor
controller.processedStateImg.image = UIImage(named: "state_default")
controller.processedStateLab.textColor = kLightGaryColor
controller.completedStateImg.image = UIImage(named: "state_default")
controller.completedStateLab.textColor = kLightGaryColor
break
case SUBMIT_REPAIR_ORDER_STATE.PROCESSING.rawValue:
controller.createdStateImg.image = UIImage(named: "state_default")
controller.createStateLab.textColor = kLightGaryColor
controller.processedStateImg.image = UIImage(named: "state_selected")
controller.processedStateLab.textColor = kBlueColor
controller.completedStateImg.image = UIImage(named: "state_default")
controller.completedStateLab.textColor = kLightGaryColor
break
case SUBMIT_REPAIR_ORDER_STATE.DONE.rawValue:
controller.createdStateImg.image = UIImage(named: "state_default")
controller.createStateLab.textColor = kLightGaryColor
controller.processedStateImg.image = UIImage(named: "state_default")
controller.processedStateLab.textColor = kLightGaryColor
controller.completedStateImg.image = UIImage(named: "state_selected")
controller.completedStateLab.textColor = kBlueColor
break
default:
break
}
}
/// 完成部门工单界面item对应事件
func didSelectRowAtIndexPath(_ indexPath: IndexPath, _ controller: RepairOrderEditSonOrderViewController) {
switch indexPath {
......@@ -58,15 +294,16 @@ extension ReparirChildBillViewModel {
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.toolOptionLabel.text, commit: { (text, index) in
controller.toolOptionLabel.text = text
controller.toolOptionLabel.textColor = kBlackColor
self?.childBillSaveModel
self?.childBillDetailData.property1 = text
}, cancel: nil)
}).disposed(by: disposeBag)
break
case IndexPath(row: 1, section: 0):
filterViewModel.queryProtectOption().subscribe(onNext: {[weak self] (result) in
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.toolOptionLabel.text, commit: { (text, index) in
controller.toolOptionLabel.text = text
controller.toolOptionLabel.textColor = kBlackColor
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.protectOptionLabel.text, commit: { (text, index) in
controller.protectOptionLabel.text = text
controller.protectOptionLabel.textColor = kBlackColor
self?.childBillDetailData.property2 = text
}, cancel: nil)
}).disposed(by: disposeBag)
break
......@@ -83,8 +320,7 @@ extension ReparirChildBillViewModel {
controller.workPersonLabel.text = choiceModel.title
controller.workPersonLabel.textColor = kBlackColor
let model = result[index!]
let user = UCN(model.login, model.name, model.uuid)
// self?.saveOrderModel.reportUser = user
self?.childBillDetailData.processor = model.name
})
}).disposed(by: disposeBag)
break
......@@ -93,7 +329,7 @@ extension ReparirChildBillViewModel {
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in
controller.placeTimeLabel.text = time
controller.placeTimeLabel.textColor = kBlackColor
// self?.saveOrderModel.receiveTime = time
self?.childBillDetailData.processBegin = time
}, cancel: nil)
break
case IndexPath(row: 4, section: 0):
......@@ -101,6 +337,7 @@ extension ReparirChildBillViewModel {
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in
controller.leaveTimeLabel.text = time
controller.leaveTimeLabel.textColor = kBlackColor
self?.childBillDetailData.processEnd = time
}, cancel: nil)
break
case IndexPath(row: 5, section: 0):
......@@ -108,6 +345,7 @@ extension ReparirChildBillViewModel {
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.failureCauseLabel.text, commit: { (text, index) in
controller.failureCauseLabel.text = text
controller.failureCauseLabel.textColor = kBlackColor
self?.childBillDetailData.reason = text
}, cancel: nil)
}).disposed(by: disposeBag)
break
......@@ -116,6 +354,7 @@ extension ReparirChildBillViewModel {
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.processModeLabel.text, commit: { (text, index) in
controller.processModeLabel.text = text
controller.processModeLabel.textColor = kBlackColor
self?.childBillDetailData.processMode = text
}, cancel: nil)
}).disposed(by: disposeBag)
break
......@@ -123,4 +362,25 @@ extension ReparirChildBillViewModel {
break
}
}
// MARK: - 工单详情分区信息
func dequeueReusableHeaderFooterView(_ identifier: String, _ tableView: UITableView, _ section: Int) ->UIView? {
let sectionView = tableView.dequeueReusableHeaderFooterView(withIdentifier: RepairOrderDetailSectionView.name()) as! RepairOrderDetailSectionView
switch section {
case CHILD_BILL_DETAIL_SECTION.SOURCE.rawValue:
sectionView.sectionStateLabel.text = "创建"
sectionView.stateTimeLabel.text = childBillDetailData.createTime
break
case CHILD_BILL_DETAIL_SECTION.COST.rawValue:
sectionView.sectionStateLabel.text = "费用与设备信息"
break
case CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue:
sectionView.sectionStateLabel.text = "创建"
sectionView.stateTimeLabel.text = childBillDetailData.createTime
break
default:
break
}
return sectionView
}
}
......@@ -9,6 +9,7 @@
import UIKit
import RxCocoa
import RxSwift
import SwiftyJSON
class TodoViewController: BaseTableViewPullController {
......@@ -57,6 +58,20 @@ class TodoViewController: BaseTableViewPullController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return todoViewModel.todoResultArray.count
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let model = todoViewModel.todoResultArray[indexPath.row]
switch model.state {
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
let childBillVc = RepairOrderEditSonOrderViewController.instantiateViewController(.Function) as! RepairOrderEditSonOrderViewController
childBillVc.billModel = BillDetailExecute(fromJson: JSON(model.toDictionary()))
pushVC(childBillVc)
break
default:
break
}
}
}
......
......@@ -34,10 +34,14 @@ class TodoViewModel: BaseViewModel {
/// - state: 状态
func queryTodoAction(_ state: TODO_STATE) ->Observable<Void> {
queryModel.stateEquals = state.rawValue
if state == .ALL {
queryModel.stateEquals = nil
}
return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryTodo(self.queryModel), success: {[weak self] (json) in
let resultModel = TodoResultModel(fromJson: json)
if resultModel.success {
self?.todoResultArray.removeAll()
for data in resultModel.data {
self?.todoResultArray.append(data)
}
......
......@@ -9,6 +9,7 @@
import UIKit
import RxSwift
import RxCocoa
import SwiftyJSON
class HomeTableViewController: BaseTableViewPullController {
......@@ -60,6 +61,16 @@ class HomeTableViewController: BaseTableViewPullController {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let model = todoViewModel.todoResultArray[indexPath.row]
switch model.state {
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
let childBillVc = RepairOrderEditSonOrderViewController.instantiateViewController(.Function) as! RepairOrderEditSonOrderViewController
childBillVc.billModel = BillDetailExecute(fromJson: JSON(model.toDictionary()))
pushVC(childBillVc)
break
default:
break
}
}
}
......
......@@ -8,9 +8,14 @@
import UIKit
import SnapKit
import RxSwift
class HomeViewController: BaseViewController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 子视图背景View
@IBOutlet weak var contentBgView: UIView!
......@@ -19,6 +24,7 @@ class HomeViewController: BaseViewController {
uiConfigAction()
addChildContentVc()
updateVersion()
}
// MARK: - UI
......@@ -36,4 +42,38 @@ class HomeViewController: BaseViewController {
make.edges.equalTo(contentBgView)
}
}
// MARK: - 检查版本更新
fileprivate func updateVersion() {
let viewModel = BaseViewModel()
viewModel.updateVersion().subscribe(onNext: { (result) in
if result.0 {
ShowAlertView(hint, String(format: "检测到有新版本<%@>需要更新", result.2), ["我知道了"], UIAlertControllerStyle.alert, { (index) in
UIApplication.shared.openURL(URL(string: result.1)!)
})
}
}).disposed(by: disposeBag)
}
}
//
// UpdateVersionModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/16.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class UpdateVersionModel: BaseModel {
var message: String!
var data: UpdateVersionData!
var success: Bool!
}
class UpdateVersionData: BaseModel {
var forceUpdate: Int!
var type: String!
var version: String!
var backgroundUrl: String!
var url: String!
var uuid: String!
}
......@@ -125,10 +125,10 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BDc-OZ-YFh">
<rect key="frame" x="0.0" y="617" width="375" height="50"/>
<rect key="frame" x="0.0" y="667" width="375" height="0.0"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bdM-lb-1gm">
<rect key="frame" x="0.0" y="1" width="187.5" height="49"/>
<rect key="frame" x="0.0" y="-49" width="187.5" height="49"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="HHw-oQ-JE8"/>
......@@ -142,7 +142,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MKL-Ph-bA0">
<rect key="frame" x="187.5" y="1" width="187.5" height="49"/>
<rect key="frame" x="187.5" y="-49" width="187.5" height="49"/>
<color key="backgroundColor" red="0.21755459899999999" green="0.53306800129999998" blue="0.99824184179999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/>
<state key="normal" title="完成">
......@@ -153,7 +153,7 @@
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nnS-SC-D6A">
<rect key="frame" x="0.0" y="0.0" width="375" height="1"/>
<rect key="frame" x="0.0" y="-50" width="375" height="1"/>
<color key="backgroundColor" red="0.94117647059999998" green="0.93725490199999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="b8w-in-mjl"/>
......@@ -172,11 +172,11 @@
<constraint firstAttribute="bottom" secondItem="MKL-Ph-bA0" secondAttribute="bottom" id="l8A-HX-ZY7"/>
<constraint firstItem="nnS-SC-D6A" firstAttribute="leading" secondItem="BDc-OZ-YFh" secondAttribute="leading" id="mbc-PK-mTD"/>
<constraint firstItem="MKL-Ph-bA0" firstAttribute="leading" secondItem="bdM-lb-1gm" secondAttribute="trailing" id="tpB-ju-NtI"/>
<constraint firstAttribute="height" constant="50" id="vaY-3X-lik"/>
<constraint firstAttribute="height" id="vaY-3X-lik"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7Xy-5k-YRJ">
<rect key="frame" x="0.0" y="20" width="375" height="597"/>
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
......@@ -262,8 +262,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="13488928594" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7vL-mk-KIW">
<rect key="frame" x="55" y="94" width="87.5" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7vL-mk-KIW">
<rect key="frame" x="55" y="94" width="18.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
......@@ -589,7 +589,7 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kFe-Eg-mY4">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kFe-Eg-mY4">
<rect key="frame" x="90" y="7" width="18.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
......@@ -653,8 +653,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rps-Bp-swV">
<rect key="frame" x="90" y="7" width="14" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rps-Bp-swV">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -681,8 +681,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="已经完成,没有问题" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dci-Ku-RAk">
<rect key="frame" x="90" y="7" width="120" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dci-Ku-RAk">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -712,7 +712,7 @@
<outlet property="createStateLab" destination="gRy-pu-9Bq" id="CET-Rz-bKa"/>
<outlet property="createTimeLab" destination="g7M-ZO-zre" id="V6w-kb-Qub"/>
<outlet property="createdStateImg" destination="hPh-1i-LfN" id="RTT-m1-kQZ"/>
<outlet property="descriptionLab" destination="kFe-Eg-mY4" id="yHN-gj-1mp"/>
<outlet property="descriptionLab" destination="kFe-Eg-mY4" id="XHf-EY-fcR"/>
<outlet property="deviceLab" destination="C0r-ij-6zA" id="5qG-Su-pP1"/>
<outlet property="deviceLocationLab" destination="IXa-tu-bb6" id="EYs-6U-JsH"/>
<outlet property="phoneLab" destination="BcA-yM-ArB" id="I3m-8Q-STn"/>
......@@ -954,7 +954,7 @@
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<textInputTraits key="textInputTraits" keyboardType="decimalPad"/>
</textField>
</subviews>
<constraints>
......@@ -1135,8 +1135,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="13488928594" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="46I-IX-sou">
<rect key="frame" x="55" y="94" width="87.5" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="46I-IX-sou">
<rect key="frame" x="55" y="94" width="18.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
......@@ -1182,8 +1182,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qh9-OR-BEP">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qh9-OR-BEP">
<rect key="frame" x="90" y="7" width="18.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1210,8 +1210,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S6q-Tg-714">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S6q-Tg-714">
<rect key="frame" x="90" y="7" width="18.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1238,8 +1238,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fq2-wn-UKp">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fq2-wn-UKp">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1266,8 +1266,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MNp-Cu-tyG">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MNp-Cu-tyG">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1294,8 +1294,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SrG-rS-RAr">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SrG-rS-RAr">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1322,8 +1322,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nHl-qb-F8P">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nHl-qb-F8P">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1350,8 +1350,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Exo-Rb-G2b">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Exo-Rb-G2b">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1378,8 +1378,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wJi-8I-gUP">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wJi-8I-gUP">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1406,8 +1406,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="来源" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zcn-r9-AIa">
<rect key="frame" x="90" y="7" width="27" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zcn-r9-AIa">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1438,8 +1438,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="100" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WNl-HH-CPV">
<rect key="frame" x="90" y="7" width="23" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WNl-HH-CPV">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1466,8 +1466,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="300" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kym-07-eN4">
<rect key="frame" x="90" y="7" width="25" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kym-07-eN4">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1494,8 +1494,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="设备名称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Ud-6a-Dqw">
<rect key="frame" x="90" y="7" width="54" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Ud-6a-Dqw">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1526,8 +1526,8 @@
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="100" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5kn-Or-yd2">
<rect key="frame" x="90" y="7" width="23" height="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="---" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5kn-Or-yd2">
<rect key="frame" x="90" y="7" width="19" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
......@@ -1589,6 +1589,28 @@
<outlet property="delegate" destination="6A0-4n-VlI" id="oJT-dX-ON8"/>
</connections>
</tableView>
<connections>
<outlet property="backupsToolLabel" destination="Fq2-wn-UKp" id="mqO-26-h0k"/>
<outlet property="billNumberLab" destination="46I-IX-sou" id="JW6-Xg-GRo"/>
<outlet property="billNumberTimeLabel" destination="S6q-Tg-714" id="mtG-p0-B95"/>
<outlet property="completedStateImg" destination="b3d-A7-D4l" id="MOg-vN-hOA"/>
<outlet property="completedStateLab" destination="uvD-Va-VzJ" id="MgL-h7-nGR"/>
<outlet property="costLaborLabel" destination="WNl-HH-CPV" id="vh0-UP-fcj"/>
<outlet property="createStateLab" destination="zIH-mp-QRx" id="Bjb-lX-TOt"/>
<outlet property="createdStateImg" destination="Oka-Ih-0e2" id="Ubi-P7-HHY"/>
<outlet property="describeLabel" destination="5kn-Or-yd2" id="r7Y-TX-aZp"/>
<outlet property="deviceNameLabel" destination="1Ud-6a-Dqw" id="VtI-X5-5fn"/>
<outlet property="failureCauseLabel" destination="wJi-8I-gUP" id="6pR-dl-yQE"/>
<outlet property="leaveTimeLabel" destination="Exo-Rb-G2b" id="4IV-K3-epw"/>
<outlet property="materialCostLabel" destination="kym-07-eN4" id="doT-u3-jWC"/>
<outlet property="operatorNameLabel" destination="qh9-OR-BEP" id="bx7-pW-Sw8"/>
<outlet property="placeTimeLabel" destination="nHl-qb-F8P" id="9nH-dy-V2G"/>
<outlet property="processModeLabel" destination="zcn-r9-AIa" id="2L4-MU-U7g"/>
<outlet property="processedStateImg" destination="fcu-eo-YQV" id="Y1K-QE-D7s"/>
<outlet property="processedStateLab" destination="Aw7-24-uzj" id="OGb-B5-xat"/>
<outlet property="safetyProtectionLabel" destination="MNp-Cu-tyG" id="rWZ-Gs-pUN"/>
<outlet property="workPersonLabel" destination="SrG-rS-RAr" id="bn4-ua-aos"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HjG-hh-gzd" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
......@@ -1604,7 +1626,7 @@
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="3kY-Qd-GAw">
<rect key="frame" x="0.0" y="60" width="375" height="607"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.94117647059999998" green="0.93725490199999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="RepairOrderTableViewCell" rowHeight="135" id="5gj-x5-3Jg" customClass="RepairOrderTableViewCell" customModule="IFS" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="135"/>
......@@ -2250,7 +2272,7 @@
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<textInputTraits key="textInputTraits" keyboardType="phonePad"/>
</textField>
</subviews>
<constraints>
......@@ -2622,6 +2644,6 @@
<image name="todo_icon" width="23" height="24"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="ui0-ve-aBK"/>
<segue reference="eK1-nw-kV4"/>
</inferredMetricsTieBreakers>
</document>
......@@ -169,6 +169,7 @@
</tableView>
<connections>
<outlet property="accountBgView" destination="wJV-4F-PDK" id="sYL-0s-kqx"/>
<outlet property="checkVersionLabel" destination="wVG-rh-gIw" id="7d7-k0-d5G"/>
<outlet property="userHeaderImg" destination="fid-gJ-sRJ" id="3uS-55-Dhk"/>
<outlet property="userNameLab" destination="xRI-yJ-k8g" id="zPL-Tv-Uyw"/>
</connections>
......
......@@ -22,6 +22,7 @@ class LoginViewModel: BaseViewModel {
Network.request(target: .Login(login, password.md5()), success: {(json) in
let model = LoginResultModel(fromJson: json)
if model.success {
model.data.password = password
AppManager.shareInstance.userModel = model.data
LoginViewModel.archiveAccountInformation()
observer.onNext(json.description)
......
......@@ -25,6 +25,7 @@ public class UserModel : NSObject, NSCoding{
var userCode : String!
var userName : String!
var userUuid : String!
var password: String!
/**
......@@ -102,6 +103,7 @@ public class UserModel : NSObject, NSCoding{
if userUuid != nil{
dictionary["user_uuid"] = userUuid
}
return dictionary
}
......@@ -125,7 +127,7 @@ public class UserModel : NSObject, NSCoding{
userCode = aDecoder.decodeObject(forKey: "user_code") as? String
userName = aDecoder.decodeObject(forKey: "user_name") as? String
userUuid = aDecoder.decodeObject(forKey: "user_uuid") as? String
password = aDecoder.decodeObject(forKey: "password") as? String
}
/**
......@@ -176,6 +178,9 @@ public class UserModel : NSObject, NSCoding{
if userUuid != nil{
aCoder.encode(userUuid, forKey: "user_uuid")
}
if password != nil{
aCoder.encode(password, forKey: "password")
}
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "loding@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "loding@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -10,4 +10,5 @@
@import YXKit;
#import "IQTextView.h"
#import "UIDevice+Helper.h"
#import "NSString+Helper.h"
#import <CommonCrypto/CommonCrypto.h>
......@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>zh_CN</string>
<key>CFBundleDisplayName</key>
<string>工单系统</string>
<string>IFS</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
......
......@@ -28,26 +28,30 @@ func ShowMessage(_ message: String) {
}
// MARK: - 菊花加载框,默认颜色和主题色相同
func ShowLoadingView(_ view: UIView?) {
var hud: MBProgressHUD?
if let view = view {
hud = BaseMBProgressView(view)
}else {
hud = BaseMBProgressView(kWindow)
func ShowLoadingView(_ view: UIView) {
if JudgeLoadingViewIsHide(view) {
return
}
hud!.mode = MBProgressHUDMode.indeterminate
hud!.bezelView.style = .solidColor
hud!.bezelView.backgroundColor = UIColor.clear
hud!.contentColor = kNavColor
let hud = BaseMBProgressView(view)
hud.mode = MBProgressHUDMode.indeterminate
hud.bezelView.style = .solidColor
hud.bezelView.backgroundColor = UIColor.clear
hud.contentColor = kNavColor
}
// MARK: - 销毁对应View上所有MBProgressHUD
func HideLoadingView(_ view: UIView?) {
if let view = view {
MBProgressHUD.hide(for: view, animated: true)
}else {
MBProgressHUD.hide(for: kWindow, animated: true)
// MARK: - 判断view中是否存在MBProgressHUD
func JudgeLoadingViewIsHide(_ view: UIView) ->Bool {
for object in view.subviews {
if object.isKind(of: MBProgressHUD.classForCoder()) {
return true
}
}
return false
}
// MARK: - 销毁对应View上所有MBProgressHUD
func HideLoadingView(_ view: UIView) {
MBProgressHUD.hide(for: view, animated: true)
}
......
......@@ -21,4 +21,6 @@ target ‘IFS’ do
pod 'SKPhotoBrowser', '~> 5.0.0'
pod 'YXPickerView'
pod 'YXAlertController'
pod 'ObservableArray-RxSwift', '~> 0.2.0'
pod 'PPBadgeViewSwift'
end
......@@ -15,6 +15,9 @@ PODS:
- Moya/Core (10.0.1):
- Alamofire (~> 4.1)
- Result (~> 3.0)
- ObservableArray-RxSwift (0.2.0):
- RxSwift (~> 4.0)
- PPBadgeViewSwift (2.0.0)
- Result (3.2.4)
- RxCocoa (4.1.1):
- RxSwift (~> 4.0)
......@@ -38,6 +41,8 @@ DEPENDENCIES:
- MBProgressHUD
- MJRefresh (~> 3.1.15.1)
- Moya
- ObservableArray-RxSwift (~> 0.2.0)
- PPBadgeViewSwift
- RxCocoa
- RxSwift
- SKPhotoBrowser (~> 5.0.0)
......@@ -60,6 +65,8 @@ SPEC CHECKSUMS:
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
MJRefresh: 5f8552bc25ca8751c010f621c1098dbdaacbccd6
Moya: 9e621707ff754eeb51ff3ec51a3d54e517c0733a
ObservableArray-RxSwift: 905a088f51b1653f7eb55e6887f8a13916618f50
PPBadgeViewSwift: dc520c183e11d87fbe19bdb223e8b47d158f3c6b
Result: d2d07204ce72856f1fd9130bbe42c35a7b0fea10
RxCocoa: fd0862fd2df95fa55562ad28ffd2522c25eb4a85
RxSwift: c6e3b1c7b325c7d121cd4327e9d98b7ed746b570
......@@ -70,6 +77,6 @@ SPEC CHECKSUMS:
YXKit: 73d6ffbcf7530f1159e030460207286e9153b080
YXPickerView: 527ca74d8fbe73b4e9bd0bbff6e143133dced907
PODFILE CHECKSUM: bbdde573a885a7ec99a2e993aa40f5a213c0d05d
PODFILE CHECKSUM: 04404f79c4f31a2c2f3feddc2c782615ce22ffce
COCOAPODS: 1.3.0
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