Commit 280a718c authored by Alex朱枝文's avatar Alex朱枝文

高才个人信息预览工作经验以及收入记录

parent 850f8c3e
......@@ -56,6 +56,7 @@
04307BA12D1D4B9500ED8E8D /* YHGCIncomeTypeSelectModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04307BA02D1D4B9500ED8E8D /* YHGCIncomeTypeSelectModel.swift */; };
04307BA32D1E4CA600ED8E8D /* YHGCInformationFillTipsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04307BA22D1E4CA600ED8E8D /* YHGCInformationFillTipsCell.swift */; };
04307BA52D1E54BD00ED8E8D /* YHGCInformationFillTipsAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04307BA42D1E54BD00ED8E8D /* YHGCInformationFillTipsAlertView.swift */; };
04307BA82D1FDF5200ED8E8D /* YHGCPreviewIncomeTypeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04307BA72D1FDF5200ED8E8D /* YHGCPreviewIncomeTypeCell.swift */; };
045C0F7F2D12CA5F00BD2DC0 /* submit_page_scroll.gif in Resources */ = {isa = PBXBuildFile; fileRef = 045C0F4F2D12CA5E00BD2DC0 /* submit_page_scroll.gif */; };
045C0F802D12CA5F00BD2DC0 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 045C0F762D12CA5E00BD2DC0 /* Localizable.xcstrings */; };
045C0F812D12CA5F00BD2DC0 /* img_0.png in Resources */ = {isa = PBXBuildFile; fileRef = 045C0F5E2D12CA5E00BD2DC0 /* img_0.png */; };
......@@ -1264,6 +1265,7 @@
04307BA02D1D4B9500ED8E8D /* YHGCIncomeTypeSelectModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCIncomeTypeSelectModel.swift; sourceTree = "<group>"; };
04307BA22D1E4CA600ED8E8D /* YHGCInformationFillTipsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCInformationFillTipsCell.swift; sourceTree = "<group>"; };
04307BA42D1E54BD00ED8E8D /* YHGCInformationFillTipsAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCInformationFillTipsAlertView.swift; sourceTree = "<group>"; };
04307BA72D1FDF5200ED8E8D /* YHGCPreviewIncomeTypeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCPreviewIncomeTypeCell.swift; sourceTree = "<group>"; };
045C09A12D12C2A800BD2DC0 /* YHGCMineSchemeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCMineSchemeViewController.swift; sourceTree = "<group>"; };
045C0A142D12CA5E00BD2DC0 /* YHBaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBaseViewController.swift; sourceTree = "<group>"; };
045C0A152D12CA5E00BD2DC0 /* YHBaseViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHBaseViewModel.swift; sourceTree = "<group>"; };
......@@ -2588,6 +2590,7 @@
04307B7C2D1AB2B000ED8E8D /* PersonInfoList(个人信息预览) */ = {
isa = PBXGroup;
children = (
04307BA62D1FDF2C00ED8E8D /* V */,
04AE20612D1ADA4700891D24 /* VM */,
04307B7D2D1AB2B900ED8E8D /* C */,
);
......@@ -2629,6 +2632,14 @@
path = M;
sourceTree = "<group>";
};
04307BA62D1FDF2C00ED8E8D /* V */ = {
isa = PBXGroup;
children = (
04307BA72D1FDF5200ED8E8D /* YHGCPreviewIncomeTypeCell.swift */,
);
path = V;
sourceTree = "<group>";
};
045C0A182D12CA5E00BD2DC0 /* C */ = {
isa = PBXGroup;
children = (
......@@ -7455,6 +7466,7 @@
045C122A2D12CA5F00BD2DC0 /* YHInformationAuthorizeViewModel.swift in Sources */,
045C122B2D12CA5F00BD2DC0 /* YHEditWorkViewController.swift in Sources */,
045C122C2D12CA5F00BD2DC0 /* YHFamilyInfoUpdateViewController.swift in Sources */,
04307BA82D1FDF5200ED8E8D /* YHGCPreviewIncomeTypeCell.swift in Sources */,
045C122D2D12CA5F00BD2DC0 /* YHVisaRenewalTipsCell.swift in Sources */,
04307B8A2D1AB66100ED8E8D /* YHGCPreviewBasiceInformationViewController.swift in Sources */,
04307B8C2D1AB66100ED8E8D /* YHGCPreviewControllerHoldViewController.swift in Sources */,
......
......@@ -34,8 +34,24 @@ class YHIncomeRecordCompanyTipsCell: YHResignDocumentCell {
infoDetailLabel.text = detail
}
func setupCellInfo(tipsDetail: ASAttributedString) {
func setupCellInfo(tipsDetail: ASAttributedString, cellType: YHResignRoundCellType = .mid) {
infoDetailLabel.attributed.text = tipsDetail
updateCellCorner(cellType)
if cellType == .bottom || cellType == .single {
infoDetailLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18)
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview().offset(-16)
make.right.lessThanOrEqualToSuperview().offset(-18)
}
} else {
infoDetailLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(18)
make.top.equalToSuperview().offset(16)
make.bottom.equalToSuperview()
make.right.lessThanOrEqualToSuperview().offset(-18)
}
}
}
private func setupUI() {
......
......@@ -69,6 +69,14 @@ class YHWorkExpPosition_NewModel : SmartCodable {
class YHWorkExpInfoPreviewModel: SmartCodable {
var list : [WorkExpInfoPreviewDetailModel]?
var count : Int = 0
var has_company_consent: Int = 0 //高才使用 在职公司是否可以提供赴港同意书 0 未知 1 是 2 否
var consent_work_id: Int = 0 //高才使用 可以提供赴港同意书的工作经历id
var has_center_consent: Int = 0 //高才使用 人才中心是否可以提供赴港同意书 0 未知 1 是 2 否
var why_work_time_overlap: String = "" //高才使用 关于工作时间重叠的说明
var has_work_experience: Int = 0 //高BC使用 是否有工作经历 0.未知 1.是 2.否
// 高才使用 是否有工作时间重叠期 0-否 1-是
var has_work_time_overlap: Int = 0
required init() {
}
}
......@@ -117,7 +125,7 @@ class WorkExpInfoPreviewDetailModel: SmartCodable {
var create_from_appid: Int = 0
var update_from_appid: Int = 0
var international_work_experience: Int = 0
var turnover: Int = 0
//var turnover: Int = 0
var business_nature: String = ""
var company_website: String = ""
var company_introduce: String = ""
......@@ -125,6 +133,19 @@ class WorkExpInfoPreviewDetailModel: SmartCodable {
var is_project_introduction: Int = 0
var customer_center_id: Int = 0
var projects: [ProjectPreviewModel]?
/// 公司近一年的营业额 对于高A,仅当收入类型包含 6/7/8/10 时,该字段才有效
var turnover: String = "0"
/// 高A使用 收入类型 1 工资薪金所得及全年一次性奖金; 2 上市公司股票期权或股权收入; 3 持股公司分红收入; 4 个体工商户/合伙企业/独资企业经营所得收入; 5
/// 股权转让收入; 6 内地公司收入(持股50%及以上); 7 香港公司收入(持股50%及以上); 8 其他境外公司收入(持股50%及以上); 10 澳门公司收入(持股50%及以上)
var type_of_income: [Int] = []
/// 高A使用 收入金额
var income: String = "0"
/// 高才使用 是否能提供工作证明 0 未知 1 是 2 否
var has_work_certificate: Int = 0
/// 高才使用 职业界别
var company_type: String = ""
/// 高才使用 其他职业界别
var company_type_other: String = ""
required init() {
......
......@@ -422,7 +422,7 @@ private extension YHPreviewViewModel {
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "下属管理人数:", answer:String(model.company_manage_total))
var ttt = ""
if model.turnover == 0 {
if model.turnover == "0" {
ttt = "0"
} else {
ttt = String(model.turnover).defaultStringIfEmpty()
......
......@@ -405,6 +405,11 @@ extension YHGCIncomeRecordViewController: UITableViewDelegate, UITableViewDataSo
let selectedEmployment = employments.first { model in
model.id == selectedId
}
// if selectedEmployment == nil, employments.count == 1 {
// selectedEmployment = employments.first
// viewModel.mainModel.consent_work_id = selectedEmployment?.id ?? 0
// }
cell.setupCellInfo(detail: selectedEmployment?.company_name)
return cell
}
......@@ -463,9 +468,9 @@ extension YHGCIncomeRecordViewController: UITableViewDelegate, UITableViewDataSo
let employments = viewModel.listModel
let selectedId = viewModel.mainModel.consent_work_id > 0 ? viewModel.mainModel.consent_work_id : nil
guard employments.count > 1 else {
return
}
// guard employments.count > 1 else {
// return
// }
let companies = employments.compactMap {
$0.company_name
}
......
......@@ -88,8 +88,6 @@ class YHGCIncomeRecordWorkExperienceViewController: YHBaseViewController {
view.register(YHIncomeInfoSelectCell.self, forCellReuseIdentifier: YHIncomeInfoSelectCell.cellReuseIdentifier)
view.register(YHIncomeInfoEditCell.self, forCellReuseIdentifier: YHIncomeInfoEditCell.cellReuseIdentifier)
view.register(YHInfoQuestionSelectionCell.self, forCellReuseIdentifier: YHInfoQuestionSelectionCell.cellReuseIdentifier)
view.register(YHIncomeUploadWorkIDCell.self, forCellReuseIdentifier: YHIncomeUploadWorkIDCell.cellReuseIdentifier)
view.register(YHIncomeRecordCompanyTipsCell.self, forCellReuseIdentifier: YHIncomeRecordCompanyTipsCell.cellReuseIdentifier)
view.keyboardDismissMode = .onDrag
return view
......
......@@ -29,7 +29,7 @@ class YHGCPreviewControllerHoldViewController: UIViewController {
lazy var arrItemTitles:[String] = {
if productType == 1 { // 高才A
return ["主申请人信息","家庭成员信息","工作经验","收入记录", "基本资料"]
return ["主申请人信息","家庭成员信息","收入记录/工作经验", "基本资料"]
}
return ["主申请人信息","家庭成员信息","学历/专业资格","工作经验", "基本资料"]
}()
......@@ -69,16 +69,13 @@ class YHGCPreviewControllerHoldViewController: UIViewController {
//家庭成员信息
let vc2 = YHGCPreviewFamilyMemberViewController()
arrItemVCs.append(vc2)
//工作经验
let vc3 = YHGCPreviewWorkExpViewController()
arrItemVCs.append(vc3)
// 收入记录
// 收入记录/工作经验
let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") as? Int ?? 0
let vc4 = YHGCPreviewIncomeRecordViewController(orderId: orderID)
arrItemVCs.append(vc4)
let vc3 = YHGCPreviewIncomeRecordViewController(orderId: orderID, pageType: .pageA)
arrItemVCs.append(vc3)
//基本资料
let vc5 = YHGCPreviewBasiceInformationViewController()
arrItemVCs.append(vc5)
let vc4 = YHGCPreviewBasiceInformationViewController()
arrItemVCs.append(vc4)
} else { // 高才BC
......@@ -91,13 +88,10 @@ class YHGCPreviewControllerHoldViewController: UIViewController {
//学历/专业资格
let vc3 = YHGCPreviewAcademicAndProfessionalQualificationViewController()
arrItemVCs.append(vc3)
//工作经验
let vc4 = YHGCPreviewWorkExpViewController()
// 工作经验
let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") as? Int ?? 0
let vc4 = YHGCPreviewIncomeRecordViewController(orderId: orderID, pageType: .pageBC)
arrItemVCs.append(vc4)
// // 收入记录
// let orderID = UserDefaults.standard.value(forKey: "orderIdForPreview") as? Int ?? 0
// let vc5 = YHGCPreviewIncomeRecordViewController(orderId: orderID)
// arrItemVCs.append(vc5)
//基本资料
let vc5 = YHGCPreviewBasiceInformationViewController()
arrItemVCs.append(vc5)
......
......@@ -6,27 +6,38 @@
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import AttributedString
import UIKit
class YHGCPreviewIncomeRecordViewController: YHPreviewBaseViewController {
enum PageType: Int {
case pageA
case pageBC
}
enum TableRow {
case infoHeader(_ title: String)
case infoSectionHeader(_ title: String)
case infoTitleAndDetail(_ title: String, _ detail: String, _ cellType: YHResignRoundCellType, _ topMargin: CGFloat, _ bottomMargin: CGFloat)
case infoIncomeType(_ title: String, _ types: [String])
case infoIncomeType(_ title: String, _ types: [String], _ subtitle: String? = nil, _ cellType: YHResignRoundCellType = .mid)
case infoTips(_ detail: ASAttributedString)
}
private lazy var noDataView: YHEmptyDataView = {
let view = YHEmptyDataView.createView("暂无收入记录", kEmptyCommonBgName)
let view = YHEmptyDataView.createView("暂无工作经验", kEmptyCommonBgName)
if pageType == .pageA {
view.tips = "暂无收入记录/工作经验"
} else {
view.tips = "暂无工作经验"
}
view.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 164)
view.backgroundColor = .clear
view.isHidden = true
return view
}()
private lazy var datas: [TableRow] = []
private lazy var viewModel = YHIncomeRecordViewModel()
private var incomeModel = YHIncomeRecordCompleteModel()
private lazy var datas: [[TableRow]] = []
private lazy var viewModel = YHGCPreviewViewModel()
override func viewDidLoad() {
super.viewDidLoad()
......@@ -35,8 +46,10 @@ class YHGCPreviewIncomeRecordViewController: YHPreviewBaseViewController {
}
private let orderId: Int
init(orderId: Int) {
private let pageType: PageType
init(orderId: Int, pageType: PageType) {
self.orderId = orderId
self.pageType = pageType
super.init(nibName: nil, bundle: nil)
}
......@@ -60,9 +73,10 @@ extension YHGCPreviewIncomeRecordViewController {
homeTableView.register(YHPreviewInfoHeaderCell.self, forCellReuseIdentifier: YHPreviewInfoHeaderCell.cellReuseIdentifier)
homeTableView.register(YHPreviewInfoNameAndDetailCell.self, forCellReuseIdentifier: YHPreviewInfoNameAndDetailCell.cellReuseIdentifier)
homeTableView.register(YHPreviewInfoSectionHeaderCell.self, forCellReuseIdentifier: YHPreviewInfoSectionHeaderCell.cellReuseIdentifier)
homeTableView.register(YHPreviewInfoIncomeTypeCell.self, forCellReuseIdentifier: YHPreviewInfoIncomeTypeCell.cellReuseIdentifier)
homeTableView.register(YHGCPreviewIncomeTypeCell.self, forCellReuseIdentifier: YHGCPreviewIncomeTypeCell.cellReuseIdentifier)
homeTableView.register(YHIncomeRecordCompanyTipsCell.self, forCellReuseIdentifier: YHIncomeRecordCompanyTipsCell.cellReuseIdentifier)
homeTableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 16))
homeTableView.tableFooterView = UIView(frame: CGRect(x: 16, y: 0, width: KScreenWidth, height: 44))
homeTableView.tableFooterView = UIView(frame: CGRect(x: 16, y: 0, width: KScreenWidth, height: 28))
}
private func currencyFormat(_ currencySymbol: String) -> NumberFormatter {
......@@ -73,59 +87,206 @@ extension YHGCPreviewIncomeRecordViewController {
return formatter
}
private func getCurrentRate() -> Double {
let configRate = Double(YHConfigManager.shared.reqVM.configModel?.rate ?? "") ?? 0
let rate = configRate > 0 ? configRate : 0.92
return rate
}
private func setupData() {
datas.removeAll()
datas.append(.infoHeader("收入情况"))
guard incomeModel.income_over_100 == YHIncomeOver100.true.rawValue else {
if incomeModel.income_over_100 == YHIncomeOver100.false.rawValue {
datas.append(.infoTitleAndDetail("前一年全年收入是否达港币100万元或以上:", "否", .bottom, 16, 16))
noDataView.isHidden = true
homeTableView.reloadData()
if pageType == .pageA {
setupDataForPageA()
} else {
setupDataForPageBC()
}
}
private func setupDataForPageA() {
guard let workExpInfoPreviewModel = viewModel.workExpInfoPreviewModel, let list = workExpInfoPreviewModel.list else {
noDataView.isHidden = false
datas = []
homeTableView.reloadData()
}
return
}
datas.append(.infoTitleAndDetail("前一年全年收入是否达港币100万元或以上:", "是", .mid, 16, 8))
datas.removeAll()
var basicInfoSection: [TableRow] = [.infoHeader("基本信息")]
let currencyFmt = currencyFormat("")
let rate = incomeModel.rate > 0 ? incomeModel.rate : 0.92
let rate = getCurrentRate()
var totalMoney: Double = 0
let listCount = incomeModel.list.count
incomeModel.list.enumerated().forEach { index, model in
datas.append(.infoSectionHeader("收入\(index + 1)"))
datas.append(.infoTitleAndDetail("收入来源公司:", model.company_name, .mid, 8, 8))
let selectedTypes = model.income_type.compactMap {
YHIncomeType(rawValue: $0)
}
datas.append(.infoIncomeType("收入类型:", selectedTypes.map {
$0.nameString()
let listCount = workExpInfoPreviewModel.count
let workId = workExpInfoPreviewModel.consent_work_id
var workCompany: WorkExpInfoPreviewDetailModel?
list.enumerated().forEach { index, model in
if workId != 0, model.id == workId {
workCompany = model
}
var incomeSection: [TableRow] = []
var workSection: [TableRow] = []
if listCount > 1 {
incomeSection.append(.infoHeader("主申请人收入(\(index + 1))"))
workSection.append(.infoHeader("主申请人工作经历(\(index + 1))"))
} else {
incomeSection.append(.infoHeader("主申请人收入"))
workSection.append(.infoHeader("主申请人工作经历"))
}
incomeSection.append(.infoTitleAndDetail("收入来源公司:", model.company_name, .mid, 16, 8))
let incomeMoney = Double(model.income) ?? 0
incomeSection.append(.infoTitleAndDetail("收入金额(港元):", currencyFmt.string(from: NSNumber(value: incomeMoney / rate)) ?? "0", .bottom, 8, 16))
workSection.append(.infoTitleAndDetail("用人单位:", model.company_name, .mid, 16, 8))
var location: String = ""
let country = model.location?.country ?? ""
if country.contains("中国") {
let city = model.location?.area.reduce("") { partialResult, item in
partialResult.count > 0 ? partialResult + "/" + item : partialResult + item
} ?? ""
location = country + "-" + city
} else {
let city = model.location?.foreign ?? ""
location = country + "-" + city
}
workSection.append(.infoTitleAndDetail("派薪地点:", location, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("职位:", model.position, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("入职年月:", model.entry_time, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("离职年月:", model.departure_time, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("是否可以提供工作证明文件:", model.has_work_certificate == 1 ? "是" : "否", .mid, 8, 8))
let selectedTypes = model.type_of_income.compactMap {
YHGCIncomeType(rawValue: $0)
}
if selectedTypes.count > 1 {
workSection.append(.infoIncomeType("收入类型:", selectedTypes.enumerated().map { index, type in
"\(index + 1)." + type.nameString()
}))
} else {
workSection.append(.infoTitleAndDetail("收入类型", selectedTypes.first?.nameString() ?? "", .mid, 8, 8))
}
if selectedTypes.contains(.incomeOfMainland) || selectedTypes.contains(.incomeOfHKCompanies) || selectedTypes.contains(.incomeOfMacauCompanies) || selectedTypes.contains(.incomeOfOtherOverseasCompanies) {
datas.append(.infoTitleAndDetail("公司营业额/人民币 (近一年):", currencyFmt.string(from: NSNumber(value: model.corporate_turnover)) ?? "0", .mid, 8, 8))
let turnover = Double(model.turnover) ?? 0
workSection.append(.infoTitleAndDetail("公司营业额/人民币 (近一年):", currencyFmt.string(from: NSNumber(value: turnover)) ?? "0", .mid, 8, 8))
}
let companyType = model.company_type
if companyType == "其他" {
workSection.append(.infoIncomeType("职业界别:", [model.company_type_other], companyType, .bottom))
} else {
workSection.append(.infoTitleAndDetail("职业界别:", companyType, .bottom, 8, 16))
}
totalMoney += Double(model.income) ?? 0
datas.append(incomeSection)
datas.append(workSection)
}
basicInfoSection.append(.infoTitleAndDetail("主申请人总收入(港元):", currencyFmt.string(from: NSNumber(value: totalMoney / rate)) ?? "0", .mid, 16, 8))
if workExpInfoPreviewModel.has_company_consent == 1 {
basicInfoSection.append(.infoTitleAndDetail("在职公司是否可以提供赴港同意书:", "是", .mid, 8, 8))
if let workCompany = workCompany {
basicInfoSection.append(.infoIncomeType("可提供赴港同意书的在职公司:", [workCompany.company_name], nil, .bottom))
} else {
basicInfoSection.append(.infoIncomeType("可提供赴港同意书的在职公司:", [], nil, .bottom))
}
} else {
basicInfoSection.append(.infoTitleAndDetail("在职公司是否可以提供赴港同意书:", "否", .mid, 8, 8))
let message = workExpInfoPreviewModel.has_center_consent == 1 ? "是" : "否"
basicInfoSection.append(.infoTitleAndDetail("人才中心是否可以提供赴港同意书:", message, .bottom, 8, 16))
}
datas.insert(basicInfoSection, at: 0)
if workExpInfoPreviewModel.has_work_time_overlap == 1 {
var timeOverlapSection: [TableRow] = [.infoHeader("工作时间重叠原因")]
let detail: ASAttributedString = .init(string: workExpInfoPreviewModel.why_work_time_overlap, .foreground(UIColor(hexString: "#8993A2") ?? .gray), .font(UIFont.PFSC_R(ofSize: 14)))
timeOverlapSection.append(.infoTips(detail))
datas.append(timeOverlapSection)
}
noDataView.isHidden = true
homeTableView.reloadData()
}
let isLast = (listCount - 1 == index)
datas.append(.infoTitleAndDetail("收入金额(港元):", currencyFmt.string(from: NSNumber(value: model.income_money / rate)) ?? "0", isLast ? .bottom : .mid, 8, 16))
totalMoney += model.income_money
private func setupDataForPageBC() {
guard let workExpInfoPreviewModel = viewModel.workExpInfoPreviewModel, let list = workExpInfoPreviewModel.list else {
noDataView.isHidden = false
datas = []
homeTableView.reloadData()
return
}
datas.removeAll()
var basicInfoSection: [TableRow] = [.infoHeader("基本信息")]
basicInfoSection.append(.infoTitleAndDetail("主申请人是否有工作经验:", workExpInfoPreviewModel.has_work_experience == 1 ? "是" : "否", .mid, 16, 8))
let listCount = workExpInfoPreviewModel.count
let workId = workExpInfoPreviewModel.consent_work_id
var workCompany: WorkExpInfoPreviewDetailModel?
list.enumerated().forEach { index, model in
if workId != 0, model.id == workId {
workCompany = model
}
var workSection: [TableRow] = []
if listCount > 1 {
workSection.append(.infoHeader("主申请人工作经历(\(index + 1))"))
} else {
workSection.append(.infoHeader("主申请人工作经历"))
}
workSection.append(.infoTitleAndDetail("用人单位:", model.company_name, .mid, 16, 8))
var location: String = ""
let country = model.location?.country ?? ""
if country.contains("中国") {
let city = model.location?.area.reduce("") { partialResult, item in
partialResult.count > 0 ? partialResult + "/" + item : partialResult + item
} ?? ""
location = country + "-" + city
} else {
let city = model.location?.foreign ?? ""
location = country + "-" + city
}
workSection.append(.infoTitleAndDetail("工作地点:", location, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("职位:", model.position, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("入职年月:", model.entry_time, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("离职年月:", model.departure_time, .mid, 8, 8))
workSection.append(.infoTitleAndDetail("是否可以提供工作证明文件:", model.has_work_certificate == 1 ? "是" : "否", .mid, 8, 8))
let companyType = model.company_type
if companyType == "其他" {
workSection.append(.infoIncomeType("职业界别:", [model.company_type_other], companyType, .bottom))
} else {
workSection.append(.infoTitleAndDetail("职业界别:", companyType, .bottom, 8, 16))
}
datas.append(workSection)
}
if workExpInfoPreviewModel.has_company_consent == 1 {
basicInfoSection.append(.infoTitleAndDetail("在职公司是否可以提供赴港同意书:", "是", .mid, 8, 8))
if let workCompany = workCompany {
basicInfoSection.append(.infoIncomeType("可提供赴港同意书的在职公司:", [workCompany.company_name], nil, .bottom))
} else {
basicInfoSection.append(.infoIncomeType("可提供赴港同意书的在职公司:", [], nil, .bottom))
}
if datas.count >= 2 {
if incomeModel.list.count == 0 {
datas.insert(.infoTitleAndDetail("主申请人总收入(港元):", currencyFmt.string(from: NSNumber(value: totalMoney / rate)) ?? "0", .bottom, 8, 16), at: 2)
} else {
datas.insert(.infoTitleAndDetail("主申请人总收入(港元):", currencyFmt.string(from: NSNumber(value: totalMoney / rate)) ?? "0", .mid, 8, 16), at: 2)
basicInfoSection.append(.infoTitleAndDetail("在职公司是否可以提供赴港同意书:", "否", .mid, 8, 8))
let message = workExpInfoPreviewModel.has_center_consent == 1 ? "是" : "否"
basicInfoSection.append(.infoTitleAndDetail("人才中心是否可以提供赴港同意书:", message, .bottom, 8, 16))
}
datas.insert(basicInfoSection, at: 0)
if workExpInfoPreviewModel.has_work_time_overlap == 1 {
var timeOverlapSection: [TableRow] = [.infoHeader("工作时间重叠原因")]
let detail: ASAttributedString = .init(string: workExpInfoPreviewModel.why_work_time_overlap, .foreground(UIColor(hexString: "#8993A2") ?? .gray), .font(UIFont.PFSC_R(ofSize: 14)))
timeOverlapSection.append(.infoTips(detail))
datas.append(timeOverlapSection)
}
noDataView.isHidden = true
homeTableView.reloadData()
}
private func requestData() {
viewModel.getIncomeList(orderId: orderId) { [weak self] incomeModel, error in
viewModel.getPreviewForGCWorkExpInfo(params: ["order_id": orderId]) { [weak self] success, error in
guard let self = self else {
return
}
guard let incomeModel = incomeModel else {
guard success else {
printLog("YHGCPreviewIncomeRecordViewController: 请求失败")
if let errorMsg = error?.errorMsg, errorMsg.count > 0 {
YHHUD.flash(message: errorMsg)
......@@ -135,7 +296,6 @@ extension YHGCPreviewIncomeRecordViewController {
self.homeTableView.reloadData()
return
}
self.incomeModel = incomeModel
self.setupData()
}
}
......@@ -143,17 +303,43 @@ extension YHGCPreviewIncomeRecordViewController {
// MARK: - UITableViewDelegate 和 UITableViewDataSource
extension YHGCPreviewIncomeRecordViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.001
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 16
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return UIView()
}
func numberOfSections(in tableView: UITableView) -> Int {
return datas.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard datas.count > section else {
return 0
}
return datas[section].count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard datas.count > indexPath.row else {
guard datas.count > indexPath.section else {
return UITableViewCell()
}
let tableRow = datas[indexPath.row]
let sectionArr = datas[indexPath.section]
guard sectionArr.count > indexPath.row else {
return UITableViewCell()
}
let tableRow = sectionArr[indexPath.row]
switch tableRow {
case let .infoHeader(title):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHPreviewInfoHeaderCell.cellReuseIdentifier) as? YHPreviewInfoHeaderCell {
cell.setup(title: title)
......@@ -169,9 +355,14 @@ extension YHGCPreviewIncomeRecordViewController {
cell.setup(title: title, detail: detail, cellType: cellType, topMargin: top, bottomMargin: bottom)
return cell
}
case let .infoIncomeType(title, docs):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHPreviewInfoIncomeTypeCell.cellReuseIdentifier) as? YHPreviewInfoIncomeTypeCell {
cell.setupCellInfo(title: title, documents: docs)
case let .infoIncomeType(title, docs, subtitle, cellType):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHGCPreviewIncomeTypeCell.cellReuseIdentifier) as? YHGCPreviewIncomeTypeCell {
cell.setupCellInfo(title: title, documents: docs, subtitle: subtitle, cellType: cellType)
return cell
}
case let .infoTips(detail):
if let cell = tableView.dequeueReusableCell(withIdentifier: YHIncomeRecordCompanyTipsCell.cellReuseIdentifier) as? YHIncomeRecordCompanyTipsCell {
cell.setupCellInfo(tipsDetail: detail, cellType: .bottom)
return cell
}
}
......
//
// YHGCPreviewIncomeTypeCell.swift
// galaxy
//
// Created by alexzzw on 2024/12/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHGCPreviewIncomeTypeCell: YHResignDocumentCell {
static let cellReuseIdentifier = "YHGCPreviewIncomeTypeCell"
private var lastDocuments: [String] = []
private lazy var infoTitleLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 14)
label.textColor = UIColor(hexString: "#8993A2")
return label
}()
private lazy var infoSubtitleLabel: UILabel = {
let label = UILabel(text: "--")
label.isHidden = true
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_R(ofSize: 14)
label.textAlignment = .right
return label
}()
private lazy var containerView: YHBaseDynamicCornerRadiusView = {
let view = YHBaseDynamicCornerRadiusView(cornerRadius: 3, corner: .allCorners)
view.backgroundColor = .contentBkgColor
return view
}()
private lazy var infoContentLabel: UILabel = {
let label = UILabel()
label.font = .PFSC_R(ofSize: 12)
label.textColor = UIColor(hexString: "#6D788A")
label.numberOfLines = 0
label.lineBreakMode = .byCharWrapping
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, documents: [String], subtitle: String? = nil, cellType: YHResignRoundCellType = .mid) {
infoTitleLabel.text = title
if let subtitle = subtitle, !subtitle.isEmpty {
infoSubtitleLabel.text = subtitle
infoSubtitleLabel.isHidden = false
} else {
infoSubtitleLabel.text = nil
infoSubtitleLabel.isHidden = false
}
let content = documents.reduce("") { partialResult, item in
partialResult.count > 0 ? partialResult + "\n" + item : partialResult + item
}
infoContentLabel.text = content
updateCellCorner(cellType)
if cellType == .bottom || cellType == .single {
containerView.snp.remakeConstraints { make in
make.left.equalTo(infoTitleLabel)
make.top.equalTo(infoTitleLabel.snp.bottom).offset(8)
make.right.equalToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-16)
}
} else {
containerView.snp.remakeConstraints { make in
make.left.equalTo(infoTitleLabel)
make.top.equalTo(infoTitleLabel.snp.bottom).offset(8)
make.right.equalToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-8)
}
}
}
private func setupUI() {
updateCellCorner(.mid)
subContainerView.addSubview(infoTitleLabel)
subContainerView.addSubview(containerView)
subContainerView.addSubview(infoSubtitleLabel)
containerView.addSubview(infoContentLabel)
infoTitleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(8)
make.left.equalToSuperview().offset(18)
}
infoSubtitleLabel.snp.makeConstraints { make in
make.left.greaterThanOrEqualTo(infoTitleLabel.snp.right).offset(10)
make.centerY.equalTo(infoTitleLabel)
make.right.equalToSuperview().offset(-18)
}
containerView.snp.makeConstraints { make in
make.left.equalTo(infoTitleLabel)
make.top.equalTo(infoTitleLabel.snp.bottom).offset(8)
make.right.equalToSuperview().offset(-18)
make.bottom.equalToSuperview().offset(-8)
}
infoContentLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(12)
make.top.equalToSuperview().offset(10)
make.right.equalToSuperview().offset(-12)
make.bottom.equalToSuperview().offset(-10)
}
}
}
......@@ -71,6 +71,30 @@ extension YHGCPreviewViewModel {
}
}
// 高才工作经验 预览
func getPreviewForGCWorkExpInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Preview.previewWorkExpInfoApi
let _ = YHNetRequest.getRequest(url: strUrl, params:params) {[weak self] json, code in
guard let self = self else { return }
printLog("model 是 ==> \(json)")
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let resultModel = YHWorkExpInfoPreviewModel.deserialize(from: dic) else {
let error = YHErrorModel(errorCode: YHErrorCode.dictParseError.rawValue, errorMsg: YHErrorCode.dictParseError.description())
callBackBlock(false,error)
return
}
self.workExpInfoPreviewModel = resultModel
callBackBlock(true,nil)
} else {
let error = YHErrorModel(errorCode: Int32(json.code), errorMsg: json.msg)
callBackBlock(false,error)
}
} failBlock: { err in
callBackBlock(false,err)
}
}
//工作经验 预览
func getPreviewForWorkExpInfo(params:[String:Any], callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
......@@ -416,7 +440,7 @@ private extension YHGCPreviewViewModel {
let tmp14 = YHPreviewQuestionAndAnswerModel(question: "下属管理人数:", answer:String(model.company_manage_total))
var ttt = ""
if model.turnover == 0 {
if model.turnover == "0" {
ttt = "0"
} else {
ttt = String(model.turnover).defaultStringIfEmpty()
......
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