Commit 714c2739 authored by 曹云霄's avatar 曹云霄

部门界面刷新控制,跳转控制,优化部分代码

parent d47bc6c6
This diff is collapsed.
...@@ -14,12 +14,12 @@ import Foundation ...@@ -14,12 +14,12 @@ import Foundation
//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/%@"
......
...@@ -120,7 +120,7 @@ extension Service: TargetType { ...@@ -120,7 +120,7 @@ extension Service: TargetType {
case .QuerybrokenOption: case .QuerybrokenOption:
return brokenOptionUrl return brokenOptionUrl
case .QueryprocessMethods: case .QueryprocessMethods:
return protectOptionUrl return processMethodsUrl
case .CompleteOrder: case .CompleteOrder:
return completedBillUrl return completedBillUrl
case .UploadAttachment(let model): case .UploadAttachment(let model):
......
...@@ -171,13 +171,16 @@ extension PhotoAttachmentViewController: ImagePickerDelegate { ...@@ -171,13 +171,16 @@ extension PhotoAttachmentViewController: ImagePickerDelegate {
// MARK: - 删除附件 // MARK: - 删除附件
extension PhotoAttachmentViewController: DeleteAttachmentDelegate { extension PhotoAttachmentViewController: DeleteAttachmentDelegate {
func deleteAttachment(_ indexPath: IndexPath) { func deleteAttachment(_ indexPath: IndexPath) {
attachmentViewModel.photoAttachments.remove(at: indexPath.item) ShowAlertView(hint, "确定删除此附件吗?", [cancel,sure], .actionSheet) {[weak self] (index) in
let count = attachmentViewModel.photoAttachments.count if index == kZERO { return }
let height = attachmentHeight(count,key) self?.attachmentViewModel.photoAttachments.remove(at: indexPath.item)
DispatchQueue.main.async(execute: { let count = self?.attachmentViewModel.photoAttachments.count
self.photoAttachmentCollectionView.reloadData() let height = self?.attachmentHeight(count!,self?.key)
self.delegate?.updatePhotoAttachment(height,self.key) DispatchQueue.main.async(execute: {
}) self?.photoAttachmentCollectionView.reloadData()
self?.delegate?.updatePhotoAttachment(height!,self?.key)
})
}
} }
} }
...@@ -12,7 +12,6 @@ import SKPhotoBrowser ...@@ -12,7 +12,6 @@ import SKPhotoBrowser
import RxSwift import RxSwift
import RxCocoa import RxCocoa
import SVProgressHUD import SVProgressHUD
import Async
class RepairOrderAddTableViewController: BaseTableViewController { class RepairOrderAddTableViewController: BaseTableViewController {
...@@ -82,64 +81,66 @@ class RepairOrderAddTableViewController: BaseTableViewController { ...@@ -82,64 +81,66 @@ class RepairOrderAddTableViewController: BaseTableViewController {
// MARK: - 提交工单--上传附件 // MARK: - 提交工单--上传附件
@objc fileprivate func submitButtonClickAction() { @objc fileprivate func submitButtonClickAction() {
var fileUrlArray = Array<String>() if !repairOrderAddViewModel.repairOrderAvailable(facilitiesSwitch) { return }
for i in 0..<attachmentVc.attachmentViewModel.photoAttachments.count - 1 { ShowAlertView(hint, "确认提交此工单吗?", [cancel,sure], .alert) {[weak self] (index) in
let image = attachmentVc.attachmentViewModel.photoAttachments[i] if index == kZERO { return }
let imageName = randomMD5() var fileUrlArray = Array<String>()
let fileUrl = saveImage(currentImage: image.attachment as! UIImage, persent: 0.8, imageName: imageName + ".jpg") for i in 0..<self!.attachmentVc.attachmentViewModel.photoAttachments.count - 1 {
fileUrlArray.append(fileUrl) let image = self?.attachmentVc.attachmentViewModel.photoAttachments[i]
} let imageName = self?.randomMD5()
let entityUuid = randomMD5() let fileUrl = self?.saveImage(currentImage: image?.attachment as! UIImage, persent: 0.8, imageName: imageName! + ".jpg")
guard fileUrlArray.count != kZERO else { fileUrlArray.append(fileUrl!)
submitRepairBillAction(entityUuid) }
return let entityUuid = self?.randomMD5()
} guard fileUrlArray.count != kZERO else {
var oberverArray = Array<Observable<Double>>() self?.submitRepairBillAction(entityUuid!)
for i in 0..<fileUrlArray.count { return
let fileUrl = fileUrlArray[i] }
let model = UploadPhotoAttachmentModel(randomMD5(), fileUrl, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue,entityUuid) var oberverArray = Array<Observable<Double>>()
let signal = Observable<Double>.create({ (oberver) -> Disposable in for i in 0..<fileUrlArray.count {
Network.upload(target: .UploadAttachment(model), progress: { (progress) in let fileUrl = fileUrlArray[i]
oberver.onNext(progress) let model = UploadPhotoAttachmentModel(self!.randomMD5(), fileUrl, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue,entityUuid!)
}, success: { (json) in let signal = Observable<Double>.create({ (oberver) -> Disposable in
oberver.onCompleted() Network.upload(target: .UploadAttachment(model), progress: { (progress) in
}, failure: { (error) in oberver.onNext(progress)
oberver.onError(error) }, success: { (json) in
oberver.onCompleted()
}, failure: { (error) in
oberver.onError(error)
})
return Disposables.create()
}) })
return Disposables.create() oberverArray.append(signal)
})
oberverArray.append(signal)
}
Observable.zip(oberverArray).subscribe {[weak self] (event) in
switch event {
case .next(let result):
var average: Double = 0
for progress in result {
average += progress
}
let perogress = average / Double(fileUrlArray.count)
ShowProgressView(Float(perogress))
break
case .completed:
self?.submitRepairBillAction(entityUuid)
break
case .error(let error):
SVProgressHUD.showError(withStatus: error.localizedDescription)
break
} }
}.disposed(by: disposeBag) Observable.zip(oberverArray).subscribe {[weak self] (event) in
switch event {
case .next(let result):
var average: Double = 0
for progress in result {
average += progress
}
let perogress = average / Double(fileUrlArray.count)
ShowProgressView(Float(perogress))
break
case .completed:
self?.submitRepairBillAction(entityUuid!)
break
case .error(let error):
SVProgressHUD.showError(withStatus: error.localizedDescription)
break
}
}.disposed(by: self!.disposeBag)
}
} }
// MARK: - 提交工单 // MARK: - 提交工单
fileprivate func submitRepairBillAction(_ entityUuid: String) { fileprivate func submitRepairBillAction(_ entityUuid: String) {
if repairOrderAddViewModel.repairOrderAvailable(facilitiesSwitch) { repairOrderAddViewModel.saveOrderModel.attachmentId = entityUuid
repairOrderAddViewModel.saveOrderModel.attachmentId = entityUuid repairOrderAddViewModel.submitRepairOrder().subscribe(onNext: {[weak self] (result) in
repairOrderAddViewModel.submitRepairOrder().subscribe(onNext: {[weak self] (result) in NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_LIST)))
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_LIST))) self?.popVC()
self?.popVC() ShowMessage("提交成功")
ShowMessage("提交成功") }).disposed(by: disposeBag)
}).disposed(by: disposeBag)
}
} }
// MARK: - 设置附件VC // MARK: - 设置附件VC
......
...@@ -90,7 +90,7 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -90,7 +90,7 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
// MARK: - UI // MARK: - UI
fileprivate func uiConfigAction() { fileprivate func uiConfigAction() {
title = billModel.dept.name title = String(format: "%@工单详情", billModel.dept.name)
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())
...@@ -104,6 +104,7 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -104,6 +104,7 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
self?.childBillViewModel.childBillDetailAssignment(self!) self?.childBillViewModel.childBillDetailAssignment(self!)
self?.childBillViewModel.billDetailStataDispose(self!) self?.childBillViewModel.billDetailStataDispose(self!)
self?.disposeAttachment() self?.disposeAttachment()
self?.tableView.reloadData()
}.disposed(by: disposeBag) }.disposed(by: disposeBag)
} }
...@@ -143,14 +144,14 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController { ...@@ -143,14 +144,14 @@ class RepairOrderChildBillDetailViewController: BaseTableViewController {
if indexPath.section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue { if indexPath.section == CHILD_BILL_DETAIL_SECTION.DESCRIBE.rawValue {
if indexPath.row == kONE { if indexPath.row == kONE {
let beforCell = tableView.dequeueReusableCell(withIdentifier: MaintainBeforAttachmentTableViewCell.name(), for: indexPath) let beforCell = tableView.dequeueReusableCell(withIdentifier: MaintainBeforAttachmentTableViewCell.name(), for: indexPath)
beforAttachmentVc.view.frame = CGRect(x: 80, y: 0, width: kWidth - 80, height: beforAttachmentHeight) beforAttachmentVc.view.frame = CGRect(x: 80, y: 0, width: kWidth - 90, height: beforAttachmentHeight)
beforCell.contentView.addSubview(beforAttachmentVc.view) beforCell.contentView.addSubview(beforAttachmentVc.view)
beforAttachmentVc.photoAttachmentCollectionView.reloadData() beforAttachmentVc.photoAttachmentCollectionView.reloadData()
return beforCell return beforCell
} }
if indexPath.row == kONE * 2 { if indexPath.row == kONE * 2 {
let afterCell = tableView.dequeueReusableCell(withIdentifier: MaintainAfterAttachmentTableViewCell.name(), for: indexPath) let afterCell = tableView.dequeueReusableCell(withIdentifier: MaintainAfterAttachmentTableViewCell.name(), for: indexPath)
afterAttachmentVc.view.frame = CGRect(x: 80, y: 0, width: kWidth - 80, height: afterAttachmentHeight) afterAttachmentVc.view.frame = CGRect(x: 80, y: 0, width: kWidth - 90, height: afterAttachmentHeight)
afterCell.contentView.addSubview(afterAttachmentVc.view) afterCell.contentView.addSubview(afterAttachmentVc.view)
afterAttachmentVc.photoAttachmentCollectionView.reloadData() afterAttachmentVc.photoAttachmentCollectionView.reloadData()
return afterCell return afterCell
......
...@@ -67,11 +67,11 @@ class RepairOrderDetailBgController: BaseViewController { ...@@ -67,11 +67,11 @@ class RepairOrderDetailBgController: BaseViewController {
self?.suspendView?.alpha = alpha self?.suspendView?.alpha = alpha
} }
detailVc.setSuspendViewStateBlock {[weak self] (model, indexPath,state) in detailVc.setSuspendViewStateBlock {[weak self] (model, indexPath,state) in
if state == SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue { if state == SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue || state == SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue {
self?.setupSuspendViewAction(model,indexPath) self?.setupSuspendViewAction(model,indexPath)
}else { }else {
UIView.animate(withDuration: kAnimationTime, animations: { UIView.animate(withDuration: kAnimationTime, animations: {
self?.suspendView?.seth(h: kHeight) self?.suspendView?.sety(y: kHeight)
}, completion: { (bool) in }, completion: { (bool) in
self?.suspendView?.removeFromSuperview() self?.suspendView?.removeFromSuperview()
}) })
...@@ -113,6 +113,7 @@ class RepairOrderDetailBgController: BaseViewController { ...@@ -113,6 +113,7 @@ class RepairOrderDetailBgController: BaseViewController {
// MARK: - 设置悬浮框 // MARK: - 设置悬浮框
fileprivate func setupSuspendViewAction(_ model: BillDetailExecute, _ indexPath: IndexPath) { fileprivate func setupSuspendViewAction(_ model: BillDetailExecute, _ indexPath: IndexPath) {
self.suspendView?.removeFromSuperview()
let suspendView = RepairOrderDetailSuspendView.instantiateFromNib() as! RepairOrderDetailSuspendView let suspendView = RepairOrderDetailSuspendView.instantiateFromNib() as! RepairOrderDetailSuspendView
suspendView.updateSuspendView(model, indexPath) suspendView.updateSuspendView(model, indexPath)
suspendView.frame = CGRect(x: 15, y: kHeight, width: kWidth - 30, height: 60) suspendView.frame = CGRect(x: 15, y: kHeight, width: kWidth - 30, height: 60)
......
...@@ -38,6 +38,8 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -38,6 +38,8 @@ class RepairOrderDetailViewController: BaseTableViewController {
@IBOutlet weak var createTimeLab: UILabel! @IBOutlet weak var createTimeLab: UILabel!
/// 指定时间 /// 指定时间
@IBOutlet weak var requestTimeLab: UILabel! @IBOutlet weak var requestTimeLab: UILabel!
/// 位置
@IBOutlet weak var positionLabel: UILabel!
/// 设施 /// 设施
@IBOutlet weak var deviceLab: UILabel! @IBOutlet weak var deviceLab: UILabel!
/// 设施位置 /// 设施位置
...@@ -73,7 +75,11 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -73,7 +75,11 @@ class RepairOrderDetailViewController: BaseTableViewController {
/// 工单数据 /// 工单数据
open var billModel: RepairOrderRecord! open var billModel: RepairOrderRecord!
/// 图片附件高度 /// 图片附件高度
var attachmentHeight: CGFloat! = 0 var attachmentHeight: CGFloat! = 20
/// 子工单高度
let childBillCellHeight: CGFloat! = 70
/// 附件每行显示个数
let attachmentCount: Int = 3
/// 图片附件 /// 图片附件
lazy final var attachmentVc: PhotoAttachmentViewController = { lazy final var attachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
...@@ -136,7 +142,11 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -136,7 +142,11 @@ class RepairOrderDetailViewController: BaseTableViewController {
fileprivate func suspendViewStateAction() { fileprivate func suspendViewStateAction() {
for i in 0..<orderDetailViewModel.billDetailModel.executes.count { for i in 0..<orderDetailViewModel.billDetailModel.executes.count {
let model = orderDetailViewModel.billDetailModel.executes[i] let model = orderDetailViewModel.billDetailModel.executes[i]
if model.dept.uuid == kUser().orgUuid && model.state == SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue { if model.dept.uuid == kUser().orgUuid
&& (model.state == SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue || model.state == SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue)
&& orderDetailViewModel.billDetailModel.state != SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue
&& orderDetailViewModel.billDetailModel.state != SUBMIT_REPAIR_ORDER_STATE.CANCLED.rawValue
&& orderDetailViewModel.billDetailModel.state != SUBMIT_REPAIR_ORDER_STATE.DELETED.rawValue {
self.suspendViewStateBlock(model,IndexPath(row: i, section: REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue),model.state) self.suspendViewStateBlock(model,IndexPath(row: i, section: REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue),model.state)
break break
} }
...@@ -152,31 +162,37 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -152,31 +162,37 @@ class RepairOrderDetailViewController: BaseTableViewController {
ShowAlertView(hint, "请确认是否领单?", [cancel,sure], .alert, {[weak self] (index) in ShowAlertView(hint, "请确认是否领单?", [cancel,sure], .alert, {[weak self] (index) in
if index == kZERO { return } if index == kZERO { return }
self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in
ShowMessage("领取成功")
self?.getBillDetailAction() self?.getBillDetailAction()
self?.gotoEditingSonOrderVc(indexPath) self?.gotoEditingSonOrderVc(indexPath)
ShowMessage("领取成功")
}).disposed(by: self!.disposeBag) }).disposed(by: self!.disposeBag)
}) })
}else { }else {
childBillViewModel.childBillDetailData = ChildBillDetailData(fromJson: JSON(model.toDictionary())) ShowAlertView(hint, "请确认是否完成此部门工单?", [cancel,sure], .alert, {[weak self] (index) in
childBillViewModel.finishChildBillAction().subscribe(onNext: {[weak self] () in if index == kZERO { return }
ShowMessage("子工单完成") self?.childBillViewModel.childBillDetailData = ChildBillDetailData(fromJson: JSON(model.toDictionary()))
self?.getBillDetailAction() self?.childBillViewModel.finishChildBillAction().subscribe(onNext: { () in
}).disposed(by:disposeBag) self?.getBillDetailAction()
ShowMessage("子工单完成")
}).disposed(by:self!.disposeBag)
})
} }
} }
// MARK: - 获取图片附件通过entity uuid // MARK: - 获取图片附件通过entity uuid
fileprivate func disposeAttachment() { fileprivate func disposeAttachment() {
orderDetailViewModel.downloadAttachmentAction(ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue).subscribe(onNext: {[weak self] (attachments) in orderDetailViewModel.downloadAttachmentAction(ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue).subscribe(onNext: {[weak self] (attachments) in
self?.attachmentVc.attachmentViewModel.photoAttachments.removeAll() self?.attachmentVc.attachmentViewModel.photoAttachments.removeAll()
for model in attachments { for model in attachments {
let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName) let url = String(format: attachmentUrl, model.entityType,model.entityUuid,model.fileName)
self?.attachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel(url, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP)) self?.attachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel(url, ATTACHMENT_TYPE.BILL_ATTACHMENT_TYPE.rawValue, model.entityUuid, ATTACHMENT_LOCATION.ATTACHMENT_HTTP))
} }
self?.attachmentVc.setItemSize(CGSize(width: self!.imageWidth, height: self!.imageWidth),3) self?.attachmentVc.setItemSize(CGSize(width: self!.imageWidth, height: self!.imageWidth),self!.attachmentCount)
self?.attachmentHeight = self?.attachmentVc.attachmentHeight(attachments.count,nil) let attHeight = self?.attachmentVc.attachmentHeight(attachments.count,nil)
self?.tableView.reloadData() if attHeight! > self!.attachmentHeight {
self?.attachmentHeight = attHeight
}
self?.tableView.reloadData()
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
} }
...@@ -212,9 +228,9 @@ class RepairOrderDetailViewController: BaseTableViewController { ...@@ -212,9 +228,9 @@ class RepairOrderDetailViewController: BaseTableViewController {
model.deptUuids = array model.deptUuids = array
model.workUuid = orderDetailViewModel.billDetailModel.uuid model.workUuid = orderDetailViewModel.billDetailModel.uuid
orderDetailViewModel.transferRepairOrderAction(model).subscribe(onNext: {[weak self] () in orderDetailViewModel.transferRepairOrderAction(model).subscribe(onNext: {[weak self] () in
ShowMessage("转交成功")
self?.getBillDetailAction() self?.getBillDetailAction()
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_LIST))) NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_LIST)))
ShowMessage("转交成功")
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
} }
...@@ -233,9 +249,9 @@ extension RepairOrderDetailViewController { ...@@ -233,9 +249,9 @@ extension RepairOrderDetailViewController {
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue { if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue {
return orderDetailViewModel.dequeueChildBillReusableCell(RepairOrderSubOrderTableViewCell.name(), indexPath, tableView) return orderDetailViewModel.dequeueChildBillReusableCell(RepairOrderSubOrderTableViewCell.name(), indexPath, tableView)
} }
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 11 { if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 12 {
let attachmentCell = tableView.dequeueReusableCell(withIdentifier: RepairOrderAttachmentTableViewCell.name(), for: indexPath) let attachmentCell = tableView.dequeueReusableCell(withIdentifier: RepairOrderAttachmentTableViewCell.name(), for: indexPath)
attachmentVc.view.frame = CGRect(x: 80, y: 5, width: kWidth - 80, height: attachmentHeight) attachmentVc.view.frame = CGRect(x: 80, y: 5, width: kWidth - 90, height: attachmentHeight)
attachmentCell.contentView.addSubview(attachmentVc.view) attachmentCell.contentView.addSubview(attachmentVc.view)
return attachmentCell return attachmentCell
} }
...@@ -276,13 +292,16 @@ extension RepairOrderDetailViewController { ...@@ -276,13 +292,16 @@ extension RepairOrderDetailViewController {
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue { if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue {
return 70 if indexPath.row == orderDetailViewModel.billDetailModel.executes.count - kONE {
return childBillCellHeight + 10
}
return childBillCellHeight
} }
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 10 { if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 11 {
return orderDetailViewModel.billDetailModel.descriptionFieldHeight + 20 return orderDetailViewModel.billDetailModel.descriptionFieldHeight + 20
} }
if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 11 { if indexPath.section == REPAIR_ORDER_DETAIL_SECTION.SOURCE.rawValue && indexPath.row == 12 {
return attachmentHeight + 30 return attachmentHeight + 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
...@@ -302,14 +321,14 @@ extension RepairOrderDetailViewController { ...@@ -302,14 +321,14 @@ extension RepairOrderDetailViewController {
ShowAlertView(hint, "请确认是否领单?", [cancel,sure], .alert, {[weak self] (index) in ShowAlertView(hint, "请确认是否领单?", [cancel,sure], .alert, {[weak self] (index) in
if index == kZERO { return } if index == kZERO { return }
self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in
ShowMessage("领取成功")
self?.getBillDetailAction() self?.getBillDetailAction()
self?.gotoEditingSonOrderVc(indexPath) self?.gotoEditingSonOrderVc(indexPath)
ShowMessage("领取成功")
}).disposed(by: self!.disposeBag) }).disposed(by: self!.disposeBag)
}) })
break break
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue: case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
if orderDetailViewModel.billDetailModel.state == SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue { if orderDetailViewModel.billDetailModel.state == SUBMIT_REPAIR_ORDER_STATE.FINISHED.rawValue || orderDetailViewModel.billDetailModel.state == SUBMIT_REPAIR_ORDER_STATE.CANCLED.rawValue || orderDetailViewModel.billDetailModel.state == SUBMIT_REPAIR_ORDER_STATE.DELETED.rawValue {
self.performSegue(withIdentifier: RepairOrderChildBillDetailViewController.name(), sender: indexPath) self.performSegue(withIdentifier: RepairOrderChildBillDetailViewController.name(), sender: indexPath)
return return
} }
...@@ -347,9 +366,9 @@ extension RepairOrderDetailViewController { ...@@ -347,9 +366,9 @@ extension RepairOrderDetailViewController {
} }
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue { // if section == REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue {
return kSectionTen // return kSectionTen
} // }
return kSectionZero return kSectionZero
} }
......
...@@ -76,6 +76,7 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController { ...@@ -76,6 +76,7 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
// MARK: - UI // MARK: - UI
fileprivate func uiConfigAction() { fileprivate func uiConfigAction() {
describeTextView.placeholder = "描述" describeTextView.placeholder = "描述"
title = String(format: "完成%@工单", billModel.dept.name)
describeTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0) describeTextView.textContainerInset = UIEdgeInsetsMake(0, 0, 0, 0)
} }
...@@ -141,13 +142,16 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController { ...@@ -141,13 +142,16 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
let completeView = RepairOrderEditSonOrderCompleteView.instantiateFromNib() as! RepairOrderEditSonOrderCompleteView let completeView = RepairOrderEditSonOrderCompleteView.instantiateFromNib() as! RepairOrderEditSonOrderCompleteView
//完成子工单 //完成子工单
completeView.completeBtn.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in completeView.completeBtn.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.uploadActtachmentAction().subscribe(onNext: {[weak self] (result) in ShowAlertView(hint, "确定完成此子工单吗?", [cancel,sure], .alert, { (index) in
self?.childBillViewModel.finishChildBillAction().subscribe(onNext: { () in if index == kZERO { return }
ShowMessage("子工单完成") self?.uploadActtachmentAction().subscribe(onNext: { (result) in
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_DETAIL_LIST))) self?.childBillViewModel.finishChildBillAction().subscribe(onNext: { () in
self?.popVC() NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: UPDATE_BILL_DETAIL_LIST)))
self?.popVC()
ShowMessage("子工单完成")
}).disposed(by: self!.disposeBag)
}).disposed(by: self!.disposeBag) }).disposed(by: self!.disposeBag)
}).disposed(by: self!.disposeBag) })
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
tableView.tableFooterView = completeView tableView.tableFooterView = completeView
navigationItem.rightBarButtonItem = createButtonItem("保存", nil, self, #selector(RepairOrderEditSonOrderViewController.saveButtonClickAction)) navigationItem.rightBarButtonItem = createButtonItem("保存", nil, self, #selector(RepairOrderEditSonOrderViewController.saveButtonClickAction))
...@@ -155,12 +159,14 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController { ...@@ -155,12 +159,14 @@ class RepairOrderEditSonOrderViewController: BaseTableViewController {
// MARK: - 提交、保存子工单 // MARK: - 提交、保存子工单
@objc fileprivate func saveButtonClickAction() { @objc fileprivate func saveButtonClickAction() {
uploadActtachmentAction().subscribe(onNext: {[weak self] (result) in ShowAlertView(hint, "确定保存此子工单吗?", [cancel,sure], .alert) {[weak self] (index) in
self?.childBillViewModel.saveChildBillAction().subscribe(onNext: { () in self?.uploadActtachmentAction().subscribe(onNext: { (result) in
ShowMessage("保存成功") self?.childBillViewModel.saveChildBillAction().subscribe(onNext: { () in
self?.popVC() self?.popVC()
ShowMessage("保存成功")
}).disposed(by: self!.disposeBag)
}).disposed(by: self!.disposeBag) }).disposed(by: self!.disposeBag)
}).disposed(by: disposeBag) }
} }
// MARK: - 上传附件 // MARK: - 上传附件
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<constraint firstItem="j4V-Po-dFb" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="utU-tL-C0b"/> <constraint firstItem="j4V-Po-dFb" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="utU-tL-C0b"/>
</constraints> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="25" y="28.5"/> <point key="canvasLocation" x="25" y="28.5"/>
</tableViewCell> </tableViewCell>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<constraint firstItem="IBZ-p5-QTS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="uNv-wU-GyU"/> <constraint firstItem="IBZ-p5-QTS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="uNv-wU-GyU"/>
</constraints> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="-102" y="-17"/> <point key="canvasLocation" x="-102" y="-17"/>
</tableViewCell> </tableViewCell>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<constraint firstItem="BEL-rn-e0r" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="egr-iP-at2"/> <constraint firstItem="BEL-rn-e0r" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="egr-iP-at2"/>
</constraints> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="-72" y="20"/> <point key="canvasLocation" x="-72" y="20"/>
</tableViewCell> </tableViewCell>
......
//
// RepairOrderDetailBottomView.swift
// IFS
//
// Created by 曹云霄 on 2018/1/8.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class RepairOrderDetailBottomView: UIView {
/// 转交
@IBOutlet weak var transferButton: UIButton!
/// 完成
@IBOutlet weak var completeButton: UIButton!
}
<?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"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="RepairOrderDetailBottomView" customModule="IFS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="70"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1mh-aC-JRq">
<rect key="frame" x="0.0" y="21" width="187.5" height="49"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="Yza-1q-CFi"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="转交"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OGh-UT-VCv">
<rect key="frame" x="187.5" y="21" width="187.5" height="49"/>
<color key="backgroundColor" red="0.21755459899999999" green="0.53306800129999998" blue="0.99824184179999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="完成">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DWW-Eq-xjB">
<rect key="frame" x="0.0" y="20" width="375" height="1"/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="y4N-Dd-1UD"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Aqz-jC-Q2t">
<rect key="frame" x="0.0" y="69" width="375" height="1"/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="yfP-6J-aYK"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="1mh-aC-JRq" secondAttribute="bottom" id="36x-7m-r3b"/>
<constraint firstItem="OGh-UT-VCv" firstAttribute="leading" secondItem="1mh-aC-JRq" secondAttribute="trailing" id="3o0-od-HLJ"/>
<constraint firstItem="Aqz-jC-Q2t" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="8fA-X7-kX2"/>
<constraint firstAttribute="bottom" secondItem="OGh-UT-VCv" secondAttribute="bottom" id="G0O-pu-dCE"/>
<constraint firstItem="1mh-aC-JRq" firstAttribute="top" secondItem="DWW-Eq-xjB" secondAttribute="bottom" id="Z1M-y1-9yS"/>
<constraint firstItem="OGh-UT-VCv" firstAttribute="width" secondItem="1mh-aC-JRq" secondAttribute="width" id="ZtD-ny-5Rc"/>
<constraint firstAttribute="trailing" secondItem="DWW-Eq-xjB" secondAttribute="trailing" id="bNC-PD-AEV"/>
<constraint firstItem="OGh-UT-VCv" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="dM9-er-Dd0"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="Aqz-jC-Q2t" secondAttribute="bottom" id="jd2-Ct-hvz"/>
<constraint firstItem="DWW-Eq-xjB" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="jmE-PH-fKI"/>
<constraint firstItem="1mh-aC-JRq" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="p6k-LW-ads"/>
<constraint firstItem="OGh-UT-VCv" firstAttribute="height" secondItem="1mh-aC-JRq" secondAttribute="height" id="rxI-cN-5oE"/>
<constraint firstItem="Aqz-jC-Q2t" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="wvI-jq-ap2"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<connections>
<outlet property="completeButton" destination="OGh-UT-VCv" id="vk6-oA-yP7"/>
<outlet property="transferButton" destination="1mh-aC-JRq" id="P0y-jq-TXN"/>
</connections>
<point key="canvasLocation" x="-100.5" y="-210"/>
</view>
</objects>
</document>
...@@ -47,11 +47,11 @@ class RepairOrderDetailSuspendView: UIView { ...@@ -47,11 +47,11 @@ class RepairOrderDetailSuspendView: UIView {
operationTimeLab.text = model.lastModifyTime operationTimeLab.text = model.lastModifyTime
departmentLab.text = model.dept.name departmentLab.text = model.dept.name
switch model.state { switch model.state {
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue: case SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue:
operationOrderBtn.setTitle(SUSPEND_BUTTON_TYPE.GET.rawValue, for: .normal) operationOrderBtn.setTitle(SUSPEND_BUTTON_TYPE.GET.rawValue, for: .normal)
operationOrderBtn.backgroundColor = kBlueColor operationOrderBtn.backgroundColor = kBlueColor
break break
case SUBMIT_REPAIR_ORDER_STATE.DONE.rawValue: case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
operationOrderBtn.setTitle(SUSPEND_BUTTON_TYPE.COMPLETED.rawValue, for: .normal) operationOrderBtn.setTitle(SUSPEND_BUTTON_TYPE.COMPLETED.rawValue, for: .normal)
operationOrderBtn.backgroundColor = kYellowColor operationOrderBtn.backgroundColor = kYellowColor
break break
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
</subviews> </subviews>
<constraints> <constraints>
<constraint firstAttribute="trailing" secondItem="WXJ-0x-D52" secondAttribute="trailing" constant="15" id="E7i-7V-QDq"/> <constraint firstAttribute="trailing" secondItem="WXJ-0x-D52" secondAttribute="trailing" constant="15" id="E7i-7V-QDq"/>
<constraint firstAttribute="height" constant="60" id="JJB-hv-kxn"/>
<constraint firstItem="jv3-76-R1p" firstAttribute="centerY" secondItem="iXK-9n-8CZ" secondAttribute="centerY" multiplier="0.6" id="OoP-za-6WD"/> <constraint firstItem="jv3-76-R1p" firstAttribute="centerY" secondItem="iXK-9n-8CZ" secondAttribute="centerY" multiplier="0.6" id="OoP-za-6WD"/>
<constraint firstItem="2Os-EU-PFL" firstAttribute="centerY" secondItem="JPd-pD-Y4s" secondAttribute="centerY" id="SAb-QY-DX7"/> <constraint firstItem="2Os-EU-PFL" firstAttribute="centerY" secondItem="JPd-pD-Y4s" secondAttribute="centerY" id="SAb-QY-DX7"/>
<constraint firstItem="WXJ-0x-D52" firstAttribute="centerY" secondItem="jv3-76-R1p" secondAttribute="centerY" id="dQC-3e-fCi"/> <constraint firstItem="WXJ-0x-D52" firstAttribute="centerY" secondItem="jv3-76-R1p" secondAttribute="centerY" id="dQC-3e-fCi"/>
...@@ -61,12 +62,12 @@ ...@@ -61,12 +62,12 @@
</view> </view>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="iXK-9n-8CZ" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="0FS-NV-dAg"/>
<constraint firstAttribute="trailing" secondItem="iXK-9n-8CZ" secondAttribute="trailing" constant="15" id="4Ki-3e-u2u"/> <constraint firstAttribute="trailing" secondItem="iXK-9n-8CZ" secondAttribute="trailing" constant="15" id="4Ki-3e-u2u"/>
<constraint firstItem="iXK-9n-8CZ" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="6m3-VS-Pp5"/>
<constraint firstAttribute="bottom" secondItem="iXK-9n-8CZ" secondAttribute="bottom" id="EJ3-vT-i23"/>
<constraint firstItem="iXK-9n-8CZ" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="hdP-Ty-wso"/> <constraint firstItem="iXK-9n-8CZ" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="hdP-Ty-wso"/>
</constraints> </constraints>
</tableViewCellContentView> </tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/> <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections> <connections>
<outlet property="contentBgView" destination="iXK-9n-8CZ" id="fiE-6x-Xdz"/> <outlet property="contentBgView" destination="iXK-9n-8CZ" id="fiE-6x-Xdz"/>
......
...@@ -55,8 +55,12 @@ extension RepairOrderAddViewModel { ...@@ -55,8 +55,12 @@ extension RepairOrderAddViewModel {
ShowMessage("请选择工单指定时间") ShowMessage("请选择工单指定时间")
return false return false
} }
guard saveOrderModel.reporterPhone != nil else { guard NSString(string: saveOrderModel.reporterPhone).isTelephone() != false else {
ShowMessage("请输入报事人电话") ShowMessage("报事人电话格式不正确")
return false
}
guard saveOrderModel.position != nil else {
ShowMessage("请选择工单指定位置")
return false return false
} }
guard saveOrderModel.position != nil else { guard saveOrderModel.position != nil else {
......
...@@ -145,27 +145,36 @@ extension RepairOrderDetailViewModel { ...@@ -145,27 +145,36 @@ extension RepairOrderDetailViewModel {
// MARK: - 工单详情赋值 // MARK: - 工单详情赋值
func billDetailAssignment(_ controller: RepairOrderDetailViewController) { func billDetailAssignment(_ controller: RepairOrderDetailViewController) {
controller.sourceLab.text = billDetailModel.source controller.sourceLab.text = disposeEmpty(billDetailModel.source)
controller.serverTypeLab.text = billDetailModel.serviceType controller.serverTypeLab.text = disposeEmpty(billDetailModel.serviceType)
controller.priorityLab.text = billDetailModel.level controller.priorityLab.text = disposeEmpty(billDetailModel.level)
if billDetailModel.reportUser != nil { if billDetailModel.reportUser != nil {
controller.userLab.text = billDetailModel.reportUser.name controller.userLab.text = disposeEmpty(billDetailModel.reportUser.name)
} }
controller.phoneLab.text = billDetailModel.reporterPhone controller.phoneLab.text = disposeEmpty(billDetailModel.reporterPhone)
controller.createTimeLab.text = billDetailModel.createTime controller.createTimeLab.text = disposeEmpty(billDetailModel.createTime)
controller.requestTimeLab.text = billDetailModel.requestTime controller.requestTimeLab.text = disposeEmpty(billDetailModel.requestTime)
if billDetailModel.device != nil { if billDetailModel.device != nil {
controller.deviceLocationLab.text = billDetailModel.deviceadree controller.deviceLocationLab.text = disposeEmpty(billDetailModel.deviceadree)
controller.deviceLab.text = billDetailModel.device.name controller.deviceLab.text = disposeEmpty(billDetailModel.device.name)
controller.brokenTimeLab.text = billDetailModel.brokenTime controller.brokenTimeLab.text = disposeEmpty(billDetailModel.brokenTime)
} }
if billDetailModel.position != nil { if billDetailModel.position != nil {
controller.deviceLocationLab.text = billDetailModel.position.name controller.positionLabel.text = disposeEmpty(billDetailModel.position.name)
} }
controller.descriptionLab.text = billDetailModel.descriptionField controller.deviceLocationLab.text = disposeEmpty(billDetailModel.deviceadree)
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.completionLabel.text = billDetailModel.finishNote controller.completionLabel.text = disposeEmpty(billDetailModel.finishNote)
}
// MARK: - 处理空数据
func disposeEmpty(_ string: String) ->String? {
if string.isEmpty {
return "---"
}
return string
} }
// MARK: - 工单详情状态处理 // MARK: - 工单详情状态处理
...@@ -261,7 +270,11 @@ extension RepairOrderDetailViewModel { ...@@ -261,7 +270,11 @@ extension RepairOrderDetailViewModel {
break break
case REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue: case REPAIR_ORDER_DETAIL_SECTION.SUBORDER.rawValue:
sectionView.sectionStateLabel.text = "创建" sectionView.sectionStateLabel.text = "创建"
// sectionView.stateTimeLabel.text = billDetailModel.executes.first?.createTime if billDetailModel.executes != nil {
sectionView.stateTimeLabel.text = billDetailModel.executes.first?.createTime
}else {
sectionView.stateTimeLabel.text = nil
}
break break
case REPAIR_ORDER_DETAIL_SECTION.COMPLETED.rawValue: case REPAIR_ORDER_DETAIL_SECTION.COMPLETED.rawValue:
sectionView.sectionStateLabel.text = "完成情况" sectionView.sectionStateLabel.text = "完成情况"
......
...@@ -138,6 +138,7 @@ extension RepairOrderViewModel { ...@@ -138,6 +138,7 @@ extension RepairOrderViewModel {
sender.addBorder(1.0, kGaryColor) sender.addBorder(1.0, kGaryColor)
sender.setTitle(text, for: .normal) sender.setTitle(text, for: .normal)
sender.horizontalCenterTitleAndImage(5) sender.horizontalCenterTitleAndImage(5)
self?.queryModel.source = text
observer.onNext(()) observer.onNext(())
}, cancel: { }, cancel: {
sender.isSelected = false sender.isSelected = false
......
...@@ -210,22 +210,21 @@ extension ReparirChildBillViewModel { ...@@ -210,22 +210,21 @@ extension ReparirChildBillViewModel {
// MARK: - 子工单赋值.查看 // MARK: - 子工单赋值.查看
func childBillDetailAssignment(_ controller: RepairOrderChildBillDetailViewController) { func childBillDetailAssignment(_ controller: RepairOrderChildBillDetailViewController) {
controller.workPersonLabel.text = disposeEmpty(childBillDetailData.processor) controller.workPersonLabel.text = disposeEmpty2(childBillDetailData.processor)
controller.placeTimeLabel.text = disposeEmpty(childBillDetailData.processBegin) controller.placeTimeLabel.text = disposeEmpty2(childBillDetailData.processBegin)
controller.leaveTimeLabel.text = disposeEmpty(childBillDetailData.processBegin) controller.leaveTimeLabel.text = disposeEmpty2(childBillDetailData.processBegin)
controller.failureCauseLabel.text = disposeEmpty(childBillDetailData.reason) controller.failureCauseLabel.text = disposeEmpty2(childBillDetailData.reason)
controller.processModeLabel.text = disposeEmpty(childBillDetailData.processMode) controller.processModeLabel.text = disposeEmpty2(childBillDetailData.processMode)
controller.materialCostLabel.text = disposeEmpty(childBillDetailData.materielfee)
if childBillDetailData.owner != nil { if childBillDetailData.owner != nil {
controller.operatorNameLabel.text = disposeEmpty(childBillDetailData.owner.name) controller.operatorNameLabel.text = disposeEmpty2(childBillDetailData.owner.name)
} }
controller.materialCostLabel.text = disposeEmpty(childBillDetailData.materielfee) controller.materialCostLabel.text = disposeEmpty2(childBillDetailData.materielfee)
controller.costLaborLabel.text = disposeEmpty(childBillDetailData.labourfee) controller.costLaborLabel.text = disposeEmpty2(childBillDetailData.labourfee)
controller.describeLabel.text = disposeEmpty(childBillDetailData.note) controller.describeLabel.text = disposeEmpty2(childBillDetailData.note)
controller.safetyProtectionLabel.text = disposeEmpty(childBillDetailData.processMode) controller.safetyProtectionLabel.text = disposeEmpty2(childBillDetailData.property2)
controller.backupsToolLabel.text = disposeEmpty(childBillDetailData.property1) controller.backupsToolLabel.text = disposeEmpty2(childBillDetailData.property1)
controller.billNumberTimeLabel.text = disposeEmpty(childBillDetailData.ownerTime) controller.billNumberTimeLabel.text = disposeEmpty2(childBillDetailData.ownerTime)
controller.billNumberLab.text = disposeEmpty(childBillDetailData.executeNo) controller.billNumberLab.text = disposeEmpty2(childBillDetailData.executeNo)
} }
// MARK: - 处理空数据 // MARK: - 处理空数据
...@@ -236,6 +235,14 @@ extension ReparirChildBillViewModel { ...@@ -236,6 +235,14 @@ extension ReparirChildBillViewModel {
return string return string
} }
// MARK: - 处理空数据
func disposeEmpty2(_ string: String) ->String? {
if string.isEmpty {
return "---"
}
return string
}
// MARK: - 工单详情状态处理 // MARK: - 工单详情状态处理
func billDetailStataDispose(_ controller: RepairOrderChildBillDetailViewController) { func billDetailStataDispose(_ controller: RepairOrderChildBillDetailViewController) {
switch childBillDetailData.state { switch childBillDetailData.state {
...@@ -293,6 +300,10 @@ extension ReparirChildBillViewModel { ...@@ -293,6 +300,10 @@ extension ReparirChildBillViewModel {
switch indexPath { switch indexPath {
case IndexPath(row: 0, section: 0): case IndexPath(row: 0, section: 0):
filterViewModel.queryToolOption().subscribe(onNext: {[weak self] (result) in filterViewModel.queryToolOption().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.toolOptionLabel.text, commit: { (text, index) in YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.toolOptionLabel.text, commit: { (text, index) in
controller.toolOptionLabel.text = text controller.toolOptionLabel.text = text
controller.toolOptionLabel.textColor = kBlackColor controller.toolOptionLabel.textColor = kBlackColor
...@@ -302,6 +313,10 @@ extension ReparirChildBillViewModel { ...@@ -302,6 +313,10 @@ extension ReparirChildBillViewModel {
break break
case IndexPath(row: 1, section: 0): case IndexPath(row: 1, section: 0):
filterViewModel.queryProtectOption().subscribe(onNext: {[weak self] (result) in filterViewModel.queryProtectOption().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.protectOptionLabel.text, commit: { (text, index) in YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.protectOptionLabel.text, commit: { (text, index) in
controller.protectOptionLabel.text = text controller.protectOptionLabel.text = text
controller.protectOptionLabel.textColor = kBlackColor controller.protectOptionLabel.textColor = kBlackColor
...@@ -311,6 +326,10 @@ extension ReparirChildBillViewModel { ...@@ -311,6 +326,10 @@ extension ReparirChildBillViewModel {
break break
case IndexPath(row: 2, section: 0): case IndexPath(row: 2, section: 0):
filterViewModel.queryInitiator().subscribe(onNext: {[weak self] (result) in filterViewModel.queryInitiator().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
let publicFilterVc = FilterViewController.instantiateViewController(.Function) as! FilterViewController let publicFilterVc = FilterViewController.instantiateViewController(.Function) as! FilterViewController
for model in result { for model in result {
let filterModel = PublicFilterModel(uuid: model.uuid, title: model.name, isSelected: "\(kZERO)") let filterModel = PublicFilterModel(uuid: model.uuid, title: model.name, isSelected: "\(kZERO)")
...@@ -344,6 +363,10 @@ extension ReparirChildBillViewModel { ...@@ -344,6 +363,10 @@ extension ReparirChildBillViewModel {
break break
case IndexPath(row: 5, section: 0): case IndexPath(row: 5, section: 0):
filterViewModel.queryBrokenOption().subscribe(onNext: {[weak self] (result) in filterViewModel.queryBrokenOption().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.failureCauseLabel.text, commit: { (text, index) in YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.failureCauseLabel.text, commit: { (text, index) in
controller.failureCauseLabel.text = text controller.failureCauseLabel.text = text
controller.failureCauseLabel.textColor = kBlackColor controller.failureCauseLabel.textColor = kBlackColor
...@@ -353,6 +376,10 @@ extension ReparirChildBillViewModel { ...@@ -353,6 +376,10 @@ extension ReparirChildBillViewModel {
break break
case IndexPath(row: 6, section: 0): case IndexPath(row: 6, section: 0):
filterViewModel.queryProcessMethods().subscribe(onNext: {[weak self] (result) in filterViewModel.queryProcessMethods().subscribe(onNext: {[weak self] (result) in
if result.isEmpty {
ShowMessage("无数据")
return
}
YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.processModeLabel.text, commit: { (text, index) in YXPickerManager.share().showGeneralPickerView(kMainColor, dataArray: result, defaultString: controller.processModeLabel.text, commit: { (text, index) in
controller.processModeLabel.text = text controller.processModeLabel.text = text
controller.processModeLabel.textColor = kBlackColor controller.processModeLabel.textColor = kBlackColor
...@@ -378,7 +405,7 @@ extension ReparirChildBillViewModel { ...@@ -378,7 +405,7 @@ extension ReparirChildBillViewModel {
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.createTime sectionView.stateTimeLabel.text = childBillDetailData.lastModifyTime
break break
default: default:
break break
......
...@@ -22,6 +22,12 @@ class TodoViewController: BaseTableViewPullController { ...@@ -22,6 +22,12 @@ class TodoViewController: BaseTableViewPullController {
return todoViewModel return todoViewModel
}() }()
/// 工单详情ViewModel
lazy final var orderDetailViewModel: RepairOrderDetailViewModel = {
var orderDetailViewModel = RepairOrderDetailViewModel()
return orderDetailViewModel
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -60,14 +66,27 @@ class TodoViewController: BaseTableViewPullController { ...@@ -60,14 +66,27 @@ class TodoViewController: BaseTableViewPullController {
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let model = todoViewModel.todoResultArray[indexPath.row] let model = todoViewModel.todoResultArray[indexPath.row]
switch model.state { switch model.state {
case SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue:
ShowAlertView(hint, "请确认是否领单?", [cancel,sure], .alert, {[weak self] (index) in
if index == kZERO { return }
self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in
self?.loadWebDataSource()
ShowMessage("领取成功")
}).disposed(by: self!.disposeBag)
})
break
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue: case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
let childBillVc = RepairOrderEditSonOrderViewController.instantiateViewController(.Function) as! RepairOrderEditSonOrderViewController let childBillVc = RepairOrderEditSonOrderViewController.instantiateViewController(.Function) as! RepairOrderEditSonOrderViewController
childBillVc.billModel = BillDetailExecute(fromJson: JSON(model.toDictionary())) childBillVc.billModel = BillDetailExecute(fromJson: JSON(model.toDictionary()))
pushVC(childBillVc) pushVC(childBillVc)
break break
case SUBMIT_REPAIR_ORDER_STATE.DONE.rawValue:
let childBillVc = RepairOrderChildBillDetailViewController.instantiateViewController(.Function) as! RepairOrderChildBillDetailViewController
childBillVc.billModel = BillDetailExecute(fromJson: JSON(model.toDictionary()))
pushVC(childBillVc)
break
default: default:
break break
} }
......
...@@ -22,6 +22,12 @@ class HomeTableViewController: BaseTableViewPullController { ...@@ -22,6 +22,12 @@ class HomeTableViewController: BaseTableViewPullController {
return todoViewModel return todoViewModel
}() }()
/// 工单详情ViewModel
lazy final var orderDetailViewModel: RepairOrderDetailViewModel = {
var orderDetailViewModel = RepairOrderDetailViewModel()
return orderDetailViewModel
}()
/// 待办状态 /// 待办状态
open var todoState: TODO_STATE! open var todoState: TODO_STATE!
...@@ -63,6 +69,15 @@ class HomeTableViewController: BaseTableViewPullController { ...@@ -63,6 +69,15 @@ class HomeTableViewController: BaseTableViewPullController {
tableView.deselectRow(at: indexPath, animated: true) tableView.deselectRow(at: indexPath, animated: true)
let model = todoViewModel.todoResultArray[indexPath.row] let model = todoViewModel.todoResultArray[indexPath.row]
switch model.state { switch model.state {
case SUBMIT_REPAIR_ORDER_STATE.INIT.rawValue:
ShowAlertView(hint, "请确认是否领单?", [cancel,sure], .alert, {[weak self] (index) in
if index == kZERO { return }
self?.orderDetailViewModel.getChildBillAction(model.uuid).subscribe(onNext: { () in
self?.loadWebDataSource()
ShowMessage("领取成功")
}).disposed(by: self!.disposeBag)
})
break
case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue: case SUBMIT_REPAIR_ORDER_STATE.DREW.rawValue:
let childBillVc = RepairOrderEditSonOrderViewController.instantiateViewController(.Function) as! RepairOrderEditSonOrderViewController let childBillVc = RepairOrderEditSonOrderViewController.instantiateViewController(.Function) as! RepairOrderEditSonOrderViewController
childBillVc.billModel = BillDetailExecute(fromJson: JSON(model.toDictionary())) childBillVc.billModel = BillDetailExecute(fromJson: JSON(model.toDictionary()))
......
...@@ -18,8 +18,10 @@ class LoginViewModel: BaseViewModel { ...@@ -18,8 +18,10 @@ class LoginViewModel: BaseViewModel {
/// - login: 用户名 /// - login: 用户名
/// - password: 密码 /// - password: 密码
func loginRequest(_ login: String, _ password: String) ->Observable<String> { func loginRequest(_ login: String, _ password: String) ->Observable<String> {
let userName = NSString(string: login).format()
let passWord = NSString(string: password).format()
return Observable.create({(observer) -> Disposable in return Observable.create({(observer) -> Disposable in
Network.request(target: .Login(login, password.md5()), success: {(json) in Network.request(target: .Login(userName!, passWord!.md5()), success: {(json) in
let model = LoginResultModel(fromJson: json) let model = LoginResultModel(fromJson: json)
if model.success { if model.success {
model.data.password = password model.data.password = password
......
...@@ -23,6 +23,5 @@ target ‘IFS’ do ...@@ -23,6 +23,5 @@ target ‘IFS’ do
pod 'ObservableArray-RxSwift', '~> 0.2.0' pod 'ObservableArray-RxSwift', '~> 0.2.0'
pod 'PPBadgeViewSwift' pod 'PPBadgeViewSwift'
pod 'SVProgressHUD', '~> 2.2.2' pod 'SVProgressHUD', '~> 2.2.2'
pod 'AsyncSwift'
pod 'UMengAnalytics' pod 'UMengAnalytics'
end end
PODS: PODS:
- Alamofire (4.6.0) - Alamofire (4.6.0)
- AsyncSwift (2.0.4)
- DeviceKit (1.4.0) - DeviceKit (1.4.0)
- DZNEmptyDataSet (1.8.1) - DZNEmptyDataSet (1.8.1)
- FDFullscreenPopGesture (1.1) - FDFullscreenPopGesture (1.1)
...@@ -32,7 +31,6 @@ PODS: ...@@ -32,7 +31,6 @@ PODS:
- YXPickerView (2.0.0) - YXPickerView (2.0.0)
DEPENDENCIES: DEPENDENCIES:
- AsyncSwift
- DeviceKit - DeviceKit
- DZNEmptyDataSet - DZNEmptyDataSet
- FDFullscreenPopGesture (~> 1.1) - FDFullscreenPopGesture (~> 1.1)
...@@ -58,7 +56,6 @@ DEPENDENCIES: ...@@ -58,7 +56,6 @@ DEPENDENCIES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
Alamofire: f41a599bd63041760b26d393ec1069d9d7b917f4 Alamofire: f41a599bd63041760b26d393ec1069d9d7b917f4
AsyncSwift: 65775a7b32e740609b24969ece3de58723b9dc3e
DeviceKit: fa74d97499660e88081718b16688e19217595dba DeviceKit: fa74d97499660e88081718b16688e19217595dba
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7 DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0 FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
...@@ -83,6 +80,6 @@ SPEC CHECKSUMS: ...@@ -83,6 +80,6 @@ SPEC CHECKSUMS:
YXKit: 73d6ffbcf7530f1159e030460207286e9153b080 YXKit: 73d6ffbcf7530f1159e030460207286e9153b080
YXPickerView: 527ca74d8fbe73b4e9bd0bbff6e143133dced907 YXPickerView: 527ca74d8fbe73b4e9bd0bbff6e143133dced907
PODFILE CHECKSUM: 5196f50090d24cd5621742bc3c9182ea72ab06d6 PODFILE CHECKSUM: 3e33205a97f219ebdb5a9ce5e01c757323891d82
COCOAPODS: 1.3.0 COCOAPODS: 1.3.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment