Commit 50f5614f authored by 曹云霄's avatar 曹云霄

工单模块开发

parent 687a581d
This diff is collapsed.
//
// BaseTableViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/3.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class BaseTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
} else {
automaticallyAdjustsScrollViewInsets = false
}
}
}
......@@ -9,8 +9,40 @@
import Foundation
/// 功能菜单
///
/// - TODO: 待办事项
/// - REPAIRORDER: 工单
public enum FunctionType: String {
case TODO = "待办事项"
case REPAIRORDER = "工单"
}
/// 图片附件类型
///
/// - ATTACHMENT_HTTP: 网络图片
/// - ATTACHMENT_LOCAL: 本地图片
/// - ATTACHMENT_ADD: 本地图片
public enum ATTACHMENT_LOCATION: String {
case ATTACHMENT_HTTP = "http"
case ATTACHMENT_LOCAL = "local"
case ATTACHMENT_ADD = "add"
}
/// 新建工单界面分区
///
/// - BASIC: 基本信息
/// - FACILITY: 设施信息
/// - DESCRIBE: 工单描述
/// - ATTACHMENT: 图片附件
public enum REPAIR_ORDER_SECTION: Int {
case BASIC = 0
case FACILITY
case DESCRIBE
case ATTACHMENT
}
......
//
// PhotoAttachmentViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/5.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import ImagePicker
import SKPhotoBrowser
import Async
protocol PhotoAttachmentDelegate {
func updatePhotoAttachment(_ height: CGFloat)
}
class PhotoAttachmentViewController: BaseViewController {
/// 更新图片附件
var delegate: PhotoAttachmentDelegate?
/// PhotoAttachmentViewModel
lazy final var attachmentViewModel: PhotoAttachmentViewModel = {
var attachmentViewModel = PhotoAttachmentViewModel()
return attachmentViewModel
}()
/// 间隔
let SPACE: Int = 5
/// 每行个数
let COUNT: Int = 2
/// 图片高度
lazy final var imageHeight: CGFloat = {
// 30表示UICollectionView距左右边距
var imageHeight = ((kWidth - 30) - CGFloat((COUNT + kONE) * SPACE)) / CGFloat(COUNT) * 3 / 4
return imageHeight
}()
/// 默认section高度
let sectionHeight: CGFloat! = 30
/// 附件
@IBOutlet weak var collectionViewFlowLayout: UICollectionViewFlowLayout!
@IBOutlet weak var photoAttachmentCollectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
setupCollectionView()
}
// MARK: - 设置图片附件
fileprivate func setupCollectionView() {
collectionViewFlowLayout.minimumLineSpacing = CGFloat(SPACE)
collectionViewFlowLayout.minimumInteritemSpacing = CGFloat(SPACE)
collectionViewFlowLayout.sectionInset = UIEdgeInsetsMake(CGFloat(SPACE), CGFloat(SPACE), CGFloat(SPACE), CGFloat(SPACE))
collectionViewFlowLayout.itemSize = CGSize(width: imageHeight * 4 / 3, height: imageHeight)
}
// MARK: - 计算图片附件所需高度
open func attachmentHeight(_ count: Int) ->CGFloat {
let rows = (count + COUNT - kONE) / COUNT
return CGFloat(rows) * imageHeight + CGFloat((rows - kONE) * SPACE)
}
}
// MARK: - 图片附件
extension PhotoAttachmentViewController: UICollectionViewDelegate,UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return attachmentViewModel.photoAttachments.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = attachmentViewModel.dequeueReusableCell(PhotoAttachmentCollectionViewCell.name(), indexPath, collectionView) as! PhotoAttachmentCollectionViewCell
cell.delegate = self
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let attachment = attachmentViewModel.photoAttachments[indexPath.item]
if attachment.attachmentType == .ATTACHMENT_ADD {
let imagePickerController = ImagePickerController()
imagePickerController.delegate = self
imagePickerController.imageLimit = 5
present(imagePickerController, animated: true, completion: nil)
}else {
var images = [SKPhoto]()
for attachment in attachmentViewModel.photoAttachments {
if attachment.attachmentType == .ATTACHMENT_ADD { continue }
var photo: SKPhoto!
switch attachment.attachmentType {
case .ATTACHMENT_HTTP:
photo = SKPhoto.photoWithImageURL(attachment.attachment as! String)
break
case .ATTACHMENT_LOCAL:
photo = SKPhoto.photoWithImage(attachment.attachment as! UIImage)
break
default:
break
}
images.append(photo)
photo.shouldCachePhotoURLImage = false
}
let browser = SKPhotoBrowser(photos: images)
browser.initializePageIndex(indexPath.item)
present(browser, animated: true, completion: {})
}
}
}
// MARK: - 拍照
extension PhotoAttachmentViewController: ImagePickerDelegate {
func wrapperDidPress(_ imagePicker: ImagePickerController, images: [UIImage]) {
for image in images {
var images = [SKPhoto]()
let photo = SKPhoto.photoWithImage(image)
images.append(photo)
let browser = SKPhotoBrowser(photos: images)
browser.initializePageIndex(0)
present(browser, animated: true, completion: {})
}
}
func doneButtonDidPress(_ imagePicker: ImagePickerController, images: [UIImage]) {
for image in images {
attachmentViewModel.photoAttachments.insert(PhotoAttachmentModel(image, .ATTACHMENT_LOCAL), at: kZERO)
dismiss(animated: true, completion: {[weak self] ()->() in
let count = self?.attachmentViewModel.photoAttachments.count
let height = self?.attachmentHeight(count!)
DispatchQueue.main.async(execute: {
self?.photoAttachmentCollectionView.reloadData()
self?.delegate?.updatePhotoAttachment(height!)
})
})
}
}
func cancelButtonDidPress(_ imagePicker: ImagePickerController) {
dismiss(animated: true, completion: nil)
}
}
// MARK: - 删除附件
extension PhotoAttachmentViewController: DeleteAttachmentDelegate {
func deleteAttachment(_ indexPath: IndexPath) {
attachmentViewModel.photoAttachments.remove(at: indexPath.item)
let count = attachmentViewModel.photoAttachments.count
let height = attachmentHeight(count)
DispatchQueue.main.async(execute: {
self.photoAttachmentCollectionView.reloadData()
self.delegate?.updatePhotoAttachment(height)
})
}
}
//
// PhotoAttachmentCollectionViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/3.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import Kingfisher
protocol DeleteAttachmentDelegate {
func deleteAttachment(_ indexPath: IndexPath)
}
class PhotoAttachmentCollectionViewCell: UICollectionViewCell {
/// 删除附件
var delegate: DeleteAttachmentDelegate?
/// 附件
@IBOutlet weak var attachmentImg: UIImageView!
/// 删除
@IBOutlet weak var deleteBtn: UIButton!
/// 附件位置信息
var indexPath: IndexPath!
// MARK: - 删除附件
@IBAction func deleteButtonClickAction(_ sender: UIButton) {
delegate?.deleteAttachment(indexPath)
}
// MARK: - 更新附件cell
open func updateAttachmentCell(_ model: PhotoAttachmentModel<Any>,_ indexPath: IndexPath) {
self.indexPath = indexPath
switch model.attachmentType {
case .ATTACHMENT_LOCAL:
attachmentImg.image = model.attachment as? UIImage
attachmentImg.contentMode = .scaleAspectFill
deleteBtn.isHidden = false
break
case .ATTACHMENT_ADD:
attachmentImg.image = UIImage(named: model.attachment as! String)
attachmentImg.contentMode = .scaleToFill
deleteBtn.isHidden = true
break
case .ATTACHMENT_HTTP:
attachmentImg.kf.setImage(with: URL(string: model.attachment as! String))
attachmentImg.contentMode = .scaleAspectFill
deleteBtn.isHidden = true
break
}
}
}
//
// PhotoAttachmentViewModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/5.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class PhotoAttachmentViewModel: BaseViewModel {
/// 图片附件
lazy final var photoAttachments: Array<PhotoAttachmentModel> = { () -> Array<PhotoAttachmentModel<Any>> in
var photoAttachments = Array<PhotoAttachmentModel<Any>>()
return photoAttachments
}()
}
extension PhotoAttachmentViewModel {
func dequeueReusableCell(_ identifier: String, _ indexPath: IndexPath, _ collectionView: UICollectionView) -> UICollectionViewCell {
let attachmentCell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! PhotoAttachmentCollectionViewCell
attachmentCell.updateAttachmentCell(photoAttachments[indexPath.item], indexPath)
return attachmentCell
}
}
//
// SearchViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/4.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class SearchViewController: BaseTableViewPullController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
//
// SearchTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/4.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class SearchTableViewCell: UITableViewCell {
/// 标题
@IBOutlet weak var titleLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
}
//
// SearchViewModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/4.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class SearchViewModel: BaseViewModel {
}
//
// V2FPSLabel.swift
// V2ex-Swift
//
// Created by huangfeng on 1/15/16.
// Copyright © 2016 Fin. All rights reserved.
//
import UIKit
//重写自 YYFPSLabel
//https://github.com/ibireme/YYText/blob/master/Demo/YYTextDemo/YYFPSLabel.m
class V2FPSLabel: UILabel {
fileprivate var _link :CADisplayLink?
fileprivate var _count:Int = 0
fileprivate var _lastTime:TimeInterval = 0
fileprivate let _defaultSize = CGSize(width: 55, height: 20);
override init(frame: CGRect) {
var targetFrame = frame
if frame.size.width == 0 && frame.size.height == 0{
targetFrame.size = _defaultSize
}
super.init(frame: targetFrame)
self.layer.cornerRadius = 5
self.clipsToBounds = true
self.textAlignment = .center
self.isUserInteractionEnabled = false
self.textColor = UIColor.white
self.backgroundColor = UIColor(white: 0, alpha: 0.7)
self.font = UIFont(name: "Menlo", size: 14)
weak var weakSelf = self
_link = CADisplayLink(target: weakSelf!, selector:#selector(V2FPSLabel.tick(_:)) );
_link!.add(to: RunLoop.main, forMode:RunLoopMode.commonModes)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
@objc func tick(_ link:CADisplayLink) {
if _lastTime == 0 {
_lastTime = link.timestamp
return
}
_count += 1
let delta = link.timestamp - _lastTime
if delta < 1 {
return
}
_lastTime = link.timestamp
let fps = Double(_count) / delta
_count = 0
let progress = fps / 60.0;
self.textColor = UIColor(hue: CGFloat(0.27 * ( progress - 0.2 )) , saturation: 1, brightness: 0.9, alpha: 1)
self.text = "\(Int(fps+0.5))FPS"
}
}
......@@ -9,7 +9,7 @@
import UIKit
import Kingfisher
class AccountTableViewController: UITableViewController {
class AccountTableViewController: BaseTableViewController {
/// 用户头像
@IBOutlet weak var userHeaderImg: UIImageView!
......@@ -33,11 +33,6 @@ class AccountTableViewController: UITableViewController {
// MARK: - UI
fileprivate func uiConfigAction() {
self.fd_prefersNavigationBarHidden = true
if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
} else {
automaticallyAdjustsScrollViewInsets = false
}
userHeaderImg.addAngle(kWidth * 0.15 * 0.5)
userHeaderImg.addBorder(1.0, UIColor.white)
accountBgView.seth(h: kWidth * 9 / 16)
......
......@@ -25,7 +25,6 @@ class FunctionViewController: BaseViewController {
setupCollectionView()
}
// MARK: - 设置UICollectionView
fileprivate func setupCollectionView() {
functionFlowLayout.itemSize = CGSize(width: kWidth / 4.0, height: kWidth / 4.0 - 20)
......@@ -33,7 +32,6 @@ class FunctionViewController: BaseViewController {
functionFlowLayout.minimumInteritemSpacing = 0
functionCollectionView.alwaysBounceVertical = true
}
}
extension FunctionViewController: UICollectionViewDelegate,UICollectionViewDataSource {
......@@ -49,6 +47,20 @@ extension FunctionViewController: UICollectionViewDelegate,UICollectionViewDataS
let sectionView = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: FunctionCollectionReusableView.name(), for: indexPath)
return sectionView
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let model = functionViewModel.itemArrays[indexPath.item]
switch model.item_name {
case FunctionType.TODO.rawValue:
self.performSegue(withIdentifier: TodoViewController.name(), sender: nil)
break
case FunctionType.REPAIRORDER.rawValue:
self.performSegue(withIdentifier: RepairOrderViewController.name(), sender: nil)
break
default:
break
}
}
}
......
......@@ -22,6 +22,8 @@ class FunctionViewModel: BaseViewModel {
}
return itemImgArrays
}()
}
extension FunctionViewModel {
......
//
// RepairOrderAddTableViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/3.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import ImagePicker
import SKPhotoBrowser
import RxSwift
import RxCocoa
class RepairOrderAddTableViewController: BaseTableViewController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 来源
@IBOutlet weak var sourceLabel: UILabel!
/// 服务类型
@IBOutlet weak var serviceTypeLabel: UILabel!
/// 优先级
@IBOutlet weak var priorityLabel: UILabel!
/// 报事人
@IBOutlet weak var originatorLabel: UILabel!
/// 接报时间
@IBOutlet weak var originatorTimeLabel: UILabel!
/// 指定时间
@IBOutlet weak var specifiedTimeLabel: UILabel!
/// 位置
@IBOutlet weak var specifiedLocationLabel: UILabel!
/// 设施信息
@IBOutlet weak var facilitiesSwitch: UISwitch!
/// 联系电话
@IBOutlet weak var phoneNumberText: UITextField!
/// 工单描述
@IBOutlet weak var describeTextView: IQTextView!
/// 图片附件高度
var attachmentHeight: CGFloat! = 0
/// 默认section高度
let sectionHeight: CGFloat! = 30
/// 图片附件
lazy final var attachmentVc: PhotoAttachmentViewController = {
var attachmentVc = PhotoAttachmentViewController.instantiateViewController(.Function) as! PhotoAttachmentViewController
attachmentVc.delegate = self
return attachmentVc
}()
/// RepairOrderViewModel
lazy final var repairOrderViewModel: RepairOrderViewModel = {
var repairOrderViewModel = RepairOrderViewModel()
return repairOrderViewModel
}()
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
setupPhotoAttachmentVc()
bindingRxAction()
}
// MARK: - UI
fileprivate func uiConfigAction() {
describeTextView.placeholder = "工单描述"
tableView.register(UINib(nibName: RepairAttachmentTableViewCell.name(), bundle: nil), forCellReuseIdentifier: RepairAttachmentTableViewCell.name())
}
// MARK: - 设置附件VC
fileprivate func setupPhotoAttachmentVc(){
addChildViewController(attachmentVc)
attachmentVc.attachmentViewModel.photoAttachments.append(PhotoAttachmentModel("add_photo", .ATTACHMENT_ADD))
attachmentHeight = attachmentVc.attachmentHeight(kONE)
}
// MARK: - 绑定RxSwift事件
fileprivate func bindingRxAction() {
facilitiesSwitch.rx.controlEvent(UIControlEvents.valueChanged).subscribe(onNext: {[weak self] (event) in
self?.tableView.reloadData()
}).disposed(by: disposeBag)
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == REPAIR_ORDER_SECTION.ATTACHMENT.rawValue {
let attachmentCell = tableView.dequeueReusableCell(withIdentifier: RepairAttachmentTableViewCell.name(), for: indexPath) as! RepairAttachmentTableViewCell
attachmentVc.view.frame = CGRect(x: 15, y: 35, width: kWidth - 30, height: attachmentHeight)
attachmentCell.contentView.addSubview(attachmentVc.view)
return attachmentCell
}
return super.tableView(tableView, cellForRowAt: indexPath)
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == REPAIR_ORDER_SECTION.ATTACHMENT.rawValue {
return attachmentHeight + 50
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == REPAIR_ORDER_SECTION.FACILITY.rawValue && !facilitiesSwitch.isOn {
return kZERO
}
if section == REPAIR_ORDER_SECTION.ATTACHMENT.rawValue {
return kONE
}
return super.tableView(tableView, numberOfRowsInSection: section)
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section == REPAIR_ORDER_SECTION.BASIC.rawValue {
return sectionHeight
}
if section == REPAIR_ORDER_SECTION.FACILITY.rawValue {
if facilitiesSwitch.isOn {
return sectionHeight
}
return CGFloat(0.01)
}
return 10
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return CGFloat(0.01)
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == REPAIR_ORDER_SECTION.FACILITY.rawValue && !facilitiesSwitch.isOn {
return UIView()
}
return super.tableView(tableView, viewForHeaderInSection: section)
}
}
extension RepairOrderAddTableViewController: PhotoAttachmentDelegate {
func updatePhotoAttachment(_ height: CGFloat) {
attachmentHeight = height
tableView.reloadData()
}
}
//
// RepairOrderViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/3.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
import RxCocoa
import RxSwift
class RepairOrderViewController: BaseTableViewPullController {
/// RxSwift自动释放
let disposeBag = DisposeBag()
/// 新建工单
@IBOutlet weak var addOrderButton: UIButton!
/// 日期选择
@IBOutlet weak var dateChooseButton: UIButton!
/// 状态选择
@IBOutlet weak var stateChooseButton: UIButton!
/// 来源选择
@IBOutlet weak var sourceChooseButton: UIButton!
/// 优先级选择
@IBOutlet weak var priorityChooseButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
uiConfigAction()
bindingRxAction()
}
// MARK: - UI
fileprivate func uiConfigAction() {
title = "工单列表"
dateChooseButton.addBorder(1.0, kGaryColor)
stateChooseButton.addBorder(1.0, kGaryColor)
sourceChooseButton.addBorder(1.0, kGaryColor)
priorityChooseButton.addBorder(1.0, kGaryColor)
dateChooseButton.horizontalCenterTitleAndImage(5)
stateChooseButton.horizontalCenterTitleAndImage(5)
sourceChooseButton.horizontalCenterTitleAndImage(5)
priorityChooseButton.horizontalCenterTitleAndImage(5)
}
// MARK: - 绑定RxSwift事件
fileprivate func bindingRxAction() {
dateChooseButton.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.dateChooseButton.isSelected = true
self?.dateChooseButton.addBorder(1.0, kBlueColor)
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["最近一周","最近两周","最近一个月"], defaultString: self?.dateChooseButton.currentTitle, commit: { (text, index) in
self?.dateChooseButton.isSelected = false
self?.dateChooseButton.addBorder(1.0, kGaryColor)
}, cancel: {
self?.dateChooseButton.isSelected = false
self?.dateChooseButton.addBorder(1.0, kGaryColor)
})
}).disposed(by: disposeBag)
stateChooseButton.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.stateChooseButton.isSelected = true
self?.stateChooseButton.addBorder(1.0, kBlueColor)
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["全部状态","已完成","已提交","已取消"], defaultString: self?.stateChooseButton.currentTitle, commit: { (text, index) in
self?.stateChooseButton.isSelected = false
self?.stateChooseButton.addBorder(1.0, kGaryColor)
}, cancel: {
self?.stateChooseButton.isSelected = false
self?.stateChooseButton.addBorder(1.0, kGaryColor)
})
}).disposed(by: disposeBag)
sourceChooseButton.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.sourceChooseButton.isSelected = true
self?.sourceChooseButton.addBorder(1.0, kBlueColor)
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["全部来源","内部","外部"], defaultString: self?.sourceChooseButton.currentTitle, commit: { (text, index) in
self?.sourceChooseButton.isSelected = false
self?.sourceChooseButton.addBorder(1.0, kGaryColor)
}, cancel: {
self?.sourceChooseButton.isSelected = false
self?.sourceChooseButton.addBorder(1.0, kGaryColor)
})
}).disposed(by: disposeBag)
priorityChooseButton.rx.controlEvent(UIControlEvents.touchUpInside).subscribe(onNext: {[weak self] (event) in
self?.priorityChooseButton.isSelected = true
self?.priorityChooseButton.addBorder(1.0, kBlueColor)
YXPickerManager.share().showGeneralPickerView(kNavColor, dataArray: ["全部优先级","高","中","低"], defaultString: self?.priorityChooseButton.currentTitle, commit: { (text, index) in
self?.priorityChooseButton.isSelected = false
self?.priorityChooseButton.addBorder(1.0, kGaryColor)
}, cancel: {
self?.priorityChooseButton.isSelected = false
self?.priorityChooseButton.addBorder(1.0, kGaryColor)
})
}).disposed(by: disposeBag)
}
// MARK: - 加载数据
override func loadWebDataSource() {
endRefresh()
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let orderCell = tableView.dequeueReusableCell(withIdentifier: RepairOrderTableViewCell.name(), for: indexPath)
return orderCell
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 135
}
}
//
// PhotoAttachmentModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/3.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
struct PhotoAttachmentModel<T> {
/// 图片附件类型
var attachmentType: ATTACHMENT_LOCATION
/// 附件
/// 如果是网络地址则为图片http地址
/// 如果是本地图片则为image
/// 如果是新增附件则为imageName
var attachment: T
init(_ attachment: T, _ type: ATTACHMENT_LOCATION) {
self.attachment = attachment
self.attachmentType = type
}
}
//
// RepairAttachmentTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/5.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class RepairAttachmentTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="96" id="KGk-i7-Jjw" customClass="RepairAttachmentTableViewCell" customModule="IFS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="96"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="95.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="taf-6G-DTT">
<rect key="frame" x="15" y="10" width="61.5" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="taf-6G-DTT" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="RE3-6X-YVJ"/>
<constraint firstItem="taf-6G-DTT" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="wIs-Wg-Vaq"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="12" y="-2"/>
</tableViewCell>
</objects>
</document>
//
// RepairOrderTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/3.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class RepairOrderTableViewCell: UITableViewCell {
/// 创建时间
@IBOutlet weak var createTimeLabel: UILabel!
/// 单据状态
@IBOutlet weak var orderStateLabel: UILabel!
/// 描述
@IBOutlet weak var describeLabel: UILabel!
/// 优先级
@IBOutlet weak var priorityLabel: UILabel!
/// 来源
@IBOutlet weak var sourceLabel: UILabel!
/// 单号
@IBOutlet weak var orderNumberLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}
//
// RepairOrderViewModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/3.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class RepairOrderViewModel: BaseViewModel {
}
extension RepairOrderViewModel {
}
//
// TodoViewController.swift
// IFS
//
// Created by 曹云霄 on 2018/1/5.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class TodoViewController: BaseTableViewPullController {
/// TodoViewModel
lazy final var todoViewModel: TodoViewModel = {
var todoViewModel = TodoViewModel()
return todoViewModel
}()
override func viewDidLoad() {
super.viewDidLoad()
tableViewAnimationHeight()
}
// MARK: - 加载数据
override func loadWebDataSource() {
endRefresh()
}
// MARK: - 设置tableview高度
fileprivate func tableViewAnimationHeight() {
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 80.0
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return todoViewModel.dequeueReusableCell(TodoTableViewCell.name(),indexPath,tableView)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
}
//
// TodoTableViewCell.swift
// IFS
//
// Created by 曹云霄 on 2018/1/5.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class TodoTableViewCell: UITableViewCell {
/// 标题 + code
@IBOutlet weak var titleCodeLabel: UILabel!
/// 操作时间
@IBOutlet weak var operationDateLabel: UILabel!
/// 状态
@IBOutlet weak var todoStateLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}
//
// TodoViewModel.swift
// IFS
//
// Created by 曹云霄 on 2018/1/5.
// Copyright © 2018年 上海勾芒信息科技有限公司. All rights reserved.
//
import UIKit
class TodoViewModel: BaseViewModel {
}
extension TodoViewModel {
func dequeueReusableCell(_ identifier: String, _ indexPath: IndexPath, _ tableView: UITableView) -> UITableViewCell {
let todoCell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath) as! TodoTableViewCell
return todoCell
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oZa-IQ-b7k">
<device id="retina4_7" orientation="portrait">
<device id="retina5_9" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
......@@ -15,26 +15,26 @@
<objects>
<viewController id="oZa-IQ-b7k" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Qv6-mi-Qhw">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="1470363197668_fact_1" translatesAutoresizingMaskIntoConstraints="NO" id="cwD-kG-8mE">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="cwD-kG-8mE" firstAttribute="bottom" secondItem="bJ4-nF-sq7" secondAttribute="bottom" id="QYE-4q-hD8"/>
<constraint firstItem="cwD-kG-8mE" firstAttribute="trailing" secondItem="bJ4-nF-sq7" secondAttribute="trailing" id="Tqs-Nb-0zs"/>
<constraint firstItem="cwD-kG-8mE" firstAttribute="leading" secondItem="bJ4-nF-sq7" secondAttribute="leading" id="gmz-Qv-m8g"/>
<constraint firstItem="cwD-kG-8mE" firstAttribute="top" secondItem="Qv6-mi-Qhw" secondAttribute="top" id="xoT-b5-H0h"/>
<constraint firstAttribute="bottom" secondItem="cwD-kG-8mE" secondAttribute="bottom" id="LvK-GB-2fS"/>
<constraint firstItem="cwD-kG-8mE" firstAttribute="leading" secondItem="bJ4-nF-sq7" secondAttribute="leading" id="g98-Y4-41x"/>
<constraint firstItem="cwD-kG-8mE" firstAttribute="trailing" secondItem="bJ4-nF-sq7" secondAttribute="trailing" id="gyN-Gy-nQV"/>
<constraint firstItem="cwD-kG-8mE" firstAttribute="top" secondItem="Qv6-mi-Qhw" secondAttribute="top" id="mzY-UV-boB"/>
</constraints>
<viewLayoutGuide key="safeArea" id="bJ4-nF-sq7"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="JRl-d9-ZaP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-180" y="-43.628185907046479"/>
<point key="canvasLocation" x="-180" y="-44.334975369458128"/>
</scene>
</scenes>
<resources>
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow_bottom@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "arrow_bottom@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "arrow_bottom_blue@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "arrow_bottom_blue@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "add_order@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "add_order@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "add_photo@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "add_photo@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "result_back_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "result_back_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "attachment_Delete@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "attachment_Delete@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -4,4 +4,6 @@
#import "UIImage+Category.h"
#import "UINavigationController+FDFullscreenPopGesture.h"
#import "YXKitHeader.h"
#import "YXPickerManager.h"
#import "IQTextView.h"
......@@ -8,7 +8,7 @@
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<string>zh_CN</string>
<key>CFBundleDisplayName</key>
<string>工单系统</string>
<key>CFBundleExecutable</key>
......@@ -27,6 +27,10 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSPhotoLibraryUsageDescription</key>
<string>App需要您的同意,才能访问相册</string>
<key>NSCameraUsageDescription</key>
<string>App需要您的同意,才能访问相机</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
......
......@@ -21,6 +21,7 @@ target ‘IFS’ do
pod 'YXAlertController', '~> 1.0.8'
pod 'IQKeyboardManager', '~> 5.0.6'
pod 'FDFullscreenPopGesture', '~> 1.1'
pod 'YXPickerView', '~> 0.0.4'
pod 'ImagePicker'
pod 'SKPhotoBrowser', '~> 5.0.0'
end
......@@ -11,8 +11,9 @@ PODS:
- IGListKit/Default (3.1.1):
- IGListKit/Diffing
- IGListKit/Diffing (3.1.1)
- IQKeyboardManager (5.0.6)
- Kingfisher (4.4.0)
- ImagePicker (3.0.0)
- IQKeyboardManager (5.0.7)
- Kingfisher (4.6.1)
- MBProgressHUD (1.1.0)
- MJRefresh (3.1.15.1)
- Moya (10.0.1):
......@@ -21,13 +22,15 @@ PODS:
- Alamofire (~> 4.1)
- Result (~> 3.0)
- Result (3.2.4)
- RxCocoa (4.0.0):
- RxCocoa (4.1.0):
- RxSwift (~> 4.0)
- RxSwift (4.0.0)
- RxSwift (4.1.0)
- SKPhotoBrowser (5.0.3)
- SnapKit (4.0.0)
- SwiftyJSON (4.0.0)
- YXAlertController (1.0.8)
- YXKit (0.0.8)
- YXPickerView (0.0.5)
- YYText (1.0.7)
DEPENDENCIES:
......@@ -38,6 +41,7 @@ DEPENDENCIES:
- HandyJSON (~> 4.0.0-beta.1)
- Hero
- IGListKit
- ImagePicker
- IQKeyboardManager (~> 5.0.6)
- Kingfisher
- MBProgressHUD
......@@ -45,10 +49,12 @@ DEPENDENCIES:
- Moya
- RxCocoa
- RxSwift
- SKPhotoBrowser (~> 5.0.0)
- SnapKit
- SwiftyJSON
- YXAlertController (~> 1.0.8)
- YXKit
- YXPickerView (~> 0.0.4)
- YYText (~> 1.0.7)
SPEC CHECKSUMS:
......@@ -60,20 +66,23 @@ SPEC CHECKSUMS:
HandyJSON: 428bb18e2c34c2a77361accebf90cf64e4f74118
Hero: cee286821578e170d8c0c9c9cda7897357401112
IGListKit: cb97f405ae43e59fe1da74271e19427ec20d3c07
IQKeyboardManager: 077b7f691dfa9d69db9cff66f2bed68ebfc02d9b
Kingfisher: 62a43e03047a1ac5159d0be3ac62673ef4b99cc3
ImagePicker: 973953c25960fe04729a7082a56194321c6762d2
IQKeyboardManager: 0bfa4607d39924116b5c0c8b55b5d789288b5cba
Kingfisher: 1f9157d9c02b380cbd0b7cc890161195164eb634
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
MJRefresh: 5f8552bc25ca8751c010f621c1098dbdaacbccd6
Moya: 9e621707ff754eeb51ff3ec51a3d54e517c0733a
Result: d2d07204ce72856f1fd9130bbe42c35a7b0fea10
RxCocoa: d62846ca96495d862fa4c59ea7d87e5031d7340e
RxSwift: fd680d75283beb5e2559486f3c0ff852f0d35334
RxCocoa: cc1fec49cdc8fabe645964de7c51c099a36c2aa8
RxSwift: 4219941c1244c88002901bd87a69d3aea9ae71f0
SKPhotoBrowser: 6de77f7004442e79059f19d86e2e7e6a03b43a13
SnapKit: a42d492c16e80209130a3379f73596c3454b7694
SwiftyJSON: 070dabdcb1beb81b247c65ffa3a79dbbfb3b48aa
YXAlertController: 37a54642cb8e8b43b79004fe9148bb8ff2fab814
YXKit: 73d6ffbcf7530f1159e030460207286e9153b080
YXPickerView: 435b7b1362931fe63f2aab25d2810b1cf5ca2226
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
PODFILE CHECKSUM: c72ca6e80c54978beb664e847fdaacaceb21dc90
PODFILE CHECKSUM: 7d116579396cd862c5b27c1bfdfc97ea5045fa0f
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