Commit a30c57ec authored by Steven杜宇's avatar Steven杜宇

// 文件清单

parent 8a66593d
......@@ -15,9 +15,10 @@ class YHMyFileListViewController: YHBaseViewController {
let topSegmentHeight = 48.0
var items:[[String]] = [["",""], [], ["","",""]]
lazy var titles = ["主申请人", "配偶", "子女"]
let certificateReqVM : YHCertificateViewModel = YHCertificateViewModel()
var orderId : Int = 0
var items:[YHFileListModel] = []
lazy var titles:[String] = []
let viewModel: YHCertificateViewModel = YHCertificateViewModel()
lazy var navBar: YHCustomNavigationBar = {
let bar = YHCustomNavigationBar.navBar()
......@@ -195,16 +196,25 @@ class YHMyFileListViewController: YHBaseViewController {
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadData()
loadData2()
}
func updateCount() {
let submitCount = self.viewModel.certificateEntryModel?.to_be_submit_num ?? 0
let reuploadCount = self.viewModel.certificateEntryModel?.reject_num ?? 0
let textColor = UIColor.mainTextColor70
let countColor = UIColor.brandMainColor
let textFont = UIFont.PFSC_R(ofSize: 14)
let countFont = UIFont.PFSC_B(ofSize: 16)
let a: ASAttributedString = .init("您有 ", .font(textFont),.foreground(textColor))
let b: ASAttributedString = .init(NSAttributedString(string: String(10)), .font(countFont),.foreground(countColor))
let b: ASAttributedString = .init(NSAttributedString(string: String(submitCount)), .font(countFont),.foreground(countColor))
let c: ASAttributedString = .init(" 项待提交,", .font(textFont),.foreground(textColor))
let d: ASAttributedString = .init(NSAttributedString(string: String(99)), .font(countFont),.foreground(countColor))
let d: ASAttributedString = .init(NSAttributedString(string: String(reuploadCount)), .font(countFont),.foreground(countColor))
let e: ASAttributedString = .init(" 项需重传", .font(textFont),.foreground(textColor))
totalLabel.attributed.text = a+b+c+d+e
}
......@@ -226,9 +236,9 @@ extension YHMyFileListViewController : UITableViewDelegate, UITableViewDataSourc
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if 0 <= section && section < items.count {
let arr = items[section]
if arr.count > 0 {
return arr.count
let model = items[section]
if model.supplement_list.count > 0 {
return model.supplement_list.count
}
return 1
}
......@@ -239,11 +249,13 @@ extension YHMyFileListViewController : UITableViewDelegate, UITableViewDataSourc
let noneCell = tableView.dequeueReusableCell(withIdentifier: YHMyFileListNoneCell.cellReuseIdentifier, for: indexPath) as! YHMyFileListNoneCell
if 0 <= indexPath.section && indexPath.section < items.count {
let arr = items[indexPath.section]
if arr.count > 0 {
let model = items[indexPath.section]
if model.supplement_list.count > 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHMyFileListCell.cellReuseIdentifier, for: indexPath) as! YHMyFileListCell
if 0 <= indexPath.row && indexPath.row < arr.count {
cell.isLastCell = indexPath.row == arr.count-1
if 0 <= indexPath.row && indexPath.row < model.supplement_list.count {
cell.indexLabel.text = "\(indexPath.row+1)"
cell.model = model.supplement_list[indexPath.row]
cell.isLastCell = indexPath.row == model.supplement_list.count-1
}
return cell
}
......@@ -253,20 +265,53 @@ extension YHMyFileListViewController : UITableViewDelegate, UITableViewDataSourc
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if 0 <= indexPath.section && indexPath.section < items.count {
let arr = items[indexPath.section]
if arr.count > 0 {
let model = items[indexPath.section]
if model.supplement_list.count > 0 {
return UITableView.automaticDimension
}
}
return 72.0
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if 0 <= indexPath.section && indexPath.section < items.count {
let model = items[indexPath.section]
if model.supplement_list.count > 0 {
let supplement = model.supplement_list[indexPath.row]
if supplement.checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
self.viewModel.showUploadSheetView(supplementId: supplement.id) {
[weak self] in
guard let self = self else { return }
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryId = model.category_id
vc.supplementId = supplement.id
self.navigationController?.pushViewController(vc)
}
self.loadData()
self.loadData2()
}
return
}
// 非待上传的进入详情
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryId = model.category_id
vc.supplementId = supplement.id
self.navigationController?.pushViewController(vc)
}
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = YHMyFileListHeaderView(frame: .zero)
view.headerView.isHidden = true
if 0 <= section && section < items.count {
let arr = items[section]
if arr.count > 0 {
let model = items[section]
view.titleLabel.text = model.ApplicantName
if model.supplement_list.count > 0 {
view.headerView.isHidden = false
}
}
......@@ -275,8 +320,8 @@ extension YHMyFileListViewController : UITableViewDelegate, UITableViewDataSourc
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if 0 <= section && section < items.count {
let arr = items[section]
if arr.count > 0 {
let model = items[section]
if model.supplement_list.count > 0 {
return 103.0
}
}
......@@ -319,7 +364,7 @@ extension YHMyFileListViewController : UITableViewDelegate, UITableViewDataSourc
if items.count > 0 {
var arr:[Double] = []
for index in 0..<items.count {
var rect = self.tableView.rectForHeader(inSection: index)
let rect = self.tableView.rectForHeader(inSection: index)
let y = rect.origin.y-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight
arr.append(y)
......@@ -425,3 +470,54 @@ extension YHMyFileListViewController {
self.navStatusBar.backgroundColor = show ? UIColor.white : UIColor.clear
}
}
extension YHMyFileListViewController {
func loadData() {
let param = ["order_id":orderId,
"node":"1",
"state":"1"] as [String : Any]
viewModel.getCertificateFileListData(params: param) { success, error in
self.items.removeAll()
self.titles.removeAll()
if success == true {
var isHaveData = false
for (_, item) in self.viewModel.arrFileListData.enumerated() {
let arr = item?.supplement_list.filter { (item) -> Bool in
return item.checkStatus == 2 || item.checkStatus == 3
}
if let array = arr, array.count > 0 {
isHaveData = true
}
}
for model in self.viewModel.arrFileListData {
if let model = model {
self.items.append(model)
self.titles.append(model.ApplicantName)
}
}
self.topSegmentView.items = self.titles
self.segmentView.items = self.titles
self.showEmptyView(!isHaveData)
self.saveBtn.isEnabled = true
self.bottomView.layer.opacity = 1.0
} else {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
self.tableView.reloadData()
}
}
func loadData2() {
let param = ["order_id": orderId,
"node": "1",
"state":"1"] as [String : Any]
viewModel.getCertificateStatisticData(params: param) { success, error in
if !success {
YHHUD.flash(message: error?.errorMsg ?? "请求出错")
}
self.updateCount()
}
}
}
......@@ -11,6 +11,32 @@ import UIKit
class YHMyFileListCell: UITableViewCell {
static let cellReuseIdentifier = "YHMyFileListCell"
var model: YHSupplementInfo = YHSupplementInfo() {
didSet {
titleLabel.text = model.name
subLabel.text = model.typeName
var text : String = "--"
var color : UIColor = .failColor
if model.checkStatus == 2 {
text = "需重传"
color = .failColor
arrowImgView.image = UIImage(named: "file_list_right_arrow_red")
} else if model.checkStatus == 3 {
text = "待提交"
color = .brandMainColor
arrowImgView.image = UIImage(named: "file_list_right_arrow_blue")
} else {
text = "需过滤" + String(model.checkStatus)
color = UIColor.purple
arrowImgView.image = UIImage(named: "file_list_right_arrow_blue")
}
statusLabel.text = text
statusLabel.textColor = color
}
}
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
......@@ -135,9 +161,8 @@ class YHMyFileListCell: UITableViewCell {
self.statusHoldView.addSubview(arrowImgView)
self.statusHoldView.addSubview(statusLabel)
self.indexLabel.text = "1"
self.titleLabel.text = "阿萨法法师打发所发生的代发阿斯顿法师法师法师法师打发沙发沙发沙发大沙发沙发打撒阿斯顿发生的发生发大水发"
self.subLabel.text = "啊发沙发沙发所发生的法守法"
self.indexLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
self.indexLabel.setContentHuggingPriority(.required, for: .horizontal)
self.whiteContentView.snp.makeConstraints { make in
make.left.equalTo(16)
......
......@@ -78,7 +78,7 @@ class YHMyFileListHeaderView: UIView {
label1.textColor = UIColor.mainTextColor
label1.font = UIFont.PFSC_M(ofSize: 18)
label1.textAlignment = .center
label1.text = "主申请人"
label1.text = ""
return label1
}()
......
......@@ -131,7 +131,7 @@ extension YHMineCertificateEntryViewController {
} else {
//生成清单
let vc = YHMyFileListViewController()
// vc.orderId = self.orderId
vc.orderId = self.orderId
self.navigationController?.pushViewController(vc)
}
}
......
......@@ -60,29 +60,13 @@ class YHCertificateViewModel: YHBaseViewModel {
return
}
for (_,item) in resultModel.enumerated() {
let arr = item?.supplement_list.filter { (item) -> Bool in
return item.checkStatus == 2 || item.checkStatus == 3
}
item?.supplement_list = arr ?? []
}
// var arr = resultModel.filter { (item) -> Bool in
// if let ttt = item,ttt.supplement_list.count > 0 {
// return true
// }
// return false
// }
var arr = resultModel
//添加 写死的数据类型
let tmpModel = YHFileListModel()
tmpModel.ApplicantName = "温馨提示"
tmpModel.type = 1
tmpModel.arrTxt = ["1.以上资料请提供清晰完整的彩色扫描件。","2.照片最好同时提供电子档及时通知我们以避免对申请结果产生影响。","3.申请递交之后,如目前所报备的情况有任何变化(包含婚姻状况、新生子女、工作情况、亲属关系变化),请及时通知我们以避免对申请结果产生影响。"]
arr.append(tmpModel)
self.arrFileListData = arr
......@@ -90,9 +74,11 @@ class YHCertificateViewModel: YHBaseViewModel {
} else {
let err = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg.isEmpty ? "" : json.msg)
self.arrFileListData = []
callBackBlock(false,err)
}
} failBlock: { err in
self.arrFileListData = []
callBackBlock(false,err)
}
}
......
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