Commit 61a428ab authored by Alex朱枝文's avatar Alex朱枝文

续签文书管理

parent 85604834
This diff is collapsed.
//
// YHBaseDynamicCornerRadiusView.swift
// galaxy
//
// Created by alexzzw on 2024/9/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHBaseDynamicCornerRadiusView: UIView {
private var radius: CGFloat = 8
public var corner: UIRectCorner? {
didSet {
if corner != oldValue {
layoutSubviews()
}
}
}
public init(cornerRadius: CGFloat, corner: UIRectCorner? = nil) {
self.corner = corner
self.radius = cornerRadius
super.init(frame: CGRect.zero)
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private var boarderLayer: CAShapeLayer?
private var viewBounds = CGRect.zero {
didSet {
boarderLayer?.removeFromSuperlayer()
boarderLayer = nil
if let corner = corner {
boarderLayer = createCorner(CGSize(width: radius, height: radius), corner)
}
}
}
override public func layoutSubviews() {
super.layoutSubviews()
viewBounds = bounds
}
}
//
// YHResignDocumentManagementVC.swift
// galaxy
//
// Created by alexzzw on 2024/9/10.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignDocumentManagementVC: YHBaseViewController {
enum RowType {
case header(_ title: String, _ detail: String)
case content(_ title: String, _ status: YHResignDocumentStatus)
}
private var datas: [[RowType]] {
let firstSetcion: [RowType] = [.header("​续期递交文书", "(王虎、百里)"), .content("QMAS文件", .awaitingSignature), .content("解释说明", .pendingConfirmation)]
let secondSetcion: [RowType] = [.header("​补件递交文书", "(王虎来、百里电、汉寒、王全新...)"), .content("QMAS文件", .finalizing), .content("解释说明", .underReview)]
let thirdSetcion: [RowType] = [.header("​​拒签递交文书", "(王虎、百里)"), .content("QMAS文件", .awaitingSignature), .content("解释说明", .completed)]
return [firstSetcion, secondSetcion, thirdSetcion]
}
private lazy var tableView: UITableView = {
let view = UITableView(frame:.zero, style:.grouped)
view.estimatedSectionHeaderHeight = 16.0
view.estimatedSectionFooterHeight = 0.01
view.sectionHeaderHeight = 16.0
view.sectionFooterHeight = 0.01
view.contentInsetAdjustmentBehavior = .never
view.showsVerticalScrollIndicator = false
view.separatorStyle = .none
view.delegate = self
view.dataSource = self
view.backgroundColor = .clear
view.rowHeight = 52
// if #available(iOS 15.0, *) {
// view.sectionHeaderTopPadding = 0
// }
view.tableFooterView = UITableViewHeaderFooterView()
view.register(YHResignDocumentHeaderCell.self, forCellReuseIdentifier: YHResignDocumentHeaderCell.cellReuseIdentifier)
view.register(YHResignDocumentContentCell.self, forCellReuseIdentifier: YHResignDocumentContentCell.cellReuseIdentifier)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
}
extension YHResignDocumentManagementVC {
private func setupUI() {
gk_navTitle = "续期文书管理"
gk_navBarAlpha = 1.0
gk_navBackgroundColor = .white
view.backgroundColor = UIColor.contentBkgColor
view.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.top.equalTo(k_Height_NavigationtBarAndStatuBar)
make.bottom.equalToSuperview()
// make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
// make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
}
}
}
extension YHResignDocumentManagementVC: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
datas.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard datas.count > section else {
return 0
}
return datas[section].count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard datas.count > indexPath.section else {
return UITableViewCell()
}
let sectionArr = datas[indexPath.section]
guard sectionArr.count > indexPath.row else {
return UITableViewCell()
}
let item = sectionArr[indexPath.row]
var cellType: YHResignRoundCellType = .mid
if sectionArr.count == 1 {
cellType = .single
} else if indexPath.row == 0 {
cellType = .top
} else if indexPath.row == sectionArr.count - 1 {
cellType = .bottom
} else {
cellType = .mid
}
switch item {
case let .header(title, detail):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHResignDocumentHeaderCell.cellReuseIdentifier) as? YHResignDocumentHeaderCell {
cell.setupCellInfo(title: title, detail: detail, cellType: cellType)
return cell
}
case let .content(title, status):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHResignDocumentContentCell.cellReuseIdentifier) as? YHResignDocumentContentCell {
cell.setupCellInfo(title: title, cellType: cellType, status: status)
return cell
}
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
}
//
// YHResignDocumentStatus.swift
// galaxy
//
// Created by alexzzw on 2024/9/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
enum YHResignDocumentStatus: Int {
case pendingConfirmation = 0
case finalizing = 1
case underReview = 2
case awaitingSignature = 3
case completed = 4
func title() -> String {
switch self {
case .pendingConfirmation:
"待确认".local
case .finalizing:
"定稿中".local
case .underReview:
"审核中".local
case .awaitingSignature:
"待签字".local
case .completed:
"已完成".local
}
}
func textColor() -> UIColor {
switch self {
case .pendingConfirmation:
UIColor.brandMainColor
case .finalizing:
UIColor.yhOrangeColor
case .underReview:
UIColor.yhOrangeColor
case .awaitingSignature:
UIColor.brandMainColor
case .completed:
UIColor.yhGreenColor
}
}
func iconName() -> String {
switch self {
case .pendingConfirmation:
"blue_right_arrow"
case .finalizing:
"orange_right_arrow"
case .underReview:
"orange_right_arrow"
case .awaitingSignature:
"blue_right_arrow"
case .completed:
"green_right_arrow"
}
}
}
//
// YHResignRoundCellType.swift
// galaxy
//
// Created by alexzzw on 2024/9/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import Foundation
enum YHResignRoundCellType: Int {
case top
case mid
case bottom
case single
}
//
// YHResignDocumentCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignDocumentCell: UITableViewCell {
lazy var subContainerView: YHBaseDynamicCornerRadiusView = {
let view = YHBaseDynamicCornerRadiusView(cornerRadius: 8, corner: .none)
view.backgroundColor = .white
return view
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func updateCellCorner(_ cellType: YHResignRoundCellType) {
switch cellType {
case .top:
subContainerView.corner = [.topLeft, .topRight]
case .mid:
subContainerView.corner = .none
case .bottom:
subContainerView.corner = [.bottomLeft, .bottomRight]
case .single:
subContainerView.corner = .allCorners
}
}
}
extension YHResignDocumentCell {
private func setupUI() {
selectionStyle = .none
backgroundColor = .clear
contentView.addSubview(subContainerView)
subContainerView.snp.makeConstraints { make in
make.top.bottom.equalToSuperview()
make.left.equalToSuperview().offset(16)
make.right.equalToSuperview().offset(-16)
}
}
}
//
// YHResignDocumentContentCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignDocumentContentCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHResignDocumentContentCell"
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_M(ofSize:14)
label.textColor = .mainTextColor
return label
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor50
label.font = .PFSC_R(ofSize:14)
return label
}()
private lazy var rightIconView: UIImageView = {
let view = UIImageView()
return view
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, cellType: YHResignRoundCellType = .top, status: YHResignDocumentStatus = .awaitingSignature) {
infoTitleLabel.text = title
infoDetailLabel.text = status.title()
infoDetailLabel.textColor = status.textColor()
rightIconView.image = UIImage(named: status.iconName())
updateCellCorner(cellType)
}
}
extension YHResignDocumentContentCell {
private func setupUI() {
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(infoDetailLabel)
subContainerView.addSubview(rightIconView)
infoTitleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
infoDetailLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
rightIconView.setContentCompressionResistancePriority(.required, for: .horizontal)
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.centerY.equalToSuperview()
}
rightIconView.snp.makeConstraints { make in
make.right.equalToSuperview().offset(-18)
make.centerY.equalToSuperview()
make.width.height.equalTo(20)
}
infoDetailLabel.snp.makeConstraints { make in
make.left.greaterThanOrEqualTo(infoTitleLabel.snp.right).offset(16)
make.centerY.equalToSuperview()
make.right.equalTo(rightIconView.snp.left)
}
}
}
//
// YHResignDocumentHeaderCell.swift
// galaxy
//
// Created by alexzzw on 2024/9/11.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHResignDocumentHeaderCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHResignDocumentHeaderCell"
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_M(ofSize:17)
label.textColor = .mainTextColor
return label
}()
private lazy var infoDetailLabel: UILabel = {
let label = UILabel()
label.textColor = .mainTextColor50
label.font = .PFSC_R(ofSize:13)
return label
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setupCellInfo(title: String?, detail: String?, cellType: YHResignRoundCellType = .top) {
infoTitleLabel.text = title
infoDetailLabel.text = detail
updateCellCorner(cellType)
}
}
extension YHResignDocumentHeaderCell {
private func setupUI() {
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(infoDetailLabel)
infoTitleLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
infoDetailLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
infoTitleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(18)
make.centerY.equalToSuperview()
}
infoDetailLabel.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel.snp.right).offset(6)
make.centerY.equalToSuperview()
make.right.lessThanOrEqualToSuperview().offset(-16)
}
}
}
...@@ -100,9 +100,10 @@ extension UIColor { ...@@ -100,9 +100,10 @@ extension UIColor {
static let yhGreyColor: UIColor = UIColor(hexString: "#94A3B8")! static let yhGreyColor: UIColor = UIColor(hexString: "#94A3B8")!
static let yhGreyColor50: UIColor = UIColor(hexString: "#94A3B8",transparency: 0.5)! static let yhGreyColor50: UIColor = UIColor(hexString: "#94A3B8",transparency: 0.5)!
// 常见按钮色
static let yhOrangeColor: UIColor = UIColor(hexString: "#FF8000")!
static let yhGreenColor: UIColor = UIColor(hexString: "#3CC694")!
public convenience init(r : CGFloat, g : CGFloat, b : CGFloat,alpha:CGFloat = 1.0) { public convenience init(r : CGFloat, g : CGFloat, b : CGFloat,alpha:CGFloat = 1.0) {
self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha) self.init(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: alpha)
......
...@@ -80,14 +80,14 @@ extension UIView { ...@@ -80,14 +80,14 @@ extension UIView {
} }
// 任意切圆角 eg:UIRectCorner(rawValue: (UIRectCorner.topRight.rawValue) | (UIRectCorner.bottomRight.rawValue) // 任意切圆角 eg:UIRectCorner(rawValue: (UIRectCorner.topRight.rawValue) | (UIRectCorner.bottomRight.rawValue)
public func createCorner(_ cornerRadii:CGSize,_ roundingCorners:UIRectCorner) { @discardableResult
public func createCorner(_ cornerRadii:CGSize,_ roundingCorners:UIRectCorner) -> CAShapeLayer {
let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: roundingCorners,cornerRadii:cornerRadii); let path = UIBezierPath(roundedRect:bounds,byRoundingCorners: roundingCorners,cornerRadii:cornerRadii)
let layer = CAShapeLayer(); let layer = CAShapeLayer()
layer.frame = bounds; layer.frame = bounds
layer.path = path.cgPath; layer.path = path.cgPath
self.layer.mask = layer; self.layer.mask = layer
return layer
} }
} }
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