Commit 67c8a843 authored by 曹云霄's avatar 曹云霄

新建工单增加位置图片编辑功能,工单详情增加位置图查看功能

parent a8fd545f
......@@ -8,6 +8,13 @@
/* Begin PBXBuildFile section */
29278C412004986800656DF1 /* TodoResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29278C402004986800656DF1 /* TodoResultModel.swift */; };
2942D6F92023056600CB07F9 /* FlooryuQueryModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2942D6F82023056500CB07F9 /* FlooryuQueryModel.swift */; };
2942D6FB202305A200CB07F9 /* FlooryuResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2942D6FA202305A200CB07F9 /* FlooryuResultModel.swift */; };
2942D6FF20230A2600CB07F9 /* FloorLayerResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2942D6FE20230A2500CB07F9 /* FloorLayerResultModel.swift */; };
2942D70120230D8100CB07F9 /* StoreResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2942D70020230D8000CB07F9 /* StoreResultModel.swift */; };
2942D703202313EB00CB07F9 /* DepartmentResultModel2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2942D702202313EB00CB07F9 /* DepartmentResultModel2.swift */; };
2942D70520231C3200CB07F9 /* EditImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2942D70420231C3200CB07F9 /* EditImageViewController.swift */; };
2942D70720231D2000CB07F9 /* BaseEditImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2942D70620231D2000CB07F9 /* BaseEditImageView.swift */; };
294B8642201974930035BF32 /* PermissionsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 294B8641201974930035BF32 /* PermissionsManager.swift */; };
294B8646201AECAD0035BF32 /* ProjectQueryModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 294B8645201AECAC0035BF32 /* ProjectQueryModel.swift */; };
294B8648201AF2DB0035BF32 /* ProjectResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 294B8647201AF2DB0035BF32 /* ProjectResultModel.swift */; };
......@@ -135,6 +142,13 @@
/* Begin PBXFileReference section */
29278C402004986800656DF1 /* TodoResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodoResultModel.swift; sourceTree = "<group>"; };
2942D6F82023056500CB07F9 /* FlooryuQueryModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlooryuQueryModel.swift; sourceTree = "<group>"; };
2942D6FA202305A200CB07F9 /* FlooryuResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlooryuResultModel.swift; sourceTree = "<group>"; };
2942D6FE20230A2500CB07F9 /* FloorLayerResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FloorLayerResultModel.swift; sourceTree = "<group>"; };
2942D70020230D8000CB07F9 /* StoreResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoreResultModel.swift; sourceTree = "<group>"; };
2942D702202313EB00CB07F9 /* DepartmentResultModel2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DepartmentResultModel2.swift; sourceTree = "<group>"; };
2942D70420231C3200CB07F9 /* EditImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditImageViewController.swift; sourceTree = "<group>"; };
2942D70620231D2000CB07F9 /* BaseEditImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseEditImageView.swift; sourceTree = "<group>"; };
294B8641201974930035BF32 /* PermissionsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionsManager.swift; sourceTree = "<group>"; };
294B8645201AECAC0035BF32 /* ProjectQueryModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectQueryModel.swift; sourceTree = "<group>"; };
294B8647201AF2DB0035BF32 /* ProjectResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectResultModel.swift; sourceTree = "<group>"; };
......@@ -320,6 +334,10 @@
29F6B8ED2007498A00EE4630 /* DeviceQueryModel.swift */,
294B8645201AECAC0035BF32 /* ProjectQueryModel.swift */,
294B8647201AF2DB0035BF32 /* ProjectResultModel.swift */,
2942D6F82023056500CB07F9 /* FlooryuQueryModel.swift */,
2942D6FA202305A200CB07F9 /* FlooryuResultModel.swift */,
2942D6FE20230A2500CB07F9 /* FloorLayerResultModel.swift */,
2942D70020230D8000CB07F9 /* StoreResultModel.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -456,6 +474,7 @@
29F6B909200C54CD00EE4630 /* RepairOrderCompletedViewController.swift */,
29DA416F20035610002762A2 /* RepairOrderEditSonOrderViewController.swift */,
29DA417720036763002762A2 /* RepairOrderChildBillDetailViewController.swift */,
2942D70420231C3200CB07F9 /* EditImageViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
......@@ -476,6 +495,7 @@
29D530741FFF626500851F00 /* PhotoAttachmentModel.swift */,
29F6B8EF200753CD00EE4630 /* SaveRepairOrderModel.swift */,
29F6B8F12007577A00EE4630 /* PublicResultModel.swift */,
2942D702202313EB00CB07F9 /* DepartmentResultModel2.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -831,6 +851,7 @@
296AAC591FFCB2A4008BE04C /* BaseTableViewController.swift */,
29EA0BD81FEA3156005A6170 /* BaseViewController.swift */,
29EA0BD91FEA3156005A6170 /* BaseViewModel.swift */,
2942D70620231D2000CB07F9 /* BaseEditImageView.swift */,
);
path = Base;
sourceTree = "<group>";
......@@ -1116,8 +1137,11 @@
buildActionMask = 2147483647;
files = (
29516A86200D8EE400C3A17E /* ChildBillDetailResultModel.swift in Sources */,
2942D70120230D8100CB07F9 /* StoreResultModel.swift in Sources */,
295064BB200CC7F5008DC8DD /* ChildBillSaveOrUpdateModel.swift in Sources */,
29DA417420035B28002762A2 /* RepairAfterAttachmentTableViewCell.swift in Sources */,
2942D703202313EB00CB07F9 /* DepartmentResultModel2.swift in Sources */,
2942D6FB202305A200CB07F9 /* FlooryuResultModel.swift in Sources */,
29EA0C031FEA3156005A6170 /* BaseNavigationController.swift in Sources */,
29EA0C101FEA3156005A6170 /* UIDevice+Extension.swift in Sources */,
29DA417220035AC3002762A2 /* ReparirChildBillViewModel.swift in Sources */,
......@@ -1155,6 +1179,7 @@
29EA0C111FEA3156005A6170 /* UIImage+Extension.swift in Sources */,
29EA0C0F1FEA3156005A6170 /* String+Extension.swift in Sources */,
29D5307D1FFF626500851F00 /* FunctionCollectionViewCell.swift in Sources */,
2942D6F92023056600CB07F9 /* FlooryuQueryModel.swift in Sources */,
29DA4169200334BC002762A2 /* RepairOrderSubOrderTableViewCell.swift in Sources */,
29F6B8F62007747900EE4630 /* RepairOrderResultModel.swift in Sources */,
29F6B90A200C54CD00EE4630 /* RepairOrderCompletedViewController.swift in Sources */,
......@@ -1193,6 +1218,7 @@
296FE44C1FFB5CAB00810820 /* HomeTableViewController.swift in Sources */,
29EA0C131FEA3156005A6170 /* UIView+Extension.swift in Sources */,
29D5308A1FFF635C00851F00 /* TodoViewModel.swift in Sources */,
2942D6FF20230A2600CB07F9 /* FloorLayerResultModel.swift in Sources */,
296AAC5A1FFCB2A4008BE04C /* BaseTableViewController.swift in Sources */,
29516A94200E3A9900C3A17E /* UpdateVersionModel.swift in Sources */,
29EA0C001FEA3156005A6170 /* UserModel.swift in Sources */,
......@@ -1203,12 +1229,14 @@
296FE4441FFB393C00810820 /* AccountTableViewController.swift in Sources */,
29DA418220045AC3002762A2 /* QueryTodoModel.swift in Sources */,
296AAC9D1FFDF533008BE04C /* FilterViewController.swift in Sources */,
2942D70720231D2000CB07F9 /* BaseEditImageView.swift in Sources */,
29D530881FFF62CB00851F00 /* TodoTableViewCell.swift in Sources */,
29EA0C181FEA3156005A6170 /* EmptyTableViewCell.swift in Sources */,
29278C412004986800656DF1 /* TodoResultModel.swift in Sources */,
29DA417620035B3C002762A2 /* RepairBeforAttachmentTableViewCell.swift in Sources */,
29F6B8EC2007488C00EE4630 /* DeviceModel.swift in Sources */,
29EA0C161FEA3156005A6170 /* Network.swift in Sources */,
2942D70520231C3200CB07F9 /* EditImageViewController.swift in Sources */,
29EA0C041FEA3156005A6170 /* BaseTableViewPullController.swift in Sources */,
29516A97200EE05900C3A17E /* NSString+Helper.m in Sources */,
296FE43C1FFB2D1D00810820 /* HomeViewController.swift in Sources */,
......
//
// BaseEditImageView.swift
// IFS
//
// Created by 曹云霄 on 2018/2/1.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class BaseEditImageView: UIImageView {
let currentScale: CGFloat! = 1;
override init(frame: CGRect) {
super.init(frame: frame)
self.isUserInteractionEnabled = true
self.contentMode = .scaleAspectFit
self.autoresizingMask = .flexibleTopMargin
let pinchGes = UIPinchGestureRecognizer(target: self, action: #selector(BaseEditImageView.backGroundViewPinchAction))
pinchGes.delegate = self
self.addGestureRecognizer(pinchGes)
let panGes = UIPanGestureRecognizer(target: self, action: #selector(BaseEditImageView.backGroundViewPanAction))
panGes.delegate = self
self.addGestureRecognizer(panGes)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension BaseEditImageView: UIGestureRecognizerDelegate {
@objc func backGroundViewPinchAction(gesture :UIPinchGestureRecognizer) {
if gesture.state == .began || gesture.state == .changed {
self.transform = CGAffineTransform.scaledBy(self.transform)(x: gesture.scale, y: gesture.scale)
gesture.scale = 1
}
}
@objc func backGroundViewPanAction(gesture: UIPanGestureRecognizer) {
if gesture.state == .began || gesture.state == .changed {
let translation = gesture.translation(in: self.superview)
self.center = CGPoint(x: self.center.x + translation.x, y: self.center.y + translation.y)
gesture.setTranslation(CGPoint.zero, in: self.superview)
}
}
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
return true
}
}
......@@ -14,6 +14,7 @@ class BaseViewController: UIViewController {
super.viewDidLoad()
self.automaticallyAdjustsScrollViewInsets = false
view.backgroundColor = UIColor.white
}
override var prefersStatusBarHidden: Bool {
......
......@@ -13,6 +13,21 @@ import RxSwift
class BaseViewModel: NSObject {
// MARK: - 获取登录人所属项目,可能为空
func getStoreByUser() {
Network.request(target: .QueryStoreByUserId, success: { (json) in
let resultModel = StoreResultModel(fromJson: json)
if resultModel.success {
AppManager.shareInstance.userStoreModel = resultModel.data
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
}
// MARK: - 检查版本更新
func updateVersion() ->Observable<(Bool,String,String)> {
return Observable.create({ (observer) -> Disposable in
......
......@@ -223,6 +223,14 @@ public enum SUSPEND_BUTTON_TYPE: String {
}
/// 新建工单位置图类型
///
/// - EDIT: 编辑
/// - VIEW: 查看
public enum LOCATION_IMAGE_TYPE: Int {
case EDIT = 0
case VIEW
}
......
......@@ -27,7 +27,6 @@ public let kROWS: Int = 15
public let kONE: Int = 1
public let kZERO: Int = 0
public let kPageSize: Int = 15
public let kMissTime: TimeInterval = 2
public let kSectionZero: CGFloat = 0.01
public let kSectionTen: CGFloat = 10
public let kEmptyHeight: CGFloat = 108
......
......@@ -77,8 +77,14 @@ public let drawExecute: String = "/work/drawExecute/%@"
public let saveExecute: String = "/work/saveExecute"
/// 子工单完成
public let finishExecute: String = "/work/finishExecute"
/// 登录人项目,可能为空
public let storeByUser: String = "/store/getByUserId/%@"
/// 通过项目获取获取下属的组织部门
public let storeSubOrgs: String = "/store/getSubOrgs/%@"
/// 楼宇查询
public let flooryuUrl: String = "/flooryu/query"
/// 获取某一楼宇下的楼层
public let floorlayerUrl: String = "/floorlayer/%@/floors"
......
......@@ -46,6 +46,14 @@ public enum Service {
case QueryToolOption()
// MARK: - 安全/防护/围封/环保
case QueryProtectOption()
// MARK: - 查询楼宇
case Queryflooryu(FlooryuQueryModel)
// MARK: - 通过楼宇查询楼层
case Queryfloorlayer(String)
// MARK: - 查询登录人所属项目,可能为空
case QueryStoreByUserId
// MARK: - 查询登录人项目下属组织
case QueryStoreSubOrgs(String)
// MARK: - 故障原因
case QuerybrokenOption()
// MARK: - 处理方式
......@@ -93,8 +101,16 @@ extension Service: TargetType {
return positionUrl
case .QueryProjectOption(_):
return projectUrl
case .QueryStoreByUserId:
return String(format: storeByUser, kUser().userUuid)
case .QueryStoreSubOrgs(let uuid):
return String(format: storeSubOrgs, uuid)
case .QueryDevice(_):
return deviceUrl
case .Queryflooryu:
return flooryuUrl
case .Queryfloorlayer(let uuid):
return String(format: floorlayerUrl, uuid)
case .SubmitOrder(_):
let path = saveRepairOrderUrl + "?operator.operId=\(kUser().userCode!)&operator.operName=\(kUser().userName!)&time=\(NSDate().httpParameterString()!)"
return path.urlEncoded()
......@@ -159,6 +175,7 @@ extension Service: TargetType {
.ChangePassword(_),
.FinishChildBill(_),
.QueryProjectOption(_),
.Queryflooryu(_),
.QueryInitiator(_):
return .post
case .QuerySource(),
......@@ -172,6 +189,9 @@ extension Service: TargetType {
.GetChildBill(_),
.GetChildBillDetail(_),
.UpdateVersion(),
.Queryfloorlayer(_),
.QueryStoreByUserId,
.QueryStoreSubOrgs(_),
.QueryPrority():
return .get
}
......@@ -207,6 +227,9 @@ extension Service: TargetType {
.DownloadAttachment(_,_),
.UpdateVersion(),
.GetChildBill(_),
.QueryStoreSubOrgs(_),
.QueryStoreByUserId,
.Queryfloorlayer(_),
.QueryPrority():
return .requestPlain
case .QueryInitiator(),
......@@ -239,6 +262,8 @@ extension Service: TargetType {
return .requestParameters(parameters: model.toDictionary(), encoding: JSONEncoding.default)
case .QueryProjectOption(let model):
return .requestParameters(parameters: model.toDictionary(), encoding: JSONEncoding.default)
case .Queryflooryu(let model):
return .requestParameters(parameters: model.toDictionary(), encoding: JSONEncoding.default)
}
}
......
//
// FloorLayerResultModel.swift
//
// Create by 云霄 曹 on 1/2/2018
// Copyright © 2018. All rights reserved.
import Foundation
import SwiftyJSON
class FloorLayerResultModel : NSObject{
var data : [FloorLayerData]!
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
}
data = [FloorLayerData]()
let dataArray = json["data"].arrayValue
for dataJson in dataArray{
let value = FloorLayerData(fromJson: dataJson)
data.append(value)
}
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{
var dictionaryElements = [[String:Any]]()
for dataElement in data {
dictionaryElements.append(dataElement.toDictionary())
}
dictionary["data"] = dictionaryElements
}
if message != nil{
dictionary["message"] = message
}
if success != nil{
dictionary["success"] = success
}
return dictionary
}
}
class FloorLayerData : NSObject{
var attachmentId : String!
var attachments : [Attachment]!
var code : String!
var createId : String!
var createOperName : String!
var createTime : String!
var enabled : Bool!
var floor : UCN!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var name : String!
var note : AnyObject!
var store : UCN!
var uuid : String!
var version : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
attachmentId = json["attachmentId"].stringValue
attachments = [Attachment]()
let attachmentsArray = json["attachments"].arrayValue
for attachmentsJson in attachmentsArray{
let value = Attachment(fromJson: attachmentsJson)
attachments.append(value)
}
code = json["code"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
enabled = json["enabled"].boolValue
let floorJson = json["floor"]
if !floorJson.isEmpty{
floor = UCN(fromJson: floorJson)
}
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
name = json["name"].stringValue
note = json["note"].stringValue as AnyObject
let storeJson = json["store"]
if !storeJson.isEmpty{
store = UCN(fromJson: storeJson)
}
uuid = json["uuid"].stringValue
version = json["version"].intValue
}
/**
* 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 attachmentId != nil{
dictionary["attachmentId"] = attachmentId
}
if attachments != nil{
var dictionaryElements = [[String:Any]]()
for attachmentsElement in attachments {
dictionaryElements.append(attachmentsElement.toDictionary())
}
dictionary["attachments"] = dictionaryElements
}
if code != nil{
dictionary["code"] = code
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if enabled != nil{
dictionary["enabled"] = enabled
}
if floor != nil{
dictionary["floor"] = floor.toDictionary()
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if name != nil{
dictionary["name"] = name
}
if note != nil{
dictionary["note"] = note
}
if store != nil{
dictionary["store"] = store.toDictionary()
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
return dictionary
}
}
class Attachment : NSObject{
var entityType : String!
var entityUuid : String!
var fileName : String!
var fileUrl : String!
var lastModified : String!
var thumbnailFileName : AnyObject!
var uuid : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
entityType = json["entityType"].stringValue
entityUuid = json["entityUuid"].stringValue
fileName = json["fileName"].stringValue
fileUrl = json["fileUrl"].stringValue
lastModified = json["lastModified"].stringValue
thumbnailFileName = json["thumbnailFileName"].stringValue as AnyObject
uuid = json["uuid"].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 entityType != nil{
dictionary["entityType"] = entityType
}
if entityUuid != nil{
dictionary["entityUuid"] = entityUuid
}
if fileName != nil{
dictionary["fileName"] = fileName
}
if fileUrl != nil{
dictionary["fileUrl"] = fileUrl
}
if lastModified != nil{
dictionary["lastModified"] = lastModified
}
if thumbnailFileName != nil{
dictionary["thumbnailFileName"] = thumbnailFileName
}
if uuid != nil{
dictionary["uuid"] = uuid
}
return dictionary
}
}
class Upper : NSObject{
var code : String!
var createId : String!
var createOperName : String!
var createTime : String!
var enabled : Bool!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var name : String!
var upper : AnyObject!
var uuid : String!
var version : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
code = json["code"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
enabled = json["enabled"].boolValue
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
name = json["name"].stringValue
upper = json["upper"].stringValue as AnyObject
uuid = json["uuid"].stringValue
version = json["version"].intValue
}
/**
* 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 code != nil{
dictionary["code"] = code
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if enabled != nil{
dictionary["enabled"] = enabled
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if name != nil{
dictionary["name"] = name
}
if upper != nil{
dictionary["upper"] = upper
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
return dictionary
}
}
//
// FlooryuQueryModel.swift
//
// Create by 云霄 曹 on 1/2/2018
// Copyright © 2018. All rights reserved.
import Foundation
import SwiftyJSON
open class FlooryuQueryModel : NSObject{
var codeEquals : String!
var nameLike : String!
var page : Int!
var pageSize : Int!
var stateEquals : Bool!
var storeUuidEquals : String!
/**
* 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 codeEquals != nil{
dictionary["codeEquals"] = codeEquals
}
if nameLike != nil{
dictionary["nameLike"] = nameLike
}
if page != nil{
dictionary["page"] = page
}
if pageSize != nil{
dictionary["pageSize"] = pageSize
}
if stateEquals != nil{
dictionary["stateEquals"] = stateEquals
}
if storeUuidEquals != nil{
dictionary["storeUuidEquals"] = storeUuidEquals
}
return dictionary
}
}
//
// FlooryuResultModel.swift
//
// Create by 云霄 曹 on 1/2/2018
// Copyright © 2018. All rights reserved.
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
import SwiftyJSON
class FlooryuResultModel : NSObject{
var data : FlooryuData!
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 = FlooryuData(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
}
}
class FlooryuData : NSObject{
var paging : Paging!
var records : [FlooryuRecord]!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
let pagingJson = json["paging"]
if !pagingJson.isEmpty{
paging = Paging(fromJson: pagingJson)
}
records = [FlooryuRecord]()
let recordsArray = json["records"].arrayValue
for recordsJson in recordsArray{
let value = FlooryuRecord(fromJson: recordsJson)
records.append(value)
}
}
/**
* 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 paging != nil{
dictionary["paging"] = paging.toDictionary()
}
if records != nil{
var dictionaryElements = [[String:Any]]()
for recordsElement in records {
dictionaryElements.append(recordsElement.toDictionary())
}
dictionary["records"] = dictionaryElements
}
return dictionary
}
}
class FlooryuRecord : NSObject{
var code : String!
var createId : String!
var createOperName : String!
var createTime : String!
var enabled : Bool!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var name : String!
var note : AnyObject!
var store : UCN!
var uuid : String!
var version : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
code = json["code"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
enabled = json["enabled"].boolValue
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
name = json["name"].stringValue
note = json["note"].stringValue as AnyObject
let storeJson = json["store"]
if !storeJson.isEmpty{
store = UCN(fromJson: storeJson)
}
uuid = json["uuid"].stringValue
version = json["version"].intValue
}
/**
* 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 code != nil{
dictionary["code"] = code
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if enabled != nil{
dictionary["enabled"] = enabled
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if name != nil{
dictionary["name"] = name
}
if note != nil{
dictionary["note"] = note
}
if store != nil{
dictionary["store"] = store.toDictionary()
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
return dictionary
}
}
......@@ -182,89 +182,6 @@ class ProjectResultRecord : NSObject{
}
}
class Upper : NSObject{
var code : String!
var createId : String!
var createOperName : String!
var createTime : String!
var enabled : Bool!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var name : String!
var upper : AnyObject!
var uuid : String!
var version : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
code = json["code"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
enabled = json["enabled"].boolValue
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
name = json["name"].stringValue
upper = json["upper"].stringValue as AnyObject
uuid = json["uuid"].stringValue
version = json["version"].intValue
}
/**
* 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 code != nil{
dictionary["code"] = code
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if enabled != nil{
dictionary["enabled"] = enabled
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if name != nil{
dictionary["name"] = name
}
if upper != nil{
dictionary["upper"] = upper
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
return dictionary
}
}
......
//
// StoreResultModel.swift
//
// Create by 云霄 曹 on 1/2/2018
// Copyright © 2018. All rights reserved.
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
import SwiftyJSON
class StoreResultModel : NSObject{
var data : StoreResultData!
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 = StoreResultData(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
}
}
class StoreResultData : NSObject{
var code : String!
var createId : String!
var createOperName : String!
var createTime : String!
var enabled : Bool!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var name : String!
var upper : Upper!
var uuid : String!
var version : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
code = json["code"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
enabled = json["enabled"].boolValue
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
name = json["name"].stringValue
let upperJson = json["upper"]
if !upperJson.isEmpty{
upper = Upper(fromJson: upperJson)
}
uuid = json["uuid"].stringValue
version = json["version"].intValue
}
/**
* 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 code != nil{
dictionary["code"] = code
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if enabled != nil{
dictionary["enabled"] = enabled
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if name != nil{
dictionary["name"] = name
}
if upper != nil{
dictionary["upper"] = upper.toDictionary()
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
return dictionary
}
}
......@@ -247,6 +247,42 @@ extension FilterViewModel {
return Disposables.create()
})
}
// MARK: - 获取楼宇
func queryFlooryu(_ model: FlooryuQueryModel) ->Observable<[FlooryuRecord]> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .Queryflooryu(model), success: { (json) in
let resultModel = FlooryuResultModel(fromJson: json)
if resultModel.success {
observer.onNext(resultModel.data.records)
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
// MARK: - 通过获取楼层导览图
func queryFloorlayer(_ uuid: String) ->Observable<FloorLayerData> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .Queryfloorlayer(uuid), success: { (json) in
let resultModel = FloorLayerResultModel(fromJson: json)
if resultModel.success {
if !resultModel.data.isEmpty {
observer.onNext(resultModel.data.first!)
}
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
}
......
//
// EditImageViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/2/1.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
public typealias SaveImageBlock = (String) ->Void
class EditImageViewController: BaseViewController {
var type: LOCATION_IMAGE_TYPE!
/// 图片路径,查看时为本地路径,编辑时为网络路径
var imageString :String!
var attachmentImg: BaseEditImageView!
/// 回调
var saveImageBlock: SaveImageBlock?
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
}
// MARK: - UI
fileprivate func uiConfigAction() {
self.fd_interactivePopDisabled = true;
view.backgroundColor = kGaryColor
attachmentImg = BaseEditImageView(frame: view.bounds)
view.addSubview(attachmentImg)
view.clipsToBounds = true
if type == .EDIT {
title = "编辑位置图"
navigationItem.rightBarButtonItem = createButtonItem("保存", nil, self, #selector(EditImageViewController.saveButtonClickAction))
let locationImg = BaseEditImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
locationImg.image = UIImage(named: "location_red")
locationImg.center = attachmentImg.center
attachmentImg.addSubview(locationImg)
attachmentImg.kf.setImage(with: URL(string: imageString), placeholder: loadingImage)
}else {
title = "查看位置图"
attachmentImg.image = UIImage(contentsOfFile: imageString)
}
}
// MARK: - 保存
@objc func saveButtonClickAction() {
guard saveImageBlock != nil else {
ShowMessage("请先实现回调方法")
return
}
popVC()
let string = saveImage(currentImage: capture(attachmentImg), persent: 1, imageName: "editAttachmentImage")
saveImageBlock!(string)
}
// 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 ""
}
// MARK: - 保存图片后回调
func setSaveImageBlock(_ block: @escaping SaveImageBlock) {
self.saveImageBlock = block
}
// MARK: - 截图
func capture(_ view: UIImageView) ->UIImage {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.isOpaque, 0.0)
view.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image!
}
}
......@@ -32,6 +32,8 @@ class RepairOrderAddTableViewController: BaseTableViewController {
@IBOutlet weak var specifiedTimeLabel: UILabel!
/// 位置
@IBOutlet weak var specifiedLocationLabel: UILabel!
/// 位置图
@IBOutlet weak var specifiedLocationImg: UIImageView!
/// 项目
@IBOutlet weak var projectLabel: UILabel!
/// 设施信息
......@@ -93,6 +95,9 @@ class RepairOrderAddTableViewController: BaseTableViewController {
let fileUrl = self?.saveImage(currentImage: image?.attachment as! UIImage, persent: 0.8, imageName: imageName! + ".jpg")
fileUrlArray.append(fileUrl!)
}
if let fileUrl = self?.repairOrderAddViewModel.saveOrderModel.locationAttachmentUrl {
fileUrlArray.append(fileUrl)
}
let entityUuid = self?.randomMD5()
guard fileUrlArray.count != kZERO else {
self?.submitRepairBillAction(entityUuid!)
......@@ -101,7 +106,12 @@ class RepairOrderAddTableViewController: BaseTableViewController {
var oberverArray = Array<Observable<Double>>()
for i in 0..<fileUrlArray.count {
let fileUrl = fileUrlArray[i]
let model = UploadPhotoAttachmentModel(self!.randomMD5(), fileUrl, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue,entityUuid!)
var model: UploadPhotoAttachmentModel!
if i == fileUrlArray.count - kONE && self?.repairOrderAddViewModel.saveOrderModel.locationAttachmentUrl != nil {
model = UploadPhotoAttachmentModel(self!.randomMD5(), fileUrl, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue,(self?.repairOrderAddViewModel.saveOrderModel.locationAttachmentId)!)
}else {
model = UploadPhotoAttachmentModel(self!.randomMD5(), fileUrl, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue,entityUuid!)
}
let signal = Observable<Double>.create({ (oberver) -> Disposable in
Network.upload(target: .UploadAttachment(model), progress: { (progress) in
oberver.onNext(progress)
......@@ -219,6 +229,7 @@ class RepairOrderAddTableViewController: BaseTableViewController {
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
repairOrderAddViewModel.didSelectRowAtIndePath(indexPath, self)
}
}
......
......@@ -43,6 +43,7 @@ class RepairOrderDetailViewController: BaseTableViewController {
@IBOutlet weak var requestTimeLab: UILabel!
/// 位置
@IBOutlet weak var positionLabel: UILabel!
/// 设施
@IBOutlet weak var deviceLab: UILabel!
/// 设施位置
......@@ -79,16 +80,24 @@ class RepairOrderDetailViewController: BaseTableViewController {
open var billModel: RepairOrderRecord!
/// 图片附件高度
var attachmentHeight: CGFloat! = 20
/// 位置图片附件高度
var locationAttHeight: CGFloat! = 20
/// 子工单高度
let childBillCellHeight: CGFloat! = 70
/// 附件每行显示个数
let attachmentCount: Int = 3
/// 图片附件
/// 照片描述图片附件
lazy final var attachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
return attachmentVc
}()
/// 位置图图片附件
lazy final var locationAttVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
return attachmentVc
}()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -192,6 +201,7 @@ class RepairOrderDetailViewController: BaseTableViewController {
// MARK: - 获取图片附件通过entity uuid
fileprivate func disposeAttachment() {
//获取照片面试附件
orderDetailViewModel.downloadAttachmentAction(ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue).subscribe(onNext: {[weak self] (attachments) in
self?.attachmentVc.attachmentViewModel.photoAttachments.removeAll()
for model in attachments {
......@@ -205,6 +215,21 @@ class RepairOrderDetailViewController: BaseTableViewController {
}
self?.tableView.reloadData()
}).disposed(by: disposeBag)
//获取位置图附件
orderDetailViewModel.downloadLocationAttAction(ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue).subscribe(onNext: {[weak self] (attachments) in
self?.locationAttVc.attachmentViewModel.photoAttachments.removeAll()
for model in attachments {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName)
self?.locationAttVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel(url, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP))
}
self?.locationAttVc.setItemSize(CGSize(width: self!.imageWidth, height: self!.imageWidth),self!.attachmentCount)
let attHeight = self?.locationAttVc.attachmentHeight(attachments.count,nil)
if attHeight! > self!.locationAttHeight {
self?.locationAttHeight = attHeight
}
self?.tableView.reloadData()
}).disposed(by: disposeBag)
}
// MARK: - 工单状态回调
......@@ -260,8 +285,16 @@ extension RepairOrderDetailViewController {
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue {
return orderDetailViewModel.dequeueChildBillReusableCell(RepairOrderSubOrderTableViewCell.name(), indexPath, tableView)
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 13 {
let attachmentCell = tableView.dequeueReusableCell(withIdentifier: RepairOrderAttachmentTableViewCell.name(), for: indexPath)
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 9 {
let attachmentCell = tableView.dequeueReusableCell(withIdentifier: RepairOrderAttachmentTableViewCell.name(), for: indexPath) as! RepairOrderAttachmentTableViewCell
attachmentCell.titleLabel.text = "位置图"
locationAttVc.view.frame = CGRect(x: 80, y: 5, width: kWidth - 90, height: locationAttHeight)
attachmentCell.contentView.addSubview(locationAttVc.view)
return attachmentCell
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 14 {
let attachmentCell = tableView.dequeueReusableCell(withIdentifier: RepairOrderAttachmentTableViewCell.name(), for: indexPath) as! RepairOrderAttachmentTableViewCell
attachmentCell.titleLabel.text = "照片描述"
attachmentVc.view.frame = CGRect(x: 80, y: 5, width: kWidth - 90, height: attachmentHeight)
attachmentCell.contentView.addSubview(attachmentVc.view)
return attachmentCell
......@@ -308,10 +341,13 @@ extension RepairOrderDetailViewController {
}
return childBillCellHeight
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 12 {
return orderDetailViewModel.billDetailModel.descriptionFieldHeight + 20
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 9 {
return locationAttHeight + 20
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 13 {
return orderDetailViewModel.billDetailModel.descriptionFieldHeight + 20
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 14 {
return attachmentHeight + 20
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.COMPLETED.rawValue && indexPath.row == 1 {
......
//
// DepartmentResultModel2.swift
//
// Create by 云霄 曹 on 1/2/2018
// Copyright © 2018. All rights reserved.
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
import SwiftyJSON
class DepartmentResultModel2 : NSObject{
var data : [DepartmentResultData]!
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
}
data = [DepartmentResultData]()
let dataArray = json["data"].arrayValue
for dataJson in dataArray{
let value = DepartmentResultData(fromJson: dataJson)
data.append(value)
}
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{
var dictionaryElements = [[String:Any]]()
for dataElement in data {
dictionaryElements.append(dataElement.toDictionary())
}
dictionary["data"] = dictionaryElements
}
if message != nil{
dictionary["message"] = message
}
if success != nil{
dictionary["success"] = success
}
return dictionary
}
}
class DepartmentResultData : NSObject{
var code : String!
var level : Int!
var name : String!
var path : String!
var upper : String!
var uuid : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
code = json["code"].stringValue
level = json["level"].intValue
name = json["name"].stringValue
path = json["path"].stringValue
upper = json["upper"].stringValue
uuid = json["uuid"].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 code != nil{
dictionary["code"] = code
}
if level != nil{
dictionary["level"] = level
}
if name != nil{
dictionary["name"] = name
}
if path != nil{
dictionary["path"] = path
}
if upper != nil{
dictionary["upper"] = upper
}
if uuid != nil{
dictionary["uuid"] = uuid
}
return dictionary
}
}
......@@ -75,6 +75,7 @@ open class BillDetailData : NSObject{
var finishNote : String!
var finishNoteHeight : CGFloat! = 10
var finishTime : String!
var locationAttachmentId: String!
var finishUser : UCN!
var labourfee : AnyObject!
var lastModifyId : String!
......@@ -119,6 +120,7 @@ open class BillDetailData : NSObject{
cancleTime = json["cancleTime"] as AnyObject
cancleUser = json["cancleUser"] as AnyObject
createId = json["create_id"].stringValue
locationAttachmentId = json["locationAttachmentId"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
descriptionField = json["description"].stringValue
......@@ -219,6 +221,9 @@ open class BillDetailData : NSObject{
if descriptionField != nil{
dictionary["description"] = descriptionField
}
if locationAttachmentId != nil{
dictionary["locationAttachmentId"] = locationAttachmentId
}
if device != nil{
dictionary["device"] = device.toDictionary()
}
......
......@@ -22,6 +22,8 @@ open class SaveRepairOrderModel {
var reporterPhone : String!
var requestTime : String!
var serviceType : String!
var locationAttachmentId: String!
var locationAttachmentUrl: String!
var source : String!
var state : String!
var workNo : String!
......@@ -35,6 +37,9 @@ open class SaveRepairOrderModel {
if brokenTime != nil{
dictionary["brokenTime"] = brokenTime
}
if locationAttachmentId != nil{
dictionary["locationAttachmentId"] = locationAttachmentId
}
if descriptionField != nil{
dictionary["description"] = descriptionField
}
......
......@@ -10,6 +10,11 @@ import UIKit
class RepairOrderAttachmentTableViewCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
......
......@@ -33,6 +33,9 @@
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="titleLabel" destination="BEL-rn-e0r" id="pKb-3b-dDc"/>
</connections>
<point key="canvasLocation" x="-72" y="20"/>
</tableViewCell>
</objects>
......
......@@ -243,6 +243,29 @@ extension RepairOrderAddViewModel {
})
}).disposed(by: disposeBag)
break
case IndexPath(row: 9, section: 0):
if saveOrderModel.locationAttachmentId != nil {
ShowAlertView(hint, "请选择操作类型", ["取消","重新编辑","查看"], .actionSheet, {[weak self] (index) in
switch index {
case 0:
break
case 1:
self?.editImage(controller)
break
case 2:
let editVc = EditImageViewController()
editVc.type = .VIEW
editVc.imageString = self?.saveOrderModel.locationAttachmentUrl
controller.pushVC(editVc)
break
default:
break
}
})
}else {
editImage(controller)
}
break
case IndexPath(row: 0, section: 1):
filterViewModel.queryDevice().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
......@@ -285,4 +308,47 @@ extension RepairOrderAddViewModel {
break
}
}
/// 编辑图片
func editImage(_ controller: RepairOrderAddTableViewController) {
let model = FlooryuQueryModel()
model.storeUuidEquals = AppManager.shareInstance.userStoreModel?.uuid
model.stateEquals = true
model.page = kZERO
model.pageSize = kZERO
filterViewModel.queryFlooryu(model).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?
if model.name == controller.specifiedLocationLabel.text {
filterModel = PublicFilterModel(uuid: model.uuid, title: model.name, isSelected: "\(kONE)")
}else {
filterModel = PublicFilterModel(uuid: model.uuid, title: model.name, isSelected: "\(kZERO)")
}
publicFilterVc.publicViewModel.filterArray.add(filterModel!)
}
controller.pushVC(publicFilterVc)
publicFilterVc.setNavigationTitle("筛选楼宇",.SINGLE, { (choices, index) in
let choiceModel = choices.first!
self?.filterViewModel.queryFloorlayer(choiceModel.uuid!).subscribe(onNext: { (result) in
let editVc = EditImageViewController()
let attachment = result.attachments.first!
editVc.type = .EDIT
let urlString = String(format: attachmentUrl, attachment.entityType,attachment.entityUuid,attachment.fileName)
editVc.imageString = urlString
controller.pushVC(editVc)
editVc.setSaveImageBlock({ (imageUrl) in
controller.specifiedLocationImg.image = UIImage(contentsOfFile: imageUrl)
self?.saveOrderModel.locationAttachmentId = controller.randomMD5()
self?.saveOrderModel.locationAttachmentUrl = imageUrl
})
}).disposed(by: self!.disposeBag)
})
}).disposed(by: disposeBag)
}
}
......@@ -9,6 +9,7 @@
import UIKit
import RxSwift
import Moya
import SwiftyJSON
class RepairOrderDetailViewModel: BaseViewModel {
......@@ -56,7 +57,7 @@ extension RepairOrderDetailViewModel {
})
}
// MARK: - 获取图片附件
// MARK: - 获取照片描述图片附件
func downloadAttachmentAction(_ entityType: String) ->Observable<[AttachmentData]> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .DownloadAttachment(entityType,self.billDetailModel.attachmentId), success: { (json) in
......@@ -72,13 +73,57 @@ extension RepairOrderDetailViewModel {
})
}
// MARK: - 获取位置图图片附件
func downloadLocationAttAction(_ entityType: String) ->Observable<[AttachmentData]> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .DownloadAttachment(entityType,self.billDetailModel.locationAttachmentId), 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 queryRepairOrderDepartmentAction() ->Observable<DepartmentData> {
if AppManager.shareInstance.userStoreModel != nil {
return queryRepairOrderDepartmentAction2()
}else {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .GetRepairOrderDepartment(), success: { (json) in
let resultModel = DepartmentResultModel(fromJson: json)
if resultModel.success {
observer.onNext(resultModel.data)
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
}
// MARK: - 查询工单转交部门2(当前登录人所属项目不为空时调用)
func queryRepairOrderDepartmentAction2() ->Observable<DepartmentData> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .GetRepairOrderDepartment(), success: { (json) in
let resultModel = DepartmentResultModel(fromJson: json)
Network.request(target: .QueryStoreSubOrgs(AppManager.shareInstance.userStoreModel!.uuid), success: { (json) in
let resultModel = DepartmentResultModel2(fromJson: json)
if resultModel.success {
observer.onNext(resultModel.data)
let model = DepartmentData(fromJson: json)
var array = [UCN]()
for model in resultModel.data {
let ucnModel = UCN(fromJson: JSON(model.toDictionary()))
array.append(ucnModel)
}
model.records = array
observer.onNext(model)
}else {
ShowMessage(resultModel.message)
}
......
......@@ -46,6 +46,7 @@ class HomeViewController: BaseViewController {
// MARK: - 检查版本更新
fileprivate func updateVersion() {
let viewModel = BaseViewModel()
viewModel.getStoreByUser()
viewModel.updateVersion().subscribe(onNext: { (result) in
if result.0 {
ShowAlertView(hint, String(format: "检测到有新版本<%@>需要更新", result.2), ["我知道了"], UIAlertControllerStyle.alert, { (index) in
......@@ -53,6 +54,9 @@ class HomeViewController: BaseViewController {
})
}
}).disposed(by: disposeBag)
}
}
......
......@@ -13,6 +13,8 @@ class AppManager: NSObject {
/// 登录用户信息
open var userModel: UserModel?
/// 用户所属项目
open var userStoreModel: StoreResultData?
/// 单例模式
static var shareInstance: AppManager = {
......
......@@ -32,8 +32,9 @@ class AppStyle: NSObject {
// MARK: - 第三方框架
fileprivate class func thirdFrameworkStyle() {
SVProgressHUD.setBackgroundColor(kGaryColor)
SVProgressHUD.setMinimumDismissTimeInterval(kMissTime)
SVProgressHUD.setMinimumDismissTimeInterval(TimeInterval(CGFloat.greatestFiniteMagnitude))
SVProgressHUD.resetOffsetFromCenter()
SVProgressHUD.setDefaultMaskType(.clear)
UMAnalyticsConfig.sharedInstance().appKey = UMKey
MobClick.start(withConfigure: UMAnalyticsConfig.sharedInstance())
MobClick.setLogEnabled(true)
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "location.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "location.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ import SVProgressHUD
// MARK: - 纯文本显示框
func ShowMessage(_ message: String) {
SVProgressHUD.showInfo(withStatus: message)
SVProgressHUD.dismiss(withDelay: 3)
}
// MARK: - 菊花加载框,默认颜色和主题色相同
......
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