Commit a438dd2d authored by Alex朱枝文's avatar Alex朱枝文

收入记录完善提交校验

parent 0c8f007d
......@@ -232,8 +232,13 @@ extension YHGCIncomeRecordViewController {
})
thirdSection.append(.consentForHKTravel("赴港同意书提供", detail + actionStr, "在职公司是否可以提供赴港同意书"))
if viewModel.mainModel.has_company_consent == 1 {
//let id = viewModel.mainModel.consent_work_id > 0 ? viewModel.mainModel.consent_work_id : nil
// thirdSection.append(.employmentVerification(viewModel.listModel, id))
let employments = viewModel.listModel.filter {
$0.departure_time == "至今"
}
if viewModel.mainModel.consent_work_id == 0, employments.count == 1 {
viewModel.mainModel.consent_work_id = employments.first?.id ?? 0
consentWorkIdOK = true
}
thirdSection.append(.employmentVerification)
} else if viewModel.mainModel.has_company_consent == 2 { //选择否时才显示
thirdSection.append(.questionSelect("人才中心是否可以提供赴港同意书"))
......@@ -489,12 +494,14 @@ extension YHGCIncomeRecordViewController: UITableViewDelegate, UITableViewDataSo
}
navigationController?.pushViewController(ctl, animated: true)
} else if case .employmentVerification = tableRow {
let employments = viewModel.listModel
let employments = viewModel.listModel.filter {
$0.departure_time == "至今"
}
if employments.count == 0 {
YHHUD.flash(message: "没有在职公司!")
return
}
let selectedId = viewModel.mainModel.consent_work_id > 0 ? viewModel.mainModel.consent_work_id : nil
// guard employments.count > 1 else {
// return
// }
let companies = employments.compactMap {
$0.company_name
}
......@@ -528,41 +535,44 @@ extension YHGCIncomeRecordViewController {
}
private func checkInput() -> Bool {
var retValue = true
var updateRows: [IndexPath] = []
if viewModel.listModel.count == 0 {
hasWorkListOK = false
if let hasWorkListIndexPath = hasWorkListIndexPath, tableView.numberOfSections > hasWorkListIndexPath.section, tableView.numberOfRows(inSection: hasWorkListIndexPath.section) > hasWorkListIndexPath.row {
tableView.reloadRows(at: [hasWorkListIndexPath], with: .none)
updateRows.append(hasWorkListIndexPath)
}
return false
retValue = false
}
hasWorkListOK = true
if viewModel.mainModel.has_company_consent == YHCheckboxSelectType.unknown.rawValue {
hasCompanyConsentOK = false
if let hasCompanyConsentIndexPath = hasCompanyConsentIndexPath, tableView.numberOfSections > hasCompanyConsentIndexPath.section, tableView.numberOfRows(inSection: hasCompanyConsentIndexPath.section) > hasCompanyConsentIndexPath.row {
tableView.reloadRows(at: [hasCompanyConsentIndexPath], with: .none)
updateRows.append(hasCompanyConsentIndexPath)
}
return false
retValue = false
}
hasCompanyConsentOK = true
if viewModel.mainModel.has_company_consent == YHCheckboxSelectType.true.rawValue, viewModel.mainModel.consent_work_id == 0 {
consentWorkIdOK = false
if let consentWorkIdOKIndexPath = consentWorkIdOKIndexPath, tableView.numberOfSections > consentWorkIdOKIndexPath.section, tableView.numberOfRows(inSection: consentWorkIdOKIndexPath.section) > consentWorkIdOKIndexPath.row {
tableView.reloadRows(at: [consentWorkIdOKIndexPath], with: .none)
updateRows.append(consentWorkIdOKIndexPath)
}
return false
retValue = false
}
consentWorkIdOK = true
if viewModel.mainModel.has_company_consent == YHCheckboxSelectType.false.rawValue, viewModel.mainModel.has_center_consent == YHCheckboxSelectType.unknown.rawValue {
hasCenterConsentOK = false
if let hasCenterConsentIndexPath = hasCenterConsentIndexPath, tableView.numberOfSections > hasCenterConsentIndexPath.section, tableView.numberOfRows(inSection: hasCenterConsentIndexPath.section) > hasCenterConsentIndexPath.row {
tableView.reloadRows(at: [hasCenterConsentIndexPath], with: .none)
updateRows.append(hasCenterConsentIndexPath)
}
return false
retValue = false
}
if updateRows.count > 0 {
tableView.reloadRows(at: updateRows, with: .none)
hasWorkListOK = true
hasCompanyConsentOK = true
consentWorkIdOK = true
hasCenterConsentOK = true
return true
}
return retValue
}
private func requestData(isNeedLoading: Bool = false, lastSelectedIncomeOver100: Int? = nil) {
......
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