Commit e5ad4984 authored by pete谢兆麟's avatar pete谢兆麟

工作经验

parent 17de6e0c
......@@ -132,9 +132,10 @@ class YHOtherPickerView: UIView {
}()
init(type: YHOtherPickerViewType) {
init(type: YHOtherPickerViewType, _ dataSource: [YHOtherPickerViewItemData] = []) {
super.init(frame: UIScreen.main.bounds)
self.createUI()
self.arrData = dataSource
self.type = type
initDataSource()
......@@ -151,11 +152,11 @@ class YHOtherPickerView: UIView {
UIApplication.shared.yhKeyWindow()?.addSubview(self)
}
static func show(type:YHOtherPickerViewType, selectTitle: String = "", callBack: @escaping ((YHOtherPickerViewItemData)->Void)) {
static func show(type:YHOtherPickerViewType, selectTitle: String = "", _ dataSource: [YHOtherPickerViewItemData] = [],callBack: @escaping ((YHOtherPickerViewItemData)->Void)) {
IQKeyboardManager.shared.resignFirstResponder()
let picker = YHOtherPickerView(type: type)
let picker = YHOtherPickerView(type: type, dataSource)
picker.selectBlock = callBack
picker.show()
picker.selectTitle = selectTitle
......@@ -250,6 +251,10 @@ class YHOtherPickerView: UIView {
return "选择国家地区"
case .field:
return "选择经验领域"
case .myCompany:
return "选择可提供的在职公司"
case .position:
return "选择职位界别"
default:
return "请选择"
}
......@@ -277,7 +282,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
switch type {
case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry,.constellation,.field:
case .nature,.certificate,.structure,.level,.prove,.idType,.sex,.marry,.constellation,.field,.myCompany,.position:
return 50
default:
return 70
......@@ -287,7 +292,7 @@ extension YHOtherPickerView: UIPickerViewDelegate, UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {
switch type {
case .nature,.certificate,.structure,.level,.prove,.idType,.travelIdType,.sex,.marry,.constellation,.selectAddress,.field:
case .nature,.certificate,.structure,.level,.prove,.idType,.travelIdType,.sex,.marry,.constellation,.selectAddress,.field,.myCompany,.position:
let label = UILabel()
label.textColor = UIColor.mainTextColor
label.font = UIFont.PFSC_M(ofSize: 14)
......@@ -460,6 +465,14 @@ extension YHOtherPickerView {
arrData.append(model)
}
title = getTitle(type: type)
case .position:
let arr = YHConstantArrayData.arrposition
arrData.removeAll()
arr.forEach { item in
let model = YHOtherPickerViewItemData(title: item["title"] ?? "-", subTitle: "", index: item["id"] ?? "-")
arrData.append(model)
}
title = getTitle(type: type)
default:
return
}
......
......@@ -21,6 +21,8 @@ enum YHWorkExperienceSelectType: Int {
case prove = 9
case company = 10
case field = 11
case myCompany = 12
case position = 13
}
enum YHWorkExperienceID: Int {
......
......@@ -24,6 +24,7 @@ class YHWorkExperienceItemView: UIView {
var country: String = ""
var workId: Int = 0
var orderId: Int = 0
var companyList: [YHWorkItemListModel] = []
var dataSource: YHWorkExperienceModel? {
didSet {
updateAllViews()
......@@ -260,6 +261,10 @@ class YHWorkExperienceItemView: UIView {
}
case .field:
break
case .myCompany:
break
case .position:
break
}
}
nextStepImageView.isHidden = false
......@@ -539,6 +544,29 @@ class YHWorkExperienceItemView: UIView {
block(self.dataSource ?? YHWorkExperienceModel())
}
}
case .myCompany:
var arrData: [YHOtherPickerViewItemData] = []
companyList.forEach { item in
let model = YHOtherPickerViewItemData(title: item.company_name ?? "", subTitle: "", index: "\(item.id ?? 0)")
arrData.append(model)
}
YHOtherPickerView.show(type: .myCompany, selectTitle: self.dataSource?.message ?? "", arrData) {[weak self] data in
guard let self = self else { return }
self.dataSource?.message = data.title
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHWorkExperienceModel())
}
}
case .position:
YHOtherPickerView.show(type: .position, selectTitle: self.dataSource?.message ?? "") {[weak self] data in
guard let self = self else { return }
self.dataSource?.message = data.title
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHWorkExperienceModel())
}
}
}
}
}
......
......@@ -122,6 +122,12 @@ class YHWorkExperiencePositionListTableViewCell: UITableViewCell {
block(model)
}
}
itemView.companyBlock = {[weak self] model in
guard let self = self else { return }
if let block = self.companyBlock {
block(model)
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
......
......@@ -36,17 +36,18 @@ class YHGCWorkExperienceListViewController: YHBaseViewController {
}
func getData() {
baseData = viewModel.getBaseDataSource(showPrompt)
docData = viewModel.getDocDataSource(showPrompt)
viewModel?.requestWorkList("\(orderId)", callBackBlock: {[weak self] success, error in
guard let self = self else { return }
self.dataSource = success
self.baseData = viewModel.getBaseDataSource(showPrompt)
self.docData = viewModel.getDocDataSource(showPrompt)
self.tableView.reloadData()
})
}
func updateDataSource() {
self.baseData = viewModel.getBaseDataSource(showPrompt)
self.docData = viewModel.getDocDataSource(showPrompt)
self.tableView.reloadData()
}
......@@ -131,6 +132,14 @@ class YHGCWorkExperienceListViewController: YHBaseViewController {
extension YHGCWorkExperienceListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// var count = 1
// if self.viewModel.mainModel.has_work_experience == 1 {
// count = count + 1
// }
// if self.viewModel.mainModel.is_consent_required == 1 {
// count = count + 1
// }
// return count
return 3
}
......@@ -140,11 +149,8 @@ extension YHGCWorkExperienceListViewController: UITableViewDelegate, UITableView
cell.dataSource = baseData
cell.workExperienceBlock = {[weak self] model in
guard let self = self else { return }
// self.viewModel.updateModel(model)
// let id = model.id
// if id != .id1 {
// self.updateDataSource()
// }
self.viewModel.updateModel(model)
self.updateDataSource()
}
return cell
} else if indexPath.row == 1 {
......@@ -158,7 +164,6 @@ extension YHGCWorkExperienceListViewController: UITableViewDelegate, UITableView
}
cell.clickBlock = {[weak self] model in
guard let self = self else { return }
let firstModel = self.dataSource?.first
let vc = YHGCWorkExperienceViewController()
vc.workID = model.id ?? 0
vc.orderID = self.orderId
......@@ -193,14 +198,13 @@ extension YHGCWorkExperienceListViewController: UITableViewDelegate, UITableView
return cell
} else if indexPath.row == 2 {
let cell = tableView.dequeueReusableCell(withClass: YHGCWorkListHasDocTableViewCell.self)
cell.companyList = self.viewModel.mainModel.list ?? []
cell.url = self.viewModel.mainModel.consent_template_url
cell.dataSource = docData
cell.workExperienceBlock = {[weak self] model in
guard let self = self else { return }
// self.viewModel.updateModel(model)
// let id = model.id
// if id != .id1 {
// self.updateDataSource()
// }
self.viewModel.updateModel(model)
self.updateDataSource()
}
return cell
}
......@@ -215,7 +219,7 @@ extension YHGCWorkExperienceListViewController: UITableViewDelegate, UITableView
let data = array[i]
let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false
h = h + 52
h = h + 62
if isShow && message.count == 0 {
h = h + 20
}
......@@ -230,7 +234,7 @@ extension YHGCWorkExperienceListViewController: UITableViewDelegate, UITableView
let data = array[i]
let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false
h = h + 52
h = h + 62
if isShow && message.count == 0 {
h = h + 20
}
......
......@@ -18,7 +18,6 @@ class YHGCWorkExperienceViewController: YHBaseViewController {
var fileDataSource: [YHWorkExperienceFileModel]?
var workID: Int = 0
var orderID: Int = 0
var positionId: Int = 0
var isMore: Bool = false
var isShowPrompt: Bool = false
var isShowMessageSelect: Bool = true
......@@ -138,10 +137,14 @@ extension YHGCWorkExperienceViewController: UITableViewDelegate, UITableViewData
guard let self = self else { return }
self.viewModel.updateModel(model)
let id = model.id
if id != .id1 && id != .id2 && id != .id6 && id != .id10 && id != .id11 {
if id != .id4 && id != .id5 && id != .id8 {
self.updateDataSource()
}
}
cell.companyBlock = {[weak self] model in
guard let self = self else { return }
self.viewModel.updateCompanyModel(model.company_name ?? "")
}
return cell
}
......@@ -154,7 +157,7 @@ extension YHGCWorkExperienceViewController: UITableViewDelegate, UITableViewData
let data = array[i]
let message = data.message ?? ""
let isShow = data.isShowPrompts ?? false
if data.id == .id7 {
if data.id == .id6 {
h = h + 72
} else {
h = h + 52
......
......@@ -23,7 +23,7 @@ class YHGCWorkModel: SmartCodable {
var why_work_time_overlap: String = "" //高才使用 关于工作时间重叠的说明
var has_work_experience: Int = 0 //高BC使用 是否有工作经历 0.未知 1.是 2.否
var is_consent_required: Int = 0 //高才使用 是否必须提供赴港同意书 0-否 1-是
var consent_template_url: String = ""
var list: [YHWorkItemListModel]?
required init() {
}
......
......@@ -18,6 +18,8 @@ class YHGCWorkListHasDocTableViewCell: UITableViewCell {
var mainItemView: UIView!
var workId: Int = 0
var orderId: Int = 0
var url: String = ""
var companyList: [YHWorkItemListModel] = []
var dataSource: YHSectionWorkExperienceModel?{
didSet {
updateAllViews()
......@@ -135,11 +137,12 @@ class YHGCWorkListHasDocTableViewCell: UITableViewCell {
let data = dataSource?.models?[i]
let isShow = data?.isShowPrompts ?? false
let message = data?.message ?? ""
var h = 51
var h = 61
if isShow && message.count == 0 {
h = h + 20
}
let itemView = YHWorkExperienceItemView()
itemView.companyList = companyList
itemView.dataSource = data
itemView.workId = workId
itemView.orderId = orderId
......
......@@ -105,7 +105,7 @@ class YHGCWorkListHasWorkExperienceTableViewCell: UITableViewCell {
let data = dataSource?.models?[i]
let isShow = data?.isShowPrompts ?? false
let message = data?.message ?? ""
var h = 51
var h = 61
if isShow && message.count == 0 {
h = h + 20
}
......
......@@ -33,8 +33,8 @@ class YHGCWorkExperienceViewModel: YHBaseViewModel {
let item4 = YHWorkExperienceModel(id: .id23, isNeed: true, title: "开始就职年月", isUserKeyBoard: false, prompts: "请选择", message: position.entry_time, type: .time)
let item5 = YHWorkExperienceModel(id: .id24, isNeed: true, title: "结束就职年月", isUserKeyBoard: false, prompts: "请选择", message: position.departure_time, type: .time)
let item6 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "工作证明是否可以提供", isUserKeyBoard: false, prompts: "", message: "\(position.has_work_certificate)", leftButtonString: "是", rightButtonString: "否")
let item7 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "职业界别", isUserKeyBoard: false, prompts: "请选择", message: position.company_type, type: .field, isShowPrompts: isShowPrompt, alertMessage:"请选择")
let item77 = YHWorkExperienceModel(id: .id8, isNeed: true, title: "具体经验领域", isUserKeyBoard: true, prompts: "请输入", message: position.company_type_other, type: .country, isShowPrompts: isShowPrompt, alertMessage:"请输入")
let item7 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "职业界别", isUserKeyBoard: false, prompts: "请选择", message: position.company_type, type: .position, isShowPrompts: isShowPrompt, alertMessage:"请选择")
let item77 = YHWorkExperienceModel(id: .id8, isNeed: true, title: "具体经验领域", isUserKeyBoard: true, prompts: "请输入", message: position.company_type_other, isShowPrompts: isShowPrompt, alertMessage:"请输入")
let addressCountry = position.location.country
......@@ -57,6 +57,10 @@ class YHGCWorkExperienceViewModel: YHBaseViewModel {
return [section]
}
func updateCompanyModel(_ value: String) {
position.company_name = value
}
func updateModel(_ item: YHWorkExperienceModel) {
guard let type = item.id else { return }
switch type {
......@@ -145,7 +149,7 @@ class YHGCWorkExperienceViewModel: YHBaseViewModel {
}
func requestWorkPositionDetail(_ workId: Int, callBackBlock:@escaping (_ success: Bool?, _ error:YHErrorModel?)->()) {
let param: [String: Any] = ["work_id": workId]
let param: [String: Any] = ["id": workId]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.WorkExperience.gcworkDetail
let _ = YHNetRequest.getRequest(url: strUrl, params: param) { [weak self] json, code in
//1. json字符串 转 对象
......
......@@ -17,17 +17,53 @@ class YHGCWorkItemListViewModel: YHBaseViewModel {
}
func getBaseDataSource(_ isShowPrompt: Bool) -> YHSectionWorkExperienceModel {
let item = YHWorkExperienceModel(id: .id1, isNeed: true, title: "主申请人是否有工作经验", isUserKeyBoard: false, prompts: "", message: "", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择")
var has_work_experience = 2
if mainModel.has_work_experience == 1 {
has_work_experience = 1
} else if mainModel.has_work_experience == 2 {
has_work_experience = 0
}
let item = YHWorkExperienceModel(id: .id1, isNeed: true, title: "主申请人是否有工作经验", isUserKeyBoard: false, prompts: "", message: "\(has_work_experience)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择")
let section = YHSectionWorkExperienceModel(title: "工作经验", models: [item])
return section
}
func getDocDataSource(_ isShowPrompt: Bool) -> YHSectionWorkExperienceModel {
let item = YHWorkExperienceModel(id: .id2, isNeed: true, title: "在职公司是否可以提供赴港同意书", isUserKeyBoard: false, prompts: "", message: "", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择")
let item1 = YHWorkExperienceModel(id: .id2, isNeed: true, title: "人才中心是否可以提供赴港同意书?", isUserKeyBoard: false, prompts: "", message: "", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择")
let item2 = YHWorkExperienceModel(id: .id2, isNeed: true, title: "公司基本情况", isUserKeyBoard: false, prompts: "请选择", message: "", type: .unit, isShowPrompts: isShowPrompt, alertMessage:"请选择")
let section = YHSectionWorkExperienceModel(title: "赴港同意书提供", models: [item,item1,item2])
return section
var has_company_consent = 2
if mainModel.has_company_consent == 1 {
has_company_consent = 1
} else if mainModel.has_company_consent == 2 {
has_company_consent = 0
}
let item = YHWorkExperienceModel(id: .id2, isNeed: true, title: "在职公司是否可以提供赴港同意书", isUserKeyBoard: false, prompts: "", message: "\(has_company_consent)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择")
var has_center_consent = 2
if mainModel.has_center_consent == 1 {
has_center_consent = 1
} else if mainModel.has_center_consent == 2 {
has_center_consent = 0
}
let item1 = YHWorkExperienceModel(id: .id3, isNeed: true, title: "人才中心是否可以提供赴港同意书?", isUserKeyBoard: false, prompts: "", message: "\(has_center_consent)", leftButtonString: "是", rightButtonString: "否", isShowPrompts: isShowPrompt, alertMessage:"请选择")
var company = ""
let array = mainModel.list ?? []
for item in array {
if mainModel.consent_work_id == item.id {
company = item.company_name ?? ""
}
}
let item2 = YHWorkExperienceModel(id: .id4, isNeed: true, title: "可提供的在职公司", isUserKeyBoard: false, prompts: "请选择", message: company, type: .myCompany, isShowPrompts: isShowPrompt, alertMessage:"请选择")
if has_company_consent == 2 {
let section = YHSectionWorkExperienceModel(title: "赴港同意书提供", models: [item])
return section
} else if has_company_consent == 1 {
let section = YHSectionWorkExperienceModel(title: "赴港同意书提供", models: [item, item2])
return section
} else if has_company_consent == 0 {
let section = YHSectionWorkExperienceModel(title: "赴港同意书提供", models: [item, item1])
return section
} else {
let section = YHSectionWorkExperienceModel(title: "赴港同意书提供", models: [item])
return section
}
}
func requestWorkList(_ orderId: String, callBackBlock:@escaping (_ success: [YHWorkItemListModel]?, _ error:YHErrorModel?)->()) {
......@@ -120,4 +156,40 @@ class YHGCWorkItemListViewModel: YHBaseViewModel {
callBackBlock(0,err)
}
}
func updateModel(_ model: YHWorkExperienceModel) {
switch model.id {
case .id1:
let value = model.value?.first?.int ?? 0
if value == 0 {
mainModel.has_work_experience = 2
} else if value == 1 {
mainModel.has_work_experience = 1
}
case .id2:
let value = model.value?.first?.int ?? 0
if value == 0 {
mainModel.has_company_consent = 2
} else if value == 1 {
mainModel.has_company_consent = 1
}
case .id3:
let value = model.value?.first?.int ?? 0
if value == 0 {
mainModel.has_center_consent = 2
} else if value == 1 {
mainModel.has_center_consent = 1
}
case .id4:
let array = mainModel.list ?? []
for item in array {
if model.message == item.company_name {
mainModel.consent_work_id = item.id ?? 0
}
}
default:
break
}
}
}
......@@ -43,6 +43,10 @@ enum YHOtherPickerViewType: Int {
case selectAddress
//选择经验领域
case field
//选择我的公司
case myCompany
//职位界别
case position
}
......@@ -494,6 +498,120 @@ class YHConstantArrayData {
"title" : "其他",
]
]
static let arrposition = [
[
"id": "1",
"title" : "学术研究及教育",
],
[
"id" : "2",
"title" : "会计服务",
],
[
"id" : "3",
"title" : "农务",
],
[
"id": "4",
"title" : "建筑及测量",
],
[
"id": "5",
"title" : "艺术及文化",
],
[
"id" : "6",
"title" : "航空业",
],
[
"id" : "7",
"title" : "广播及娱乐",
],
[
"id": "8",
"title" : "商业支援及人力资源",
],
[
"id": "9",
"title" : "餐饮服务",
],
[
"id" : "10",
"title" : "商业及贸易",
],
[
"id" : "11",
"title" : "创意产业和表演艺术",
],
[
"id": "12",
"title" : "工程及建造",
],
[
"id": "13",
"title" : "环境技术服务",
],
[
"id" : "14",
"title" : "金融服务",
],
[
"id" : "15",
"title" : "政府相关",
],
[
"id": "16",
"title" : "资讯及通讯科技服务",
],
[
"id": "17",
"title" : "创新及科技",
],
[
"id" : "18",
"title" : "保险/经纪服务",
],
[
"id" : "19",
"title" : "法律及争议解决服务关",
],
[
"id": "20",
"title" : "物流及运输",
],
[
"id": "21",
"title" : "工业制造",
],
[
"id" : "22",
"title" : "海运服务",
],
[
"id" : "23",
"title" : "市场营销/公共关系",
],
[
"id": "24",
"title" : "医疗保健服务(包括中医及兽医)",
],
[
"id": "25",
"title" : "康复及体育运动",
],
[
"id" : "26",
"title" : "宗教团体",
],
[
"id" : "27",
"title" : "旅游",
],
[
"id": "28",
"title" : "其他",
]
]
//通过 id 获取 title
static func getShowNameBy(indexStr:String,type : YHOtherPickerViewType) -> String {
if indexStr.isEmpty {
......
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