Commit 1c48dd7d authored by Steven杜宇's avatar Steven杜宇

配偶信息填写

parent 54ab7e63
...@@ -20,7 +20,7 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -20,7 +20,7 @@ class YHFamilyMemberFormVC: YHBaseViewController {
var isChildsEditMode: YHFamilyMemberEditType = .none var isChildsEditMode: YHFamilyMemberEditType = .none
var isBrothersEditMode: YHFamilyMemberEditType = .none var isBrothersEditMode: YHFamilyMemberEditType = .none
var items:[[YHFamilyMemberProtocol]] = [] var items:[[YHFormItemProtocol]] = []
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
...@@ -29,6 +29,7 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -29,6 +29,7 @@ class YHFamilyMemberFormVC: YHBaseViewController {
if #available(iOS 11.0, *) { if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never tableView.contentInsetAdjustmentBehavior = .never
} }
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear tableView.backgroundColor = .clear
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.delegate = self tableView.delegate = self
...@@ -59,7 +60,7 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -59,7 +60,7 @@ class YHFamilyMemberFormVC: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.gk_navTitle = "家庭成员信息填写" self.gk_navTitle = "家庭成员信息填写".local
view.backgroundColor = UIColor(hexString:"#F8F8F8") view.backgroundColor = UIColor(hexString:"#F8F8F8")
createUI() createUI()
loadData() loadData()
...@@ -274,12 +275,12 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -274,12 +275,12 @@ class YHFamilyMemberFormVC: YHBaseViewController {
// 配偶section // 配偶section
if let sponse = familyMemberInfo?.spouse { if let sponse = familyMemberInfo?.spouse {
let sponseArray:[YHFamilyMemberProtocol] = [YHFamilyMemberFormItem(type: .sponse), sponse] let sponseArray:[YHFormItemProtocol] = [YHFormTitleItem(type: .sponse), sponse]
items.append(sponseArray) items.append(sponseArray)
} }
// 父母section // 父母section
var parents = [YHFamilyMemberProtocol]() var parents = [YHFormItemProtocol]()
if let father = familyMemberInfo?.father { if let father = familyMemberInfo?.father {
parents.append(father) parents.append(father)
} }
...@@ -287,20 +288,20 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -287,20 +288,20 @@ class YHFamilyMemberFormVC: YHBaseViewController {
parents.append(mother) parents.append(mother)
} }
if !parents.isEmpty { if !parents.isEmpty {
let item0 = YHFamilyMemberFormItem(type: .parent) let item0 = YHFormTitleItem(type: .parent)
parents.insert(item0, at: 0) parents.insert(item0, at: 0)
items.append(parents) items.append(parents)
} }
// 子女section // 子女section
var childArr:[YHFamilyMemberProtocol] = [YHFamilyMemberFormItem(type: .child), YHFamilyMemberFormItem(type: .addChild)] var childArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .child), YHFormAddItem(type: .addChild)]
if let childs = familyMemberInfo?.child, !childs.isEmpty { if let childs = familyMemberInfo?.child, !childs.isEmpty {
childArr.insert(contentsOf: childs, at:1) childArr.insert(contentsOf: childs, at:1)
} }
items.append(childArr) items.append(childArr)
// 兄妹section // 兄妹section
var brotherArr:[YHFamilyMemberProtocol] = [YHFamilyMemberFormItem(type: .brother), YHFamilyMemberFormItem(type: .addBrother)] var brotherArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .brother), YHFormAddItem(type: .addBrother)]
if let brothers = familyMemberInfo?.brother, !brothers.isEmpty { if let brothers = familyMemberInfo?.brother, !brothers.isEmpty {
brotherArr.insert(contentsOf: brothers, at:1) brotherArr.insert(contentsOf: brothers, at:1)
} }
...@@ -486,27 +487,14 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -486,27 +487,14 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let arr = items[indexPath.section] let arr = items[indexPath.section]
let item:YHFamilyMemberProtocol = arr[indexPath.row] let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFamilyMemberFormItem { // 是标题或添加项目 if item is YHFormTitleItem { // 是标题
let formItem = item as! YHFormTitleItem
let formItem = item as! YHFamilyMemberFormItem
if formItem.type == .addChild || formItem.type == .addBrother { // 新增子女/兄弟姐妹
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.clickBlock = { [weak self] in
if formItem.type == .addBrother {
self?.addBrother()
} else if formItem.type == .addChild {
self?.addChild()
}
}
return cell
}
// 配偶父母子女兄妹title // 配偶父母子女兄妹title
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.titleLabel.text = formItem.getTitle() cell.titleLabel.text = formItem.getTitle()
cell.subTitleLabel.text = formItem.getSubTitle() cell.subTitleLabel.text = formItem.getSubTitle()
...@@ -539,12 +527,11 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -539,12 +527,11 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
} }
return cell return cell
} }
// 配偶父母子女兄妹具体条目 // 配偶父母子女兄妹具体条目
if item is YHParent || item is YHChild || item is YHSpouse || item is YHBrother { if item is YHParent || item is YHChild || item is YHSpouse || item is YHBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.isShowDeleteBtn = false cell.isShowDeleteBtn = false
cell.deleteBlock = nil cell.deleteBlock = nil
if item is YHChild || item is YHBrother { if item is YHChild || item is YHBrother {
...@@ -559,8 +546,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -559,8 +546,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
cell.deleteBlock = { [weak self] in cell.deleteBlock = { [weak self] in
if item is YHChild { if item is YHChild {
let childCount = self?.familyMemberInfo?.child?.count ?? 0 let childCount = self?.familyMemberInfo?.child?.count ?? 0
if (indexPath.row < childCount) { // 因为子女兄妹section第一行都是标题所以row-1
// 因为子女兄妹section第一行都是标题所以row-1 if (indexPath.row-1 < childCount) {
self?.familyMemberInfo?.child?.remove(at: indexPath.row-1) self?.familyMemberInfo?.child?.remove(at: indexPath.row-1)
self?.isChildsEditMode = .none self?.isChildsEditMode = .none
self?.isBrothersEditMode = .none self?.isBrothersEditMode = .none
...@@ -568,8 +555,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -568,8 +555,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
} else if item is YHBrother { } else if item is YHBrother {
let brotherCount = self?.familyMemberInfo?.brother?.count ?? 0 let brotherCount = self?.familyMemberInfo?.brother?.count ?? 0
if (indexPath.row < brotherCount) { // 因为子女兄妹section第一行都是标题所以row-1
// 因为子女兄妹section第一行都是标题所以row-1 if (indexPath.row-1 < brotherCount) {
self?.familyMemberInfo?.brother?.remove(at: indexPath.row-1) self?.familyMemberInfo?.brother?.remove(at: indexPath.row-1)
self?.isChildsEditMode = .none self?.isChildsEditMode = .none
self?.isBrothersEditMode = .none self?.isBrothersEditMode = .none
...@@ -581,25 +568,49 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -581,25 +568,49 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
return cell return cell
} }
// 新增子女/兄弟姐妹
if item is YHFormAddItem {
let formItem = item as! YHFormAddItem
if formItem.type == .addChild || formItem.type == .addBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
cell.clickBlock = { [weak self] in
if formItem.type == .addBrother {
self?.addBrother()
} else if formItem.type == .addChild {
self?.addChild()
}
}
return cell
}
}
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath) let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
createCorner(cell: cell, arr: arr, indexPath: indexPath)
return cell return cell
} }
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section >= items.count { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return }
createCorner(cell: cell, arr: arr, indexPath: indexPath)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let arr = items[indexPath.section] let arr = items[indexPath.section]
let item:YHFamilyMemberProtocol = arr[indexPath.row] let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFamilyMemberFormItem { // 是标题或添加项目 if item is YHFormTitleItem { // 是标题
let titleItem = item as! YHFamilyMemberFormItem
if titleItem.type == .addChild || titleItem.type == .addBrother {
return 77.0
}
return 52.0 return 52.0
} else if item is YHFormAddItem { // 新增子女兄妹
return 70.0
} }
return 64.0 return 50.0
} }
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......
...@@ -10,8 +10,9 @@ import UIKit ...@@ -10,8 +10,9 @@ import UIKit
class YHSpouseFormVC: YHBaseViewController { class YHSpouseFormVC: YHBaseViewController {
lazy var items:[YHTableItemInfo] = [YHTableItemInfo]() var sponseInfo:YHSpouse?
lazy var items:[[YHFormItemProtocol]] = [[YHFormItemProtocol]]()
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
let tableView = UITableView(frame:.zero, style:.plain) let tableView = UITableView(frame:.zero, style:.plain)
...@@ -19,6 +20,7 @@ class YHSpouseFormVC: YHBaseViewController { ...@@ -19,6 +20,7 @@ class YHSpouseFormVC: YHBaseViewController {
if #available(iOS 11.0, *) { if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never tableView.contentInsetAdjustmentBehavior = .never
} }
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear tableView.backgroundColor = .clear
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.delegate = self tableView.delegate = self
...@@ -58,19 +60,18 @@ class YHSpouseFormVC: YHBaseViewController { ...@@ -58,19 +60,18 @@ class YHSpouseFormVC: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
gk_navTitle = "配偶信息填写".local
createUI() createUI()
loadData() loadSponseInfo()
} }
func loadData() { func loadSponseInfo() {
let item1 = YHTableItemInfo(type: .accompany) let arr0:[YHFormItemProtocol] = [YHFormTitleItem(type: .accompany), YHFormDetailItem(type: .accompany)]
let item2 = YHTableItemInfo(type: .country) let arr1:[YHFormItemProtocol] = [YHFormTitleItem(type: .country), YHFormDetailItem(type: .country)]
let item3 = YHTableItemInfo(type: .address) let arr2:[YHFormItemProtocol] = [YHFormTitleItem(type: .liveInfo),YHFormDetailItem(type: .isLiveTother),YHFormDetailItem(type: .liveContry),YHFormDetailItem(type: .liveCity),YHFormDetailItem(type: .detailAddress)]
let item4 = YHTableItemInfo(type: .hongkongMacaouPassport) let arr3:[YHFormItemProtocol] = [YHFormTitleItem(type: .hkPassport), YHFormDetailItem(type: .hkPassport)]
items.append(contentsOf: [item1, item2, item3, item4]) items.append(contentsOf:[arr0, arr1, arr2, arr3])
tableView.reloadData() tableView.reloadData()
} }
...@@ -126,74 +127,91 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -126,74 +127,91 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section >= items.count { return 0 } if section >= items.count { return 0 }
let item:YHTableItemInfo = items[section] let arr = items[section]
return item.getSubItems().count return arr.count
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section >= items.count { return UITableViewCell() } if indexPath.section >= items.count { return createDefaultCell(indexPath) }
let arr:[YHFormItemProtocol] = items[indexPath.section]
let item:YHTableItemInfo = items[indexPath.section] if indexPath.row >= arr.count { return createDefaultCell(indexPath) }
if indexPath.row >= item.getSubItems().count { return UITableViewCell() }
let subItem:YHTableSubItemInfo = item.getSubItems()[indexPath.row] let item:YHFormItemProtocol = arr[indexPath.row]
switch subItem.type { if item is YHFormTitleItem { // 标题
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
// createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.titleLabel.text = item.getTitle()
return cell
case .subTitle: } else if item is YHFormDetailItem { // 具体信息
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = item.title
return cell
case .subAcompany: let detailItem = item as! YHFormDetailItem
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
createCorner(cell: cell, indexPath: indexPath)
cell.question = subItem.title
return cell
case .subCountry: if detailItem.type == .accompany || detailItem.type == .hkPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, indexPath: indexPath) let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
cell.isMust = subItem.isMust // createCorner(cell: cell, arr: arr,indexPath: indexPath)
cell.title = subItem.title cell.question = detailItem.getTitle()
return cell return cell
case .subIsLiveTogether, .subHongkongMacaouPassport: } else if detailItem.type == .isLiveTother || detailItem.isHongKongMacouPassport {
let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
createCorner(cell: cell, indexPath: indexPath) // createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.question = subItem.title cell.question = detailItem.getTitle()
return cell return cell
case .subLiveNation, .subLiveCity, .subDetailAddress: } else if detailItem.type == .country || detailItem.type == .liveContry || detailItem.type == .liveCity || detailItem.type == .detailAddress {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, indexPath: indexPath) // createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.isMust = subItem.isMust cell.isMust = detailItem.isNeed
cell.title = subItem.title cell.title = detailItem.getTitle()
return cell return cell
}
} }
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath) return createDefaultCell(indexPath)
createCorner(cell: cell, indexPath: indexPath) }
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section >= items.count { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return }
createCorner(cell: cell, arr: arr, indexPath: indexPath)
}
func createDefaultCell(_ indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
return cell return cell
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section >= items.count { return 0 } if indexPath.section >= items.count { return 0.0 }
let item:YHTableItemInfo = items[indexPath.section] let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return 0.0 }
if indexPath.row >= item.getSubItems().count { return 0 } let item = arr[indexPath.row]
let subItem = item.getSubItems()[indexPath.row]
if subItem.type == .subIsLiveTogether || if item is YHFormTitleItem { // 标题
subItem.type == .subAcompany || return 52.0
subItem.type == .subHongkongMacaouPassport }
{ return UITableView.automaticDimension }
if item is YHFormDetailItem {
let detailItem = item as! YHFormDetailItem
if detailItem.type == .isLiveTother ||
detailItem.type == .accompany ||
detailItem.type == .hkPassport
{
return UITableView.automaticDimension
}
}
return 52.0 return 52.0
} }
...@@ -210,13 +228,15 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -210,13 +228,15 @@ extension YHSpouseFormVC : UITableViewDelegate, UITableViewDataSource {
} }
func createCorner(cell:UITableViewCell, indexPath:IndexPath) { func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
// 复用时需清理
cell.layer.mask = nil
// 设置每块section圆角 // 设置每块section圆角
if (indexPath.row == 0) { if (indexPath.row == 0) {
let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue) let corner = UIRectCorner(rawValue: UIRectCorner.topLeft.rawValue | UIRectCorner.topRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner) cell.createCorner(CGSizeMake(12.0, 12.0), corner)
} else if (indexPath.row == 2) { } else if (indexPath.row == arr.count-1) {
let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue) let corner = UIRectCorner(rawValue: UIRectCorner.bottomLeft.rawValue | UIRectCorner.bottomRight.rawValue)
cell.createCorner(CGSizeMake(12.0, 12.0), corner) cell.createCorner(CGSizeMake(12.0, 12.0), corner)
......
...@@ -108,22 +108,7 @@ class YHTableSubItemInfo { ...@@ -108,22 +108,7 @@ class YHTableSubItemInfo {
// 是否必填 // 是否必填
var isMust:Bool var isMust:Bool
// 是否随行
var isAccompany:Bool = false
// 港澳通信证
var isHongKongMacouPassport:Bool = false
// 国籍
var nation:String? = ""
/** 居住信息 **/
// 是否与主申请人同住
var isLiveTogether:Bool = false
// 现居住国家
var liveContry:String? = ""
// 现居住城市
var liveCity:String? = ""
// 现居住详细地址
var liveAddress:String? = ""
var title:String { var title:String {
return getTitle() return getTitle()
......
...@@ -9,28 +9,75 @@ ...@@ -9,28 +9,75 @@
import UIKit import UIKit
import SmartCodable import SmartCodable
enum YHFamilyMemberItemType:Int { protocol YHFormItemProtocol {
func getTitle() -> String
func getSubTitle() -> String
}
// 表单标题类型
enum YHFormTitleItemType:Int {
case sponse = 1 case sponse = 1
case parent = 2 case parent = 2
case child = 3 case child = 3
case brother = 4 case brother = 4
case addChild = 5
case addBrother = 6 case accompany = 5
case country = 6
case liveInfo = 7
case hkPassport = 8
} }
// 表单添加条目类型
enum YHFormAddItemType:Int {
case addChild = 1
case addBrother = 2
}
protocol YHFamilyMemberProtocol { // 表单具体条目类型
enum YHFormDetailItemType:Int {
func getTitle() -> String case accompany = 1
func getSubTitle() -> String case country = 2
case isLiveTother = 3
case liveContry = 4
case liveCity = 5
case detailAddress = 6
case hkPassport = 7
}
//添加item
class YHFormAddItem : YHFormItemProtocol
{
var type: YHFormAddItemType
init(type: YHFormAddItemType) {
self.type = type
}
func getTitle() -> String {
switch self.type {
case .addChild:
return "新增子女".local
case .addBrother:
return "新增兄弟姐妹".local
}
}
func getSubTitle() -> String {
return ""
}
} }
class YHFamilyMemberFormItem : YHFamilyMemberProtocol {
// 标题item
class YHFormTitleItem : YHFormItemProtocol {
var type: YHFamilyMemberItemType var type: YHFormTitleItemType
init(type: YHFamilyMemberItemType) { init(type: YHFormTitleItemType) {
self.type = type self.type = type
} }
...@@ -44,10 +91,14 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol { ...@@ -44,10 +91,14 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol {
return "兄弟姐妹".local return "兄弟姐妹".local
case .child: case .child:
return "子女".local return "子女".local
case .addChild: case .accompany:
return "新增子女".local return "随行".local
case .addBrother: case .country:
return "新增兄弟姐妹".local return "国籍".local
case .liveInfo:
return "居住信息".local
case .hkPassport:
return "港澳通行证".local
} }
} }
...@@ -61,14 +112,71 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol { ...@@ -61,14 +112,71 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol {
return String(format: "(%@)", "如无可不填".local) return String(format: "(%@)", "如无可不填".local)
case .child: case .child:
return String(format: "(%@)", "如无可不填".local) return String(format: "(%@)", "如无可不填".local)
case .addChild: case .accompany:
return "" return "".local
case .addBrother: case .country:
return "" return "".local
case .liveInfo:
return "".local
case .hkPassport:
return "".local
} }
} }
} }
// 具体item
class YHFormDetailItem : YHFormItemProtocol {
var type: YHFormDetailItemType
// 是否是必填项
var isNeed: Bool = true
// 是否随行
var isAccompany:Bool = false
// 港澳通信证
var isHongKongMacouPassport:Bool = false
// 国籍
var nation:String? = ""
/** 居住信息 **/
// 是否与主申请人同住
var isLiveTogether:Bool = false
// 现居住国家
var liveContry:String? = ""
// 现居住城市
var liveCity:String? = ""
// 现居住详细地址
var liveAddress:String? = ""
init(type: YHFormDetailItemType) {
self.type = type
}
func getTitle() -> String {
switch type {
case .accompany:
return "是否随行至香港".local
case .country:
return String(format: "%@/%@", "国家".local, "地区".local)
case .isLiveTother:
return "是否与主申请人同住".local
case .liveContry:
return String(format: "%@/%@", "国家".local, "地区".local)
case .liveCity:
return String(format: "%@/%@", "国家".local, "地区".local)
case .detailAddress:
return "详细地址".local
case .hkPassport:
return "是否办理".local
}
}
func getSubTitle() -> String {
return ""
}
}
/* ***** ***** ***** ***** ***** ***** ***** ***** */ /* ***** ***** ***** ***** ***** ***** ***** ***** */
// MARK: - YHWelcome // MARK: - YHWelcome
...@@ -112,7 +220,7 @@ class YHFamilyMemberInfo: SmartCodable { ...@@ -112,7 +220,7 @@ class YHFamilyMemberInfo: SmartCodable {
} }
// MARK: - 子女初始信息 YHChild // MARK: - 子女初始信息 YHChild
class YHChild: SmartCodable, YHFamilyMemberProtocol { class YHChild: SmartCodable, YHFormItemProtocol {
var id: Int = -1 var id: Int = -1
var deceased: Int = -1 var deceased: Int = -1
...@@ -209,7 +317,7 @@ class YHChild: SmartCodable, YHFamilyMemberProtocol { ...@@ -209,7 +317,7 @@ class YHChild: SmartCodable, YHFamilyMemberProtocol {
} }
// MARK: - YHBrother // MARK: - YHBrother
class YHBrother: SmartCodable, YHFamilyMemberProtocol { class YHBrother: SmartCodable, YHFormItemProtocol {
var id: Int? = -1 var id: Int? = -1
var deceased: Int? = -1 var deceased: Int? = -1
var custody: Int? = -1 var custody: Int? = -1
...@@ -354,7 +462,7 @@ class YHSubsetNamePinyin: SmartCodable { ...@@ -354,7 +462,7 @@ class YHSubsetNamePinyin: SmartCodable {
} }
// MARK: - 父母信息 YHParent // MARK: - 父母信息 YHParent
class YHParent: SmartCodable, YHFamilyMemberProtocol { class YHParent: SmartCodable, YHFormItemProtocol {
var id: Int = -1 var id: Int = -1
var deceased: Int = -1 var deceased: Int = -1
var custody: Int = -1 var custody: Int = -1
...@@ -451,7 +559,7 @@ class YHParent: SmartCodable, YHFamilyMemberProtocol { ...@@ -451,7 +559,7 @@ class YHParent: SmartCodable, YHFamilyMemberProtocol {
} }
// MARK: - 配偶 YHSpouse // MARK: - 配偶 YHSpouse
class YHSpouse: SmartCodable, YHFamilyMemberProtocol { class YHSpouse: SmartCodable, YHFormItemProtocol {
var id: Int = -1 var id: Int = -1
var deceased: Int = -1 var deceased: Int = -1
var custody: Int = -1 var custody: Int = -1
......
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