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

// 文件清单

parent 69c65d19
......@@ -17,7 +17,8 @@ class YHFileListViewController: YHBaseViewController {
var orderId : Int?
private let certificateReqVM : YHCertificateViewModel = YHCertificateViewModel()
let viewModel: YHCertificateViewModel = YHCertificateViewModel()
private lazy var headView : YHFileListHeaerView = {
let view = YHFileListHeaerView()
view.backgroundColor = .clear
......@@ -48,7 +49,6 @@ class YHFileListViewController: YHBaseViewController {
view.backgroundColor = .white
view.layer.cornerRadius = kCornerRadius12
view.clipsToBounds = true
view.orderId = self.orderId ?? 0
return view
}()
......@@ -69,6 +69,9 @@ class YHFileListViewController: YHBaseViewController {
loadData2()
NotificationCenter.default.addObserver(self, selector: #selector(refreshListData), name: YhConstant.YhNotification.refreshCertificateFileListNotifiction, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didClickFileListItem(_:)), name: YhConstant.YhNotification.clickCertificateFileListItemNotifiction, object: nil)
}
deinit {
......@@ -248,3 +251,47 @@ extension YHFileListViewController {
YHHUD.flash(message: "保存成功")
}
}
extension YHFileListViewController {
// 点击文件清单
@objc func didClickFileListItem(_ notification: Notification) {
guard let userInfo = notification.userInfo else {
return
}
guard let supplementId = userInfo["supplementId"] as? Int,
let categoryId = userInfo["categoryId"] as? Int,
let checkStatus = userInfo["checkStatus"] as? Int else {
printLog("参数不全")
return
}
printLog("\(userInfo)")
if checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
self.viewModel.showUploadSheetView(supplementId: supplementId) {
[weak self] in
guard let self = self else { return }
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId ?? 0
vc.categoryId = categoryId
vc.supplementId = supplementId
self.navigationController?.pushViewController(vc)
}
self.loadData()
self.loadData2()
}
return
}
// 非待上传的进入详情
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId ?? 0
vc.categoryId = categoryId
vc.supplementId = supplementId
self.navigationController?.pushViewController(vc)
}
}
......@@ -9,9 +9,7 @@
import UIKit
class YHFileListContentView: UIView {
var orderId: Int = 0
override init(frame: CGRect) {
super.init(frame: frame)
initView()
......@@ -78,10 +76,6 @@ extension YHFileListContentView {
continue
}
var view : UIView = YHFileListItemsView()
if view is YHFileListItemsView {
let targetView = view as! YHFileListItemsView
targetView.orderId = self.orderId
}
if iii.type == 0 {
(view as! YHFileListItemsView).dataModel = item
} else {
......
......@@ -8,11 +8,12 @@
import UIKit
let kSupplementIdKey = "supplementId"
let kCheckStatusKey = "checkStatus"
let kCategoryIdKey = "categoryId"
class YHFileListItemsView: UIView {
var orderId:Int = 0
var viewModel: YHCertificateViewModel = YHCertificateViewModel()
override init(frame: CGRect) {
super.init(frame: frame)
}
......@@ -43,11 +44,6 @@ class YHFileListItemsView: UIView {
lable0.textAlignment = .center
return lable0
}()
}
private extension YHFileListItemsView {
......@@ -138,9 +134,14 @@ private extension YHFileListItemsView {
view.myIndex = index
view.dataModel = item
view.clickBlock = {
[weak self] model in
guard let self = self else { return }
self.handleClickDataModel(model)
model in
let supplementId = model?.id ?? 0
let categoryId = self.dataModel?.category_id ?? 0
let checkStatus = model?.checkStatus ?? -1
let dict = [kSupplementIdKey: supplementId,
kCategoryIdKey: categoryId,
kCheckStatusKey: checkStatus]
NotificationCenter.default.post(name: YhConstant.YhNotification.clickCertificateFileListItemNotifiction, object: nil, userInfo: dict)
}
holdView.addSubview(view)
......@@ -167,37 +168,5 @@ private extension YHFileListItemsView {
}
}
private extension YHFileListItemsView {
func handleClickDataModel(_ targetModel: YHSupplementInfo?) {
guard let model = targetModel else {
return
}
if model.checkStatus == YHCertificateUploadStatus.preUpload.rawValue { // 待上传
showUploadSheetView(supplementId: model.id)
return
}
// 非待上传的进入详情
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryId = self.dataModel?.category_id ?? 0
vc.supplementId = model.id
UIViewController.current?.navigationController?.pushViewController(vc)
}
func showUploadSheetView(supplementId: Int) {
self.viewModel.showUploadSheetView(supplementId: supplementId) {
DispatchQueue.main.async {
let vc = YHCertificateUploadContentListVC()
vc.orderId = self.orderId
vc.categoryId = self.dataModel?.category_id ?? 0
vc.supplementId = supplementId
UIViewController.current?.navigationController?.pushViewController(vc)
}
}
}
}
......@@ -34,9 +34,10 @@ enum YHCertificateUploadStatus : Int {
class YHCertificateViewModel: YHBaseViewModel {
let sheetView = YHCertificateUploadSheetView.sheetView()
var certificateEntryModel : YHCertificateEntryModel?
var arrQuestionAndAnswer : [YHQuestionAndAnswerModel?] = []
var arrFileListData : [YHFileListModel?] = []
......@@ -239,7 +240,6 @@ extension YHCertificateViewModel {
func showUploadSheetView(supplementId: Int, completion:(()->())?) {
let sheetView = YHCertificateUploadSheetView.sheetView()
sheetView.maxSelectCount = 9
sheetView.uploadFilesBlock = {
[weak self] fileUrl in
......
......@@ -217,6 +217,9 @@ extension YhConstant {
// 刷新证件文件列表通知
public static let refreshCertificateFileListNotifiction = Notification.Name(rawValue: "com.yinhe.certificate.updateFileList")
// 点击文件清单条目通知
public static let clickCertificateFileListItemNotifiction = Notification.Name(rawValue: "com.yinhe.certificate.clickFileListItem")
}
}
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