// // HistoryController.swift // OrderScheduling // // Created by 中道 on 2023/8/18. // import Foundation import DDAutoUIKit_Private import DDControlsKit_Private import RxSwift import RxRelay import RxCocoa import JXCategoryView import DDToastKit_Private import MJRefresh extension HistoryController { func addActions() { MCOUNT.messageCountRelay .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] count in if count > 0 { self?.messageView.countLabel.isHidden = false self?.messageView.countLabel.text = String(count) self?.messageView.countLabel.snp.updateConstraints({ make in make.width.equalTo(20) }) }else{ self?.messageView.countLabel.isHidden = true self?.messageView.countLabel.snp.updateConstraints({ make in make.width.equalTo(0) }) } }) .disposed(by: disposeBag) MCOUNT.pendingCountRelay .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] count in if count > 0 { self?.pendingView.countLabel.isHidden = false self?.pendingView.countLabel.text = String(count) self?.pendingView.countLabel.snp.updateConstraints({ make in make.width.equalTo(20) }) }else{ self?.pendingView.countLabel.isHidden = true self?.pendingView.countLabel.snp.updateConstraints({ make in make.width.equalTo(0) }) } }) .disposed(by: disposeBag) messageTapGes.rx.event .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] _ in MESSAGETOOL.openMessageCenter(by: self?.navigationController) }) .disposed(by: disposeBag) pendingTapGes.rx.event .observe(on: MainScheduler.instance) .subscribe(onNext: { _ in WEBTOOL.open(name: .todoList,appending: nil) }) .disposed(by: disposeBag) // 点击tabBar 需要刷下下列 preRefreshRelay .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] _ in MCOUNT.newestMessage() self?.categoryView.reloadData() }) .disposed(by: disposeBag) } } extension HistoryItemController { func addActions() { historyItemView.tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: {[weak self] in self?.pageNum = 1 self?.refreshRelay.accept(self?.pageNum ?? 1) }) historyItemView.tableView.mj_footer = MJRefreshBackNormalFooter(refreshingBlock: {[weak self] in self?.pageNum+=1 self?.refreshRelay.accept(self?.pageNum ?? 1) }) refreshRelay .flatMapLatest {[weak self] pageNum in return Observable.zip(RQ.orderList(parameters: self?.conditionalSearchTool.getParameters(pageNum: pageNum, queryType: (self?.type)!) ?? OrderListParameters(pageNum: pageNum, queryType: (self?.type)!)).asObservable(), Observable.just(pageNum)) } .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] (response, pageNum) in if response?.success == true { if pageNum == 1 { self?.resultArr.removeAll() self?.historyItemView.tableView.mj_footer?.resetNoMoreData() self?.historyItemView.tableView.mj_header?.endRefreshing() }else{ if response?.data?.isEmpty == false { self?.historyItemView.tableView.mj_footer?.endRefreshing() }else{ self?.historyItemView.tableView.mj_footer?.endRefreshingWithNoMoreData() } } if let array = response?.data { self?.resultArr.append(contentsOf: array) } if self?.resultArr.isEmpty == false { self?.emptyView.isHidden = true }else{ self?.emptyView.isHidden = false } self?.historyItemView.tableView.reloadData() }else{ if pageNum == 1 { self?.historyItemView.tableView.mj_header?.endRefreshing() }else{ self?.historyItemView.tableView.mj_footer?.endRefreshing() } self?.view.dd_makeToast(response?.msg) } }) .disposed(by: disposeBag) searchButton.rx.tap .subscribe(onNext: {[weak self] _ in self?.conditionalSearchTool.showSearchViewSub.accept(UIApplication.shared.dd_keyWindow.safeAreaInsets.bottom) }) .disposed(by: disposeBag) conditionalSearchTool.resetSub .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] _ in self?.historyItemView.tableView.mj_header?.beginRefreshing() }) .disposed(by: disposeBag) conditionalSearchTool.searchSub .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] _ in self?.historyItemView.tableView.mj_header?.beginRefreshing() }) .disposed(by: disposeBag) historyItemView.tableView.mj_header?.beginRefreshing() USERP.userPermissionRelay .observe(on: MainScheduler.instance) .subscribe(onNext: {[weak self] _ in self?.historyItemView.tableView.reloadData() }) .disposed(by: disposeBag) } } extension HistoryItemController : UITableViewDelegate, UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return resultArr.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCell(withIdentifier: "cell") as? HistoryItemCell if cell == nil { cell = HistoryItemCell(style: .default, reuseIdentifier: "cell") cell?.line.backgroundColor = .hex("E9E9EA").alpha(0.6) cell?.orderDateTitleLabel.text = "工单时间:" cell?.orderStatusTitleLabel.text = "状态:" cell?.serviceTitleLabel.text = "故障地:" cell?.reportButton.setTitle("报备", for: .normal) cell?.reportDetailButton.setTitle("报备查看", for: .normal) cell?.additionalButton.setTitle("补结算单", for: .normal) } let model = resultArr[indexPath.row] cell?.typeLabel.text = model.taskServiceName cell?.orderNumLabel.text = model.orderCode cell?.orderStatusLabel.text = model.taskOrderStatusString if model.taskOrderStatusString == "任务完成" { cell?.orderStatusLabel.textColor = .hex("09B820") }else{ cell?.orderStatusLabel.textColor = .hex("E64C0B") } cell?.orderDateLabel.text = model.createTime cell?.serviceLabel.text = model.vehiclePointAddress if model.destinationAddress?.isEmpty == false { cell?.destinationTitleLabel.text = "目的地:" cell?.destinationLabel.text = model.destinationAddress cell?.destinationTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.serviceLabel.snp.bottom).offset(auto(8)) }) }else{ cell?.destinationTitleLabel.text = nil cell?.destinationLabel.text = nil cell?.destinationTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.serviceLabel.snp.bottom).offset(0) }) } if model.isSupplierSettle?.label.isEmpty == false { cell?.settlementLabel.text = model.isSupplierSettle?.label cell?.settlementTitleLabel.text = "是否结算:" cell?.settlementTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.destinationLabel.snp.bottom).offset(auto(8)) }) }else{ cell?.settlementLabel.text = nil cell?.settlementTitleLabel.text = nil cell?.settlementTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.destinationLabel.snp.bottom).offset(0) }) } if model.supplierSettleRatio?.label.isEmpty == false { cell?.settlementRatioLabel.text = model.supplierSettleRatio?.label cell?.settlementRatioTitleLabel.text = "结算比例:" cell?.settlementRatioTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.settlementLabel.snp.bottom).offset(auto(8)) }) }else{ cell?.settlementRatioLabel.text = nil cell?.settlementRatioTitleLabel.text = nil cell?.settlementRatioTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.settlementLabel.snp.bottom).offset(0) }) } cell?.reportButton.rx.tap .observe(on: MainScheduler.instance) .subscribe(onNext: { _ in WEBTOOL.open(name: .reporting, appending: "&queryType=\(OrderTypeEnum.UNCLOSED_ORDER.rawValue)&userOrderId=\(model.userOrderId)&orderCode=\(model.orderCode)") }) .disposed(by: cell!.disposeBag) cell?.reportDetailButton.rx.tap .observe(on: MainScheduler.instance) .subscribe(onNext: { _ in WEBTOOL.open(name: .reportingList,appending: "&queryType=\(OrderTypeEnum.UNCLOSED_ORDER.rawValue)&userOrderId=\(model.userOrderId)&orderCode=\(model.orderCode)&taskOrderId=\(model.taskOrderId)") }) .disposed(by: cell!.disposeBag) cell?.additionalButton.rx.tap .observe(on: MainScheduler.instance) .subscribe(onNext: { _ in WEBTOOL.open(name: .supplySettlement, appending: "&queryType=\(OrderTypeEnum.UNCLOSED_ORDER.rawValue)&userOrderId=\(model.userOrderId)&orderCode=\(model.orderCode)&taskOrderId=\(model.taskOrderId)") }) .disposed(by: cell!.disposeBag) if USERP.canSupplierRemarkBtn == true { cell?.reportButton.isHidden = false cell?.reportButton.snp.updateConstraints({ make in make.width.equalTo(auto(80)) make.right.equalTo(cell!.additionalButton.snp.left).offset(-auto(5)) }) }else{ cell?.reportButton.isHidden = true cell?.reportButton.snp.updateConstraints({ make in make.width.equalTo(0) make.right.equalTo(cell!.additionalButton.snp.left).offset(0) }) } if USERP.canSupplierAuditEditCostBtn == true { cell?.additionalButton.isHidden = false cell?.additionalButton.snp.updateConstraints({ make in make.width.equalTo(auto(80)) make.right.equalTo(-auto(8)) }) }else{ cell?.additionalButton.isHidden = true cell?.additionalButton.snp.updateConstraints({ make in make.width.equalTo(0) make.right.equalTo(0) }) } return cell! } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let model = resultArr[indexPath.item] WEBTOOL.open(name: .workOrderDetail, appending: "&queryType=\(type.rawValue)&userOrderId=\(model.userOrderId)&orderCode=\(model.orderCode)&taskOrderId=\(model.taskOrderId)") } } // MARK: JXCategoryViewDelegate,JXCategoryListContainerViewDelegate extension HistoryController : JXCategoryViewDelegate,JXCategoryListContainerViewDelegate { public func number(ofListsInlistContainerView listContainerView: JXCategoryListContainerView!) -> Int { return categoryView.titles.count } public func listContainerView(_ listContainerView: JXCategoryListContainerView!, initListFor index: Int) -> JXCategoryListContentViewDelegate! { if index == 0 { return HistoryItemController(type: .UNCLOSED_ORDER) } if index == 1 { return HistoryItemController(type: .WITHIN_30_DAYS) } return HistoryItemController(type: .WITHIN_3_MONTHS) } } open class HistoryController : ZDViewController { private let categoryView = JXCategoryTitleView() private lazy var categoryContainerView = JXCategoryListContainerView(type: .scrollView, delegate: self) private let reloadToDoMessageCountRelay = ReplayRelay.create(bufferSize: 1) private let disposeBag = DisposeBag() private let messageTapGes = UITapGestureRecognizer() private let messageView = MessageView() private let pendingTapGes = UITapGestureRecognizer() private let pendingView = MessageView() private var preRefreshRelay = ReplayRelay.create(bufferSize: 1) public override func viewDidLoad() { super.viewDidLoad() dd_navigationBarBackgroundColor = .hex("354683") dd_navigationBarTitleTextAttributes = [.foregroundColor : UIColor.white(alpha: 0.7),.font:UIFont.mediumFont(auto(15))] dd_navigationBarBarButtonItemAttributes = [.foregroundColor : UIColor.white] dd_navigationItemTitle = "历史工单" navigationItem.leftBarButtonItems = nil addSubviews() addActions() } func addSubviews() { categoryView.titles = ["未关闭工单","30天内工单","3个月内工单"] categoryView.titleColor = .hex("737373").alpha(0.55) categoryView.titleSelectedColor = .hex("3678FF") categoryView.backgroundColor = .hex("F4F5F7") categoryView.delegate = self view.addSubview(categoryView) // 指示器 let indicator = JXCategoryIndicatorLineView() indicator.indicatorColor = .hex("3678FF") indicator.indicatorWidth = auto(18) indicator.verticalMargin = 7 categoryView.indicators = [indicator] // 内容 view.addSubview(categoryContainerView!) categoryView.listContainer = categoryContainerView messageView.titleLabel.text = "消息" messageView.addGestureRecognizer(messageTapGes) navigationItem.leftBarButtonItem = UIBarButtonItem(customView: messageView) messageView.snp.makeConstraints { make in make.height.equalTo(40) make.width.greaterThanOrEqualTo(40) } pendingView.titleLabel.text = "待办" pendingView.addGestureRecognizer(pendingTapGes) navigationItem.rightBarButtonItem = UIBarButtonItem(customView: pendingView) pendingView.snp.makeConstraints { make in make.height.equalTo(40) make.width.greaterThanOrEqualTo(40) } } open override func viewSafeAreaInsetsDidChange() { super.viewSafeAreaInsetsDidChange() categoryView.snp.remakeConstraints { make in make.left.right.equalToSuperview() make.top.equalTo(view.safeAreaInsets.top) make.height.equalTo(auto(44)) } // view.safeAreaInsets.bottom为0的时候是hiddenBottomBar的时候,此时不必约束,由于是首页所以view.safeAreaInsets.bottom一定是大于0的 if view.safeAreaInsets.bottom != 0 { categoryContainerView?.snp.makeConstraints({ make in make.top.equalTo(categoryView.snp.bottom) make.left.right.equalToSuperview() make.bottom.equalTo(-view.safeAreaInsets.bottom) }) } } open override func reloadData() { super.reloadData() preRefreshRelay.accept(nil) } } class HistoryItemController : ZDViewController { private let disposeBag = DisposeBag() private let historyItemView = HistoryItemView() private var resultArr : [OrderListDataModel] = [] private var environmentPics : [String] = [] private var refreshRelay = ReplayRelay.create(bufferSize: 1) private var pageNum : Int = 1 private var type : OrderTypeEnum private var emptyView = EmptyView() private var searchButton = DDButton.dd_initCustom() public lazy var conditionalSearchTool = ConditionalSearchTool() public init(type:OrderTypeEnum) { self.type = type super.init(nibName: nil, bundle: nil) } public required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() dd_navigationBarBackgroundColor = .hex("354683") dd_navigationBarTitleTextAttributes = [.foregroundColor : UIColor.white(alpha: 0.7),.font:UIFont.mediumFont(17)] dd_navigationBarBarButtonItemAttributes = [.foregroundColor : UIColor.white] addSubviews() addActions() } func addSubviews() { view.addSubview(historyItemView) historyItemView.snp.makeConstraints { make in make.edges.equalToSuperview() } historyItemView.tableView.addSubview(emptyView) emptyView.snp.makeConstraints { make in make.centerX.centerY.equalToSuperview() make.width.equalTo(auto(303)) make.height.equalTo(auto(94)) } historyItemView.tableView.delegate = self historyItemView.tableView.dataSource = self searchButton.backgroundColor = .hex("2A5094") searchButton.setImage(UIImage(named: "conditional_search"), for: .normal) view.addSubview(searchButton) searchButton.layer.cornerRadius = auto(20) searchButton.snp.remakeConstraints { make in make.bottom.equalTo(historyItemView.snp.bottom).offset(-auto(30)) make.right.equalTo(historyItemView.snp.right).offset(-auto(20)) make.width.height.equalTo(auto(40)) } } } class HistoryItemCell : DDTableViewCell { public let radiusView : DDView public let typeLabel : DDLabel public let orderNumLabel : DDLabel public let orderStatusTitleLabel : DDLabel public let orderStatusLabel : DDLabel public let line : DDView public let orderDateTitleLabel : DDLabel public let orderDateLabel : DDLabel public let serviceTitleLabel : DDLabel public let serviceLabel : DDLabel public let destinationTitleLabel : DDLabel public let destinationLabel : DDLabel public let settlementTitleLabel : DDLabel public let settlementLabel : DDLabel public let settlementRatioTitleLabel : DDLabel public let settlementRatioLabel : DDLabel public let additionalButton : DDButton public let reportButton : DDButton public let reportDetailButton : DDButton public var disposeBag : DisposeBag override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { radiusView = DDView.init() typeLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(13)), textColor: .hex("000000").alpha(0.85)) orderNumLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(11)), textColor: .hex("000000").alpha(0.55)) orderStatusTitleLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(12)), textColor: .hex("000000").alpha(0.5)) orderStatusLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(12)), textColor: .hex("E69B0B")) line = DDView.init() orderDateTitleLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(12)), textColor: .hex("000000").alpha(0.5)) orderDateLabel = DDLabel.dd_init(withText: "", font: .regularFont(auto(12)), textColor: .hex("000000")) serviceTitleLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(12)), textColor: .hex("000000").alpha(0.5)) serviceLabel = DDLabel.dd_init(withText: "", font: .regularFont(auto(12)), textColor: .hex("000000")) destinationTitleLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(12)), textColor: .hex("000000").alpha(0.5)) destinationLabel = DDLabel.dd_init(withText: "", font: .regularFont(auto(12)), textColor: .hex("000000")) settlementTitleLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(12)), textColor: .hex("000000").alpha(0.5)) settlementLabel = DDLabel.dd_init(withText: "", font: .regularFont(auto(12)), textColor: .hex("000000")) settlementRatioTitleLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(12)), textColor: .hex("000000").alpha(0.5)) settlementRatioLabel = DDLabel.dd_init(withText: "", font: .regularFont(auto(12)), textColor: .hex("000000")) additionalButton = DDButton.dd_initCustom() additionalButton.titleLabel?.font = .mediumFont(13) additionalButton.setTitleColor(.hex("FFFFFF"), for: .normal) reportButton = DDButton.dd_initCustom() reportButton.titleLabel?.font = .mediumFont(13) reportButton.setTitleColor(.hex("000000").alpha(0.7), for: .normal) reportDetailButton = DDButton.dd_initCustom() reportDetailButton.titleLabel?.font = .mediumFont(13) reportDetailButton.setTitleColor(.hex("000000").alpha(0.7), for: .normal) disposeBag = DisposeBag() super.init(style: style, reuseIdentifier: reuseIdentifier) contentView.backgroundColor = .hex("F4F5F7") radiusView.layer.cornerRadius = auto(6) radiusView.layer.shadowColor = UIColor.black(alpha: 0.1).cgColor radiusView.layer.shadowOpacity = 1.0 radiusView.layer.shadowRadius = 3 radiusView.layer.shadowOffset = CGSize(width: 0, height: 3) radiusView.backgroundColor = .white contentView.addSubview(radiusView) radiusView.addSubview(typeLabel) radiusView.addSubview(orderNumLabel) radiusView.addSubview(orderStatusTitleLabel) orderStatusLabel.numberOfLines = 0 radiusView.addSubview(orderStatusLabel) radiusView.addSubview(line) radiusView.addSubview(orderDateTitleLabel) radiusView.addSubview(orderDateLabel) radiusView.addSubview(serviceTitleLabel) serviceLabel.numberOfLines = 0 radiusView.addSubview(serviceLabel) radiusView.addSubview(destinationTitleLabel) destinationLabel.numberOfLines = 0 radiusView.addSubview(destinationLabel) radiusView.addSubview(settlementTitleLabel) radiusView.addSubview(settlementLabel) radiusView.addSubview(settlementRatioTitleLabel) radiusView.addSubview(settlementRatioLabel) additionalButton.layer.cornerRadius = auto(4) additionalButton.layer.masksToBounds = true additionalButton.backgroundColor = .hex("2A5094") radiusView.addSubview(additionalButton) reportButton.layer.borderColor = UIColor.hex("DDDDDD").cgColor reportButton.layer.borderWidth = 1 reportButton.layer.cornerRadius = auto(4) radiusView.addSubview(reportButton) reportDetailButton.layer.borderColor = UIColor.hex("DDDDDD").cgColor reportDetailButton.layer.borderWidth = 1 reportDetailButton.layer.cornerRadius = auto(4) radiusView.addSubview(reportDetailButton) radiusView.snp.makeConstraints { make in make.left.equalTo(auto(12)) make.right.equalTo(-auto(12)) make.top.equalTo(0) make.bottom.equalTo(-auto(12)) } typeLabel.snp.makeConstraints { make in make.left.equalTo(auto(18)) make.top.equalTo(auto(13)) } orderNumLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal) orderNumLabel.snp.makeConstraints { make in make.centerY.equalTo(typeLabel) make.left.equalTo(typeLabel.snp.right).offset(auto(10)) } line.snp.makeConstraints { make in make.top.equalTo(typeLabel.snp.bottom).offset(auto(7)) make.left.right.equalTo(0) make.height.equalTo(0.5) } orderDateTitleLabel.snp.makeConstraints { make in make.left.equalTo(typeLabel) make.top.equalTo(line.snp.top).offset(auto(5)) make.width.equalTo(auto(60)) } orderDateLabel.snp.makeConstraints { make in make.left.equalTo(orderDateTitleLabel.snp.right).offset(auto(10)) make.top.equalTo(orderDateTitleLabel) } orderStatusTitleLabel.snp.makeConstraints { make in make.left.equalTo(typeLabel) make.top.equalTo(orderDateLabel.snp.bottom).offset(auto(8)) make.width.equalTo(orderDateTitleLabel) } orderStatusLabel.snp.makeConstraints { make in make.right.equalTo(-auto(20)) make.top.equalTo(orderStatusTitleLabel) make.left.equalTo(orderStatusTitleLabel.snp.right) } serviceTitleLabel.snp.makeConstraints { make in make.top.equalTo(orderStatusLabel.snp.bottom).offset(auto(8)) make.left.equalTo(typeLabel) make.width.equalTo(orderDateTitleLabel) } serviceLabel.snp.makeConstraints { make in make.top.equalTo(serviceTitleLabel) make.left.equalTo(serviceTitleLabel.snp.right) make.right.equalTo(-auto(20)) } destinationTitleLabel.snp.makeConstraints { make in make.top.equalTo(serviceLabel.snp.bottom).offset(auto(8)) make.left.equalTo(typeLabel) make.width.equalTo(orderDateTitleLabel) } destinationLabel.snp.makeConstraints { make in make.top.equalTo(destinationTitleLabel) make.left.equalTo(destinationTitleLabel.snp.right) make.right.equalTo(-auto(20)) } settlementTitleLabel.snp.makeConstraints { make in make.left.equalTo(typeLabel) make.top.equalTo(destinationLabel.snp.bottom) make.width.equalTo(orderDateTitleLabel) } settlementLabel.snp.makeConstraints { make in make.top.equalTo(settlementTitleLabel) make.right.equalTo(-auto(20)) make.left.equalTo(settlementTitleLabel.snp.right) } settlementRatioTitleLabel.snp.makeConstraints { make in make.left.equalTo(typeLabel) make.top.equalTo(settlementLabel.snp.bottom).offset(auto(8)) make.width.equalTo(orderDateTitleLabel) } settlementRatioLabel.snp.makeConstraints { make in make.top.equalTo(settlementRatioTitleLabel) make.right.equalTo(-auto(20)) make.left.equalTo(settlementRatioTitleLabel.snp.right) } additionalButton.snp.makeConstraints { make in make.right.equalToSuperview().offset(-auto(8)) make.top.equalTo(reportDetailButton) make.width.equalTo(auto(80)) make.height.equalTo(auto(30)) } reportButton.snp.makeConstraints { make in make.right.equalTo(additionalButton.snp.left).offset(-auto(5)) make.top.equalTo(reportDetailButton) make.width.equalTo(auto(80)) make.height.equalTo(auto(30)) } reportDetailButton.snp.makeConstraints { make in make.right.equalTo(reportButton.snp.left).offset(-auto(5)) make.width.equalTo(auto(80)) make.height.equalTo(auto(30)) make.top.equalTo(settlementRatioLabel.snp.bottom).offset(auto(10)) make.bottom.equalToSuperview().offset(-auto(10)) } } required public init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func prepareForReuse() { super.prepareForReuse() disposeBag = DisposeBag() } } // MARK: View class HistoryItemView : DDView { public let tableView = DDTableView.init(frame: CGRectZero) override init(frame: CGRect) { super.init(frame: frame) tableView.separatorStyle = .none tableView.backgroundColor = .hex("FAFAFA") addSubview(tableView) tableView.snp.makeConstraints { make in make.edges.equalToSuperview() } } required public init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } // MARK: JXCategoryListContentViewDelegate extension HistoryItemController : JXCategoryListContentViewDelegate { func listView() -> UIView! { return view } }