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

// 配偶信息

parent c695d434
...@@ -66,7 +66,7 @@ class YHConsortFormVC: YHBaseViewController { ...@@ -66,7 +66,7 @@ class YHConsortFormVC: YHBaseViewController {
func loadData() { func loadData() {
var item1 = YHTableItemInfo(type: .accompany) let item1 = YHTableItemInfo(type: .accompany)
let item2 = YHTableItemInfo(type: .country) let item2 = YHTableItemInfo(type: .country)
let item3 = YHTableItemInfo(type: .address) let item3 = YHTableItemInfo(type: .address)
let item4 = YHTableItemInfo(type: .hongkongMacaouPassport) let item4 = YHTableItemInfo(type: .hongkongMacaouPassport)
...@@ -127,88 +127,74 @@ extension YHConsortFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -127,88 +127,74 @@ extension YHConsortFormVC : 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 item:YHTableItemInfo = items[section]
switch item.type { return item.getSubItems().count
case .accompany:
return 2
case .country:
return 2
case .address:
if !item.isAccompany {
return 3
}
return 1
case .hongkongMacaouPassport:
return 1
}
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 { if indexPath.section >= items.count { return UITableViewCell() }
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell let item:YHTableItemInfo = items[indexPath.section]
createCorner(cell: cell, indexPath: indexPath) if indexPath.row >= item.getSubItems().count { return UITableViewCell() }
cell.title = "配偶".local
cell.detailLabel.text = "(如未婚、离婚、丧偶可不填)".local
return cell let subItem:YHTableSubItemInfo = item.getSubItems()[indexPath.row]
} else if indexPath.section == 1 { switch subItem.type {
if indexPath.row == 0 { case .subTitle:
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, indexPath: indexPath) createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = "子女".local cell.titleLabel.text = item.title
cell.subTitleLabel.text = "(如无可不填)".local
return cell
} else if indexPath.row == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
createCorner(cell: cell, indexPath: indexPath)
return cell return cell
}
} else if indexPath.section == 2 {
if indexPath.row == 0 { case .subAcompany:
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
createCorner(cell: cell, indexPath: indexPath) createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = "父母".local cell.question = subItem.title
cell.subTitleLabel.text = "(包含已故)".local
return cell return cell
} else { case .subCountry:
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, indexPath: indexPath)
cell.isMust = subItem.isMust
cell.title = subItem.title
return cell return cell
}
} else if indexPath.section == 3 {
if indexPath.row == 0 { case .subIsLiveTogether, .subHongkongMacaouPassport:
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell let cell = tableView.dequeueReusableCell(withIdentifier: YHDoubleChoiceFormCell.cellReuseIdentifier, for: indexPath) as! YHDoubleChoiceFormCell
createCorner(cell: cell, indexPath: indexPath) createCorner(cell: cell, indexPath: indexPath)
cell.titleLabel.text = "兄弟姐妹".local cell.question = subItem.title
cell.subTitleLabel.text = "(如无可不填)".local
return cell return cell
} else { case .subLiveNation, .subLiveCity, .subDetailAddress:
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, indexPath: indexPath) createCorner(cell: cell, indexPath: indexPath)
cell.isMust = subItem.isMust
cell.title = subItem.title
return cell return cell
}
} }
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath) let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
createCorner(cell: cell, indexPath: indexPath) createCorner(cell: cell, indexPath: indexPath)
return cell return cell
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 80.0
if indexPath.section >= items.count { return 0 }
let item:YHTableItemInfo = items[indexPath.section]
if indexPath.row >= item.getSubItems().count { return 0 }
let subItem = item.getSubItems()[indexPath.row]
if subItem.type == .subIsLiveTogether ||
subItem.type == .subAcompany ||
subItem.type == .subHongkongMacaouPassport
{ return UITableView.automaticDimension }
return 52.0
} }
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......
...@@ -24,15 +24,90 @@ public enum YHTableItemType : Int32 { ...@@ -24,15 +24,90 @@ public enum YHTableItemType : Int32 {
case hongkongMacaouPassport = 3 case hongkongMacaouPassport = 3
} }
//表单条目信息 //表单条目信息
class YHTableItemInfo { class YHTableItemInfo {
var type:YHTableItemType var type:YHTableItemType
var title:String {
return getTitle()
}
init(type: YHTableItemType) { init(type: YHTableItemType) {
self.type = type self.type = type
} }
var subTitleItems:[YHTableSubItemInfo]? = Array()
func getTitle()-> String {
switch self.type {
case .accompany:
return "随行".local
case .country:
return "国籍".local
case .address:
return "居住信息".local
case .hongkongMacaouPassport:
return "港澳通信证".local
}
}
func getSubItems()->[YHTableSubItemInfo] {
let item0 = YHTableSubItemInfo(type: .subTitle)
var res = [item0]
switch self.type {
case .accompany:
res.append(YHTableSubItemInfo(type: .subAcompany))
case .country:
res.append(YHTableSubItemInfo(type: .subCountry))
case .address:
let item1 = YHTableSubItemInfo(type: .subIsLiveTogether, isMust: true)
let item2 = YHTableSubItemInfo(type: .subLiveNation, isMust: true)
let item3 = YHTableSubItemInfo(type: .subDetailAddress, isMust: true)
res.append(contentsOf:[item1, item2, item3])
case .hongkongMacaouPassport:
res.append(YHTableSubItemInfo(type: .subHongkongMacaouPassport, isMust: true))
}
return res
}
}
public enum YHTableSubItemType : Int32 {
// 标题
case subTitle = 0
// 是否随行
case subAcompany = 1
// 国籍
case subCountry = 2
/* 居住信息 */
// 是否与主申请人同住
case subIsLiveTogether = 3
// 居住国家/地区
case subLiveNation = 4
// 现居住城市
case subLiveCity = 5
// 详细地址
case subDetailAddress = 6
// 港澳通信证
case subHongkongMacaouPassport = 7
}
class YHTableSubItemInfo {
var type:YHTableSubItemType
// 是否必填
var isMust:Bool
// 是否随行 // 是否随行
var isAccompany:Bool = false var isAccompany:Bool = false
// 港澳通信证 // 港澳通信证
...@@ -40,7 +115,6 @@ class YHTableItemInfo { ...@@ -40,7 +115,6 @@ class YHTableItemInfo {
// 国籍 // 国籍
var nation:String? = "" var nation:String? = ""
/** 居住信息 **/ /** 居住信息 **/
// 是否与主申请人同住 // 是否与主申请人同住
var isLiveTogether:Bool = false var isLiveTogether:Bool = false
...@@ -51,19 +125,34 @@ class YHTableItemInfo { ...@@ -51,19 +125,34 @@ class YHTableItemInfo {
// 现居住详细地址 // 现居住详细地址
var liveAddress:String? = "" var liveAddress:String? = ""
func getTitle(_ type:YHTableItemType)-> String { var title:String {
switch type { return getTitle()
case .accompany: }
return "随行".local
case .country: init(type: YHTableSubItemType, isMust:Bool = true) {
return "国籍".local self.type = type
case .address: self.isMust = isMust
return "居住信息".local
case .hongkongMacaouPassport:
return "港澳通信证".local
default:
return ""
}
} }
func getTitle()-> String {
switch self.type {
case .subTitle:
return "".local
case .subAcompany:
return "是否随行至香港".local
case .subCountry:
return "国家/地区".local
case .subIsLiveTogether:
return "是否与主申请人同住".local
case .subLiveNation:
return "国家/地区".local
case .subLiveCity:
return "现居住城市".local
case .subDetailAddress:
return "现居住地址".local
case .subHongkongMacaouPassport:
return "是否办理".local
}
}
} }
...@@ -127,6 +127,11 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -127,6 +127,11 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if (indexPath.row >= items.count) { return } if (indexPath.row >= items.count) { return }
let vvc = YHFamilyMemberFormVC()
self.navigationController?.pushViewController(vvc)
return
let item: PersonalModuleItem = items[indexPath.row]; let item: PersonalModuleItem = items[indexPath.row];
if item.title == "关于我们" { if item.title == "关于我们" {
......
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