Commit 392c40c0 authored by 曹云霄's avatar 曹云霄

IFSbug修改

parent 67c8a843
This diff is collapsed.
...@@ -94,6 +94,13 @@ class BaseTableViewPullController: BaseViewController { ...@@ -94,6 +94,13 @@ class BaseTableViewPullController: BaseViewController {
} }
} }
// MARK: - 刷新数据源
func reloadData() {
tableView.reloadData()
if tableView.isEmptyDataSetVisible {
tableView.reloadEmptyDataSet()
} }
// MARK: - 结束刷新切显示无更多的数据 // MARK: - 结束刷新切显示无更多的数据
func endRefreshNomoreData() { func endRefreshNomoreData() {
endRefresh() endRefresh()
......
...@@ -60,11 +60,13 @@ public enum REPAIR_ORDER_SECTION: Int { ...@@ -60,11 +60,13 @@ public enum REPAIR_ORDER_SECTION: Int {
/// - STATE: 工单状态 /// - STATE: 工单状态
/// - SOURCE: 工单来源 /// - SOURCE: 工单来源
/// - COST: 费用 /// - COST: 费用
/// - BORROW: 借用
/// - DESCRIBE: 描述 /// - DESCRIBE: 描述
public enum CHILD_BILL_DETAIL_SECTION: Int { public enum CHILD_BILL_DETAIL_SECTION: Int {
case STATE = 0 case STATE = 0
case SOURCE case SOURCE
case COST case COST
case BORROW
case DESCRIBE case DESCRIBE
} }
...@@ -233,11 +235,24 @@ public enum LOCATION_IMAGE_TYPE: Int { ...@@ -233,11 +235,24 @@ public enum LOCATION_IMAGE_TYPE: Int {
} }
/// 新建工单是否显示门店
///
/// - SHOW: 显示
/// - HIDE: 隐藏
public enum REPAIRORDER_STORE: Int {
case HIDE = 0
case SHOW
}
/// 子工单详情费用信息和借用信息区分
///
/// - COST: 费用信息
/// - BORROW: 借用信息
public enum CHILDORDERCOST_TYPE: String {
case COST = "outputBill"
case BORROW = "borrowbill"
}
......
...@@ -12,5 +12,8 @@ import Foundation ...@@ -12,5 +12,8 @@ import Foundation
/// 更新工单列表数据 /// 更新工单列表数据
public let UPDATE_BILL_LIST: String = "UPDATE_BILL_LIST" public let UPDATE_BILL_LIST: String = "UPDATE_BILL_LIST"
/// 更新工单列表数据 /// 更新工单详情数据
public let UPDATE_BILL_DETAIL_LIST: String = "UPDATE_BILL_DETAIL_LIST" public let UPDATE_BILL_DETAIL_LIST: String = "UPDATE_BILL_DETAIL_LIST"
/// 更新新建工单列表
public let UPDATE_REPAIRORDER_ADD_LIST: String = "UPDATE_REPAIRORDER_ADD_LIST"
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
import Foundation import Foundation
/// BaseUrl ///内网开发环境
public let BaseUrl: String = "http://192.168.1.176:9030/ifs-server/rest" //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 BaseAttachmentUrl: String = "http://192.168.1.176:9030"
//测试环境 //测试环境
//public let BaseUrl: String = "http://222.180.250.18:7080/ifs-server/rest" //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 BaseAttachmentUrl: String = "http://222.180.250.18:7080"
//外网开发环境 //外网开发环境
//public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest" public let BaseUrl: String = "http://dev.gomoretech.com/ifs-server/rest"
//public let BaseAttachmentUrl: String = "http://dev.gomoretech.com" public let BaseAttachmentUrl: String = "http://dev.gomoretech.com"
/// 登录 /// 登录
public let loginUrl: String = "/user/login/%@" public let loginUrl: String = "/user/login/%@"
...@@ -37,6 +37,9 @@ public let serviceTypeUrl: String = "/config/getValue/serviceType" ...@@ -37,6 +37,9 @@ public let serviceTypeUrl: String = "/config/getValue/serviceType"
public let prorityUrl: String = "/config/getValue/prorityOption" public let prorityUrl: String = "/config/getValue/prorityOption"
/// 新建工单报事人 /// 新建工单报事人
public let initiatorUrl: String = "/user/query" public let initiatorUrl: String = "/user/query"
public let initiatorUrl2: String = "/store/getSubUsers/%@"
/// 新建工单查询商户
public let queryTenant: String = "/information/tenant/query"
/// 项目 /// 项目
public let projectUrl: String = "/store/query" public let projectUrl: String = "/store/query"
/// 新建工单位置 /// 新建工单位置
...@@ -51,6 +54,8 @@ public let repairOrderUrl: String = "/work/query" ...@@ -51,6 +54,8 @@ public let repairOrderUrl: String = "/work/query"
public let getBillDetailUrl: String = "/work/get/%@" public let getBillDetailUrl: String = "/work/get/%@"
/// 子单详情get /// 子单详情get
public let getChildBillDetailUrl: String = "/work/getWorkExecute/%@" public let getChildBillDetailUrl: String = "/work/getWorkExecute/%@"
/// 生效工单
public let usefulWorkBill: String = "/work/submit/%@"
/// 工单详情转交部门 /// 工单详情转交部门
public let organizationUrl : String = "/organization/query" public let organizationUrl : String = "/organization/query"
/// 工单详情转交 /// 工单详情转交
......
...@@ -20,16 +20,20 @@ public enum Service { ...@@ -20,16 +20,20 @@ public enum Service {
case QuerySource() case QuerySource()
// MARK: - 新建工单服务类型 // MARK: - 新建工单服务类型
case QueryServerType() case QueryServerType()
// MARK: - 新建工单商户
case QueryTenant(QueryModel)
// MARK: - 新建工单优先级 // MARK: - 新建工单优先级
case QueryPrority() case QueryPrority()
// MARK: - 查询报事人 // MARK: - 查询报事人
case QueryInitiator() case QueryInitiator(QueryModel)
// MARK: - 查询位置 // MARK: - 查询位置
case QueryPosition() case QueryPosition(QueryModel)
// MARK: - 查询设施 // MARK: - 查询设施
case QueryDevice(DeviceQueryModel) case QueryDevice(DeviceQueryModel)
// MARK: - 提交工单 // MARK: - 提交工单
case SubmitOrder(SaveRepairOrderModel) case SubmitOrder(SaveRepairOrderModel)
// MARK: - 生效工单
case UsefulWorkBill(String)
// MARK: - 查询工单列表 // MARK: - 查询工单列表
case QueryRepairOrder(RepairOrderQueryModel) case QueryRepairOrder(RepairOrderQueryModel)
// MARK: - 查询工单详情 // MARK: - 查询工单详情
...@@ -37,7 +41,7 @@ public enum Service { ...@@ -37,7 +41,7 @@ public enum Service {
// MARK: - 查询子单详情 // MARK: - 查询子单详情
case GetChildBillDetail(String) case GetChildBillDetail(String)
// MARK: - 查询工单详情转交部门 // MARK: - 查询工单详情转交部门
case GetRepairOrderDepartment() case GetRepairOrderDepartment(QueryModel)
// MARK: - 工单详情转交 // MARK: - 工单详情转交
case TransferOrder(DepartmentQueryModel) case TransferOrder(DepartmentQueryModel)
// MARK: - 工单详情完成 // MARK: - 工单详情完成
...@@ -95,9 +99,9 @@ extension Service: TargetType { ...@@ -95,9 +99,9 @@ extension Service: TargetType {
return serviceTypeUrl return serviceTypeUrl
case .QueryPrority: case .QueryPrority:
return prorityUrl return prorityUrl
case .QueryInitiator(): case .QueryInitiator(let model):
return initiatorUrl return String(format: initiatorUrl2, model.storeUuidEquals)
case .QueryPosition(): case .QueryPosition(_):
return positionUrl return positionUrl
case .QueryProjectOption(_): case .QueryProjectOption(_):
return projectUrl return projectUrl
...@@ -156,6 +160,11 @@ extension Service: TargetType { ...@@ -156,6 +160,11 @@ extension Service: TargetType {
case .ChangePassword(_): case .ChangePassword(_):
let path = String(format: changePassword, kUser().userUuid,NSDate().httpParameterString(),kUser().userCode,kUser().userName) let path = String(format: changePassword, kUser().userUuid,NSDate().httpParameterString(),kUser().userCode,kUser().userName)
return path.urlEncoded() return path.urlEncoded()
case .QueryTenant(_):
return queryTenant
case .UsefulWorkBill(let uuid):
let path = String(format: usefulWorkBill, uuid) + "?operator.operId=\(kUser().userCode!)&operator.operName=\(kUser().userName!)&time=\(NSDate().httpParameterString()!)"
return path.urlEncoded()
} }
} }
...@@ -163,11 +172,11 @@ extension Service: TargetType { ...@@ -163,11 +172,11 @@ extension Service: TargetType {
switch self { switch self {
case .Login(_, _), case .Login(_, _),
.QueryTodo(_), .QueryTodo(_),
.QueryPosition(), .QueryPosition(_),
.QueryDevice(_), .QueryDevice(_),
.SubmitOrder(_), .SubmitOrder(_),
.QueryRepairOrder(_), .QueryRepairOrder(_),
.GetRepairOrderDepartment(), .GetRepairOrderDepartment(_),
.TransferOrder(_), .TransferOrder(_),
.CompleteOrder(_), .CompleteOrder(_),
.UploadAttachment(_), .UploadAttachment(_),
...@@ -175,8 +184,9 @@ extension Service: TargetType { ...@@ -175,8 +184,9 @@ extension Service: TargetType {
.ChangePassword(_), .ChangePassword(_),
.FinishChildBill(_), .FinishChildBill(_),
.QueryProjectOption(_), .QueryProjectOption(_),
.Queryflooryu(_), .UsefulWorkBill(_),
.QueryInitiator(_): .QueryTenant(_),
.Queryflooryu(_):
return .post return .post
case .QuerySource(), case .QuerySource(),
.QueryServerType(), .QueryServerType(),
...@@ -192,6 +202,7 @@ extension Service: TargetType { ...@@ -192,6 +202,7 @@ extension Service: TargetType {
.Queryfloorlayer(_), .Queryfloorlayer(_),
.QueryStoreByUserId, .QueryStoreByUserId,
.QueryStoreSubOrgs(_), .QueryStoreSubOrgs(_),
.QueryInitiator(_),
.QueryPrority(): .QueryPrority():
return .get return .get
} }
...@@ -223,6 +234,7 @@ extension Service: TargetType { ...@@ -223,6 +234,7 @@ extension Service: TargetType {
.QueryProtectOption(), .QueryProtectOption(),
.QuerybrokenOption(), .QuerybrokenOption(),
.QueryprocessMethods(), .QueryprocessMethods(),
.UsefulWorkBill(_),
.GetChildBillDetail(_), .GetChildBillDetail(_),
.DownloadAttachment(_,_), .DownloadAttachment(_,_),
.UpdateVersion(), .UpdateVersion(),
...@@ -230,13 +242,13 @@ extension Service: TargetType { ...@@ -230,13 +242,13 @@ extension Service: TargetType {
.QueryStoreSubOrgs(_), .QueryStoreSubOrgs(_),
.QueryStoreByUserId, .QueryStoreByUserId,
.Queryfloorlayer(_), .Queryfloorlayer(_),
.QueryInitiator(_),
.QueryPrority(): .QueryPrority():
return .requestPlain return .requestPlain
case .QueryInitiator(), case .GetRepairOrderDepartment(let model),
.GetRepairOrderDepartment(), .QueryTenant(let model),
.QueryPosition(): .QueryPosition(let model):
let model = EmptyModel() return .requestParameters(parameters: model.toDictionary(),
return .requestParameters(parameters: model.toJSON()!,
encoding: JSONEncoding.default) encoding: JSONEncoding.default)
case .QueryDevice(let queryModel): case .QueryDevice(let queryModel):
return .requestParameters(parameters: queryModel.toDictionary(), return .requestParameters(parameters: queryModel.toDictionary(),
......
...@@ -41,6 +41,9 @@ class PhotoAttachmentViewController: BaseViewController { ...@@ -41,6 +41,9 @@ class PhotoAttachmentViewController: BaseViewController {
let SPACE: Int = 5 let SPACE: Int = 5
/// 每行个数 /// 每行个数
var COUNT: Int = 2 var COUNT: Int = 2
/// 图片数量默认最多五张
var imageCount: Int = 5
/// 图片高度 /// 图片高度
lazy final var imageHeight: CGFloat = { lazy final var imageHeight: CGFloat = {
// 30表示UICollectionView距左右边距 // 30表示UICollectionView距左右边距
...@@ -109,7 +112,13 @@ extension PhotoAttachmentViewController: UICollectionViewDelegate,UICollectionVi ...@@ -109,7 +112,13 @@ extension PhotoAttachmentViewController: UICollectionViewDelegate,UICollectionVi
if attachment.attachmentType == .ATTACHMENT_ADD { if attachment.attachmentType == .ATTACHMENT_ADD {
let imagePickerController = ImagePickerController() let imagePickerController = ImagePickerController()
imagePickerController.delegate = self imagePickerController.delegate = self
imagePickerController.imageLimit = 5 let count = attachmentViewModel.photoAttachments.count
if count - kONE >= imageCount {
ShowMessage(String(format: "最多只能拍摄%d张照片", imageCount))
return
}else {
imagePickerController.imageLimit = imageCount - (count - kONE)
}
present(imagePickerController, animated: true, completion: nil) present(imagePickerController, animated: true, completion: nil)
}else { }else {
var images = [SKPhoto]() var images = [SKPhoto]()
......
...@@ -17,8 +17,8 @@ open class DeviceQueryModel { ...@@ -17,8 +17,8 @@ open class DeviceQueryModel {
var order : DeviceOrder! var order : DeviceOrder!
var page : Int! var page : Int!
var pageSize : Int! var pageSize : Int!
var stateEquals : String! var stateEquals : String! = "true"
var storeUuidEquals: String!
func toDictionary() -> [String:Any] func toDictionary() -> [String:Any]
{ {
...@@ -29,6 +29,9 @@ open class DeviceQueryModel { ...@@ -29,6 +29,9 @@ open class DeviceQueryModel {
if nameLike != nil{ if nameLike != nil{
dictionary["nameLike"] = nameLike dictionary["nameLike"] = nameLike
} }
if storeUuidEquals != nil{
dictionary["storeUuidEquals"] = storeUuidEquals
}
if order != nil{ if order != nil{
dictionary["order"] = order.toDictionary() dictionary["order"] = order.toDictionary()
} }
......
//
// EmptyModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/11.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class EmptyModel: BaseModel {
}
//
// InitiatorResultModel.swift
//
// Create by 云霄 曹 on 12/3/2018
// Copyright © 2018. All rights reserved.
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
import SwiftyJSON
class InitiatorResultModel : NSObject{
var data : [InitiatorResultData]!
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 = [InitiatorResultData]()
let dataArray = json["data"].arrayValue
for dataJson in dataArray{
let value = InitiatorResultData(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 InitiatorResultData : NSObject{
var address : String!
var belongOrg : String!
var businessType : String!
var createId : String!
var createOperName : String!
var createTime : String!
var email : String!
var enabled : Bool!
var enterprise : String!
var jobGrade : String!
var jobLeavel : String!
var jobPost : String!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var login : String!
var mobile : String!
var name : String!
var password : String!
var position : String!
var positions : [String]!
var remark : String!
var state : String!
var thirdLogin : String!
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
}
address = json["address"].stringValue
belongOrg = json["belongOrg"].stringValue
businessType = json["businessType"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
email = json["email"].stringValue
enabled = json["enabled"].boolValue
enterprise = json["enterprise"].stringValue
jobGrade = json["jobGrade"].stringValue
jobLeavel = json["jobLeavel"].stringValue
jobPost = json["jobPost"].stringValue
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
login = json["login"].stringValue
mobile = json["mobile"].stringValue
name = json["name"].stringValue
password = json["password"].stringValue
position = json["position"].stringValue
positions = [String]()
let positionsArray = json["positions"].arrayValue
for positionsJson in positionsArray{
positions.append(positionsJson.stringValue)
}
remark = json["remark"].stringValue
state = json["state"].stringValue
thirdLogin = json["thirdLogin"].stringValue
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 address != nil{
dictionary["address"] = address
}
if belongOrg != nil{
dictionary["belongOrg"] = belongOrg
}
if businessType != nil{
dictionary["businessType"] = businessType
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if email != nil{
dictionary["email"] = email
}
if enabled != nil{
dictionary["enabled"] = enabled
}
if enterprise != nil{
dictionary["enterprise"] = enterprise
}
if jobGrade != nil{
dictionary["jobGrade"] = jobGrade
}
if jobLeavel != nil{
dictionary["jobLeavel"] = jobLeavel
}
if jobPost != nil{
dictionary["jobPost"] = jobPost
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if login != nil{
dictionary["login"] = login
}
if mobile != nil{
dictionary["mobile"] = mobile
}
if name != nil{
dictionary["name"] = name
}
if password != nil{
dictionary["password"] = password
}
if position != nil{
dictionary["position"] = position
}
if positions != nil{
dictionary["positions"] = positions
}
if remark != nil{
dictionary["remark"] = remark
}
if state != nil{
dictionary["state"] = state
}
if thirdLogin != nil{
dictionary["thirdLogin"] = thirdLogin
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
return dictionary
}
}
//
// QueryModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/11.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import SwiftyJSON
open class QueryModel: NSObject {
var stateEquals : String! = "true"
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 stateEquals != nil{
dictionary["stateEquals"] = stateEquals
}
if storeUuidEquals != nil{
dictionary["storeUuidEquals"] = storeUuidEquals
}
return dictionary
}
}
//
// TenantResultModel.swift
//
// Create by 云霄 曹 on 12/3/2018
// Copyright © 2018. All rights reserved.
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
import SwiftyJSON
class TenantResultModel : NSObject{
var data : TenantData!
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 = TenantData(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 TenantData : NSObject{
var paging : TenantPaging!
var records : [TenantRecord]!
/**
* 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 = TenantPaging(fromJson: pagingJson)
}
records = [TenantRecord]()
let recordsArray = json["records"].arrayValue
for recordsJson in recordsArray{
let value = TenantRecord(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 TenantRecord : NSObject{
var code : String!
var contractCode : String!
var contractId : String!
var contractName : 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 shopSigns : String!
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
contractCode = json["contractCode"].stringValue
contractId = json["contractId"].stringValue
contractName = json["contractName"].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
shopSigns = json["shopSigns"].stringValue
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 contractCode != nil{
dictionary["contractCode"] = contractCode
}
if contractId != nil{
dictionary["contractId"] = contractId
}
if contractName != nil{
dictionary["contractName"] = contractName
}
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 shopSigns != nil{
dictionary["shopSigns"] = shopSigns
}
if store != nil{
dictionary["store"] = store.toDictionary()
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
return dictionary
}
}
class TenantPaging : NSObject{
var page : Int!
var pageCount : Int!
var pageSize : Int!
var recordCount : Int!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
page = json["page"].intValue
pageCount = json["pageCount"].intValue
pageSize = json["pageSize"].intValue
recordCount = json["recordCount"].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 page != nil{
dictionary["page"] = page
}
if pageCount != nil{
dictionary["pageCount"] = pageCount
}
if pageSize != nil{
dictionary["pageSize"] = pageSize
}
if recordCount != nil{
dictionary["recordCount"] = recordCount
}
return dictionary
}
}
...@@ -76,8 +76,8 @@ extension FilterViewModel { ...@@ -76,8 +76,8 @@ extension FilterViewModel {
func queryProjectType() ->Observable<[ProjectResultRecord]> { func queryProjectType() ->Observable<[ProjectResultRecord]> {
let queryModel = ProjectQueryModel() let queryModel = ProjectQueryModel()
queryModel.userId = kUser().userUuid queryModel.userId = kUser().userUuid
queryModel.nameLike = "重庆IFS项目" queryModel.nameLike = AppManager.shareInstance.userStoreModel?.name
queryModel.codeEquals = "CQIFS" queryModel.codeEquals = AppManager.shareInstance.userStoreModel?.code
queryModel.enabled = true queryModel.enabled = true
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryProjectOption(queryModel), success: { (json) in Network.request(target: .QueryProjectOption(queryModel), success: { (json) in
...@@ -94,6 +94,23 @@ extension FilterViewModel { ...@@ -94,6 +94,23 @@ extension FilterViewModel {
}) })
} }
// MARK: - 查询商户
func queryTenant(_ model: QueryModel) ->Observable<[TenantRecord]> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryTenant(model), success: { (json) in
let resultModel = TenantResultModel(fromJson: json)
if resultModel.success {
observer.onNext(resultModel.data.records)
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
})
return Disposables.create()
})
}
// MARK: - 查询服务类型 // MARK: - 查询服务类型
func queryServerType() ->Observable<[String]> { func queryServerType() ->Observable<[String]> {
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
...@@ -129,12 +146,12 @@ extension FilterViewModel { ...@@ -129,12 +146,12 @@ extension FilterViewModel {
} }
// MARK: - 查询报事人 // MARK: - 查询报事人
func queryInitiator() ->Observable<[InitiatorRecord]> { func queryInitiator(_ model: QueryModel) ->Observable<[InitiatorResultData]> {
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryInitiator(), success: { (json) in Network.request(target: .QueryInitiator(model), success: { (json) in
let resultModel = InitiatorModel(fromJson: json) let resultModel = InitiatorResultModel(fromJson: json)
if resultModel.success { if resultModel.success {
observer.onNext(resultModel.data.records) observer.onNext(resultModel.data)
}else { }else {
ShowMessage(resultModel.message) ShowMessage(resultModel.message)
} }
...@@ -146,9 +163,9 @@ extension FilterViewModel { ...@@ -146,9 +163,9 @@ extension FilterViewModel {
} }
// MARK: - 查询报事人位置 // MARK: - 查询报事人位置
func queryLocation() ->Observable<[LocationRecord]> { func queryLocation(_ model: QueryModel) ->Observable<[LocationRecord]> {
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryPosition(), success: { (json) in Network.request(target: .QueryPosition(model), success: { (json) in
let resultModel = LocationModel(fromJson: json) let resultModel = LocationModel(fromJson: json)
if resultModel.success { if resultModel.success {
observer.onNext(resultModel.data.records) observer.onNext(resultModel.data.records)
...@@ -163,10 +180,9 @@ extension FilterViewModel { ...@@ -163,10 +180,9 @@ extension FilterViewModel {
} }
// MARK: - 查询设施 // MARK: - 查询设施
func queryDevice() ->Observable<[DeviceRecord]> { func queryDevice(_ model: DeviceQueryModel) ->Observable<[DeviceRecord]> {
let queryModel = DeviceQueryModel()
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryDevice(queryModel), success: { (json) in Network.request(target: .QueryDevice(model), success: { (json) in
let resultModel = DeviceModel(fromJson: json) let resultModel = DeviceModel(fromJson: json)
if resultModel.success { if resultModel.success {
observer.onNext(resultModel.data.records) observer.onNext(resultModel.data.records)
...@@ -266,13 +282,13 @@ extension FilterViewModel { ...@@ -266,13 +282,13 @@ extension FilterViewModel {
} }
// MARK: - 通过获取楼层导览图 // MARK: - 通过获取楼层导览图
func queryFloorlayer(_ uuid: String) ->Observable<FloorLayerData> { func queryFloorlayer(_ uuid: String) ->Observable<[FloorLayerData]> {
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
Network.request(target: .Queryfloorlayer(uuid), success: { (json) in Network.request(target: .Queryfloorlayer(uuid), success: { (json) in
let resultModel = FloorLayerResultModel(fromJson: json) let resultModel = FloorLayerResultModel(fromJson: json)
if resultModel.success { if resultModel.success {
if !resultModel.data.isEmpty { if !resultModel.data.isEmpty {
observer.onNext(resultModel.data.first!) observer.onNext(resultModel.data!)
} }
}else { }else {
ShowMessage(resultModel.message) ShowMessage(resultModel.message)
......
//
// ChildBillDetailBorrowViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/3/12.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class ChildBillDetailBorrowViewController: BaseTableViewController {
/// 设备
@IBOutlet weak var deviceLabel: UILabel!
/// 借用单单号
@IBOutlet weak var orderNumberLabel: UILabel!
/// 借用数量
@IBOutlet weak var extractCountLabel: UILabel!
/// 归回数量
@IBOutlet weak var returnCountLabel: UILabel!
open var borrowModel: ExecuteMateriel!
override func viewDidLoad() {
super.viewDidLoad()
setupDataAction()
}
// MARK: - 设置数据源
fileprivate func setupDataAction() {
deviceLabel.text = borrowModel.materiel.name
orderNumberLabel.text = borrowModel.outputbillno
extractCountLabel.text = String(format: "%.0f", borrowModel.getQty)
returnCountLabel.text = String(format: "%.0f", borrowModel.useQty)
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return kSectionTen
}
}
//
// ChildBillDetailCostViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/3/12.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class ChildBillDetailCostViewController: BaseTableViewController {
/// 物料
@IBOutlet weak var logisticsLabel: UILabel!
/// 单价
@IBOutlet weak var priceLabel: UILabel!
/// 数量
@IBOutlet weak var countLabel: UILabel!
/// 合计
@IBOutlet weak var totalPriceLabel: UILabel!
/// 提取数量
@IBOutlet weak var extractCountLabel: UILabel!
/// 退料数量
@IBOutlet weak var returnCountLabel: UILabel!
open var costModel: ExecuteMateriel!
override func viewDidLoad() {
super.viewDidLoad()
setupDataAction()
}
// MARK: - 设置数据源
fileprivate func setupDataAction() {
logisticsLabel.text = costModel.materiel.name
priceLabel.text = String(format: "%.2f", costModel.unitPrice)
countLabel.text = String(format: "%.2f", costModel.getQty)
totalPriceLabel.text = String(format: "%.2f", costModel.getQty * costModel.unitPrice)
extractCountLabel.text = String(format: "%.0f", costModel.getQty)
returnCountLabel.text = String(format: "%.0f", costModel.useQty)
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return kSectionTen
}
}
...@@ -15,13 +15,23 @@ class EditImageViewController: BaseViewController { ...@@ -15,13 +15,23 @@ class EditImageViewController: BaseViewController {
var type: LOCATION_IMAGE_TYPE! var type: LOCATION_IMAGE_TYPE!
/// 图片路径,查看时为本地路径,编辑时为网络路径 /// 图片路径,查看时为本地路径,编辑时为网络路径
var imageString :String! open var imageString: String?
open var imageArray: [FloorLayerData]!
var attachmentImg: BaseEditImageView! var attachmentImg: BaseEditImageView!
/// 回调 /// 回调
var saveImageBlock: SaveImageBlock? var saveImageBlock: SaveImageBlock?
/// 楼层区分TableView
final lazy var selectedTableView: UITableView = {
var selectedTableView = UITableView(frame: CGRect(x: 20, y: 30, width: 60, height: 150), style: .plain)
selectedTableView.delegate = self
selectedTableView.showsVerticalScrollIndicator = false
selectedTableView.dataSource = self
return selectedTableView
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -42,10 +52,21 @@ class EditImageViewController: BaseViewController { ...@@ -42,10 +52,21 @@ class EditImageViewController: BaseViewController {
locationImg.image = UIImage(named: "location_red") locationImg.image = UIImage(named: "location_red")
locationImg.center = attachmentImg.center locationImg.center = attachmentImg.center
attachmentImg.addSubview(locationImg) attachmentImg.addSubview(locationImg)
let attachment = imageArray.first!.attachments.first
if attachment == nil {
ShowMessage("无楼层图片数据")
return
}
let imageString = String(format: attachmentUrl, attachment!.entityType,attachment!.entityUuid,attachment!.fileName)
attachmentImg.kf.setImage(with: URL(string: imageString), placeholder: loadingImage) attachmentImg.kf.setImage(with: URL(string: imageString), placeholder: loadingImage)
selectedTableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: UITableViewCell.name())
view.addSubview(selectedTableView)
selectedTableView.selectRow(at: IndexPath(row: 0, section: 0), animated: true, scrollPosition: .top)
}else { }else {
title = "查看位置图" title = "查看位置图"
attachmentImg.image = UIImage(contentsOfFile: imageString) if let imageString = imageString {
attachmentImg.image = UIImage(contentsOfFile: imageString)
}
} }
} }
...@@ -84,3 +105,57 @@ class EditImageViewController: BaseViewController { ...@@ -84,3 +105,57 @@ class EditImageViewController: BaseViewController {
return image! return image!
} }
} }
extension EditImageViewController: UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if imageString != nil {
return kZERO
}
return imageArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let towerCell = tableView.dequeueReusableCell(withIdentifier: UITableViewCell.name(), for: indexPath)
towerCell.textLabel?.textAlignment = .center
towerCell.textLabel?.text = imageArray[indexPath.row].name!
towerCell.textLabel?.font = UIFont.systemFont(ofSize: 12)
return towerCell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let attachment = imageArray[indexPath.row].attachments.first!
let imageString = String(format: attachmentUrl, attachment.entityType,attachment.entityUuid,attachment.fileName)
if type == .EDIT {
attachmentImg.kf.setImage(with: URL(string: imageString), placeholder: loadingImage)
}else {
attachmentImg.image = UIImage(contentsOfFile: imageString)
}
}
}
...@@ -28,6 +28,8 @@ class RepairOrderAddTableViewController: BaseTableViewController { ...@@ -28,6 +28,8 @@ class RepairOrderAddTableViewController: BaseTableViewController {
@IBOutlet weak var originatorLabel: UILabel! @IBOutlet weak var originatorLabel: UILabel!
/// 接报时间 /// 接报时间
@IBOutlet weak var originatorTimeLabel: UILabel! @IBOutlet weak var originatorTimeLabel: UILabel!
/// 商户
@IBOutlet weak var tenantLabel: UILabel!
/// 指定时间 /// 指定时间
@IBOutlet weak var specifiedTimeLabel: UILabel! @IBOutlet weak var specifiedTimeLabel: UILabel!
/// 位置 /// 位置
...@@ -52,7 +54,8 @@ class RepairOrderAddTableViewController: BaseTableViewController { ...@@ -52,7 +54,8 @@ class RepairOrderAddTableViewController: BaseTableViewController {
var attachmentHeight: CGFloat! = 0 var attachmentHeight: CGFloat! = 0
/// 默认section高度 /// 默认section高度
let sectionHeight: CGFloat! = 30 let sectionHeight: CGFloat! = 30
/// 是否显示门店选择cell
var isShowStoreItem: Bool = false
/// 图片附件 /// 图片附件
lazy final var attachmentVc: PhotoAttachmentViewController = { lazy final var attachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
...@@ -81,6 +84,15 @@ class RepairOrderAddTableViewController: BaseTableViewController { ...@@ -81,6 +84,15 @@ class RepairOrderAddTableViewController: BaseTableViewController {
describeTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0) describeTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0)
tableView.register(UINib(nibName: RepairAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairAttachmentTableViewCell.name()) tableView.register(UINib(nibName: RepairAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairAttachmentTableViewCell.name())
navigationItem.rightBarButtonItem = createButtonItem("提交", nil, self, #selector(RepairOrderAddTableViewController.submitButtonClickAction)) navigationItem.rightBarButtonItem = createButtonItem("提交", nil, self, #selector(RepairOrderAddTableViewController.submitButtonClickAction))
NotificationCenter.default.rx.notification(Notification.Name(rawValue: UPDATE_REPAIRORDER_ADD_LIST)).subscribe(onNext: {[weak self] (notice) in
let isShow = notice.object as! Int
if isShow == kONE {
self?.isShowStoreItem = true
}else {
self?.isShowStoreItem = false
}
self?.tableView.reloadData()
}).disposed(by: disposeBag)
} }
// MARK: - 提交工单--上传附件 // MARK: - 提交工单--上传附件
...@@ -188,6 +200,12 @@ class RepairOrderAddTableViewController: BaseTableViewController { ...@@ -188,6 +200,12 @@ class RepairOrderAddTableViewController: BaseTableViewController {
} }
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == REPAIR_ORDER_SECTION.BASIC.rawValue && indexPath.row == 2 {
if isShowStoreItem {
return kCellHeight
}
return 0
}
if indexPath.section == REPAIR_ORDER_SECTION.ATTACHMENT.rawValue { if indexPath.section == REPAIR_ORDER_SECTION.ATTACHMENT.rawValue {
return attachmentHeight + 50 return attachmentHeight + 50
} }
......
...@@ -94,6 +94,7 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -94,6 +94,7 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
tableView.register(UINib(nibName: RepairOrderDetailSectionView.name(), bundle: nil), forHeaderFooterViewReuseIdentifier: RepairOrderDetailSectionView.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: MaintainBeforAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: MaintainBeforAttachmentTableViewCell.name())
tableView.register(UINib(nibName: MaintainAfterAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: MaintainAfterAttachmentTableViewCell.name()) tableView.register(UINib(nibName: MaintainAfterAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: MaintainAfterAttachmentTableViewCell.name())
tableView.register(UINib(nibName: CostOrBorrowTableViewCell.name(), bundle: nil), forCellReuseIdentifier: CostOrBorrowTableViewCell.name())
addChildViewController(afterAttachmentVc) addChildViewController(afterAttachmentVc)
addChildViewController(beforAttachmentVc) addChildViewController(beforAttachmentVc)
} }
...@@ -157,6 +158,22 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -157,6 +158,22 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
return afterCell return afterCell
} }
} }
if indexPath.section == CHILD_BILL_DETAIL_SECTION.COST.rawValue {
if indexPath.row != kZERO {
let costCell = tableView.dequeueReusableCell(withIdentifier: CostOrBorrowTableViewCell.name(), for: indexPath) as! CostOrBorrowTableViewCell
let model = childBillViewModel.childBillDetailData.costArray[indexPath.row - kONE]
costCell.updateCell(model, indexPath)
return costCell
}
}
if indexPath.section == CHILD_BILL_DETAIL_SECTION.BORROW.rawValue {
if indexPath.row != kZERO {
let brrowCell = tableView.dequeueReusableCell(withIdentifier: CostOrBorrowTableViewCell.name(), for: indexPath) as! CostOrBorrowTableViewCell
let model = childBillViewModel.childBillDetailData.executeMateriels[indexPath.row - kONE]
brrowCell.updateCell(model, indexPath)
return brrowCell
}
}
return super.tableView(tableView, cellForRowAt: indexPath) return super.tableView(tableView, cellForRowAt: indexPath)
} }
...@@ -172,8 +189,21 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -172,8 +189,21 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
} }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue { switch section {
case CHILD_BILL_DETAIL_SECTION.COST.rawValue:
if childBillViewModel.childBillDetailData.costArray == nil {
return kZERO
}
return childBillViewModel.childBillDetailData.costArray.count + kONE
case CHILD_BILL_DETAIL_SECTION.BORROW.rawValue:
if childBillViewModel.childBillDetailData.costArray == nil {
return kZERO
}
return childBillViewModel.childBillDetailData.executeMateriels.count + kONE
case CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue:
return 3 return 3
default:
break
} }
return super.tableView(tableView, numberOfRowsInSection: section) return super.tableView(tableView, numberOfRowsInSection: section)
} }
...@@ -185,6 +215,19 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -185,6 +215,19 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
return childBillViewModel.dequeueReusableHeaderFooterView(RepairOrderDetailSectionView.name(),tableView,section) return childBillViewModel.dequeueReusableHeaderFooterView(RepairOrderDetailSectionView.name(),tableView,section)
} }
//cell的缩进级别,动态静态cell必须重写,否则会造成崩溃
override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int {
switch indexPath.section {
case CHILD_BILL_DETAIL_SECTION.COST.rawValue:
return super.tableView(tableView, indentationLevelForRowAt: IndexPath(row: 0, section: CHILD_BILL_DETAIL_SECTION.COST.rawValue))
case CHILD_BILL_DETAIL_SECTION.BORROW.rawValue:
return super.tableView(tableView, indentationLevelForRowAt: IndexPath(row: 0, section: CHILD_BILL_DETAIL_SECTION.BORROW.rawValue))
default:
break
}
return super.tableView(tableView, indentationLevelForRowAt: indexPath)
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue { if indexPath.section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue {
if indexPath.row == kZERO { if indexPath.row == kZERO {
...@@ -197,7 +240,51 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -197,7 +240,51 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
return afterAttachmentHeight + 15 return afterAttachmentHeight + 15
} }
} }
if indexPath.section == CHILD_BILL_DETAIL_SECTION.COST.rawValue || indexPath.section == CHILD_BILL_DETAIL_SECTION.BORROW.rawValue {
if indexPath.row == kZERO {
return 30
}
return kCellHeight
}
return super.tableView(tableView, heightForRowAt: indexPath) return super.tableView(tableView, heightForRowAt: indexPath)
} }
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
switch indexPath.section {
case CHILD_BILL_DETAIL_SECTION.COST.rawValue:
if indexPath.row == kZERO {
return
}
let costVc = ChildBillDetailCostViewController.instantiateViewController(.Function) as! ChildBillDetailCostViewController
costVc.costModel = childBillViewModel.childBillDetailData.costArray[indexPath.row - kONE]
pushVC(costVc)
break
case CHILD_BILL_DETAIL_SECTION.BORROW.rawValue:
if indexPath.row == kZERO {
return
}
let borrowVc = ChildBillDetailBorrowViewController.instantiateViewController(.Function) as! ChildBillDetailBorrowViewController
borrowVc.borrowModel = childBillViewModel.childBillDetailData.executeMateriels[indexPath.row - kONE]
pushVC(borrowVc)
break
default:
break
}
}
} }
...@@ -104,7 +104,7 @@ class RepairOrderDetailBgController: BaseViewController { ...@@ -104,7 +104,7 @@ class RepairOrderDetailBgController: BaseViewController {
// MARK: - 工单底部view // MARK: - 工单底部view
fileprivate func rapairBillBottomViewAction(_ state: String) { 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 { if state == SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.DELETED.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.CANCLED.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.CREATED.rawValue {
bottomLayoutHeight.constant = 0 bottomLayoutHeight.constant = 0
UIView.animate(withDuration: kAnimationTime, animations: { UIView.animate(withDuration: kAnimationTime, animations: {
self.view.layoutIfNeeded() self.view.layoutIfNeeded()
...@@ -115,6 +115,24 @@ class RepairOrderDetailBgController: BaseViewController { ...@@ -115,6 +115,24 @@ class RepairOrderDetailBgController: BaseViewController {
self.view.layoutIfNeeded() self.view.layoutIfNeeded()
}) })
} }
if state == SUBMIT_REPAIR_ORDER_STATE.CREATED.rawValue {
setupSendButtonItem()
}
}
// MARK: - 设置发出按钮
fileprivate func setupSendButtonItem() {
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "发出", style: .done, target: self, action: #selector(RepairOrderDetailBgController.sendBtnAction))
}
// MARK: - 发出工单
@objc func sendBtnAction() {
orderDetailViewModel.usefulWorkBillAction(billModel.uuid).subscribe(onNext: {[weak self] () in
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_LIST)))
self?.popVC()
ShowMessage("工单已发出")
}).disposed(by: disposeBag)
} }
// MARK: - 设置悬浮框 // MARK: - 设置悬浮框
......
...@@ -43,7 +43,6 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -43,7 +43,6 @@ class RepairOrderDetailViewController: BaseTableViewController {
@IBOutlet weak var requestTimeLab: UILabel! @IBOutlet weak var requestTimeLab: UILabel!
/// 位置 /// 位置
@IBOutlet weak var positionLabel: UILabel! @IBOutlet weak var positionLabel: UILabel!
/// 设施 /// 设施
@IBOutlet weak var deviceLab: UILabel! @IBOutlet weak var deviceLab: UILabel!
/// 设施位置 /// 设施位置
...@@ -56,6 +55,9 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -56,6 +55,9 @@ class RepairOrderDetailViewController: BaseTableViewController {
@IBOutlet weak var isSolveLabel: UILabel! @IBOutlet weak var isSolveLabel: UILabel!
/// 完成情况 /// 完成情况
@IBOutlet weak var completionLabel: UILabel! @IBOutlet weak var completionLabel: UILabel!
/// 备注
@IBOutlet weak var remarkLabel: UILabel!
/// 附件宽度 /// 附件宽度
let imageWidth = ((kWidth - 90) - CGFloat((3 + kONE) * 5)) / 3 let imageWidth = ((kWidth - 90) - CGFloat((3 + kONE) * 5)) / 3
/// 工单状态回调 /// 工单状态回调
...@@ -94,8 +96,8 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -94,8 +96,8 @@ class RepairOrderDetailViewController: BaseTableViewController {
/// 位置图图片附件 /// 位置图图片附件
lazy final var locationAttVc: PhotoAttachmentViewController = { lazy final var locationAttVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController var locationAttVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
return attachmentVc return locationAttVc
}() }()
override func viewDidLoad() { override func viewDidLoad() {
...@@ -219,14 +221,15 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -219,14 +221,15 @@ class RepairOrderDetailViewController: BaseTableViewController {
//获取位置图附件 //获取位置图附件
orderDetailViewModel.downloadLocationAttAction(ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue).subscribe(onNext: {[weak self] (attachments) in orderDetailViewModel.downloadLocationAttAction(ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue).subscribe(onNext: {[weak self] (attachments) in
self?.locationAttVc.attachmentViewModel.photoAttachments.removeAll() self?.locationAttVc.attachmentViewModel.photoAttachments.removeAll()
for model in attachments { let model = attachments.first
if let model = model {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName) 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.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)
self?.locationAttVc.setItemSize(CGSize(width: self!.imageWidth, height: self!.imageWidth),self!.attachmentCount) let attHeight = self?.locationAttVc.attachmentHeight(kONE,nil)
let attHeight = self?.locationAttVc.attachmentHeight(attachments.count,nil) if attHeight! > self!.locationAttHeight {
if attHeight! > self!.locationAttHeight { self?.locationAttHeight = attHeight
self?.locationAttHeight = attHeight }
} }
self?.tableView.reloadData() self?.tableView.reloadData()
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
...@@ -249,7 +252,9 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -249,7 +252,9 @@ class RepairOrderDetailViewController: BaseTableViewController {
// MARK: - 转交工单...查询、选择部门 // MARK: - 转交工单...查询、选择部门
func transferRepairOrder() { func transferRepairOrder() {
orderDetailViewModel.queryRepairOrderDepartmentAction().subscribe(onNext: {[weak self] (resuleModel) in let model = QueryModel()
model.storeUuidEquals = orderDetailViewModel.billDetailModel.store.uuid
orderDetailViewModel.queryRepairOrderDepartmentAction(model).subscribe(onNext: {[weak self] (resuleModel) in
self?.orderDetailViewModel.repairOrderDepartmentChoice(resuleModel, self!).subscribe(onNext: { (result) in self?.orderDetailViewModel.repairOrderDepartmentChoice(resuleModel, self!).subscribe(onNext: { (result) in
ShowAlertView(hint, result.0, [cancel,sure], .alert, { (index) in ShowAlertView(hint, result.0, [cancel,sure], .alert, { (index) in
self?.transferRepairOrderAction(result.1) self?.transferRepairOrderAction(result.1)
...@@ -350,6 +355,9 @@ extension RepairOrderDetailViewController { ...@@ -350,6 +355,9 @@ extension RepairOrderDetailViewController {
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 14 { if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 14 {
return attachmentHeight + 20 return attachmentHeight + 20
} }
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 15 {
return orderDetailViewModel.billDetailModel.noteHeight + 20
}
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.COMPLETED.rawValue && indexPath.row == 1 { if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.COMPLETED.rawValue && indexPath.row == 1 {
return orderDetailViewModel.billDetailModel.finishNoteHeight + 20 return orderDetailViewModel.billDetailModel.finishNoteHeight + 20
} }
......
...@@ -119,7 +119,7 @@ class RepairOrderViewController: BaseTableViewPullController { ...@@ -119,7 +119,7 @@ class RepairOrderViewController: BaseTableViewPullController {
default: default:
break break
} }
self?.tableView.reloadData() self?.reloadData()
}.disposed(by: disposeBag) }.disposed(by: disposeBag)
} }
......
...@@ -57,9 +57,9 @@ open class ChildBillDetailData : NSObject{ ...@@ -57,9 +57,9 @@ open class ChildBillDetailData : NSObject{
var createTime : String! var createTime : String!
var dept : UCN! var dept : UCN!
var endAttachmentId : String! var endAttachmentId : String!
// var executeMateriels : [AnyObject]! var executeMateriels : [ExecuteMateriel]!
var costArray : [ExecuteMateriel]!
var executeNo : String! var executeNo : String!
// var executeOutsources : [AnyObject]!
var hasOut : Bool! var hasOut : Bool!
var hasPaid : Bool! var hasPaid : Bool!
var labourfee : String! var labourfee : String!
...@@ -104,6 +104,17 @@ open class ChildBillDetailData : NSObject{ ...@@ -104,6 +104,17 @@ open class ChildBillDetailData : NSObject{
if !deptJson.isEmpty{ if !deptJson.isEmpty{
dept = UCN(fromJson: deptJson) dept = UCN(fromJson: deptJson)
} }
executeMateriels = [ExecuteMateriel]()
costArray = [ExecuteMateriel]()
let executeMaterielsArray = json["executeMateriels"].arrayValue
for executeMaterielsJson in executeMaterielsArray{
let value = ExecuteMateriel(fromJson: executeMaterielsJson)
if value.sourceType == CHILDORDERCOST_TYPE.COST.rawValue {
costArray.append(value)
}else {
executeMateriels.append(value)
}
}
endAttachmentId = json["endAttachmentId"].stringValue endAttachmentId = json["endAttachmentId"].stringValue
executeNo = json["executeNo"].stringValue executeNo = json["executeNo"].stringValue
hasOut = json["hasOut"].boolValue hasOut = json["hasOut"].boolValue
...@@ -157,9 +168,9 @@ open class ChildBillDetailData : NSObject{ ...@@ -157,9 +168,9 @@ open class ChildBillDetailData : NSObject{
if endAttachmentId != nil{ if endAttachmentId != nil{
dictionary["endAttachmentId"] = endAttachmentId dictionary["endAttachmentId"] = endAttachmentId
} }
// if !executeMateriels.isEmpty { if !executeMateriels.isEmpty {
// dictionary["executeMateriels"] = executeMateriels dictionary["executeMateriels"] = executeMateriels
// } }
if executeNo != nil{ if executeNo != nil{
dictionary["executeNo"] = executeNo dictionary["executeNo"] = executeNo
} }
...@@ -231,6 +242,126 @@ open class ChildBillDetailData : NSObject{ ...@@ -231,6 +242,126 @@ open class ChildBillDetailData : NSObject{
} }
return dictionary return dictionary
} }
}
class ExecuteMateriel : NSObject{
var backQty : String!
var batchNo : String!
var createId : String!
var createOperName : String!
var createTime : String!
var getQty : Float!
var lastModifyId : String!
var lastModifyOperName : String!
var lastModifyTime : String!
var materiel : UCN!
var outputbillno : String!
var outputid : String!
var sourceId : String!
var sourceType : String!
var unitPrice : Float!
var useQty : Double!
var uuid : String!
var version : Int!
var workexecuteid : String!
/**
* Instantiate the instance using the passed json values to set the properties values
*/
init(fromJson json: JSON!){
if json.isEmpty{
return
}
backQty = json["backQty"].stringValue
batchNo = json["batchNo"].stringValue
createId = json["create_id"].stringValue
createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue
getQty = json["getQty"].floatValue
lastModifyId = json["lastModify_id"].stringValue
lastModifyOperName = json["lastModify_operName"].stringValue
lastModifyTime = json["lastModify_time"].stringValue
let materielJson = json["materiel"]
if !materielJson.isEmpty{
materiel = UCN(fromJson: materielJson)
}
outputbillno = json["outputbillno"].stringValue
outputid = json["outputid"].stringValue
sourceId = json["sourceId"].stringValue
sourceType = json["sourceType"].stringValue
unitPrice = json["unitPrice"].floatValue
useQty = json["useQty"].doubleValue
uuid = json["uuid"].stringValue
version = json["version"].intValue
workexecuteid = json["workexecuteid"].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 backQty != nil{
dictionary["backQty"] = backQty
}
if batchNo != nil{
dictionary["batchNo"] = batchNo
}
if createId != nil{
dictionary["create_id"] = createId
}
if createOperName != nil{
dictionary["create_operName"] = createOperName
}
if createTime != nil{
dictionary["create_time"] = createTime
}
if getQty != nil{
dictionary["getQty"] = getQty
}
if lastModifyId != nil{
dictionary["lastModify_id"] = lastModifyId
}
if lastModifyOperName != nil{
dictionary["lastModify_operName"] = lastModifyOperName
}
if lastModifyTime != nil{
dictionary["lastModify_time"] = lastModifyTime
}
if materiel != nil{
dictionary["materiel"] = materiel.toDictionary()
}
if outputbillno != nil{
dictionary["outputbillno"] = outputbillno
}
if outputid != nil{
dictionary["outputid"] = outputid
}
if sourceId != nil{
dictionary["sourceId"] = sourceId
}
if sourceType != nil{
dictionary["sourceType"] = sourceType
}
if unitPrice != nil{
dictionary["unitPrice"] = unitPrice
}
if useQty != nil{
dictionary["useQty"] = useQty
}
if uuid != nil{
dictionary["uuid"] = uuid
}
if version != nil{
dictionary["version"] = version
}
if workexecuteid != nil{
dictionary["workexecuteid"] = workexecuteid
}
return dictionary
}
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Create by 云霄 曹 on 12/1/2018 // Create by 云霄 曹 on 12/1/2018
// Copyright © 2018. All rights reserved. // Copyright © 2018. All rights reserved.
import Foundation import Foundation
import SwiftyJSON import SwiftyJSON
...@@ -84,6 +84,7 @@ open class BillDetailData : NSObject{ ...@@ -84,6 +84,7 @@ open class BillDetailData : NSObject{
var level : String! var level : String!
var materielfee : AnyObject! var materielfee : AnyObject!
var note : String! var note : String!
var noteHeight: CGFloat! = 10
var position : UCN! var position : UCN!
var receiveTime : String! var receiveTime : String!
var reportOrg : String! var reportOrg : String!
...@@ -124,7 +125,7 @@ open class BillDetailData : NSObject{ ...@@ -124,7 +125,7 @@ open class BillDetailData : NSObject{
createOperName = json["create_operName"].stringValue createOperName = json["create_operName"].stringValue
createTime = json["create_time"].stringValue createTime = json["create_time"].stringValue
descriptionField = json["description"].stringValue descriptionField = json["description"].stringValue
descriptionFieldHeight = descriptionField.calculateStringSize(CGSize(width: kWidth - 105, height: CGFloat.greatestFiniteMagnitude), font: UIFont.systemFont(ofSize: 13)).height descriptionFieldHeight = descriptionField.calculateStringSize(CGSize(width: kWidth - 105, height: CGFloat.greatestFiniteMagnitude), font: UIFont.systemFont(ofSize: 13)).height
let deviceJson = json["device"] let deviceJson = json["device"]
if !deviceJson.isEmpty{ if !deviceJson.isEmpty{
device = UCN(fromJson: deviceJson) device = UCN(fromJson: deviceJson)
...@@ -154,6 +155,8 @@ open class BillDetailData : NSObject{ ...@@ -154,6 +155,8 @@ open class BillDetailData : NSObject{
level = json["level"].stringValue level = json["level"].stringValue
materielfee = json["materielfee"] as AnyObject materielfee = json["materielfee"] as AnyObject
note = json["note"].stringValue note = json["note"].stringValue
noteHeight = note.calculateStringSize(CGSize(width: kWidth - 105, height: CGFloat.greatestFiniteMagnitude), font: UIFont.systemFont(ofSize: 13)).height
let positionJson = json["position"] let positionJson = json["position"]
if !positionJson.isEmpty{ if !positionJson.isEmpty{
position = UCN(fromJson: positionJson) position = UCN(fromJson: positionJson)
......
...@@ -19,6 +19,7 @@ open class SaveRepairOrderModel { ...@@ -19,6 +19,7 @@ open class SaveRepairOrderModel {
var reportOrg : String! var reportOrg : String!
var reportUser : UCN! var reportUser : UCN!
var store: UCN! var store: UCN!
var tenant: UCN!
var reporterPhone : String! var reporterPhone : String!
var requestTime : String! var requestTime : String!
var serviceType : String! var serviceType : String!
...@@ -49,6 +50,9 @@ open class SaveRepairOrderModel { ...@@ -49,6 +50,9 @@ open class SaveRepairOrderModel {
if store != nil{ if store != nil{
dictionary["store"] = store.toDictionary() dictionary["store"] = store.toDictionary()
} }
if tenant != nil{
dictionary["tenant"] = tenant.toDictionary()
}
if level != nil{ if level != nil{
dictionary["level"] = level dictionary["level"] = level
} }
......
//
// CostOrBorrowTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/3/12.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class CostOrBorrowTableViewCell: UITableViewCell {
/// item 标题
@IBOutlet weak var titleLabel: UILabel!
/// item 详情
@IBOutlet weak var detailLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
// MARK: - 更新cell
open func updateCell(_ model: ExecuteMateriel,_ indexPath: IndexPath) {
titleLabel.text = model.materiel.name
if model.sourceType == CHILDORDERCOST_TYPE.BORROW.rawValue {
detailLabel.text = model.outputbillno
}else {
detailLabel.text = String(format: "%.2f", model.getQty)
}
}
}
<?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="default" accessoryType="disclosureIndicator" indentationWidth="10" id="KGk-i7-Jjw" customClass="CostOrBorrowTableViewCell" customModule="IFS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<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="286" height="43.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="udf-Xr-Jev">
<rect key="frame" x="30" y="14" width="27" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lRF-hd-RRs">
<rect key="frame" x="277" y="14" width="9" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="udf-Xr-Jev" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="Jls-kE-DuC"/>
<constraint firstItem="lRF-hd-RRs" firstAttribute="centerY" secondItem="udf-Xr-Jev" secondAttribute="centerY" id="TYP-G4-1UJ"/>
<constraint firstItem="udf-Xr-Jev" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="30" id="bmV-3Q-CxJ"/>
<constraint firstAttribute="trailing" secondItem="lRF-hd-RRs" secondAttribute="trailing" id="dbH-2Z-guv"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="detailLabel" destination="lRF-hd-RRs" id="tvr-jN-hKH"/>
<outlet property="titleLabel" destination="udf-Xr-Jev" id="Eff-4D-AJy"/>
</connections>
</tableViewCell>
</objects>
</document>
...@@ -144,10 +144,50 @@ extension RepairOrderAddViewModel { ...@@ -144,10 +144,50 @@ extension RepairOrderAddViewModel {
controller.sourceLabel.text = text controller.sourceLabel.text = text
controller.sourceLabel.textColor = kBlackColor controller.sourceLabel.textColor = kBlackColor
self?.saveOrderModel.source = text self?.saveOrderModel.source = text
if text == "租区" {
NotificationCenter.default.post(name: NSNotification.Name(rawValue: UPDATE_REPAIRORDER_ADD_LIST), object: REPAIRORDER_STORE.SHOW.rawValue)
}else {
self?.saveOrderModel.tenant = nil
controller.tenantLabel.text = nil
NotificationCenter.default.post(name: NSNotification.Name(rawValue: UPDATE_REPAIRORDER_ADD_LIST), object: REPAIRORDER_STORE.HIDE.rawValue)
}
}, cancel: nil) }, cancel: nil)
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
break break
case IndexPath(row: 2, section: 0): case IndexPath(row: 2, section: 0):
if saveOrderModel.store == nil {
ShowMessage("请先选择项目")
return
}
let model = QueryModel()
model.storeUuidEquals = saveOrderModel.store.uuid
filterViewModel.queryTenant(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.tenantLabel.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!
controller.tenantLabel.text = choiceModel.title
controller.tenantLabel.textColor = kBlackColor
let model = result[index!]
let tenant = UCN(model.code, model.name, model.uuid)
self?.saveOrderModel.tenant = tenant
})
}).disposed(by: disposeBag)
break
case IndexPath(row: 3, section: 0):
filterViewModel.queryServerType().subscribe(onNext: {[weak self] (result) in filterViewModel.queryServerType().subscribe(onNext: {[weak self] (result) in
if result.isEmpty { if result.isEmpty {
ShowMessage("无数据") ShowMessage("无数据")
...@@ -160,7 +200,7 @@ extension RepairOrderAddViewModel { ...@@ -160,7 +200,7 @@ extension RepairOrderAddViewModel {
}, cancel: nil) }, cancel: nil)
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
break break
case IndexPath(row: 3, section: 0): case IndexPath(row: 4, section: 0):
filterViewModel.queryProrityOption().subscribe(onNext: {[weak self] (result) in filterViewModel.queryProrityOption().subscribe(onNext: {[weak self] (result) in
if result.isEmpty { if result.isEmpty {
ShowMessage("无数据") ShowMessage("无数据")
...@@ -173,8 +213,14 @@ extension RepairOrderAddViewModel { ...@@ -173,8 +213,14 @@ extension RepairOrderAddViewModel {
}, cancel: nil) }, cancel: nil)
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
break break
case IndexPath(row: 4, section: 0): case IndexPath(row: 5, section: 0):
filterViewModel.queryInitiator().subscribe(onNext: {[weak self] (result) in if saveOrderModel.store == nil {
ShowMessage("请先选择项目")
return
}
let model = QueryModel()
model.storeUuidEquals = saveOrderModel.store.uuid
filterViewModel.queryInitiator(model).subscribe(onNext: {[weak self] (result) in
if result.isEmpty { if result.isEmpty {
ShowMessage("无数据") ShowMessage("无数据")
return return
...@@ -200,24 +246,38 @@ extension RepairOrderAddViewModel { ...@@ -200,24 +246,38 @@ extension RepairOrderAddViewModel {
}) })
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
break break
case IndexPath(row: 6, section: 0): case IndexPath(row: 7, section: 0):
let defaultDate = controller.originatorTimeLabel.text == "工单接报时间" ? NSDate().httpParameterString() : controller.originatorTimeLabel.text let defaultDate = controller.originatorTimeLabel.text == "工单接报时间" ? NSDate().httpParameterString() : controller.originatorTimeLabel.text
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in var date: Date?
if saveOrderModel.requestTime != nil {
date = Date(fromString: saveOrderModel.requestTime, format: "yyyy-MM-dd HH:mm:ss")!
}
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: date, defaultDate: defaultDate, commit: {[weak self] (time) in
controller.originatorTimeLabel.text = time controller.originatorTimeLabel.text = time
controller.originatorTimeLabel.textColor = kBlackColor controller.originatorTimeLabel.textColor = kBlackColor
self?.saveOrderModel.receiveTime = time self?.saveOrderModel.receiveTime = time
}, cancel: nil) }, cancel: nil)
break break
case IndexPath(row: 7, section: 0): case IndexPath(row: 8, section: 0):
let defaultDate = controller.specifiedTimeLabel.text == "工单指定时间" ? NSDate().httpParameterString() : controller.originatorTimeLabel.text let defaultDate = controller.specifiedTimeLabel.text == "工单指定时间" ? NSDate().httpParameterString() : controller.originatorTimeLabel.text
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in var date = Date()
if saveOrderModel.receiveTime != nil {
date = Date(fromString: saveOrderModel.receiveTime, format: "yyyy-MM-dd HH:mm:ss")!
}
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: date, maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in
controller.specifiedTimeLabel.text = time controller.specifiedTimeLabel.text = time
controller.specifiedTimeLabel.textColor = kBlackColor controller.specifiedTimeLabel.textColor = kBlackColor
self?.saveOrderModel.requestTime = time self?.saveOrderModel.requestTime = time
}, cancel: nil) }, cancel: nil)
break break
case IndexPath(row: 8, section: 0): case IndexPath(row: 9, section: 0):
filterViewModel.queryLocation().subscribe(onNext: {[weak self] (result) in if saveOrderModel.store == nil {
ShowMessage("请先选择项目")
return
}
let model = QueryModel()
model.storeUuidEquals = saveOrderModel.store.uuid
filterViewModel.queryLocation(model).subscribe(onNext: {[weak self] (result) in
if result.isEmpty { if result.isEmpty {
ShowMessage("无数据") ShowMessage("无数据")
return return
...@@ -243,7 +303,7 @@ extension RepairOrderAddViewModel { ...@@ -243,7 +303,7 @@ extension RepairOrderAddViewModel {
}) })
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
break break
case IndexPath(row: 9, section: 0): case IndexPath(row: 10, section: 0):
if saveOrderModel.locationAttachmentId != nil { if saveOrderModel.locationAttachmentId != nil {
ShowAlertView(hint, "请选择操作类型", ["取消","重新编辑","查看"], .actionSheet, {[weak self] (index) in ShowAlertView(hint, "请选择操作类型", ["取消","重新编辑","查看"], .actionSheet, {[weak self] (index) in
switch index { switch index {
...@@ -267,7 +327,13 @@ extension RepairOrderAddViewModel { ...@@ -267,7 +327,13 @@ extension RepairOrderAddViewModel {
} }
break break
case IndexPath(row: 0, section: 1): case IndexPath(row: 0, section: 1):
filterViewModel.queryDevice().subscribe(onNext: {[weak self] (result) in if saveOrderModel.store == nil {
ShowMessage("请先选择项目")
return
}
let model = DeviceQueryModel()
model.storeUuidEquals = saveOrderModel.store.uuid
filterViewModel.queryDevice(model).subscribe(onNext: {[weak self] (result) in
if result.isEmpty { if result.isEmpty {
ShowMessage("无数据") ShowMessage("无数据")
return return
...@@ -336,11 +402,15 @@ extension RepairOrderAddViewModel { ...@@ -336,11 +402,15 @@ extension RepairOrderAddViewModel {
publicFilterVc.setNavigationTitle("筛选楼宇",.SINGLE, { (choices, index) in publicFilterVc.setNavigationTitle("筛选楼宇",.SINGLE, { (choices, index) in
let choiceModel = choices.first! let choiceModel = choices.first!
self?.filterViewModel.queryFloorlayer(choiceModel.uuid!).subscribe(onNext: { (result) in self?.filterViewModel.queryFloorlayer(choiceModel.uuid!).subscribe(onNext: { (result) in
if result.isEmpty {
self?.saveOrderModel.locationAttachmentId = nil
self?.saveOrderModel.locationAttachmentUrl = nil
ShowMessage("无楼层数据")
return
}
let editVc = EditImageViewController() let editVc = EditImageViewController()
let attachment = result.attachments.first!
editVc.type = .EDIT editVc.type = .EDIT
let urlString = String(format: attachmentUrl, attachment.entityType,attachment.entityUuid,attachment.fileName) editVc.imageArray = result
editVc.imageString = urlString
controller.pushVC(editVc) controller.pushVC(editVc)
editVc.setSaveImageBlock({ (imageUrl) in editVc.setSaveImageBlock({ (imageUrl) in
controller.specifiedLocationImg.image = UIImage(contentsOfFile: imageUrl) controller.specifiedLocationImg.image = UIImage(contentsOfFile: imageUrl)
......
...@@ -32,6 +32,24 @@ class RepairOrderDetailViewModel: BaseViewModel { ...@@ -32,6 +32,24 @@ class RepairOrderDetailViewModel: BaseViewModel {
extension RepairOrderDetailViewModel { extension RepairOrderDetailViewModel {
/// 发出工单
func usefulWorkBillAction(_ billUuid: String) ->Observable<Void> {
return Observable.create({ (observer) -> Disposable in
Network.request(target: .UsefulWorkBill(billUuid), success: { (json) in
let resultModel = PublicResultModel(fromJson: json)
if resultModel.success {
observer.onNext(())
}else {
ShowMessage(resultModel.message)
}
}, failure: { (error) in
ShowMessage(error.localizedDescription)
observer.onError(MoyaError.requestMapping(error.localizedDescription))
})
return Disposables.create()
})
}
/// 查询工单详情 /// 查询工单详情
func queryRepairOrderDetailAction(_ billUuid: String) ->Observable<Void>{ func queryRepairOrderDetailAction(_ billUuid: String) ->Observable<Void>{
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
...@@ -90,12 +108,12 @@ extension RepairOrderDetailViewModel { ...@@ -90,12 +108,12 @@ extension RepairOrderDetailViewModel {
} }
// MARK: - 查询工单转交部门 // MARK: - 查询工单转交部门
func queryRepairOrderDepartmentAction() ->Observable<DepartmentData> { func queryRepairOrderDepartmentAction(_ model: QueryModel) ->Observable<DepartmentData> {
if AppManager.shareInstance.userStoreModel != nil { if AppManager.shareInstance.userStoreModel != nil {
return queryRepairOrderDepartmentAction2() return queryRepairOrderDepartmentAction2()
}else { }else {
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
Network.request(target: .GetRepairOrderDepartment(), success: { (json) in Network.request(target: .GetRepairOrderDepartment(model), success: { (json) in
let resultModel = DepartmentResultModel(fromJson: json) let resultModel = DepartmentResultModel(fromJson: json)
if resultModel.success { if resultModel.success {
observer.onNext(resultModel.data) observer.onNext(resultModel.data)
...@@ -113,7 +131,7 @@ extension RepairOrderDetailViewModel { ...@@ -113,7 +131,7 @@ extension RepairOrderDetailViewModel {
// MARK: - 查询工单转交部门2(当前登录人所属项目不为空时调用) // MARK: - 查询工单转交部门2(当前登录人所属项目不为空时调用)
func queryRepairOrderDepartmentAction2() ->Observable<DepartmentData> { func queryRepairOrderDepartmentAction2() ->Observable<DepartmentData> {
return Observable.create({ (observer) -> Disposable in return Observable.create({ (observer) -> Disposable in
Network.request(target: .QueryStoreSubOrgs(AppManager.shareInstance.userStoreModel!.uuid), success: { (json) in Network.request(target: .QueryStoreSubOrgs(self.billDetailModel.store.uuid), success: { (json) in
let resultModel = DepartmentResultModel2(fromJson: json) let resultModel = DepartmentResultModel2(fromJson: json)
if resultModel.success { if resultModel.success {
let model = DepartmentData(fromJson: json) let model = DepartmentData(fromJson: json)
...@@ -190,7 +208,15 @@ extension RepairOrderDetailViewModel { ...@@ -190,7 +208,15 @@ extension RepairOrderDetailViewModel {
// MARK: - 工单详情赋值 // MARK: - 工单详情赋值
func billDetailAssignment(_ controller: RepairOrderDetailViewController) { func billDetailAssignment(_ controller: RepairOrderDetailViewController) {
controller.sourceLab.text = disposeEmpty(billDetailModel.source) var source: String?
if billDetailModel.source == "租区" {
source = String(format: "%@,商户: (%@)", billDetailModel.source,billDetailModel.tenant.name)
}else {
source = String(format: "%@", billDetailModel.source)
}
controller.descriptionLab.adjustsFontSizeToFitWidth = true
controller.remarkLabel.adjustsFontSizeToFitWidth = true
controller.sourceLab.text = source
controller.serverTypeLab.text = disposeEmpty(billDetailModel.serviceType) controller.serverTypeLab.text = disposeEmpty(billDetailModel.serviceType)
controller.priorityLab.text = disposeEmpty(billDetailModel.level) controller.priorityLab.text = disposeEmpty(billDetailModel.level)
if billDetailModel.reportUser != nil { if billDetailModel.reportUser != nil {
...@@ -211,6 +237,7 @@ extension RepairOrderDetailViewModel { ...@@ -211,6 +237,7 @@ extension RepairOrderDetailViewModel {
controller.descriptionLab.text = disposeEmpty(billDetailModel.descriptionField) controller.descriptionLab.text = disposeEmpty(billDetailModel.descriptionField)
controller.billNumberLab.text = billDetailModel.workNo controller.billNumberLab.text = billDetailModel.workNo
controller.isSolveLabel.text = billDetailModel.finish ? "是" : "否" controller.isSolveLabel.text = billDetailModel.finish ? "是" : "否"
controller.remarkLabel.text = disposeEmpty(billDetailModel.note)
controller.completionLabel.text = disposeEmpty(billDetailModel.finishNote) controller.completionLabel.text = disposeEmpty(billDetailModel.finishNote)
if billDetailModel.store != nil { if billDetailModel.store != nil {
controller.projectLabel.text = disposeEmpty(billDetailModel.store.name) controller.projectLabel.text = disposeEmpty(billDetailModel.store.name)
......
...@@ -325,7 +325,9 @@ extension ReparirChildBillViewModel { ...@@ -325,7 +325,9 @@ extension ReparirChildBillViewModel {
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
break break
case IndexPath(row: 2, section: 0): case IndexPath(row: 2, section: 0):
filterViewModel.queryInitiator().subscribe(onNext: {[weak self] (result) in let model = QueryModel()
model.storeUuidEquals = childBillDetailData.dept.uuid
filterViewModel.queryInitiator(model).subscribe(onNext: {[weak self] (result) in
if result.isEmpty { if result.isEmpty {
ShowMessage("无数据") ShowMessage("无数据")
return return
...@@ -347,7 +349,11 @@ extension ReparirChildBillViewModel { ...@@ -347,7 +349,11 @@ extension ReparirChildBillViewModel {
break break
case IndexPath(row: 3, section: 0): case IndexPath(row: 3, section: 0):
let defaultDate = controller.placeTimeLabel.text == "请选择" ? NSDate().httpParameterString() : controller.placeTimeLabel.text let defaultDate = controller.placeTimeLabel.text == "请选择" ? NSDate().httpParameterString() : controller.placeTimeLabel.text
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in var date: Date?
if !childBillDetailData.processEnd.isEmpty {
date = Date(fromString: childBillDetailData.processEnd, format: "yyyy-MM-dd HH:mm:ss")!
}
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: date, defaultDate: defaultDate, commit: {[weak self] (time) in
controller.placeTimeLabel.text = time controller.placeTimeLabel.text = time
controller.placeTimeLabel.textColor = kBlackColor controller.placeTimeLabel.textColor = kBlackColor
self?.childBillDetailData.processBegin = time self?.childBillDetailData.processBegin = time
...@@ -355,7 +361,11 @@ extension ReparirChildBillViewModel { ...@@ -355,7 +361,11 @@ extension ReparirChildBillViewModel {
break break
case IndexPath(row: 4, section: 0): case IndexPath(row: 4, section: 0):
let defaultDate = controller.leaveTimeLabel.text == "请选择" ? NSDate().httpParameterString() : controller.leaveTimeLabel.text let defaultDate = controller.leaveTimeLabel.text == "请选择" ? NSDate().httpParameterString() : controller.leaveTimeLabel.text
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: Date(), maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in var date = Date()
if !childBillDetailData.processBegin.isEmpty {
date = Date(fromString: childBillDetailData.processBegin, format: "yyyy-MM-dd HH:mm:ss")!
}
YXPickerManager.share().showDatePickerView(kMainColor, datePickerModel: UIDatePickerMode.dateAndTime, minimumDate: date, maximumDate: nil, defaultDate: defaultDate, commit: {[weak self] (time) in
controller.leaveTimeLabel.text = time controller.leaveTimeLabel.text = time
controller.leaveTimeLabel.textColor = kBlackColor controller.leaveTimeLabel.textColor = kBlackColor
self?.childBillDetailData.processEnd = time self?.childBillDetailData.processEnd = time
...@@ -401,10 +411,15 @@ extension ReparirChildBillViewModel { ...@@ -401,10 +411,15 @@ extension ReparirChildBillViewModel {
sectionView.stateTimeLabel.text = childBillDetailData.createTime sectionView.stateTimeLabel.text = childBillDetailData.createTime
break break
case CHILD_BILL_DETAIL_SECTION.COST.rawValue: case CHILD_BILL_DETAIL_SECTION.COST.rawValue:
sectionView.sectionStateLabel.text = "费用与设备信息" sectionView.sectionStateLabel.text = "费用信息"
sectionView.stateTimeLabel.text = nil
break
case CHILD_BILL_DETAIL_SECTION.BORROW.rawValue:
sectionView.sectionStateLabel.text = "借用信息"
sectionView.stateTimeLabel.text = nil
break break
case CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue: case CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue:
sectionView.sectionStateLabel.text = "创建" sectionView.sectionStateLabel.text = "描述信息"
sectionView.stateTimeLabel.text = childBillDetailData.lastModifyTime sectionView.stateTimeLabel.text = childBillDetailData.lastModifyTime
break break
default: default:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.2</string> <string>1.0.3</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0.2</string> <string>1.0.3</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
......
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